landmarks/locationlandmarks/tsrc/LandmarkURL/src/CUTLandmarkURL.cpp
branchRCL_3
changeset 44 2b4ea9893b66
equal deleted inserted replaced
42:02ba3f1733c6 44:2b4ea9893b66
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 * 
       
    14 * Description:    This file contains testclass implementation.
       
    15 * This file defines the test class for testing the encoder functionality.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <Stiftestinterface.h>
       
    24 #include <SettingServerClient.h>
       
    25 #include "CUTLandmarkURL.h"
       
    26 
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CCUTLandmarkURL::CCUTLandmarkURL
       
    32 // C++ default constructor can NOT contain any code, that
       
    33 // might leave.
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 CCUTLandmarkURL::CCUTLandmarkURL( 
       
    37     CTestModuleIf& aTestModuleIf ):
       
    38         CScriptBase( aTestModuleIf ),
       
    39         iCount(0),
       
    40         iVerticalAccuracy(_L("")),
       
    41         iHorizontalAccuracy(_L("")),
       
    42         iName(_L("")),
       
    43         iDescription(_L("")),
       
    44         iLatitude(_L("")),
       
    45         iLongitude(_L("")),
       
    46         iAltitude(_L("")),
       
    47         iCategory(_L("")),
       
    48         iMatchCategory(_L("")),
       
    49         iMatchCategory2(_L("")),
       
    50         iTS(_L("")),
       
    51         iPID(_L("")),
       
    52         iYear(_L("")),
       
    53         iMonth(_L("")),
       
    54         iDay(_L("")),
       
    55         iHour(_L("")),
       
    56         iMinutes(_L("")),
       
    57         iSeconds(_L("")),
       
    58         iMSeconds(_L("")),
       
    59         iSpeed(_L("")),
       
    60         iTelephone(_L("")),
       
    61         iWeb(_L("")),
       
    62         iHeading(_L("")),
       
    63         iCountry(_L("")),
       
    64         iState(_L("")),
       
    65         iCity(_L("")),
       
    66         iStreet(_L("")),
       
    67         iHouseNumber(_L("")),
       
    68         iPostalCode(_L(""))
       
    69     {
       
    70     
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // CCUTLandmarkURL::ConstructL
       
    75 // Symbian 2nd phase constructor can leave.
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 void CCUTLandmarkURL::ConstructL()
       
    79     {
       
    80     //Read logger settings to check whether test case name is to be
       
    81     //appended to log file name.
       
    82     RSettingServer settingServer;
       
    83     TInt ret = settingServer.Connect();
       
    84     if(ret != KErrNone)
       
    85         {
       
    86         User::Leave(ret);
       
    87         }
       
    88     // Struct to StifLogger settigs.
       
    89     TLoggerSettings loggerSettings; 
       
    90     // Parse StifLogger defaults from STIF initialization file.
       
    91     ret = settingServer.GetLoggerSettings(loggerSettings);
       
    92     if(ret != KErrNone)
       
    93         {
       
    94         User::Leave(ret);
       
    95         } 
       
    96     // Close Setting server session
       
    97     settingServer.Close();
       
    98 
       
    99     TFileName logFileName;
       
   100     
       
   101     if(loggerSettings.iAddTestCaseTitle)
       
   102         {
       
   103         TName title;
       
   104         TestModuleIf().GetTestCaseTitleL(title);
       
   105         logFileName.Format(KCUTLandmarkURLLogFileWithTitle, &title);
       
   106         }
       
   107     else
       
   108         {
       
   109         logFileName.Copy(KCUTLandmarkURLLogFile);
       
   110         }
       
   111 
       
   112     iLog = CStifLogger::NewL( KCUTLandmarkURLLogPath, 
       
   113                           logFileName,
       
   114                           CStifLogger::ETxt,
       
   115                           CStifLogger::EFile,
       
   116                           EFalse );
       
   117     
       
   118     SendTestClassVersion();
       
   119     //Connects the file session
       
   120     User::LeaveIfError(iFileSession.Connect());
       
   121     }
       
   122 
       
   123 // -----------------------------------------------------------------------------
       
   124 // CCUTLandmarkURL::NewL
       
   125 // Two-phased constructor.
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 CCUTLandmarkURL* CCUTLandmarkURL::NewL( 
       
   129     CTestModuleIf& aTestModuleIf )
       
   130     {
       
   131     CCUTLandmarkURL* self = new (ELeave) CCUTLandmarkURL( aTestModuleIf );
       
   132 
       
   133     CleanupStack::PushL( self );
       
   134     self->ConstructL();
       
   135     CleanupStack::Pop();
       
   136 
       
   137     return self;
       
   138 
       
   139     }
       
   140 
       
   141 // Destructor
       
   142 CCUTLandmarkURL::~CCUTLandmarkURL()
       
   143     { 
       
   144 
       
   145     // Delete resources allocated from test methods
       
   146     Delete();
       
   147 
       
   148     // Delete logger
       
   149     delete iLog; 
       
   150 
       
   151     }
       
   152 
       
   153 //-----------------------------------------------------------------------------
       
   154 // CCUTLandmarkURL::SendTestClassVersion
       
   155 // Method used to send version of test class
       
   156 //-----------------------------------------------------------------------------
       
   157 //
       
   158 void CCUTLandmarkURL::SendTestClassVersion()
       
   159 	{
       
   160 	TVersion moduleVersion;
       
   161 	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
       
   162 	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
       
   163 	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
       
   164 	
       
   165 	TFileName moduleName;
       
   166 	moduleName = _L("CUTLandmarkURL.dll");
       
   167 
       
   168 	TBool newVersionOfMethod = ETrue;
       
   169 	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
       
   170 	}
       
   171 
       
   172 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // LibEntryL is a polymorphic Dll entry point.
       
   176 // Returns: CScriptBase: New CScriptBase derived object
       
   177 // -----------------------------------------------------------------------------
       
   178 //
       
   179 EXPORT_C CScriptBase* LibEntryL( 
       
   180     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
   181     {
       
   182 
       
   183     return ( CScriptBase* ) CCUTLandmarkURL::NewL( aTestModuleIf );
       
   184 
       
   185     }
       
   186 
       
   187 
       
   188 //  End of File