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