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