|
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: imcvuiengine_test.cpp |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <StifTestInterface.h> |
|
22 #include "imcvuiengine_test.h" |
|
23 #include <SettingServerClient.h> |
|
24 #include "imcvuiengine_testsendmessage.h" |
|
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 // Cimcvuiengine_test::Cimcvuiengine_test |
|
78 // C++ default constructor can NOT contain any code, that |
|
79 // might leave. |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 Cimcvuiengine_test::Cimcvuiengine_test( |
|
83 CTestModuleIf& aTestModuleIf ): |
|
84 CScriptBase( aTestModuleIf ) |
|
85 { |
|
86 } |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // Cimcvuiengine_test::ConstructL |
|
90 // Symbian 2nd phase constructor can leave. |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 void Cimcvuiengine_test::ConstructL() |
|
94 { |
|
95 //Read logger settings to check whether test case name is to be |
|
96 //appended to log file name. |
|
97 TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles ); |
|
98 TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksRequests ); |
|
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(Kimcvuiengine_testLogFileWithTitle, &title); |
|
123 } |
|
124 else |
|
125 { |
|
126 logFileName.Copy(Kimcvuiengine_testLogFile); |
|
127 } |
|
128 |
|
129 iLog = CStifLogger::NewL( Kimcvuiengine_testLogPath, |
|
130 logFileName, |
|
131 CStifLogger::ETxt, |
|
132 CStifLogger::EFile, |
|
133 EFalse ); |
|
134 iSender = CIMCVUiEngine_TestSendMessage::NewL(); |
|
135 } |
|
136 |
|
137 // ----------------------------------------------------------------------------- |
|
138 // Cimcvuiengine_test::NewL |
|
139 // Two-phased constructor. |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 Cimcvuiengine_test* Cimcvuiengine_test::NewL( |
|
143 CTestModuleIf& aTestModuleIf ) |
|
144 { |
|
145 Cimcvuiengine_test* self = new (ELeave) Cimcvuiengine_test( aTestModuleIf ); |
|
146 |
|
147 CleanupStack::PushL( self ); |
|
148 self->ConstructL(); |
|
149 CleanupStack::Pop(); |
|
150 |
|
151 return self; |
|
152 |
|
153 } |
|
154 |
|
155 // Destructor |
|
156 Cimcvuiengine_test::~Cimcvuiengine_test() |
|
157 { |
|
158 delete iSender; |
|
159 // Delete resources allocated from test methods |
|
160 Delete(); |
|
161 |
|
162 // Delete logger |
|
163 delete iLog; |
|
164 |
|
165 } |
|
166 |
|
167 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
168 |
|
169 // ----------------------------------------------------------------------------- |
|
170 // LibEntryL is a polymorphic Dll entry point. |
|
171 // Returns: CScriptBase: New CScriptBase derived object |
|
172 // ----------------------------------------------------------------------------- |
|
173 // |
|
174 EXPORT_C CScriptBase* LibEntryL( |
|
175 CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework |
|
176 { |
|
177 |
|
178 return ( CScriptBase* ) Cimcvuiengine_test::NewL( aTestModuleIf ); |
|
179 |
|
180 } |
|
181 |
|
182 |
|
183 // End of File |