websrv_pub/web_service_connection_api/tsrc/SenLayeredPropertiesTester/src/SenLayeredPropertiesTester.cpp
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     1 /*
       
     2 * Copyright (c) 2002 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:        ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 // INCLUDE FILES
       
    27 #include <StifTestInterface.h>
       
    28 #include "SenLayeredPropertiesTester.h"
       
    29 #include <SettingServerClient.h>
       
    30 
       
    31 // EXTERNAL DATA STRUCTURES
       
    32 //extern  ?external_data;
       
    33 
       
    34 // EXTERNAL FUNCTION PROTOTYPES  
       
    35 //extern ?external_function( ?arg_type,?arg_type );
       
    36 
       
    37 // CONSTANTS
       
    38 //const ?type ?constant_var = ?constant;
       
    39 
       
    40 // MACROS
       
    41 //#define ?macro ?macro_def
       
    42 
       
    43 // LOCAL CONSTANTS AND MACROS
       
    44 //const ?type ?constant_var = ?constant;
       
    45 //#define ?macro_name ?macro_def
       
    46 
       
    47 // MODULE DATA STRUCTURES
       
    48 //enum ?declaration
       
    49 //typedef ?declaration
       
    50 
       
    51 // LOCAL FUNCTION PROTOTYPES
       
    52 //?type ?function_name( ?arg_type, ?arg_type );
       
    53 
       
    54 // FORWARD DECLARATIONS
       
    55 //class ?FORWARD_CLASSNAME;
       
    56 
       
    57 // ============================= LOCAL FUNCTIONS ===============================
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // ?function_name ?description.
       
    61 // ?description
       
    62 // Returns: ?value_1: ?description
       
    63 //          ?value_n: ?description_line1
       
    64 //                    ?description_line2
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 /*
       
    68 ?type ?function_name(
       
    69     ?arg_type arg,  // ?description
       
    70     ?arg_type arg)  // ?description
       
    71     {
       
    72 
       
    73     ?code  // ?comment
       
    74 
       
    75     // ?comment
       
    76     ?code
       
    77     }
       
    78 */
       
    79 
       
    80 // ============================ MEMBER FUNCTIONS ===============================
       
    81 
       
    82 // -----------------------------------------------------------------------------
       
    83 // CSenLayeredPropertiesTester::CSenLayeredPropertiesTester
       
    84 // C++ default constructor can NOT contain any code, that
       
    85 // might leave.
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 CSenLayeredPropertiesTester::CSenLayeredPropertiesTester( 
       
    89     CTestModuleIf& aTestModuleIf ):
       
    90         CScriptBase( aTestModuleIf )
       
    91     {
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // CSenLayeredPropertiesTester::ConstructL
       
    96 // Symbian 2nd phase constructor can leave.
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 void CSenLayeredPropertiesTester::ConstructL()
       
   100     {
       
   101     //Read logger settings to check whether test case name is to be
       
   102     //appended to log file name.
       
   103     RSettingServer settingServer;
       
   104     TInt ret = settingServer.Connect();
       
   105     if(ret != KErrNone)
       
   106         {
       
   107         User::Leave(ret);
       
   108         }
       
   109     // Struct to StifLogger settigs.
       
   110     TLoggerSettings loggerSettings; 
       
   111     // Parse StifLogger defaults from STIF initialization file.
       
   112     ret = settingServer.GetLoggerSettings(loggerSettings);
       
   113     if(ret != KErrNone)
       
   114         {
       
   115         User::Leave(ret);
       
   116         } 
       
   117     // Close Setting server session
       
   118     settingServer.Close();
       
   119 
       
   120     TFileName logFileName;
       
   121     
       
   122     if(loggerSettings.iAddTestCaseTitle)
       
   123         {
       
   124         TName title;
       
   125         TestModuleIf().GetTestCaseTitleL(title);
       
   126         logFileName.Format(KSenLayeredPropertiesTesterLogFileWithTitle, &title);
       
   127         }
       
   128     else
       
   129         {
       
   130         logFileName.Copy(KSenLayeredPropertiesTesterLogFile);
       
   131         }
       
   132 
       
   133     iLog = CStifLogger::NewL( KSenLayeredPropertiesTesterLogPath, 
       
   134                           logFileName,
       
   135                           CStifLogger::ETxt,
       
   136                           CStifLogger::EFile,
       
   137                           EFalse );
       
   138     
       
   139     SendTestClassVersion();
       
   140     }
       
   141 
       
   142 // -----------------------------------------------------------------------------
       
   143 // CSenLayeredPropertiesTester::NewL
       
   144 // Two-phased constructor.
       
   145 // -----------------------------------------------------------------------------
       
   146 //
       
   147 CSenLayeredPropertiesTester* CSenLayeredPropertiesTester::NewL( 
       
   148     CTestModuleIf& aTestModuleIf )
       
   149     {
       
   150     CSenLayeredPropertiesTester* self = new (ELeave) CSenLayeredPropertiesTester( aTestModuleIf );
       
   151 
       
   152     CleanupStack::PushL( self );
       
   153     self->ConstructL();
       
   154     CleanupStack::Pop();
       
   155 
       
   156     return self;
       
   157 
       
   158     }
       
   159 
       
   160 // Destructor
       
   161 CSenLayeredPropertiesTester::~CSenLayeredPropertiesTester()
       
   162     { 
       
   163 
       
   164     // Delete resources allocated from test methods
       
   165     Delete();
       
   166 
       
   167     // Delete logger
       
   168     delete iLog; 
       
   169 
       
   170     }
       
   171 
       
   172 //-----------------------------------------------------------------------------
       
   173 // CSenLayeredPropertiesTester::SendTestClassVersion
       
   174 // Method used to send version of test class
       
   175 //-----------------------------------------------------------------------------
       
   176 //
       
   177 void CSenLayeredPropertiesTester::SendTestClassVersion()
       
   178 	{
       
   179 	TVersion moduleVersion;
       
   180 	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
       
   181 	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
       
   182 	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
       
   183 	
       
   184 	TFileName moduleName;
       
   185 	moduleName = _L("SenLayeredPropertiesTester.dll");
       
   186 
       
   187 	TBool newVersionOfMethod = ETrue;
       
   188 	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
       
   189 	}
       
   190 
       
   191 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   192 
       
   193 // -----------------------------------------------------------------------------
       
   194 // LibEntryL is a polymorphic Dll entry point.
       
   195 // Returns: CScriptBase: New CScriptBase derived object
       
   196 // -----------------------------------------------------------------------------
       
   197 //
       
   198 EXPORT_C CScriptBase* LibEntryL( 
       
   199     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
   200     {
       
   201 
       
   202     return ( CScriptBase* ) CSenLayeredPropertiesTester::NewL( aTestModuleIf );
       
   203 
       
   204     }
       
   205 
       
   206 
       
   207 //  End of File