uiservicetab/vimpststorage/tsrc/vimpststorage_ut/cvimpststoragecontactsorter_ut/src/CVIMPSTStorageContactSorter_UT.cpp
changeset 0 5e5d6b214f4f
equal deleted inserted replaced
-1:000000000000 0:5e5d6b214f4f
       
     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:  
       
    15 :                
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <StifTestInterface.h>
       
    23 #include "CVIMPSTStorageContactSorter_UT.h"
       
    24 #include <SettingServerClient.h>
       
    25 #include <flogger.h>
       
    26 
       
    27 // ============================= LOCAL FUNCTIONS ===============================
       
    28 
       
    29 
       
    30 // ============================ MEMBER FUNCTIONS ===============================
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // CCVIMPSTStorageContactSorter_UT::CCVIMPSTStorageContactSorter_UT
       
    34 // C++ default constructor can NOT contain any code, that
       
    35 // might leave.
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 CCVIMPSTStorageContactSorter_UT::CCVIMPSTStorageContactSorter_UT( 
       
    39     CTestModuleIf& aTestModuleIf ):
       
    40         CScriptBase( aTestModuleIf )
       
    41     {
       
    42     }
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // CCVIMPSTStorageContactSorter_UT::ConstructL
       
    46 // Symbian 2nd phase constructor can leave.
       
    47 // -----------------------------------------------------------------------------
       
    48 //
       
    49 void CCVIMPSTStorageContactSorter_UT::ConstructL()
       
    50     {
       
    51     //Read logger settings to check whether test case name is to be
       
    52     //appended to log file name.
       
    53     RSettingServer settingServer;
       
    54     TInt ret = settingServer.Connect();
       
    55     if(ret != KErrNone)
       
    56         {
       
    57         User::Leave(ret);
       
    58         }
       
    59     // Struct to StifLogger settigs.
       
    60     TLoggerSettings loggerSettings; 
       
    61     // Parse StifLogger defaults from STIF initialization file.
       
    62     ret = settingServer.GetLoggerSettings(loggerSettings);
       
    63     if(ret != KErrNone)
       
    64         {
       
    65         User::Leave(ret);
       
    66         } 
       
    67     // Close Setting server session
       
    68     settingServer.Close();
       
    69 
       
    70     TFileName logFileName;
       
    71     
       
    72     if(loggerSettings.iAddTestCaseTitle)
       
    73         {
       
    74         TName title;
       
    75         TestModuleIf().GetTestCaseTitleL(title);
       
    76         logFileName.Format(KCVIMPSTStorageContactSorter_UTLogFileWithTitle, &title);
       
    77         }
       
    78     else
       
    79         {
       
    80         logFileName.Copy(KCVIMPSTStorageContactSorter_UTLogFile);
       
    81         }
       
    82 
       
    83     iLog = CStifLogger::NewL( KCVIMPSTStorageContactSorter_UTLogPath, 
       
    84                           logFileName,
       
    85                           CStifLogger::ETxt,
       
    86                           CStifLogger::EFile,
       
    87                           EFalse );
       
    88     
       
    89     SendTestClassVersion();
       
    90     }
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // CCVIMPSTStorageContactSorter_UT::NewL
       
    94 // Two-phased constructor.
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 CCVIMPSTStorageContactSorter_UT* CCVIMPSTStorageContactSorter_UT::NewL( 
       
    98     CTestModuleIf& aTestModuleIf )
       
    99     {
       
   100     CCVIMPSTStorageContactSorter_UT* self = new (ELeave) CCVIMPSTStorageContactSorter_UT( aTestModuleIf );
       
   101 
       
   102     CleanupStack::PushL( self );
       
   103     self->ConstructL();
       
   104     CleanupStack::Pop();
       
   105 
       
   106     return self;
       
   107 
       
   108     }
       
   109 
       
   110 // Destructor
       
   111 CCVIMPSTStorageContactSorter_UT::~CCVIMPSTStorageContactSorter_UT()
       
   112     { 
       
   113 
       
   114     // Delete resources allocated from test methods
       
   115     Delete();
       
   116 
       
   117     // Delete logger
       
   118     delete iLog; 
       
   119 
       
   120     }
       
   121 
       
   122 //-----------------------------------------------------------------------------
       
   123 // CCVIMPSTStorageContactSorter_UT::SendTestClassVersion
       
   124 // Method used to send version of test class
       
   125 //-----------------------------------------------------------------------------
       
   126 //
       
   127 void CCVIMPSTStorageContactSorter_UT::SendTestClassVersion()
       
   128 	{
       
   129 	TVersion moduleVersion;
       
   130 	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
       
   131 	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
       
   132 	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
       
   133 	
       
   134 	TFileName moduleName;
       
   135 	moduleName = _L("CVIMPSTStorageContactSorter_UT.dll");
       
   136 
       
   137 	TBool newVersionOfMethod = ETrue;
       
   138 	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
       
   139 	}
       
   140 
       
   141 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   142 
       
   143 // -----------------------------------------------------------------------------
       
   144 // LibEntryL is a polymorphic Dll entry point.
       
   145 // Returns: CScriptBase: New CScriptBase derived object
       
   146 // -----------------------------------------------------------------------------
       
   147 //
       
   148 EXPORT_C CScriptBase* LibEntryL( 
       
   149     CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
       
   150     {
       
   151 
       
   152     return ( CScriptBase* ) CCVIMPSTStorageContactSorter_UT::NewL( aTestModuleIf );
       
   153 
       
   154     }
       
   155 
       
   156 
       
   157 //  End of File