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