|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // The test files do not log the url that has been accessed. This |
|
15 // is because we use an 8 bit HBufC or TPtr. The LogIt() function |
|
16 // needs a 16 bit TDesC so we have commented the LogIt() function |
|
17 // for the time being. This would require to overload the LogIt() |
|
18 // function so that it can accept even 8 bit descriptors. |
|
19 // |
|
20 // |
|
21 |
|
22 #include <flogger.h> |
|
23 #include "HttpTestCore.h" |
|
24 #include "httptestutils.h" |
|
25 #include "TestScripts.h" |
|
26 |
|
27 // ITERATION 1 |
|
28 #include "Tc1.h" |
|
29 #include "Tc2.h" |
|
30 #include "Tc4.h" |
|
31 #include "Tc5.h" |
|
32 #include "Tc6.h" |
|
33 #include "Tc7.h" |
|
34 #include "Tc8.h" |
|
35 #include "Tc9.h" |
|
36 #include "Tc10.h" |
|
37 #include "Tc11.h" |
|
38 #include "Tc12.h" |
|
39 |
|
40 // ITERATION 2 GET |
|
41 #include "get12.h" |
|
42 #include "get13.h" |
|
43 #include "get14.h" |
|
44 #include "Get17.h" |
|
45 #include "Get18.h" |
|
46 #include "get21.h" |
|
47 |
|
48 // ITERATION 2 POST |
|
49 #include "post12.h" |
|
50 #include "post13.h" |
|
51 #include "post14.h" |
|
52 #include "post23.h" |
|
53 |
|
54 //ITERATION 3 POST |
|
55 |
|
56 #include "Iter3Post6.h" |
|
57 #include "Iter3Post7.h" |
|
58 |
|
59 // Iteration 5 |
|
60 #include "Iter5Chunked1.h" |
|
61 #include "Iter5Chunked2.h" |
|
62 |
|
63 #include "3BasicAuthTransactions.h" |
|
64 #include "3DigestAuthTransactions.h" |
|
65 #include "EofTransactionResubmission.h" |
|
66 |
|
67 |
|
68 #include "SingleTrans.h" |
|
69 #include "WspTestTransactions.h" |
|
70 // Constants used in this file |
|
71 |
|
72 // Location of INI file that defines the test cases to be run |
|
73 _LIT(KAcceptanceTestCompName, "acceptance"); |
|
74 _LIT(KAcceptanceTestScriptName, "TestCases.ini"); |
|
75 |
|
76 _LIT(KSettingsIniCompName, "settings"); |
|
77 _LIT(KSettingsIniName, "settings.ini"); |
|
78 |
|
79 // Labels for section names and resources in the INI file |
|
80 _LIT(KSectionNameIter1Fmt, "Iter1TestCase%d"); |
|
81 |
|
82 _LIT(KSectionDefaults, "Defaults"); |
|
83 _LIT(KItemSilent, "Silent"); |
|
84 _LIT(KSectionSingleTrans, "SINGLE_TRANS"); |
|
85 _LIT(KSectionWspSingleTrans, "WSP_SINGLE_TRANS"); |
|
86 _LIT(KSectionGet12, "GET12"); |
|
87 _LIT(KSectionGet13, "GET13"); |
|
88 _LIT(KSectionGet14, "GET14"); |
|
89 _LIT(KSectionGet17, "GET17"); |
|
90 _LIT(KSectionGet18, "GET18"); |
|
91 _LIT(KSectionGet21, "GET21"); |
|
92 |
|
93 _LIT(KSectionPost12, "POST12"); |
|
94 _LIT(KSectionPost13, "POST13"); |
|
95 _LIT(KSectionPost14, "POST14"); |
|
96 _LIT(KSectionPost23, "POST23"); |
|
97 |
|
98 _LIT(KSection3Post6, "Iter3Post6"); |
|
99 _LIT(KSection3Post7, "Iter3Post7"); |
|
100 |
|
101 _LIT(KSection5Chunked1, "Iter5Chunked1"); |
|
102 _LIT(KSection5Chunked2, "Iter5Chunked2"); |
|
103 _LIT(K3BasicAuthTransactions, "3BasicAuthTransactions"); |
|
104 _LIT(K3DigestAuthTransactions, "3DigestAuthTransactions"); |
|
105 _LIT(KEofTransactionResubmission, "EofTransactionResubmission"); |
|
106 |
|
107 _LIT(KRunTestItemName, "RunTest"); |
|
108 |
|
109 _LIT(KLeakTestCount, "LeakTestCount"); |
|
110 _LIT(KFirstLeakIteration, "FirstLeakIteration"); |
|
111 |
|
112 // Other stuff. |
|
113 _LIT(KHttpTestTitle, "Http Acceptance Tests"); |
|
114 |
|
115 const TInt KMaxHeapSize = 0x100000; |
|
116 const TInt KMaxIntDesLen = 10; // Des length required for displaying max 32 bit int |
|
117 _LIT(KTestThreadName, "TestThread"); |
|
118 _LIT(KRtestFailureLabel, "RTEST: FAILED due to a %S %d Panic "); |
|
119 _LIT(KPanicOnLeave, "Leave DoTestL()");// Panic if DeTestL() does a Leave(). |
|
120 |
|
121 void AppendIteration1Tests(CScriptFile& aIniFile, |
|
122 CScriptFile& aIniSettingsFile, |
|
123 RPointerArray<CHttpTestBase>& aTestArray) |
|
124 { |
|
125 // ITERATION 1 TESTS |
|
126 TBuf<24> sectionName; |
|
127 sectionName.Format(KSectionNameIter1Fmt, 1); |
|
128 if (aIniFile.ItemValue(sectionName, KRunTestItemName, EFalse)) |
|
129 { |
|
130 CHttpTestCase1* tc1 = new(ELeave) CHttpTestCase1; |
|
131 TInt numLeakTests = aIniFile.ItemValue(sectionName, KLeakTestCount(), 0); |
|
132 TInt firstLeakIter = aIniFile.ItemValue(sectionName, KFirstLeakIteration(), 0); |
|
133 tc1->SetLeakTests(numLeakTests, firstLeakIter); |
|
134 aTestArray.Append(tc1); |
|
135 } |
|
136 sectionName.Format(KSectionNameIter1Fmt, 2); |
|
137 if (aIniFile.ItemValue(sectionName, KRunTestItemName, EFalse)) |
|
138 { |
|
139 CHttpTestCase2* tc2 = new(ELeave) CHttpTestCase2(&aIniSettingsFile); |
|
140 TInt numLeakTests = aIniFile.ItemValue(sectionName, KLeakTestCount(), 0); |
|
141 TInt firstLeakIter = aIniFile.ItemValue(sectionName, KFirstLeakIteration(), 0); |
|
142 tc2->SetLeakTests(numLeakTests, firstLeakIter); |
|
143 aTestArray.Append(tc2); |
|
144 } |
|
145 sectionName.Format(KSectionNameIter1Fmt, 4); |
|
146 if (aIniFile.ItemValue(sectionName, KRunTestItemName, EFalse)) |
|
147 { |
|
148 CHttpTestCase4* tc4 = new(ELeave) CHttpTestCase4(&aIniSettingsFile); |
|
149 TInt numLeakTests = aIniFile.ItemValue(sectionName, KLeakTestCount(), 0); |
|
150 TInt firstLeakIter = aIniFile.ItemValue(sectionName, KFirstLeakIteration(), 0); |
|
151 tc4->SetLeakTests(numLeakTests, firstLeakIter); |
|
152 aTestArray.Append(tc4); |
|
153 } |
|
154 sectionName.Format(KSectionNameIter1Fmt, 5); |
|
155 if (aIniFile.ItemValue(sectionName, KRunTestItemName, EFalse)) |
|
156 { |
|
157 CHttpTestCase5* tc5 = new(ELeave) CHttpTestCase5(&aIniSettingsFile); |
|
158 TInt numLeakTests = aIniFile.ItemValue(sectionName, KLeakTestCount(), 0); |
|
159 TInt firstLeakIter = aIniFile.ItemValue(sectionName, KFirstLeakIteration(), 0); |
|
160 tc5->SetLeakTests(numLeakTests, firstLeakIter); |
|
161 aTestArray.Append(tc5); |
|
162 } |
|
163 sectionName.Format(KSectionNameIter1Fmt, 6); |
|
164 if (aIniFile.ItemValue(sectionName, KRunTestItemName, EFalse)) |
|
165 { |
|
166 CHttpTestCase6* tc6 = new(ELeave) CHttpTestCase6(&aIniSettingsFile); |
|
167 TInt numLeakTests = aIniFile.ItemValue(sectionName, KLeakTestCount(), 0); |
|
168 TInt firstLeakIter = aIniFile.ItemValue(sectionName, KFirstLeakIteration(), 0); |
|
169 tc6->SetLeakTests(numLeakTests, firstLeakIter); |
|
170 aTestArray.Append(tc6); |
|
171 } |
|
172 sectionName.Format(KSectionNameIter1Fmt, 7); |
|
173 if (aIniFile.ItemValue(sectionName, KRunTestItemName, EFalse)) |
|
174 { |
|
175 CHttpTestCase7* tc7 = new(ELeave) CHttpTestCase7(&aIniSettingsFile); |
|
176 TInt numLeakTests = aIniFile.ItemValue(sectionName, KLeakTestCount(), 0); |
|
177 TInt firstLeakIter = aIniFile.ItemValue(sectionName, KFirstLeakIteration(), 0); |
|
178 tc7->SetLeakTests(numLeakTests, firstLeakIter); |
|
179 aTestArray.Append(tc7); |
|
180 } |
|
181 sectionName.Format(KSectionNameIter1Fmt, 8); |
|
182 if (aIniFile.ItemValue(sectionName, KRunTestItemName, EFalse)) |
|
183 { |
|
184 CHttpTestCase8* tc8 = new(ELeave) CHttpTestCase8(&aIniSettingsFile); |
|
185 TInt numLeakTests = aIniFile.ItemValue(sectionName, KLeakTestCount(), 0); |
|
186 TInt firstLeakIter = aIniFile.ItemValue(sectionName, KFirstLeakIteration(), 0); |
|
187 tc8->SetLeakTests(numLeakTests, firstLeakIter); |
|
188 aTestArray.Append(tc8); |
|
189 } |
|
190 sectionName.Format(KSectionNameIter1Fmt, 9); |
|
191 if (aIniFile.ItemValue(sectionName, KRunTestItemName, EFalse)) |
|
192 { |
|
193 CHttpTestCase9* tc9 = new(ELeave) CHttpTestCase9(&aIniSettingsFile); |
|
194 TInt numLeakTests = aIniFile.ItemValue(sectionName, KLeakTestCount(), 0); |
|
195 TInt firstLeakIter = aIniFile.ItemValue(sectionName, KFirstLeakIteration(), 0); |
|
196 tc9->SetLeakTests(numLeakTests, firstLeakIter); |
|
197 aTestArray.Append(tc9); |
|
198 } |
|
199 sectionName.Format(KSectionNameIter1Fmt, 10); |
|
200 if (aIniFile.ItemValue(sectionName, KRunTestItemName, EFalse)) |
|
201 { |
|
202 CHttpTestCase10* tc10 = new(ELeave) CHttpTestCase10(&aIniSettingsFile); |
|
203 TInt numLeakTests = aIniFile.ItemValue(sectionName, KLeakTestCount(), 0); |
|
204 TInt firstLeakIter = aIniFile.ItemValue(sectionName, KFirstLeakIteration(), 0); |
|
205 tc10->SetLeakTests(numLeakTests, firstLeakIter); |
|
206 aTestArray.Append(tc10); |
|
207 } |
|
208 sectionName.Format(KSectionNameIter1Fmt, 11); |
|
209 if (aIniFile.ItemValue(sectionName, KRunTestItemName, EFalse)) |
|
210 { |
|
211 // this one fails!? |
|
212 CHttpTestCase11* tc11 = new(ELeave) CHttpTestCase11(&aIniSettingsFile); |
|
213 TInt numLeakTests = aIniFile.ItemValue(sectionName, KLeakTestCount(), 0); |
|
214 TInt firstLeakIter = aIniFile.ItemValue(sectionName, KFirstLeakIteration(), 0); |
|
215 tc11->SetLeakTests(numLeakTests, firstLeakIter); |
|
216 aTestArray.Append(tc11); |
|
217 } |
|
218 sectionName.Format(KSectionNameIter1Fmt, 12); |
|
219 if (aIniFile.ItemValue(sectionName, KRunTestItemName, EFalse)) |
|
220 { |
|
221 CHttpTestCase12* tc12 = new(ELeave) CHttpTestCase12(&aIniSettingsFile); |
|
222 TInt numLeakTests = aIniFile.ItemValue(sectionName, KLeakTestCount(), 0); |
|
223 TInt firstLeakIter = aIniFile.ItemValue(sectionName, KFirstLeakIteration(), 0); |
|
224 tc12->SetLeakTests(numLeakTests, firstLeakIter); |
|
225 aTestArray.Append(tc12); |
|
226 } |
|
227 } |
|
228 |
|
229 void StartL() |
|
230 { |
|
231 // The following two lines create a semaphore which removes the security dialog |
|
232 // displayed when an untrusted certificate is received from a SSL server |
|
233 RSemaphore semaphore; |
|
234 semaphore.CreateGlobal(_L("T_AUTOSSL"), 0); |
|
235 |
|
236 TBool runTestDefault = EFalse; |
|
237 |
|
238 CTestScheduler* as = new(ELeave) CTestScheduler; |
|
239 CleanupStack::PushL(as); |
|
240 if (!as) |
|
241 { |
|
242 User::Panic(_L("Failed to create active scheduler"),KErrNoMemory); |
|
243 } |
|
244 CActiveScheduler::Install(as); // Install active scheduler |
|
245 |
|
246 // tialise Comms, required in a minimal console environment |
|
247 CHTTPTestUtils::InitCommsL(); |
|
248 |
|
249 CHttpTestEngine* engine = NULL; |
|
250 // not silent by default |
|
251 TRAPD(err,engine = CHttpTestEngine::NewL(KHttpTestTitle(), ETrue)); |
|
252 if (err != KErrNone) |
|
253 { |
|
254 User::Panic(_L("T_HTTP_ENG"),err); |
|
255 } |
|
256 CleanupStack::PushL(engine); |
|
257 |
|
258 engine->Utils().LogIt(_L("@SYMTestCaseID IWS-APPPROTOCOLS-HTTP-FRAMEWORK-ACCPT-T_HTTP-0001 ")); |
|
259 |
|
260 // Open the INI file to initialise the tests we're going to run |
|
261 CScriptFile* iniFile = NULL; |
|
262 TRAP(err, iniFile = CScriptFile::NewL(engine->Utils(), KAcceptanceTestCompName)); |
|
263 if (err != KErrNone) |
|
264 { |
|
265 User::Panic(_L("T_HTTP_INI"),err); |
|
266 } |
|
267 CleanupStack::PushL(iniFile); |
|
268 iniFile->ReadScriptL(KAcceptanceTestScriptName()); |
|
269 |
|
270 // Open the settings.ini file which has the server IP/Name that would |
|
271 // be used by the tests. |
|
272 CScriptFile* iniSettingsFile = NULL; |
|
273 TRAP(err, iniSettingsFile = CScriptFile::NewL(engine->Utils(), KSettingsIniCompName, KSettingsIniName())); |
|
274 if (err != KErrNone) |
|
275 { |
|
276 User::Panic(KAcceptanceTestCompName(),err); |
|
277 } |
|
278 CleanupStack::PushL(iniSettingsFile); |
|
279 |
|
280 // Create an array containing all the tests we're going to run. |
|
281 // Ownership is transferred to the test engine |
|
282 RPointerArray<CHttpTestBase> acceptanceTests; |
|
283 CleanupClosePushL(acceptanceTests); |
|
284 |
|
285 CArrayPtrFlat<CScriptSection>& sections=iniFile->Sections(); |
|
286 |
|
287 //create the tests for iteration2 and append them in the array |
|
288 AppendIteration1Tests(*iniFile, *iniSettingsFile, acceptanceTests); |
|
289 |
|
290 //create the tests for iteration2 and append them in the array |
|
291 TInt secCount = sections.Count(); |
|
292 TInt count= secCount; |
|
293 CScriptSection* section = NULL; |
|
294 for (TInt i=0;i<count;i++) |
|
295 { |
|
296 //create an array of tests to be sent to the engine |
|
297 section = sections[i]; |
|
298 _LIT(KZero, "0"); |
|
299 |
|
300 if (section->SectionName().CompareF(KSectionDefaults) == 0) |
|
301 { |
|
302 if (iniFile->Section(i).ItemL(KItemSilent).Value().CompareF(KZero) == 0) |
|
303 { |
|
304 engine->SetSilent(EFalse); |
|
305 } |
|
306 else |
|
307 { |
|
308 engine->SetSilent(ETrue); |
|
309 } |
|
310 if (iniFile->Section(i).ItemL(KRunTestItemName).Value().CompareF(KZero) != 0) |
|
311 { |
|
312 runTestDefault = ETrue; |
|
313 } |
|
314 } |
|
315 |
|
316 if ( section->SectionName().CompareF(KSectionSingleTrans) == 0) |
|
317 { |
|
318 TBool runTest = runTestDefault; |
|
319 |
|
320 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
321 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
322 { |
|
323 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
324 } |
|
325 if (runTest) |
|
326 { |
|
327 CHttpTestBase* singleTrans = CHttpTestSingleTrans::NewL(*iniFile,iniSettingsFile,i); |
|
328 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
329 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
330 singleTrans->SetLeakTests(numLeakTests, firstLeakIter); |
|
331 acceptanceTests.Append(singleTrans); |
|
332 } |
|
333 } |
|
334 |
|
335 if ( section->SectionName().CompareF(KSectionWspSingleTrans) == 0) |
|
336 { |
|
337 TBool runTest = runTestDefault; |
|
338 |
|
339 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
340 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
341 { |
|
342 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
343 } |
|
344 if (runTest) |
|
345 { |
|
346 CHttpTestBase* wspTrans = CWspTestTransactions::NewL(*iniFile, iniSettingsFile,i); |
|
347 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
348 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
349 wspTrans->SetLeakTests(numLeakTests, firstLeakIter); |
|
350 acceptanceTests.Append(wspTrans); |
|
351 } |
|
352 } |
|
353 |
|
354 if ( section->SectionName().CompareF(KSectionGet12) == 0) |
|
355 { |
|
356 TBool runTest = runTestDefault; |
|
357 |
|
358 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
359 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
360 { |
|
361 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
362 } |
|
363 if (runTest) |
|
364 { |
|
365 CHttpTestCaseGet12* get12 = new(ELeave) CHttpTestCaseGet12(iniSettingsFile); |
|
366 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
367 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
368 get12->SetLeakTests(numLeakTests, firstLeakIter); |
|
369 acceptanceTests.Append(get12); |
|
370 } |
|
371 } |
|
372 |
|
373 if ( section->SectionName().CompareF(KSectionGet13) == 0) |
|
374 { |
|
375 TBool runTest = runTestDefault; |
|
376 |
|
377 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
378 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
379 { |
|
380 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
381 } |
|
382 if (runTest) |
|
383 { |
|
384 CHttpTestCaseGet13* get13 = new(ELeave) CHttpTestCaseGet13(iniSettingsFile); |
|
385 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
386 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
387 get13->SetLeakTests(numLeakTests, firstLeakIter); |
|
388 acceptanceTests.Append(get13); |
|
389 } |
|
390 } |
|
391 if ( section->SectionName().CompareF(KSectionGet14) == 0) |
|
392 { |
|
393 TBool runTest = runTestDefault; |
|
394 |
|
395 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
396 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
397 { |
|
398 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
399 } |
|
400 if (runTest) |
|
401 { |
|
402 CHttpTestCaseGet14* get14 = new(ELeave) CHttpTestCaseGet14(iniSettingsFile); |
|
403 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
404 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
405 get14->SetLeakTests(numLeakTests, firstLeakIter); |
|
406 acceptanceTests.Append(get14); |
|
407 } |
|
408 } |
|
409 if ( section->SectionName().CompareF(KSectionGet17) == 0) |
|
410 { |
|
411 TBool runTest = runTestDefault; |
|
412 |
|
413 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
414 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
415 { |
|
416 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
417 } |
|
418 if (runTest) |
|
419 { |
|
420 CHttpTestCaseGet17* get17 = new(ELeave) CHttpTestCaseGet17(iniSettingsFile); |
|
421 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
422 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
423 get17->SetLeakTests(numLeakTests, firstLeakIter); |
|
424 acceptanceTests.Append(get17); |
|
425 } |
|
426 } |
|
427 |
|
428 if ( section->SectionName().CompareF(KSectionGet18) == 0) |
|
429 { |
|
430 TBool runTest = runTestDefault; |
|
431 |
|
432 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
433 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
434 { |
|
435 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
436 } |
|
437 if (runTest) |
|
438 { |
|
439 CHttpTestCaseGet18* get18 = new(ELeave) CHttpTestCaseGet18(iniSettingsFile); |
|
440 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
441 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
442 get18->SetLeakTests(numLeakTests, firstLeakIter); |
|
443 acceptanceTests.Append(get18); |
|
444 } |
|
445 } |
|
446 if ( section->SectionName().CompareF(KSectionGet21) == 0) |
|
447 { |
|
448 TBool runTest = runTestDefault; |
|
449 |
|
450 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
451 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
452 { |
|
453 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
454 } |
|
455 if (runTest) |
|
456 { |
|
457 CHttpTestCaseGet21* get21 = new(ELeave) CHttpTestCaseGet21; |
|
458 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
459 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
460 get21->SetLeakTests(numLeakTests, firstLeakIter); |
|
461 acceptanceTests.Append(get21); |
|
462 } |
|
463 } |
|
464 if ( section->SectionName().CompareF(KSectionPost12) == 0) |
|
465 { |
|
466 TBool runTest = runTestDefault; |
|
467 |
|
468 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
469 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
470 { |
|
471 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
472 } |
|
473 if (runTest) |
|
474 { |
|
475 CHttpTestCasePost12* post12 = new(ELeave) CHttpTestCasePost12(iniSettingsFile); |
|
476 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
477 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
478 post12->SetLeakTests(numLeakTests, firstLeakIter); |
|
479 acceptanceTests.Append(post12); |
|
480 } |
|
481 } |
|
482 if ( section->SectionName().CompareF(KSectionPost13) == 0) |
|
483 { |
|
484 TBool runTest = runTestDefault; |
|
485 |
|
486 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
487 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
488 { |
|
489 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
490 } |
|
491 if (runTest) |
|
492 { |
|
493 CHttpTestCasePost13* post13 = new(ELeave) CHttpTestCasePost13(iniSettingsFile); |
|
494 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
495 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
496 post13->SetLeakTests(numLeakTests, firstLeakIter); |
|
497 acceptanceTests.Append(post13); |
|
498 } |
|
499 } |
|
500 if ( section->SectionName().CompareF(KSectionPost14) == 0) |
|
501 { |
|
502 TBool runTest = runTestDefault; |
|
503 |
|
504 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
505 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
506 { |
|
507 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
508 } |
|
509 if (runTest) |
|
510 { |
|
511 CHttpTestCasePost14* post14 = new(ELeave) CHttpTestCasePost14(iniSettingsFile); |
|
512 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
513 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
514 post14->SetLeakTests(numLeakTests, firstLeakIter); |
|
515 acceptanceTests.Append(post14); |
|
516 } |
|
517 } |
|
518 if ( section->SectionName().CompareF(KSectionPost23) == 0) |
|
519 { |
|
520 TBool runTest = runTestDefault; |
|
521 |
|
522 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
523 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
524 { |
|
525 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
526 } |
|
527 if (runTest) |
|
528 { |
|
529 CHttpTestCasePost23* post23 = new(ELeave) CHttpTestCasePost23(iniSettingsFile); |
|
530 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
531 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
532 post23->SetLeakTests(numLeakTests, firstLeakIter); |
|
533 acceptanceTests.Append(post23); |
|
534 } |
|
535 } |
|
536 if ( section->SectionName().CompareF(KSection3Post6) == 0) |
|
537 { |
|
538 TBool runTest = runTestDefault; |
|
539 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
540 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
541 { |
|
542 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
543 } |
|
544 if (runTest) |
|
545 { |
|
546 CHttpTestCaseIter3Post6* iter3Post6= new(ELeave) CHttpTestCaseIter3Post6(iniSettingsFile); |
|
547 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
548 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
549 iter3Post6->SetLeakTests(numLeakTests, firstLeakIter); |
|
550 acceptanceTests.Append(iter3Post6); |
|
551 } |
|
552 } |
|
553 if ( section->SectionName().CompareF(KSection3Post7) == 0) |
|
554 { |
|
555 TBool runTest = runTestDefault; |
|
556 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
557 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
558 { |
|
559 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
560 } |
|
561 if (runTest) |
|
562 { |
|
563 CHttpTestCaseIter3Post7* iter3Post7 = new(ELeave) CHttpTestCaseIter3Post7(iniSettingsFile); |
|
564 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
565 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
566 iter3Post7->SetLeakTests(numLeakTests, firstLeakIter); |
|
567 acceptanceTests.Append(iter3Post7); |
|
568 } |
|
569 } |
|
570 if ( section->SectionName().CompareF(KSection5Chunked1) == 0) |
|
571 { |
|
572 TBool runTest = runTestDefault; |
|
573 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
574 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
575 { |
|
576 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
577 } |
|
578 if (runTest) |
|
579 { |
|
580 CHttpTestCaseIter5Chunked1* iter5Chunked1 = new(ELeave) CHttpTestCaseIter5Chunked1(iniSettingsFile); |
|
581 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
582 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
583 iter5Chunked1->SetLeakTests(numLeakTests, firstLeakIter); |
|
584 acceptanceTests.Append(iter5Chunked1); |
|
585 } |
|
586 } |
|
587 if ( section->SectionName().CompareF(KSection5Chunked2) == 0) |
|
588 { |
|
589 TBool runTest = runTestDefault; |
|
590 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
591 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
592 { |
|
593 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
594 } |
|
595 if (runTest) |
|
596 { |
|
597 CHttpTestCaseIter5Chunked2* iter5Chunked2 = new(ELeave) CHttpTestCaseIter5Chunked2(iniSettingsFile); |
|
598 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
599 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
600 iter5Chunked2->SetLeakTests(numLeakTests, firstLeakIter); |
|
601 acceptanceTests.Append(iter5Chunked2); |
|
602 } |
|
603 } |
|
604 |
|
605 if ( section->SectionName().CompareF(K3BasicAuthTransactions) == 0) |
|
606 { |
|
607 TBool runTest = runTestDefault; |
|
608 |
|
609 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
610 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
611 { |
|
612 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
613 } |
|
614 if (runTest) |
|
615 { |
|
616 C3BasicAuthTransactions* basicAuthTrans = new(ELeave) C3BasicAuthTransactions(iniSettingsFile); |
|
617 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
618 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
619 basicAuthTrans->SetLeakTests(numLeakTests, firstLeakIter); |
|
620 acceptanceTests.Append(basicAuthTrans); |
|
621 } |
|
622 } |
|
623 |
|
624 if ( section->SectionName().CompareF(K3DigestAuthTransactions) == 0) |
|
625 { |
|
626 TBool runTest = runTestDefault; |
|
627 |
|
628 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
629 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
630 { |
|
631 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
632 } |
|
633 if (runTest) |
|
634 { |
|
635 C3DigestAuthTransactions* digestAuthTrans = new(ELeave) C3DigestAuthTransactions(iniSettingsFile); |
|
636 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
637 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
638 digestAuthTrans->SetLeakTests(numLeakTests, firstLeakIter); |
|
639 acceptanceTests.Append(digestAuthTrans); |
|
640 } |
|
641 } |
|
642 |
|
643 if ( section->SectionName().CompareF(KEofTransactionResubmission) == 0) |
|
644 { |
|
645 TBool runTest = runTestDefault; |
|
646 |
|
647 TPtrC itemPtr(iniFile->Section(i).Item(0).Item()); |
|
648 if (itemPtr.CompareF(KRunTestItemName)==0) |
|
649 { |
|
650 runTest = !(iniFile->Section(i).Item(0).Value().CompareF(KZero) == 0); |
|
651 } |
|
652 if (runTest) |
|
653 { |
|
654 CEofTransactionResubmission* eofTransResubmission = new(ELeave) CEofTransactionResubmission(iniSettingsFile); |
|
655 TInt numLeakTests = iniFile->ItemValue(iniFile->Section(i).SectionName(), KLeakTestCount(), 0); |
|
656 TInt firstLeakIter = iniFile->ItemValue(iniFile->Section(i).SectionName(), KFirstLeakIteration(), 0); |
|
657 eofTransResubmission->SetLeakTests(numLeakTests, firstLeakIter); |
|
658 acceptanceTests.Append(eofTransResubmission); |
|
659 } |
|
660 } |
|
661 } |
|
662 |
|
663 // Set the test array then pop because the engine takes ownership |
|
664 engine->ConfigureTestSet(acceptanceTests); |
|
665 |
|
666 //-------- |
|
667 CleanupStack::Pop(&acceptanceTests);// |
|
668 |
|
669 // All the action happens within the main event loop |
|
670 CActiveScheduler::Start(); |
|
671 |
|
672 TInt pass, fail; |
|
673 engine->TestSummary(pass, fail); |
|
674 engine->Utils().LogIt(_L("\nTest Summary: %d passed, %d failed.\n"), |
|
675 pass, fail); |
|
676 engine->PressAnyKey(); |
|
677 // Returned from start so shutdown |
|
678 //RL: pause a sec to get a gander |
|
679 engine->Utils().LogIt(_L("\nEnd of test program ")); |
|
680 CleanupStack::PopAndDestroy(4); // engine, iniSettingsFile, iniFile, as |
|
681 } |
|
682 |
|
683 TInt TestEntryPoint(TAny* /*aParam*/) |
|
684 { |
|
685 __UHEAP_MARK; |
|
686 |
|
687 // Install exception handler |
|
688 CTrapCleanup* theCleanup = CTrapCleanup::New(); |
|
689 |
|
690 // Run all the tests |
|
691 TRAPD(err,StartL()); |
|
692 if (err!=KErrNone) |
|
693 User::Panic(KPanicOnLeave,err); |
|
694 |
|
695 delete theCleanup; |
|
696 |
|
697 __UHEAP_MARKEND; |
|
698 User::Heap().Check(); |
|
699 return(KErrNone); |
|
700 } |
|
701 |
|
702 void LogOnPanicL(RThread& aTestThread) |
|
703 { |
|
704 CTestScheduler* as = new(ELeave) CTestScheduler; |
|
705 CleanupStack::PushL(as); |
|
706 if (!as) |
|
707 { |
|
708 User::Panic(_L("Failed to create active scheduler"),KErrNoMemory); |
|
709 } |
|
710 CActiveScheduler::Install(as); // Install active scheduler |
|
711 |
|
712 // Initialise Comms, required in a minimal console environment |
|
713 CHTTPTestUtils::InitCommsL(); |
|
714 |
|
715 // Force a connection to be held open keep NT RAS connected... |
|
716 CHTTPTestUtils::HoldOpenConnectionL(); |
|
717 |
|
718 // Create the test engine |
|
719 CHttpTestEngine* engine=NULL; |
|
720 TRAPD(err,engine = CHttpTestEngine::NewL(KHttpTestTitle(), EFalse)); |
|
721 if (err != KErrNone) |
|
722 { |
|
723 User::Panic(_L("T_HTTP_ENG"), err); |
|
724 } |
|
725 CleanupStack::PushL(engine); |
|
726 |
|
727 // Create log message |
|
728 TExitCategoryName panicName = aTestThread.ExitCategory(); |
|
729 TInt panicNumber = aTestThread.ExitReason(); |
|
730 HBufC* logMessage = HBufC::NewLC(KRtestFailureLabel().Length() + |
|
731 panicName.Length() + |
|
732 KMaxIntDesLen); |
|
733 TPtr logMessagePtr = logMessage->Des(); |
|
734 logMessagePtr.Format(KRtestFailureLabel, &panicName, panicNumber); |
|
735 |
|
736 engine->Utils().LogIt(logMessagePtr); |
|
737 |
|
738 // Panic here so that nothing else is written to the log file |
|
739 User::Panic(panicName, panicNumber); |
|
740 |
|
741 // The code below provided for completenes, but should never be reached |
|
742 |
|
743 // Release the held open connection |
|
744 CHTTPTestUtils::ReleaseConnectionL(); |
|
745 |
|
746 CleanupStack::PopAndDestroy(3, as); //as, engine, logMessage |
|
747 } |
|
748 |
|
749 // main loop |
|
750 // |
|
751 GLDEF_C TInt E32Main() |
|
752 { |
|
753 __UHEAP_MARK; |
|
754 CTrapCleanup* theCleanup = CTrapCleanup::New(); // Install exception handler |
|
755 |
|
756 // Create a new thread for running tests in |
|
757 RThread testThread; |
|
758 TInt err = testThread.Create(KTestThreadName, TestEntryPoint, KDefaultStackSize, |
|
759 KMinHeapSize, KMaxHeapSize, NULL); |
|
760 if(err == KErrNone) |
|
761 { |
|
762 testThread.Resume(); |
|
763 } |
|
764 else |
|
765 { |
|
766 return err; |
|
767 } |
|
768 |
|
769 // Kick off test thread and wait for it to exit |
|
770 TRequestStatus tStat; |
|
771 testThread.Logon(tStat); |
|
772 User::WaitForRequest(tStat); |
|
773 |
|
774 // Log if paniced |
|
775 if(testThread.ExitType() == EExitPanic) |
|
776 { |
|
777 TRAP_IGNORE(LogOnPanicL(testThread)); |
|
778 } |
|
779 |
|
780 testThread.Close(); |
|
781 delete theCleanup; |
|
782 __UHEAP_MARKEND; |
|
783 return KErrNone; |
|
784 } |
|
785 |