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