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