|
1 // Copyright (c) 2002-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 // |
|
15 |
|
16 #include "ctestengine.h" |
|
17 |
|
18 #include <ecom/ecom.h> |
|
19 |
|
20 #include "cmessageparserdriver.h" |
|
21 #include "cmessagecomposerdriver.h" |
|
22 |
|
23 _LIT(KTestHttpMessageParserTitle, "HTTP Message Test Harness"); |
|
24 |
|
25 const TInt KLogBufSize = 128; |
|
26 |
|
27 CTestEngine* CTestEngine::NewL() |
|
28 { |
|
29 CTestEngine* self = new (ELeave) CTestEngine(); |
|
30 CleanupStack::PushL(self); |
|
31 self->ConstructL(); |
|
32 CleanupStack::Pop(self); |
|
33 return self; |
|
34 } |
|
35 |
|
36 CTestEngine::~CTestEngine() |
|
37 { |
|
38 delete iTestUtils; |
|
39 } |
|
40 |
|
41 CTestEngine::CTestEngine() |
|
42 : CBase() |
|
43 { |
|
44 } |
|
45 |
|
46 void CTestEngine::ConstructL() |
|
47 { |
|
48 iTestUtils = CHTTPTestUtils::NewL(KTestHttpMessageParserTitle()); |
|
49 iTestUtils->InitCommsL(); |
|
50 } |
|
51 |
|
52 void CTestEngine::DoOOMTest(TTestFunctionL aDoTestFunctionL) |
|
53 { |
|
54 Log(_L("Doing OOM testing - logging turned-off")); |
|
55 iOOMTesting = ETrue; |
|
56 |
|
57 TInt err = 1; |
|
58 TInt count = 0; |
|
59 |
|
60 while( err || iTestFailed ) |
|
61 { |
|
62 __UHEAP_MARK; |
|
63 __UHEAP_SETFAIL(RHeap::EFailNext, count); // This is a Macro, not leaving function |
|
64 TRAPD(error, (this->*aDoTestFunctionL)()); |
|
65 err = error; |
|
66 __UHEAP_MARKEND; |
|
67 ++count; |
|
68 } |
|
69 __UHEAP_RESET; |
|
70 iOOMTesting = EFalse; |
|
71 Log(_L("End of OOM testing")); |
|
72 } |
|
73 |
|
74 void CTestEngine::DoTestsL() |
|
75 { |
|
76 iTestUtils->SetSilent(EFalse); |
|
77 TBuf<KLogBufSize> buf; |
|
78 buf.Format(_L("@SYMTestCaseID IWS-APPPROTOCOLS-HTTP-FRAMEWORK-T_HTTPMESSAGE-0001 ")); |
|
79 iTestUtils->LogIt(buf); |
|
80 iTestUtils->SetSilent(ETrue); |
|
81 |
|
82 // Run through tests... |
|
83 |
|
84 // Simple Message Test Case |
|
85 iTestUtils->StartTestL(_L("Parse Simple Message Test Case HTTP-U-2201")); |
|
86 DoParseSimpleMessageL(); |
|
87 iTestUtils->EndTest(iTestFailed); |
|
88 |
|
89 // Do OOM testing |
|
90 iTestUtils->StartTestL(_L("OOM Testing of Parse Simple Message Test Case HTTP-U-2202")); |
|
91 if( !iTestFailed ) |
|
92 { |
|
93 DoOOMTest(&CTestEngine::DoParseSimpleMessageL); |
|
94 } |
|
95 iTestUtils->EndTest(iTestFailed); |
|
96 |
|
97 // No Entity Body Test Case |
|
98 iTestUtils->StartTestL(_L("Parse No Entity Body Test Case HTTP-U-2203")); |
|
99 DoParseNoEntityBodyL(); |
|
100 iTestUtils->EndTest(iTestFailed); |
|
101 |
|
102 // Do OOM testing |
|
103 iTestUtils->StartTestL(_L("OOM Testing of Parse No Entity Body Test Case HTTP-U-2204")); |
|
104 if( !iTestFailed ) |
|
105 { |
|
106 DoOOMTest(&CTestEngine::DoParseNoEntityBodyL); |
|
107 } |
|
108 iTestUtils->EndTest(iTestFailed); |
|
109 |
|
110 |
|
111 // Non-encoded Entity Body Test Case |
|
112 iTestUtils->StartTestL(_L("Parse Non-encoded Entity Body Test Case HTTP-U-2205")); |
|
113 DoParseNonEncodedBodyL(); |
|
114 iTestUtils->EndTest(iTestFailed); |
|
115 |
|
116 // Do OOM testing |
|
117 iTestUtils->StartTestL(_L("OOM Testing of Parse Non-encoded Entity Body Test Case HTTP-U-2206")); |
|
118 if( !iTestFailed ) |
|
119 { |
|
120 DoOOMTest(&CTestEngine::DoParseNonEncodedBodyL); |
|
121 } |
|
122 iTestUtils->EndTest(iTestFailed); |
|
123 |
|
124 |
|
125 // Chunk-Encoded Entity Body Test Case |
|
126 iTestUtils->StartTestL(_L("Parse Chunk-Encoded Entity Body Test Case HTTP-U-2207")); |
|
127 DoParseChunkEncodedBodyL(); |
|
128 iTestUtils->EndTest(iTestFailed); |
|
129 |
|
130 // Do OOM testing |
|
131 iTestUtils->StartTestL(_L("OOM Testing of Parse Chunk-Encoded Entity Body Test Case HTTP-U-2208")); |
|
132 if( !iTestFailed ) |
|
133 { |
|
134 DoOOMTest(&CTestEngine::DoParseChunkEncodedBodyL); |
|
135 } |
|
136 iTestUtils->EndTest(iTestFailed); |
|
137 |
|
138 |
|
139 // Chunk-Encoded Entity Body And Trailers Test Case |
|
140 iTestUtils->StartTestL(_L("Parse Chunk-Encoded Entity Body And Trailers Test Case HTTP-U-2209")); |
|
141 DoParseChunkEncodedBodyWithTrailersL(); |
|
142 iTestUtils->EndTest(iTestFailed); |
|
143 |
|
144 // Do OOM testing |
|
145 iTestUtils->StartTestL(_L("OOM Testing of Parse Chunk-Encoded Entity Body And Trailers Test Case HTTP-U-2210")); |
|
146 if( !iTestFailed ) |
|
147 { |
|
148 DoOOMTest(&CTestEngine::DoParseChunkEncodedBodyWithTrailersL); |
|
149 } |
|
150 iTestUtils->EndTest(iTestFailed); |
|
151 |
|
152 |
|
153 // Bad Header Line Test Case |
|
154 iTestUtils->StartTestL(_L("Parse Bad Header Line Test Case HTTP-U-2211")); |
|
155 DoParseBadLineL(); |
|
156 iTestUtils->EndTest(iTestFailed); |
|
157 |
|
158 |
|
159 // Bad Empty Line Test Case |
|
160 iTestUtils->StartTestL(_L("Parse Bad Empty Line Test Case HTTP-U-2212")); |
|
161 DoParseBadEmptyLineL(); |
|
162 iTestUtils->EndTest(iTestFailed); |
|
163 |
|
164 |
|
165 // Bad Header Continuation Value Test Case |
|
166 iTestUtils->StartTestL(_L("Parse Bad Header Continuation Value Test Case HTTP-U-2213")); |
|
167 DoParseBadHeaderContinuationL(); |
|
168 iTestUtils->EndTest(iTestFailed); |
|
169 |
|
170 |
|
171 // Bad Chunk-Extension Test Case |
|
172 iTestUtils->StartTestL(_L("Parse Bad Chunk-Extension Test Case HTTP-U-2214")); |
|
173 DoParseBadChunkExtensionL(); |
|
174 iTestUtils->EndTest(iTestFailed); |
|
175 |
|
176 |
|
177 // Bad Chunk-Data Test Case |
|
178 iTestUtils->StartTestL(_L("Parse Bad Chunk-Data Test Case HTTP-U-2215")); |
|
179 DoParseBadChunkDataL(); |
|
180 iTestUtils->EndTest(iTestFailed); |
|
181 |
|
182 |
|
183 // Bad Chunk-Size Test Case |
|
184 iTestUtils->StartTestL(_L("Parse Bad Chunk-Size Test Case HTTP-U-2216")); |
|
185 DoParseBadChunkSizeL(); |
|
186 iTestUtils->EndTest(iTestFailed); |
|
187 |
|
188 |
|
189 // Missing CRs Test Case |
|
190 iTestUtils->StartTestL(_L("Parse Missing CRs Test Case HTTP-U-2217")); |
|
191 DoParseMissingCRsL(); |
|
192 iTestUtils->EndTest(iTestFailed); |
|
193 |
|
194 |
|
195 // Spurious CRs Test Case |
|
196 iTestUtils->StartTestL(_L("Parse Spurious CRs Test Case HTTP-U-2218")); |
|
197 DoParseSpuriousCRsL(); |
|
198 iTestUtils->EndTest(iTestFailed); |
|
199 |
|
200 |
|
201 // Long Header Test Case |
|
202 iTestUtils->StartTestL(_L("Parse Long Header Test Case HTTP-U-2219")); |
|
203 DoParseLongHeaderL(); |
|
204 iTestUtils->EndTest(iTestFailed); |
|
205 |
|
206 |
|
207 // Leading Empty Line Test Case |
|
208 iTestUtils->StartTestL(_L("Parse Leading Empty Line Test Case HTTP-U-2220")); |
|
209 DoParseLeadingEmptyLineL(); |
|
210 iTestUtils->EndTest(iTestFailed); |
|
211 |
|
212 |
|
213 // Non Chunked Message Reset Test Case |
|
214 iTestUtils->StartTestL(_L("Parse Non Chunked Message Reset Test Case HTTP-U-2221")); |
|
215 DoParseNonChunkedResetL(); |
|
216 iTestUtils->EndTest(iTestFailed); |
|
217 |
|
218 |
|
219 // Chunked Message Reset Test Case |
|
220 iTestUtils->StartTestL(_L("Parse Chunked Message Reset Test Case HTTP-U-2222")); |
|
221 DoParseChunkedResetL(); |
|
222 iTestUtils->EndTest(iTestFailed); |
|
223 |
|
224 // Chunked Messages Containing Only CRs Test Case |
|
225 iTestUtils->StartTestL(_L("Parse Chunked Messages Containing Only CRs Test Case HTTP-U-2223")); |
|
226 DoParseChunkDataContainingOnlyCRsL(); |
|
227 iTestUtils->EndTest(iTestFailed); |
|
228 |
|
229 //--------------------- Composing Tests ------------------------- |
|
230 |
|
231 iTestUtils->StartTestL(_L("Compose Simple Message Test Case HTTP-U-2225")); |
|
232 DoComposeSimpleMessageL(); |
|
233 iTestUtils->EndTest(iTestFailed); |
|
234 |
|
235 // Do OOM testing |
|
236 iTestUtils->StartTestL(_L("OOM Testing of Compose Simple Message Test Case HTTP-U-2226")); |
|
237 if( !iTestFailed ) |
|
238 { |
|
239 DoOOMTest(&CTestEngine::DoComposeSimpleMessageL); |
|
240 } |
|
241 iTestUtils->EndTest(iTestFailed); |
|
242 |
|
243 |
|
244 // No Entity Body Test Case |
|
245 iTestUtils->StartTestL(_L("Compose No Entity Body Test Case HTTP-U-2227")); |
|
246 DoComposeNoEntityBodyL(); |
|
247 iTestUtils->EndTest(iTestFailed); |
|
248 |
|
249 // Do OOM testing |
|
250 iTestUtils->StartTestL(_L("OOM Testing of Compose No Entity Body Test Case HTTP-U-2228")); |
|
251 if( !iTestFailed ) |
|
252 { |
|
253 DoOOMTest(&CTestEngine::DoComposeNoEntityBodyL); |
|
254 } |
|
255 iTestUtils->EndTest(iTestFailed); |
|
256 |
|
257 // Non-encoded Entity Body Test Case |
|
258 iTestUtils->StartTestL(_L("Compose Non-encoded Entity Body Test Case HTTP-U-2229")); |
|
259 DoComposeNonEncodedBodyL(); |
|
260 iTestUtils->EndTest(iTestFailed); |
|
261 |
|
262 // Do OOM testing |
|
263 iTestUtils->StartTestL(_L("OOM Testing of Compose Non-encoded Entity Body Test Case HTTP-U-2230")); |
|
264 if( !iTestFailed ) |
|
265 { |
|
266 DoOOMTest(&CTestEngine::DoComposeNonEncodedBodyL); |
|
267 } |
|
268 iTestUtils->EndTest(iTestFailed); |
|
269 |
|
270 |
|
271 // Chunk-Encoded Entity Body Test Case |
|
272 iTestUtils->StartTestL(_L("Compose Chunk-Encoded Entity Body Test Case HTTP-U-2231")); |
|
273 DoComposeChunkEncodedBodyL(); |
|
274 iTestUtils->EndTest(iTestFailed); |
|
275 |
|
276 // Do OOM testing |
|
277 iTestUtils->StartTestL(_L("OOM Testing of Compose Chunk-Encoded Entity Body Test Case HTTP-U-2232")); |
|
278 if( !iTestFailed ) |
|
279 { |
|
280 DoOOMTest(&CTestEngine::DoComposeChunkEncodedBodyL); |
|
281 } |
|
282 iTestUtils->EndTest(iTestFailed); |
|
283 |
|
284 |
|
285 // Chunk-Encoded Entity Body And Trailers Test Case |
|
286 iTestUtils->StartTestL(_L("Compose Chunk-Encoded Entity Body And Trailers Test Case HTTP-U-2233")); |
|
287 DoComposeChunkEncodedBodyWithTrailersL(); |
|
288 iTestUtils->EndTest(iTestFailed); |
|
289 |
|
290 // Do OOM testing |
|
291 iTestUtils->StartTestL(_L("OOM Testing of Compose Chunk-Encoded Entity Body And Trailers Test Case HTTP-U-2234")); |
|
292 if( !iTestFailed ) |
|
293 { |
|
294 DoOOMTest(&CTestEngine::DoComposeChunkEncodedBodyWithTrailersL); |
|
295 } |
|
296 iTestUtils->EndTest(iTestFailed); |
|
297 |
|
298 // Bad Entity Body - too much data |
|
299 iTestUtils->StartTestL(_L("Compose Bad Entity Body With Too Much Data Test Case HTTP-U-2235")); |
|
300 DoComposeTooMuchEntityBodyDataL(); |
|
301 iTestUtils->EndTest(iTestFailed); |
|
302 |
|
303 // Bad Entity Body - too little data |
|
304 iTestUtils->StartTestL(_L("Compose Bad Entity Body With Too Little Data Test Case HTTP-U-2236")); |
|
305 DoComposeTooLittleEntityBodyDataL(); |
|
306 iTestUtils->EndTest(iTestFailed); |
|
307 |
|
308 // Long Header - too little data |
|
309 iTestUtils->StartTestL(_L("Compose Long Header Test Case HTTP-U-2237")); |
|
310 DoComposeLongHeaderL(); |
|
311 iTestUtils->EndTest(iTestFailed); |
|
312 |
|
313 |
|
314 // Non-encoded Entity Body Reset Test Case |
|
315 iTestUtils->StartTestL(_L("Compose Non-encoded Entity Body Reset Test Case HTTP-U-2238")); |
|
316 DoComposeNonEncodedBodyResetL(); |
|
317 iTestUtils->EndTest(iTestFailed); |
|
318 |
|
319 // Chunk-Encoded Entity Body And Trailers Reset Test Case |
|
320 iTestUtils->StartTestL(_L("Compose Chunk-Encoded Entity Body And Trailers Reset Test Case HTTP-U-2239")); |
|
321 DoComposeChunkEncodedBodyWithTrailersResetL(); |
|
322 iTestUtils->EndTest(iTestFailed); |
|
323 |
|
324 //--------------------- Unknown Body Length Tests ------------------------- |
|
325 // Run all the above parser tests again using a HTTP 1.0 style response of unknown body length |
|
326 iUseUnknownBodyLength = ETrue; |
|
327 |
|
328 // Simple Message Test Case |
|
329 iTestUtils->StartTestL(_L("Parse Simple Message Test Case HTTP-U-2201")); |
|
330 DoParseSimpleMessageL(); |
|
331 iTestUtils->EndTest(iTestFailed); |
|
332 |
|
333 // Do OOM testing |
|
334 iTestUtils->StartTestL(_L("OOM Testing of Parse Simple Message Test Case HTTP-U-2202")); |
|
335 if( !iTestFailed ) |
|
336 { |
|
337 DoOOMTest(&CTestEngine::DoParseSimpleMessageL); |
|
338 } |
|
339 iTestUtils->EndTest(iTestFailed); |
|
340 |
|
341 // No Entity Body Test Case |
|
342 iTestUtils->StartTestL(_L("Parse No Entity Body Test Case HTTP-U-2203")); |
|
343 DoParseNoEntityBodyL(); |
|
344 iTestUtils->EndTest(iTestFailed); |
|
345 |
|
346 // Do OOM testing |
|
347 iTestUtils->StartTestL(_L("OOM Testing of Parse No Entity Body Test Case HTTP-U-2204")); |
|
348 if( !iTestFailed ) |
|
349 { |
|
350 DoOOMTest(&CTestEngine::DoParseNoEntityBodyL); |
|
351 } |
|
352 iTestUtils->EndTest(iTestFailed); |
|
353 |
|
354 |
|
355 // Non-encoded Entity Body Test Case |
|
356 iTestUtils->StartTestL(_L("Parse Non-encoded Entity Body Test Case HTTP-U-2205")); |
|
357 DoParseNonEncodedBodyL(); |
|
358 iTestUtils->EndTest(iTestFailed); |
|
359 |
|
360 // Do OOM testing |
|
361 iTestUtils->StartTestL(_L("OOM Testing of Parse Non-encoded Entity Body Test Case HTTP-U-2206")); |
|
362 if( !iTestFailed ) |
|
363 { |
|
364 DoOOMTest(&CTestEngine::DoParseNonEncodedBodyL); |
|
365 } |
|
366 iTestUtils->EndTest(iTestFailed); |
|
367 |
|
368 // Bad Header Line Test Case |
|
369 iTestUtils->StartTestL(_L("Parse Bad Header Line Test Case HTTP-U-2211")); |
|
370 DoParseBadLineL(); |
|
371 iTestUtils->EndTest(iTestFailed); |
|
372 |
|
373 |
|
374 // Bad Header Continuation Value Test Case |
|
375 iTestUtils->StartTestL(_L("Parse Bad Header Continuation Value Test Case HTTP-U-2213")); |
|
376 DoParseBadHeaderContinuationL(); |
|
377 iTestUtils->EndTest(iTestFailed); |
|
378 |
|
379 |
|
380 // Long Header Test Case |
|
381 iTestUtils->StartTestL(_L("Parse Long Header Test Case HTTP-U-2219")); |
|
382 DoParseLongHeaderL(); |
|
383 iTestUtils->EndTest(iTestFailed); |
|
384 |
|
385 |
|
386 // Leading Empty Line Test Case |
|
387 iTestUtils->StartTestL(_L("Parse Leading Empty Line Test Case HTTP-U-2220")); |
|
388 DoParseLeadingEmptyLineL(); |
|
389 iTestUtils->EndTest(iTestFailed); |
|
390 |
|
391 iUseUnknownBodyLength = EFalse; |
|
392 |
|
393 |
|
394 // Raw Bad Response - field containing "<sp>:<sp> |
|
395 iTestUtils->StartTestL(_L("Parse Raw Bad Response Test Case HTTP-U-2240")); |
|
396 DoParseRawBadResponseTest1L(); |
|
397 iTestUtils->EndTest(iTestFailed); |
|
398 |
|
399 // Do OOM testing |
|
400 iTestUtils->StartTestL(_L("OOM Testing of Parse Raw Bad Response Test Case HTTP-U-2241")); |
|
401 if( !iTestFailed ) |
|
402 { |
|
403 DoOOMTest(&CTestEngine::DoParseRawBadResponseTest1L); |
|
404 } |
|
405 iTestUtils->EndTest(iTestFailed); |
|
406 |
|
407 // Raw Bad Response - field containing "<sp>:<sp>bytes" |
|
408 iTestUtils->StartTestL(_L("Parse Raw Bad Response Test Case HTTP-U-2242")); |
|
409 DoParseRawBadResponseTest2L(); |
|
410 iTestUtils->EndTest(iTestFailed); |
|
411 |
|
412 // Do OOM testing |
|
413 iTestUtils->StartTestL(_L("OOM Testing of Parse Raw Bad Response Test Case HTTP-U-2243")); |
|
414 if( !iTestFailed ) |
|
415 { |
|
416 DoOOMTest(&CTestEngine::DoParseRawBadResponseTest2L); |
|
417 } |
|
418 iTestUtils->EndTest(iTestFailed); |
|
419 |
|
420 // Raw Bad Response - field containing "Accept-Ranges:<sp>" |
|
421 iTestUtils->StartTestL(_L("Parse Raw Bad Response Test Case HTTP-U-2244")); |
|
422 DoParseRawBadResponseTest3L(); |
|
423 iTestUtils->EndTest(iTestFailed); |
|
424 |
|
425 // Do OOM testing |
|
426 iTestUtils->StartTestL(_L("OOM Testing of Parse Raw Bad Response Test Case HTTP-U-2245")); |
|
427 if( !iTestFailed ) |
|
428 { |
|
429 DoOOMTest(&CTestEngine::DoParseRawBadResponseTest3L); |
|
430 } |
|
431 iTestUtils->EndTest(iTestFailed); |
|
432 |
|
433 // Raw Bad Response - field containing "<sp>:bytes" |
|
434 iTestUtils->StartTestL(_L("Parse Raw Bad Response Test Case HTTP-U-2246")); |
|
435 DoParseRawBadResponseTest4L(); |
|
436 iTestUtils->EndTest(iTestFailed); |
|
437 |
|
438 // Do OOM testing |
|
439 iTestUtils->StartTestL(_L("OOM Testing of Parse Raw Bad Response Test Case HTTP-U-2247")); |
|
440 if( !iTestFailed ) |
|
441 { |
|
442 DoOOMTest(&CTestEngine::DoParseRawBadResponseTest4L); |
|
443 } |
|
444 iTestUtils->EndTest(iTestFailed); |
|
445 |
|
446 // Raw Bad Response - field containing "<sp>:" |
|
447 iTestUtils->StartTestL(_L("Parse Raw Bad Response Test Case HTTP-U-2248")); |
|
448 DoParseRawBadResponseTest5L(); |
|
449 iTestUtils->EndTest(iTestFailed); |
|
450 |
|
451 // Do OOM testing |
|
452 iTestUtils->StartTestL(_L("OOM Testing of Parse Raw Bad Response Test Case HTTP-U-2249")); |
|
453 if( !iTestFailed ) |
|
454 { |
|
455 DoOOMTest(&CTestEngine::DoParseRawBadResponseTest5L); |
|
456 } |
|
457 iTestUtils->EndTest(iTestFailed); |
|
458 |
|
459 // Raw Bad Response - field containing "Accept-Ranges:" |
|
460 iTestUtils->StartTestL(_L("Parse Raw Bad Response Test Case HTTP-U-2250")); |
|
461 DoParseRawBadResponseTest6L(); |
|
462 iTestUtils->EndTest(iTestFailed); |
|
463 |
|
464 // Do OOM testing |
|
465 iTestUtils->StartTestL(_L("OOM Testing of Parse Raw Bad Response Test Case HTTP-U-2251")); |
|
466 if( !iTestFailed ) |
|
467 { |
|
468 DoOOMTest(&CTestEngine::DoParseRawBadResponseTest6L); |
|
469 } |
|
470 iTestUtils->EndTest(iTestFailed); |
|
471 |
|
472 // Raw Bad Response - field containing "<sp>::" |
|
473 iTestUtils->StartTestL(_L("Parse Raw Bad Response Test Case HTTP-U-2252")); |
|
474 DoParseRawBadResponseTest7L(); |
|
475 iTestUtils->EndTest(iTestFailed); |
|
476 |
|
477 // Do OOM testing |
|
478 iTestUtils->StartTestL(_L("OOM Testing of Parse Raw Bad Response Test Case HTTP-U-2253")); |
|
479 if( !iTestFailed ) |
|
480 { |
|
481 DoOOMTest(&CTestEngine::DoParseRawBadResponseTest7L); |
|
482 } |
|
483 iTestUtils->EndTest(iTestFailed); |
|
484 |
|
485 // Raw Bad Response - field containing "<sp>::!!" |
|
486 iTestUtils->StartTestL(_L("Parse Raw Bad Response Test Case HTTP-U-2254")); |
|
487 DoParseRawBadResponseTest8L(); |
|
488 iTestUtils->EndTest(iTestFailed); |
|
489 |
|
490 // Do OOM testing |
|
491 iTestUtils->StartTestL(_L("OOM Testing of Parse Raw Bad Response Test Case HTTP-U-2255")); |
|
492 if( !iTestFailed ) |
|
493 { |
|
494 DoOOMTest(&CTestEngine::DoParseRawBadResponseTest8L); |
|
495 } |
|
496 iTestUtils->EndTest(iTestFailed); |
|
497 |
|
498 // Raw Bad Response - field containing "<sp>: :!!" |
|
499 iTestUtils->StartTestL(_L("Parse Raw Bad Response Test Case HTTP-U-2256")); |
|
500 DoParseRawBadResponseTest9L(); |
|
501 iTestUtils->EndTest(iTestFailed); |
|
502 |
|
503 // Do OOM testing |
|
504 iTestUtils->StartTestL(_L("OOM Testing of Parse Raw Bad Response Test Case HTTP-U-2257")); |
|
505 if( !iTestFailed ) |
|
506 { |
|
507 DoOOMTest(&CTestEngine::DoParseRawBadResponseTest9L); |
|
508 } |
|
509 iTestUtils->EndTest(iTestFailed); |
|
510 |
|
511 } |
|
512 void CTestEngine::DoParseRawBadResponseTest1L() |
|
513 { |
|
514 // Simple message test case - field containing "<sp>:<sp>". |
|
515 |
|
516 // Reset test flags. |
|
517 iTestCount = 0; |
|
518 iTestFailed = EFalse; |
|
519 |
|
520 // Create the http message parser driver |
|
521 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
522 CleanupStack::PushL(messageParser); |
|
523 |
|
524 _LIT8(KMessageData, "HTTP/1.1 200 OK\r\nContent-Length: 6\r\n : \r\n\r\nhello!"); |
|
525 _LIT8(KStartLine, "HTTP/1.1 200 OK"); |
|
526 _LIT8(KHeaderName1, "Content-Length"); _LIT8(KHeaderValue1,"6 :"); |
|
527 _LIT8(KEntityBody, "hello!"); |
|
528 TBool isChunked = EFalse; |
|
529 |
|
530 messageParser->SetMessageData(KMessageData()); |
|
531 messageParser->SetStartLine(KStartLine()); |
|
532 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
533 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
534 |
|
535 messageParser->Start(KErrNone); |
|
536 |
|
537 CActiveScheduler::Start(); |
|
538 |
|
539 CleanupStack::PopAndDestroy(messageParser); |
|
540 |
|
541 } |
|
542 void CTestEngine::DoParseRawBadResponseTest2L() |
|
543 { |
|
544 // Simple message test case - field containing "<sp>:<sp>bytes". |
|
545 |
|
546 // Reset test flags. |
|
547 iTestCount = 0; |
|
548 iTestFailed = EFalse; |
|
549 |
|
550 // Create the http message parser driver |
|
551 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
552 CleanupStack::PushL(messageParser); |
|
553 |
|
554 _LIT8(KMessageData, "HTTP/1.1 200 OK\r\nContent-Length: 6\r\n : bytes\r\n\r\nhello!"); |
|
555 |
|
556 _LIT8(KStartLine, "HTTP/1.1 200 OK"); |
|
557 _LIT8(KHeaderName1, "Content-Length"); _LIT8(KHeaderValue1,"6 : bytes"); |
|
558 _LIT8(KEntityBody, "hello!"); |
|
559 TBool isChunked = EFalse; |
|
560 |
|
561 messageParser->SetMessageData(KMessageData()); |
|
562 messageParser->SetStartLine(KStartLine()); |
|
563 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
564 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
565 |
|
566 messageParser->Start(KErrNone); |
|
567 |
|
568 CActiveScheduler::Start(); |
|
569 |
|
570 CleanupStack::PopAndDestroy(messageParser); |
|
571 } |
|
572 void CTestEngine::DoParseRawBadResponseTest3L() |
|
573 { |
|
574 // Simple message test case - field containing "Accept-Ranges:<sp>". |
|
575 |
|
576 // Reset test flags. |
|
577 iTestCount = 0; |
|
578 iTestFailed = EFalse; |
|
579 |
|
580 // Create the http message parser driver |
|
581 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
582 CleanupStack::PushL(messageParser); |
|
583 |
|
584 _LIT8(KMessageData, "HTTP/1.1 200 OK\r\nContent-Length: 6\r\nAccept-Ranges: \r\n\r\nhello!"); |
|
585 |
|
586 _LIT8(KStartLine, "HTTP/1.1 200 OK"); |
|
587 _LIT8(KHeaderName1, "Content-Length"); _LIT8(KHeaderValue1,"6"); |
|
588 _LIT8(KHeaderName2, "Accept-Ranges"); _LIT8(KHeaderValue2, ""); |
|
589 _LIT8(KEntityBody, "hello!"); |
|
590 TBool isChunked = EFalse; |
|
591 |
|
592 messageParser->SetMessageData(KMessageData()); |
|
593 messageParser->SetStartLine(KStartLine()); |
|
594 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
595 messageParser->SetHeaderL(KHeaderName2(),KHeaderValue2()); |
|
596 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
597 |
|
598 messageParser->Start(KErrNone); |
|
599 |
|
600 CActiveScheduler::Start(); |
|
601 |
|
602 CleanupStack::PopAndDestroy(messageParser); |
|
603 } |
|
604 void CTestEngine::DoParseRawBadResponseTest4L() |
|
605 { |
|
606 // Simple message test case - field containing "<sp>:bytes". |
|
607 |
|
608 // Reset test flags. |
|
609 iTestCount = 0; |
|
610 iTestFailed = EFalse; |
|
611 |
|
612 // Create the http message parser driver |
|
613 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
614 CleanupStack::PushL(messageParser); |
|
615 |
|
616 _LIT8(KMessageData, "HTTP/1.1 200 OK\r\nContent-Length: 6\r\n :bytes\r\n\r\nhello!"); |
|
617 |
|
618 _LIT8(KStartLine, "HTTP/1.1 200 OK"); |
|
619 _LIT8(KHeaderName1, "Content-Length"); _LIT8(KHeaderValue1,"6 :bytes"); |
|
620 _LIT8(KEntityBody, "hello!"); |
|
621 TBool isChunked = EFalse; |
|
622 |
|
623 messageParser->SetMessageData(KMessageData()); |
|
624 messageParser->SetStartLine(KStartLine()); |
|
625 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
626 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
627 |
|
628 messageParser->Start(KErrNone); |
|
629 |
|
630 CActiveScheduler::Start(); |
|
631 |
|
632 CleanupStack::PopAndDestroy(messageParser); |
|
633 } |
|
634 void CTestEngine::DoParseRawBadResponseTest5L() |
|
635 { |
|
636 // Simple message test case - field containing "<sp>:". |
|
637 |
|
638 // Reset test flags. |
|
639 iTestCount = 0; |
|
640 iTestFailed = EFalse; |
|
641 |
|
642 // Create the http message parser driver |
|
643 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
644 CleanupStack::PushL(messageParser); |
|
645 |
|
646 _LIT8(KMessageData, "HTTP/1.1 200 OK\r\nContent-Length: 6\r\n :\r\n\r\nhello!"); |
|
647 |
|
648 _LIT8(KStartLine, "HTTP/1.1 200 OK"); |
|
649 _LIT8(KHeaderName1, "Content-Length"); _LIT8(KHeaderValue1,"6 :"); |
|
650 _LIT8(KEntityBody, "hello!"); |
|
651 TBool isChunked = EFalse; |
|
652 |
|
653 messageParser->SetMessageData(KMessageData()); |
|
654 messageParser->SetStartLine(KStartLine()); |
|
655 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
656 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
657 |
|
658 messageParser->Start(KErrNone); |
|
659 |
|
660 CActiveScheduler::Start(); |
|
661 |
|
662 CleanupStack::PopAndDestroy(messageParser); |
|
663 } |
|
664 void CTestEngine::DoParseRawBadResponseTest6L() |
|
665 { |
|
666 // Simple message test case - field containing "Accept-Ranges:". |
|
667 |
|
668 // Reset test flags. |
|
669 iTestCount = 0; |
|
670 iTestFailed = EFalse; |
|
671 |
|
672 // Create the http message parser driver |
|
673 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
674 CleanupStack::PushL(messageParser); |
|
675 |
|
676 _LIT8(KMessageData, "HTTP/1.1 200 OK\r\nContent-Length: 6\r\nAccept-Ranges:\r\n\r\nhello!"); |
|
677 |
|
678 _LIT8(KStartLine, "HTTP/1.1 200 OK"); |
|
679 _LIT8(KHeaderName1, "Content-Length"); _LIT8(KHeaderValue1,"6"); |
|
680 _LIT8(KHeaderName2, "Accept-Ranges"); _LIT8(KHeaderValue2, ""); |
|
681 _LIT8(KEntityBody, "hello!"); |
|
682 TBool isChunked = EFalse; |
|
683 |
|
684 messageParser->SetMessageData(KMessageData()); |
|
685 messageParser->SetStartLine(KStartLine()); |
|
686 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
687 messageParser->SetHeaderL(KHeaderName2(),KHeaderValue2()); |
|
688 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
689 |
|
690 messageParser->Start(KErrNone); |
|
691 |
|
692 CActiveScheduler::Start(); |
|
693 |
|
694 CleanupStack::PopAndDestroy(messageParser); |
|
695 } |
|
696 void CTestEngine::DoParseRawBadResponseTest7L() |
|
697 { |
|
698 // Simple message test case - field containing "<sp>::". |
|
699 |
|
700 // Reset test flags. |
|
701 iTestCount = 0; |
|
702 iTestFailed = EFalse; |
|
703 |
|
704 // Create the http message parser driver |
|
705 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
706 CleanupStack::PushL(messageParser); |
|
707 |
|
708 _LIT8(KMessageData, "HTTP/1.1 200 OK\r\nContent-Length: 6\r\n ::\r\n\r\nhello!"); |
|
709 |
|
710 _LIT8(KStartLine, "HTTP/1.1 200 OK"); |
|
711 _LIT8(KHeaderName1, "Content-Length"); _LIT8(KHeaderValue1,"6 ::"); |
|
712 _LIT8(KEntityBody, "hello!"); |
|
713 TBool isChunked = EFalse; |
|
714 |
|
715 messageParser->SetMessageData(KMessageData()); |
|
716 messageParser->SetStartLine(KStartLine()); |
|
717 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
718 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
719 |
|
720 messageParser->Start(KErrNone); |
|
721 |
|
722 CActiveScheduler::Start(); |
|
723 |
|
724 CleanupStack::PopAndDestroy(messageParser); |
|
725 } |
|
726 void CTestEngine::DoParseRawBadResponseTest8L() |
|
727 { |
|
728 // Simple message test case - field containing "<sp>::!!". |
|
729 |
|
730 // Reset test flags. |
|
731 iTestCount = 0; |
|
732 iTestFailed = EFalse; |
|
733 |
|
734 // Create the http message parser driver |
|
735 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
736 CleanupStack::PushL(messageParser); |
|
737 |
|
738 _LIT8(KMessageData, "HTTP/1.1 200 OK\r\nContent-Length: 6\r\n ::!!\r\n\r\nhello!"); |
|
739 |
|
740 _LIT8(KStartLine, "HTTP/1.1 200 OK"); |
|
741 _LIT8(KHeaderName1, "Content-Length"); _LIT8(KHeaderValue1,"6 ::!!"); |
|
742 _LIT8(KEntityBody, "hello!"); |
|
743 TBool isChunked = EFalse; |
|
744 |
|
745 messageParser->SetMessageData(KMessageData()); |
|
746 messageParser->SetStartLine(KStartLine()); |
|
747 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
748 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
749 |
|
750 messageParser->Start(KErrNone); |
|
751 |
|
752 CActiveScheduler::Start(); |
|
753 |
|
754 CleanupStack::PopAndDestroy(messageParser); |
|
755 } |
|
756 |
|
757 void CTestEngine::DoParseRawBadResponseTest9L() |
|
758 { |
|
759 // Simple message test case - field containing "<sp>: :!!". |
|
760 |
|
761 // Reset test flags. |
|
762 iTestCount = 0; |
|
763 iTestFailed = EFalse; |
|
764 |
|
765 // Create the http message parser driver |
|
766 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
767 CleanupStack::PushL(messageParser); |
|
768 |
|
769 _LIT8(KMessageData, "HTTP/1.1 200 OK\r\nContent-Length: 6\r\n : :!!\r\n\r\nhello!"); |
|
770 |
|
771 _LIT8(KStartLine, "HTTP/1.1 200 OK"); |
|
772 _LIT8(KHeaderName1, "Content-Length"); _LIT8(KHeaderValue1,"6 : :!!"); |
|
773 _LIT8(KEntityBody, "hello!"); |
|
774 TBool isChunked = EFalse; |
|
775 |
|
776 messageParser->SetMessageData(KMessageData()); |
|
777 messageParser->SetStartLine(KStartLine()); |
|
778 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
779 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
780 |
|
781 messageParser->Start(KErrNone); |
|
782 |
|
783 CActiveScheduler::Start(); |
|
784 |
|
785 CleanupStack::PopAndDestroy(messageParser); |
|
786 } |
|
787 |
|
788 |
|
789 void CTestEngine::DoParseSimpleMessageL() |
|
790 { |
|
791 // Simple message test case - just a start-line. no headers or entity body. |
|
792 |
|
793 // Reset test flags. |
|
794 iTestCount = 0; |
|
795 iTestFailed = EFalse; |
|
796 |
|
797 // Create the http message parser driver |
|
798 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
799 CleanupStack::PushL(messageParser); |
|
800 |
|
801 _LIT8(KMessageData, "HTTP/1.1 100 Continue\r\n\r\n"); |
|
802 _LIT8(KStartLine, "HTTP/1.1 100 Continue"); |
|
803 _LIT8(KEntityBody, ""); |
|
804 TBool isChunked = EFalse; |
|
805 |
|
806 messageParser->SetMessageData(KMessageData()); |
|
807 messageParser->SetStartLine(KStartLine()); |
|
808 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
809 messageParser->Start(KErrNone); |
|
810 |
|
811 CActiveScheduler::Start(); |
|
812 |
|
813 CleanupStack::PopAndDestroy(messageParser); |
|
814 } |
|
815 |
|
816 void CTestEngine::DoParseNoEntityBodyL() |
|
817 { |
|
818 // Message with no entity body - just headers. |
|
819 |
|
820 // Reset test flags. |
|
821 iTestCount = 0; |
|
822 iTestFailed = EFalse; |
|
823 |
|
824 // Create the http message parser driver |
|
825 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
826 CleanupStack::PushL(messageParser); |
|
827 |
|
828 _LIT8(KMessageData, "HTTP/1.1 204 No Content\r\nX-Wap-Push-Status: 400 Accepted\r\n\r\n"); |
|
829 _LIT8(KStartLine, "HTTP/1.1 204 No Content"); |
|
830 _LIT8(KHeaderName1, "X-Wap-Push-Status"); _LIT8(KHeaderValue1, "400 Accepted"); |
|
831 _LIT8(KEntityBody, ""); |
|
832 TBool isChunked = EFalse; |
|
833 |
|
834 messageParser->SetMessageData(KMessageData()); |
|
835 messageParser->SetStartLine(KStartLine()); |
|
836 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
837 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
838 |
|
839 messageParser->Start(KErrNone); |
|
840 |
|
841 CActiveScheduler::Start(); |
|
842 |
|
843 CleanupStack::PopAndDestroy(messageParser); |
|
844 } |
|
845 |
|
846 void CTestEngine::DoParseNonEncodedBodyL() |
|
847 { |
|
848 // Message with headers and non-encoded entity body. |
|
849 |
|
850 // Reset test flags. |
|
851 iTestCount = 0; |
|
852 iTestFailed = EFalse; |
|
853 |
|
854 // Create the http message parser driver |
|
855 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
856 CleanupStack::PushL(messageParser); |
|
857 |
|
858 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nContent-Length: 35\r\nServer: CERN/3.0\r\n libwww/2.17\r\n\r\nThis is the data that is being sent"); |
|
859 _LIT8(KStartLine, "HTTP/1.1 200 Ok"); |
|
860 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
861 _LIT8(KHeaderName2, "Content-Length"); _LIT8(KHeaderValue2, "35"); |
|
862 _LIT8(KHeaderName3, "Server"); _LIT8(KHeaderValue3, "CERN/3.0 libwww/2.17"); |
|
863 _LIT8(KEntityBody, "This is the data that is being sent"); |
|
864 TBool isChunked = EFalse; |
|
865 |
|
866 messageParser->SetMessageData(KMessageData()); |
|
867 messageParser->SetStartLine(KStartLine()); |
|
868 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
869 messageParser->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
870 messageParser->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
871 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
872 |
|
873 messageParser->Start(KErrNone); |
|
874 |
|
875 CActiveScheduler::Start(); |
|
876 |
|
877 CleanupStack::PopAndDestroy(messageParser); |
|
878 } |
|
879 |
|
880 void CTestEngine::DoParseChunkEncodedBodyL() |
|
881 { |
|
882 // Message with headers and chunk-encoded entity body. |
|
883 |
|
884 // Reset test flags. |
|
885 iTestCount = 0; |
|
886 iTestFailed = EFalse; |
|
887 |
|
888 // Create the http message parser driver |
|
889 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
890 CleanupStack::PushL(messageParser); |
|
891 |
|
892 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nTransfer-Encoding: chunked\r\nServer: CERN/3.0\r\n\tlibwww/2.17\r\n\r\n4 \r\nThis\r\n0a\r\n is the da\r\n15 ; myextension = \"ten\"\r\nta that is being sent\r\n000\r\n\r\n"); |
|
893 _LIT8(KStartLine, "HTTP/1.1 200 Ok"); |
|
894 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
895 _LIT8(KHeaderName2, "Transfer-Encoding"); _LIT8(KHeaderValue2, "chunked"); |
|
896 _LIT8(KHeaderName3, "Server"); _LIT8(KHeaderValue3, "CERN/3.0\tlibwww/2.17"); |
|
897 _LIT8(KEntityBody, "This is the data that is being sent"); |
|
898 TBool isChunked = ETrue; |
|
899 |
|
900 messageParser->SetMessageData(KMessageData()); |
|
901 messageParser->SetStartLine(KStartLine()); |
|
902 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
903 messageParser->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
904 messageParser->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
905 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
906 |
|
907 messageParser->Start(KErrNone); |
|
908 |
|
909 CActiveScheduler::Start(); |
|
910 |
|
911 CleanupStack::PopAndDestroy(messageParser); |
|
912 } |
|
913 |
|
914 void CTestEngine::DoParseChunkEncodedBodyWithTrailersL() |
|
915 { |
|
916 // Message with headers, chunk-encoded entity body and trailers. |
|
917 |
|
918 // Reset test flags. |
|
919 iTestCount = 0; |
|
920 iTestFailed = EFalse; |
|
921 |
|
922 // Create the http message parser driver |
|
923 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
924 CleanupStack::PushL(messageParser); |
|
925 |
|
926 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nTransfer-Encoding: chunked\r\nTrailer: Server, ETag\r\n\r\n4 \r\nThis\r\n0a\r\n is the da\r\n15 ; myextension = \"ten\"\r\nta that is being sent\r\n 0 \r\nServer: CERN/3.0\r\n libwww/2.17\r\nETag: \"dave\"\r\n\r\n"); |
|
927 _LIT8(KStartLine, "HTTP/1.1 200 Ok"); |
|
928 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
929 _LIT8(KHeaderName2, "Transfer-Encoding"); _LIT8(KHeaderValue2, "chunked"); |
|
930 _LIT8(KHeaderName3, "Trailer"); _LIT8(KHeaderValue3, "Server, ETag"); |
|
931 _LIT8(KEntityBody, "This is the data that is being sent"); |
|
932 TBool isChunked = ETrue; |
|
933 _LIT8(KTrailerName1,"Server"); _LIT8(KTrailerValue1, "CERN/3.0 libwww/2.17"); |
|
934 _LIT8(KTrailerName2,"ETag"); _LIT8(KTrailerValue2, "\"dave\""); |
|
935 |
|
936 messageParser->SetMessageData(KMessageData()); |
|
937 messageParser->SetStartLine(KStartLine()); |
|
938 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
939 messageParser->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
940 messageParser->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
941 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
942 messageParser->SetTrailerL(KTrailerName1(), KTrailerValue1()); |
|
943 messageParser->SetTrailerL(KTrailerName2(), KTrailerValue2()); |
|
944 |
|
945 messageParser->Start(KErrNone); |
|
946 |
|
947 CActiveScheduler::Start(); |
|
948 |
|
949 CleanupStack::PopAndDestroy(messageParser); |
|
950 } |
|
951 |
|
952 void CTestEngine::DoParseBadLineL() |
|
953 { |
|
954 // Message with a bad header line - malformed CRLF; missing LF |
|
955 |
|
956 // Reset test flags. |
|
957 iTestCount = 0; |
|
958 iTestFailed = EFalse; |
|
959 |
|
960 // Create the http message parser driver |
|
961 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
962 CleanupStack::PushL(messageParser); |
|
963 |
|
964 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\rContent-Length: 35\r\nServer: CERN/3.0\r\n libwww/2.17\r\n\r\nThis is the data that is being sent"); |
|
965 _LIT8(KStartLine, "HTTP/1.1 200 Ok"); |
|
966 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plainContent-Length: 35"); |
|
967 _LIT8(KHeaderName2, "Server"); _LIT8(KHeaderValue2, "CERN/3.0 libwww/2.17"); |
|
968 _LIT8(KEntityBody, "This is the data that is being sent"); |
|
969 TBool isChunked = EFalse; |
|
970 |
|
971 messageParser->SetMessageData(KMessageData()); |
|
972 messageParser->SetStartLine(KStartLine()); |
|
973 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
974 messageParser->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
975 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
976 |
|
977 messageParser->Start(KErrNone); |
|
978 |
|
979 CActiveScheduler::Start(); |
|
980 |
|
981 CleanupStack::PopAndDestroy(messageParser); |
|
982 } |
|
983 |
|
984 void CTestEngine::DoParseBadEmptyLineL() |
|
985 { |
|
986 // Message with a bad empty line - malformed CRLF; missing LF |
|
987 |
|
988 // Create the http message parser driver |
|
989 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
990 CleanupStack::PushL(messageParser); |
|
991 |
|
992 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nTransfer-Encoding: chunked\r\nServer: CERN/3.0\r\n\tlibwww/2.17\r\n\r4 \r\nThis\r\n0a\r\n is the da\r\n15 ; myextension = \"ten\"\r\nta that is being sent\r\n000\r\n\r\n"); |
|
993 _LIT8(KStartLine, "HTTP/1.1 200 Ok"); |
|
994 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
995 _LIT8(KHeaderName2, "Transfer-Encoding"); _LIT8(KHeaderValue2, "chunked"); |
|
996 _LIT8(KHeaderName3, "Server"); _LIT8(KHeaderValue3, "CERN/3.0\tlibwww/2.17"); |
|
997 _LIT8(KEntityBody, ""); |
|
998 TBool isChunked = ETrue; |
|
999 |
|
1000 messageParser->SetMessageData(KMessageData()); |
|
1001 messageParser->SetStartLine(KStartLine()); |
|
1002 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1003 messageParser->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
1004 messageParser->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
1005 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
1006 |
|
1007 messageParser->Start(KErrNone); |
|
1008 |
|
1009 CActiveScheduler::Start(); |
|
1010 |
|
1011 CleanupStack::PopAndDestroy(messageParser); |
|
1012 } |
|
1013 |
|
1014 void CTestEngine::DoParseBadHeaderContinuationL() |
|
1015 { |
|
1016 // Message with bad header - malformed header continuation; missing space/tab. |
|
1017 |
|
1018 // Reset test flags. |
|
1019 iTestCount = 0; |
|
1020 iTestFailed = EFalse; |
|
1021 |
|
1022 // Create the http message parser driver |
|
1023 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
1024 CleanupStack::PushL(messageParser); |
|
1025 |
|
1026 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nContent-Length: 35\r\nServer: CERN/3.0\r\nlibwww/2.17\r\n\r\nThis is the data that is being sent"); |
|
1027 _LIT8(KStartLine, "HTTP/1.1 200 Ok"); |
|
1028 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
1029 _LIT8(KHeaderName2, "Content-Length"); _LIT8(KHeaderValue2, "35"); |
|
1030 _LIT8(KHeaderName3, "Server"); _LIT8(KHeaderValue3, "CERN/3.0"); |
|
1031 _LIT8(KEntityBody, "This is the data that is being sent"); |
|
1032 TBool isChunked = EFalse; |
|
1033 |
|
1034 messageParser->SetMessageData(KMessageData()); |
|
1035 messageParser->SetStartLine(KStartLine()); |
|
1036 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1037 messageParser->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
1038 messageParser->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
1039 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
1040 |
|
1041 messageParser->Start(KErrNone); |
|
1042 |
|
1043 CActiveScheduler::Start(); |
|
1044 |
|
1045 CleanupStack::PopAndDestroy(messageParser); |
|
1046 } |
|
1047 |
|
1048 void CTestEngine::DoParseBadChunkDataL() |
|
1049 { |
|
1050 // Chunked message with error in chunk-data - too much data. |
|
1051 |
|
1052 // Reset test flags. |
|
1053 iTestCount = 0; |
|
1054 iTestFailed = EFalse; |
|
1055 |
|
1056 // Create the http message parser driver |
|
1057 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
1058 CleanupStack::PushL(messageParser); |
|
1059 |
|
1060 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nTransfer-Encoding: chunked\r\nServer: CERN/3.0\r\n\tlibwww/2.17\r\n\r\n4 \r\nThis\r\n0a\r\n is the da\r\n12 ; myextension = \"ten\"\r\nta that is being sent\r\n000\r\n\r\n"); |
|
1061 _LIT8(KStartLine, "HTTP/1.1 200 Ok"); |
|
1062 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
1063 _LIT8(KHeaderName2, "Transfer-Encoding"); _LIT8(KHeaderValue2, "chunked"); |
|
1064 _LIT8(KHeaderName3, "Server"); _LIT8(KHeaderValue3, "CERN/3.0\tlibwww/2.17"); |
|
1065 //_LIT8(KEntityBody, "This is the data that is being sent"); |
|
1066 _LIT8(KEntityBody, "This is the data that is being s"); |
|
1067 TBool isChunked = ETrue; |
|
1068 |
|
1069 messageParser->SetMessageData(KMessageData()); |
|
1070 messageParser->SetStartLine(KStartLine()); |
|
1071 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1072 messageParser->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
1073 messageParser->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
1074 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
1075 |
|
1076 messageParser->Start(KErrCorrupt); |
|
1077 |
|
1078 CActiveScheduler::Start(); |
|
1079 |
|
1080 CleanupStack::PopAndDestroy(messageParser); |
|
1081 } |
|
1082 |
|
1083 void CTestEngine::DoParseBadChunkExtensionL() |
|
1084 { |
|
1085 // Chunked message with error in chunk-size - bad chunk-extension |
|
1086 |
|
1087 // Reset test flags. |
|
1088 iTestCount = 0; |
|
1089 iTestFailed = EFalse; |
|
1090 |
|
1091 // Create the http message parser driver |
|
1092 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
1093 CleanupStack::PushL(messageParser); |
|
1094 |
|
1095 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nTransfer-Encoding: chunked\r\nServer: CERN/3.0\r\n libwww/2.17\r\n\r\n4 \r\nThis\r\n0a\r\n is the da\r\n15 myextension = \"ten\"\r\nta that is being sent\r\n000\r\n\r\n"); |
|
1096 _LIT8(KStartLine, "HTTP/1.1 200 Ok"); |
|
1097 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
1098 _LIT8(KHeaderName2, "Transfer-Encoding"); _LIT8(KHeaderValue2, "chunked"); |
|
1099 _LIT8(KHeaderName3, "Server"); _LIT8(KHeaderValue3, "CERN/3.0 libwww/2.17"); |
|
1100 _LIT8(KEntityBody, "This is the data that is being sent"); |
|
1101 TBool isChunked = ETrue; |
|
1102 |
|
1103 messageParser->SetMessageData(KMessageData()); |
|
1104 messageParser->SetStartLine(KStartLine()); |
|
1105 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1106 messageParser->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
1107 messageParser->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
1108 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
1109 |
|
1110 messageParser->Start(KErrNone); |
|
1111 |
|
1112 CActiveScheduler::Start(); |
|
1113 |
|
1114 CleanupStack::PopAndDestroy(messageParser); |
|
1115 } |
|
1116 |
|
1117 void CTestEngine::DoParseBadChunkSizeL() |
|
1118 { |
|
1119 // Chunked message with errors in the chunk-size - an empty line where a |
|
1120 // chunk-size should be (ignored) followed by the chunk-data, treated as a |
|
1121 // chunk-size and ignoring the error (can't convert to numeric value) |
|
1122 |
|
1123 // Reset test flags. |
|
1124 iTestCount = 0; |
|
1125 iTestFailed = EFalse; |
|
1126 |
|
1127 // Create the http message parser driver |
|
1128 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
1129 CleanupStack::PushL(messageParser); |
|
1130 |
|
1131 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nTransfer-Encoding: chunked\r\nServer: CERN/3.0\r\n libwww/2.17\r\n\r\n4 \r\nThis\r\n\r\n is the da\r\n15 ;myextension = \"ten\"\r\nta that is being sent\r\n000\r\n\r\n"); |
|
1132 _LIT8(KStartLine, "HTTP/1.1 200 Ok"); |
|
1133 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
1134 _LIT8(KHeaderName2, "Transfer-Encoding"); _LIT8(KHeaderValue2, "chunked"); |
|
1135 _LIT8(KHeaderName3, "Server"); _LIT8(KHeaderValue3, "CERN/3.0 libwww/2.17"); |
|
1136 _LIT8(KEntityBody, "This"); |
|
1137 TBool isChunked = ETrue; |
|
1138 |
|
1139 messageParser->SetMessageData(KMessageData()); |
|
1140 messageParser->SetStartLine(KStartLine()); |
|
1141 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1142 messageParser->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
1143 messageParser->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
1144 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
1145 |
|
1146 messageParser->Start(KErrNone); |
|
1147 |
|
1148 CActiveScheduler::Start(); |
|
1149 |
|
1150 CleanupStack::PopAndDestroy(messageParser); |
|
1151 } |
|
1152 |
|
1153 void CTestEngine::DoParseMissingCRsL() |
|
1154 { |
|
1155 // Message with headers, chunk-encoded entity body and trailers. |
|
1156 // NOTE - CRs are missing from line terminators |
|
1157 |
|
1158 // Reset test flags. |
|
1159 iTestCount = 0; |
|
1160 iTestFailed = EFalse; |
|
1161 |
|
1162 // Create the http message parser driver |
|
1163 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
1164 CleanupStack::PushL(messageParser); |
|
1165 |
|
1166 _LIT8(KMessageData, "HTTP/1.1 200 Ok\nContent-Type: text/plain\nTransfer-Encoding: chunked\nTrailer: Server, ETag\n\n4 \nThis\n0a\n is the da\n15 ; myextension = \"ten\"\nta that is being sent\n 0 \nServer: CERN/3.0\n libwww/2.17\nETag: \"dave\"\n\n"); |
|
1167 _LIT8(KStartLine, "HTTP/1.1 200 Ok"); |
|
1168 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
1169 _LIT8(KHeaderName2, "Transfer-Encoding"); _LIT8(KHeaderValue2, "chunked"); |
|
1170 _LIT8(KHeaderName3, "Trailer"); _LIT8(KHeaderValue3, "Server, ETag"); |
|
1171 _LIT8(KEntityBody, "This is the data that is being sent"); |
|
1172 TBool isChunked = ETrue; |
|
1173 _LIT8(KTrailerName1,"Server"); _LIT8(KTrailerValue1, "CERN/3.0 libwww/2.17"); |
|
1174 _LIT8(KTrailerName2,"ETag"); _LIT8(KTrailerValue2, "\"dave\""); |
|
1175 |
|
1176 messageParser->SetMessageData(KMessageData()); |
|
1177 messageParser->SetStartLine(KStartLine()); |
|
1178 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1179 messageParser->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
1180 messageParser->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
1181 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
1182 messageParser->SetTrailerL(KTrailerName1(), KTrailerValue1()); |
|
1183 messageParser->SetTrailerL(KTrailerName2(), KTrailerValue2()); |
|
1184 |
|
1185 messageParser->Start(KErrNone); |
|
1186 |
|
1187 CActiveScheduler::Start(); |
|
1188 |
|
1189 CleanupStack::PopAndDestroy(messageParser); |
|
1190 } |
|
1191 |
|
1192 void CTestEngine::DoParseSpuriousCRsL() |
|
1193 { |
|
1194 // Message with headers, chunk-encoded entity body and trailers. |
|
1195 // NOTE - there are spurious CRs throughout the message that should be ignored. |
|
1196 |
|
1197 // Reset test flags. |
|
1198 iTestCount = 0; |
|
1199 iTestFailed = EFalse; |
|
1200 |
|
1201 // Create the http message parser driver |
|
1202 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
1203 CleanupStack::PushL(messageParser); |
|
1204 |
|
1205 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\r\r\r\r\nContent\r-Type:\rtext/plain\r\nTransfer-Encoding\r:\r \rchunked\r\r\r\n\rTrailer: Server,\rETag\r\n\r\r\r\r\n\r\r4\r\nThis\n0a\r\n is the da\r\n15 ; myextension = \"ten\"\r\nta that is being sent\r\n0\r\nServer: CERN/3.0\r\n\r libwww/2.17\r\nETag:\r \"d\rave\"\r\n\r\r\n"); |
|
1206 _LIT8(KStartLine, "HTTP/1.1 200 Ok"); |
|
1207 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
1208 _LIT8(KHeaderName2, "Transfer-Encoding"); _LIT8(KHeaderValue2, "chunked"); |
|
1209 _LIT8(KHeaderName3, "Trailer"); _LIT8(KHeaderValue3, "Server,ETag"); |
|
1210 _LIT8(KEntityBody, "This is the data that is being sent"); |
|
1211 TBool isChunked = ETrue; |
|
1212 _LIT8(KTrailerName1,"Server"); _LIT8(KTrailerValue1, "CERN/3.0 libwww/2.17"); |
|
1213 _LIT8(KTrailerName2,"ETag"); _LIT8(KTrailerValue2, "\"dave\""); |
|
1214 |
|
1215 messageParser->SetMessageData(KMessageData()); |
|
1216 messageParser->SetStartLine(KStartLine()); |
|
1217 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1218 messageParser->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
1219 messageParser->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
1220 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
1221 messageParser->SetTrailerL(KTrailerName1(), KTrailerValue1()); |
|
1222 messageParser->SetTrailerL(KTrailerName2(), KTrailerValue2()); |
|
1223 |
|
1224 messageParser->Start(KErrNone); |
|
1225 |
|
1226 CActiveScheduler::Start(); |
|
1227 |
|
1228 CleanupStack::PopAndDestroy(messageParser); |
|
1229 } |
|
1230 |
|
1231 void CTestEngine::DoParseLongHeaderL() |
|
1232 { |
|
1233 // Message with no entity body - just headers. |
|
1234 // Header is very long - should excercise the realloc functionality |
|
1235 |
|
1236 // Reset test flags. |
|
1237 iTestCount = 0; |
|
1238 iTestFailed = EFalse; |
|
1239 |
|
1240 // Create the http message parser driver |
|
1241 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
1242 CleanupStack::PushL(messageParser); |
|
1243 |
|
1244 _LIT8(KMessageData, "HTTP/1.1 204 No Content\r\nLong-Header: AVeryLongHeaderIndeedFullOfRubbishAndNotReallyHavingAnyMeaningAtAllInFactItJustNeedToBeOver128BytesInLengthAndThatIsReallyItOkJustALIttlMoreAndThatIsAll\r\n\r\n"); |
|
1245 _LIT8(KStartLine, "HTTP/1.1 204 No Content"); |
|
1246 _LIT8(KHeaderName1, "Long-Header"); _LIT8(KHeaderValue1, "AVeryLongHeaderIndeedFullOfRubbishAndNotReallyHavingAnyMeaningAtAllInFactItJustNeedToBeOver128BytesInLengthAndThatIsReallyItOkJustALIttlMoreAndThatIsAll"); |
|
1247 _LIT8(KEntityBody, ""); |
|
1248 TBool isChunked = EFalse; |
|
1249 |
|
1250 messageParser->SetMessageData(KMessageData()); |
|
1251 messageParser->SetStartLine(KStartLine()); |
|
1252 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1253 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
1254 |
|
1255 messageParser->Start(KErrNone); |
|
1256 |
|
1257 CActiveScheduler::Start(); |
|
1258 |
|
1259 CleanupStack::PopAndDestroy(messageParser); |
|
1260 } |
|
1261 |
|
1262 void CTestEngine::DoParseLeadingEmptyLineL() |
|
1263 { |
|
1264 // Simple message test case - just a start-line. no headers or entity body. |
|
1265 // There is a leading empty lines that should just be ignored. |
|
1266 |
|
1267 // Reset test flags. |
|
1268 iTestCount = 0; |
|
1269 iTestFailed = EFalse; |
|
1270 |
|
1271 // Create the http message parser driver |
|
1272 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
1273 CleanupStack::PushL(messageParser); |
|
1274 |
|
1275 _LIT8(KMessageData, "\r\n\r\nHTTP/1.1 100 Continue\r\n\r\n"); |
|
1276 _LIT8(KStartLine, "HTTP/1.1 100 Continue"); |
|
1277 _LIT8(KEntityBody, ""); |
|
1278 TBool isChunked = EFalse; |
|
1279 |
|
1280 messageParser->SetMessageData(KMessageData()); |
|
1281 messageParser->SetStartLine(KStartLine()); |
|
1282 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
1283 |
|
1284 messageParser->Start(KErrNone); |
|
1285 |
|
1286 CActiveScheduler::Start(); |
|
1287 |
|
1288 CleanupStack::PopAndDestroy(messageParser); |
|
1289 } |
|
1290 |
|
1291 void CTestEngine::DoParseNonChunkedResetL() |
|
1292 { |
|
1293 // Message with headers and non-encoded entity body. |
|
1294 |
|
1295 // Reset test flags. |
|
1296 iTestCount = 0; |
|
1297 iTestFailed = EFalse; |
|
1298 |
|
1299 // Create the http message parser driver |
|
1300 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
1301 CleanupStack::PushL(messageParser); |
|
1302 |
|
1303 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nContent-Length: 35\r\nServer: CERN/3.0\r\n libwww/2.17\r\n\r\nThis is the data that is being sent"); |
|
1304 _LIT8(KStartLine, "HTTP/1.1 200 Ok"); |
|
1305 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
1306 _LIT8(KHeaderName2, "Content-Length"); _LIT8(KHeaderValue2, "35"); |
|
1307 _LIT8(KHeaderName3, "Server"); _LIT8(KHeaderValue3, "CERN/3.0 libwww/2.17"); |
|
1308 _LIT8(KEntityBody, "This is the data that is being sent"); |
|
1309 TBool isChunked = EFalse; |
|
1310 |
|
1311 messageParser->SetMessageData(KMessageData()); |
|
1312 messageParser->SetStartLine(KStartLine()); |
|
1313 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1314 messageParser->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
1315 messageParser->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
1316 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
1317 |
|
1318 messageParser->Start(KErrNone, ETrue); |
|
1319 |
|
1320 CActiveScheduler::Start(); |
|
1321 |
|
1322 CleanupStack::PopAndDestroy(messageParser); |
|
1323 } |
|
1324 |
|
1325 void CTestEngine::DoParseChunkedResetL() |
|
1326 { |
|
1327 // Message with headers, chunk-encoded entity body and trailers. |
|
1328 |
|
1329 // Reset test flags. |
|
1330 iTestCount = 0; |
|
1331 iTestFailed = EFalse; |
|
1332 |
|
1333 // Create the http message parser driver |
|
1334 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
1335 CleanupStack::PushL(messageParser); |
|
1336 |
|
1337 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nTransfer-Encoding: chunked\r\nTrailer: Server, ETag\r\n\r\n4 \r\nThis\r\n0a\r\n is the da\r\n15 ; myextension = \"ten\"\r\nta that is being sent\r\n 0 \r\nServer: CERN/3.0\r\n libwww/2.17\r\nETag: \"dave\"\r\n\r\n"); |
|
1338 _LIT8(KStartLine, "HTTP/1.1 200 Ok"); |
|
1339 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
1340 _LIT8(KHeaderName2, "Transfer-Encoding"); _LIT8(KHeaderValue2, "chunked"); |
|
1341 _LIT8(KHeaderName3, "Trailer"); _LIT8(KHeaderValue3, "Server, ETag"); |
|
1342 _LIT8(KEntityBody, "This is the data that is being sent"); |
|
1343 TBool isChunked = ETrue; |
|
1344 _LIT8(KTrailerName1,"Server"); _LIT8(KTrailerValue1, "CERN/3.0 libwww/2.17"); |
|
1345 _LIT8(KTrailerName2,"ETag"); _LIT8(KTrailerValue2, "\"dave\""); |
|
1346 |
|
1347 messageParser->SetMessageData(KMessageData()); |
|
1348 messageParser->SetStartLine(KStartLine()); |
|
1349 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1350 messageParser->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
1351 messageParser->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
1352 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
1353 messageParser->SetTrailerL(KTrailerName1(), KTrailerValue1()); |
|
1354 messageParser->SetTrailerL(KTrailerName2(), KTrailerValue2()); |
|
1355 |
|
1356 messageParser->Start(KErrNone, ETrue); |
|
1357 |
|
1358 CActiveScheduler::Start(); |
|
1359 |
|
1360 CleanupStack::PopAndDestroy(messageParser); |
|
1361 } |
|
1362 |
|
1363 void CTestEngine::DoParseChunkDataContainingOnlyCRsL() |
|
1364 { |
|
1365 // Message with headers and chunk-encoded entity body. |
|
1366 // Message body has chunks containing only CRs |
|
1367 |
|
1368 // Reset test flags. |
|
1369 iTestCount = 0; |
|
1370 iTestFailed = EFalse; |
|
1371 |
|
1372 // Create the http message parser driver |
|
1373 CMessageParserDriver* messageParser = CMessageParserDriver::NewL(*this); |
|
1374 CleanupStack::PushL(messageParser); |
|
1375 |
|
1376 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nTransfer-Encoding: chunked\r\nServer: CERN/3.0\r\n\tlibwww/2.17\r\n\r\n4 \r\nThis\r\n0a\r\n is the da\r\n0d ; myextension = \"ten\"\r\nta that is be\r\n1\r\n\r\r\n5\r\ning s\r\n2\r\n\r\r\r\n3\r\nent\r\n000\r\n\r\n"); |
|
1377 _LIT8(KStartLine, "HTTP/1.1 200 Ok"); |
|
1378 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
1379 _LIT8(KHeaderName2, "Transfer-Encoding"); _LIT8(KHeaderValue2, "chunked"); |
|
1380 _LIT8(KHeaderName3, "Server"); _LIT8(KHeaderValue3, "CERN/3.0\tlibwww/2.17"); |
|
1381 _LIT8(KEntityBody, "This is the data that is be\ring s\r\rent"); |
|
1382 TBool isChunked = ETrue; |
|
1383 |
|
1384 messageParser->SetMessageData(KMessageData()); |
|
1385 messageParser->SetStartLine(KStartLine()); |
|
1386 messageParser->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1387 messageParser->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
1388 messageParser->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
1389 messageParser->SetBodyData(KEntityBody(), isChunked, iUseUnknownBodyLength); |
|
1390 |
|
1391 messageParser->Start(KErrNone); |
|
1392 |
|
1393 CActiveScheduler::Start(); |
|
1394 |
|
1395 CleanupStack::PopAndDestroy(messageParser); |
|
1396 } |
|
1397 |
|
1398 void CTestEngine::DoComposeSimpleMessageL() |
|
1399 { |
|
1400 // Reset test flags. |
|
1401 iTestCount = 0; |
|
1402 iTestFailed = EFalse; |
|
1403 |
|
1404 _LIT8(KMessageData, "HTTP/1.1 100 Continue\r\n\r\n"); |
|
1405 _LIT8(KStartLine1, "HTTP/1.1"); |
|
1406 _LIT8(KStartLine2, "100"); |
|
1407 _LIT8(KStartLine3, "Continue"); |
|
1408 |
|
1409 // Create the http message parser driver |
|
1410 CMessageComposerDriver* messageComposer = CMessageComposerDriver::NewL(*this); |
|
1411 CleanupStack::PushL(messageComposer); |
|
1412 |
|
1413 // Set the message data... |
|
1414 messageComposer->SetMessageData(KMessageData()); |
|
1415 |
|
1416 // Set the start-line |
|
1417 messageComposer->SetStartLine(KStartLine1(), KStartLine2(), KStartLine3()); |
|
1418 |
|
1419 // Start the composer... |
|
1420 messageComposer->Start(KErrNone); |
|
1421 |
|
1422 CActiveScheduler::Start(); |
|
1423 |
|
1424 CleanupStack::PopAndDestroy(messageComposer); |
|
1425 } |
|
1426 |
|
1427 void CTestEngine::DoComposeNoEntityBodyL() |
|
1428 { |
|
1429 // Reset test flags. |
|
1430 iTestCount = 0; |
|
1431 iTestFailed = EFalse; |
|
1432 |
|
1433 _LIT8(KMessageData, "HTTP/1.1 204 No Content\r\nX-Wap-Push-Status: 400 Accepted\r\n\r\n"); |
|
1434 _LIT8(KStartLine1, "HTTP/1.1"); |
|
1435 _LIT8(KStartLine2, "204"); |
|
1436 _LIT8(KStartLine3, "No Content"); |
|
1437 _LIT8(KHeaderName1, "X-Wap-Push-Status"); _LIT8(KHeaderValue1, "400 Accepted"); |
|
1438 |
|
1439 // Create the http message parser driver |
|
1440 CMessageComposerDriver* messageComposer = CMessageComposerDriver::NewL(*this); |
|
1441 CleanupStack::PushL(messageComposer); |
|
1442 |
|
1443 // Set the message data... |
|
1444 messageComposer->SetMessageData(KMessageData()); |
|
1445 |
|
1446 // Set the start-line |
|
1447 messageComposer->SetStartLine(KStartLine1(), KStartLine2(), KStartLine3()); |
|
1448 |
|
1449 // Set the headers... |
|
1450 messageComposer->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1451 |
|
1452 // Start the composer... |
|
1453 messageComposer->Start(KErrNone); |
|
1454 |
|
1455 CActiveScheduler::Start(); |
|
1456 |
|
1457 CleanupStack::PopAndDestroy(messageComposer); |
|
1458 } |
|
1459 |
|
1460 void CTestEngine::DoComposeNonEncodedBodyL() |
|
1461 { |
|
1462 // Reset test flags. |
|
1463 iTestCount = 0; |
|
1464 iTestFailed = EFalse; |
|
1465 |
|
1466 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nContent-Length: 35\r\nServer: CERN/3.0 libwww/2.17\r\n\r\nThis is the data that is being sent"); |
|
1467 _LIT8(KStartLine1, "HTTP/1.1"); |
|
1468 _LIT8(KStartLine2, "200"); |
|
1469 _LIT8(KStartLine3, "Ok"); |
|
1470 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
1471 _LIT8(KHeaderName2, "Content-Length"); _LIT8(KHeaderValue2, "35"); |
|
1472 _LIT8(KHeaderName3, "Server"); _LIT8(KHeaderValue3, "CERN/3.0 libwww/2.17"); |
|
1473 _LIT8(KBodyPart1, "This is the da"); |
|
1474 _LIT8(KBodyPart2, ""); |
|
1475 _LIT8(KBodyPart3, "ta that is being sent"); |
|
1476 |
|
1477 // Create the http message parser driver |
|
1478 CMessageComposerDriver* messageComposer = CMessageComposerDriver::NewL(*this); |
|
1479 CleanupStack::PushL(messageComposer); |
|
1480 |
|
1481 // Set the message data... |
|
1482 messageComposer->SetMessageData(KMessageData()); |
|
1483 |
|
1484 // Set the start-line |
|
1485 messageComposer->SetStartLine(KStartLine1(), KStartLine2(), KStartLine3()); |
|
1486 |
|
1487 // Set the headers... |
|
1488 messageComposer->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1489 messageComposer->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
1490 messageComposer->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
1491 |
|
1492 // Set body... |
|
1493 messageComposer->SetBodyDataL(KBodyPart1()); |
|
1494 messageComposer->SetBodyDataL(KBodyPart2()); |
|
1495 messageComposer->SetBodyDataL(KBodyPart3()); |
|
1496 messageComposer->SetBodySize(35); |
|
1497 |
|
1498 |
|
1499 // Start the composer... |
|
1500 messageComposer->Start(KErrNone); |
|
1501 |
|
1502 CActiveScheduler::Start(); |
|
1503 |
|
1504 CleanupStack::PopAndDestroy(messageComposer); |
|
1505 } |
|
1506 |
|
1507 void CTestEngine::DoComposeChunkEncodedBodyL() |
|
1508 { |
|
1509 // Reset test flags. |
|
1510 iTestCount = 0; |
|
1511 iTestFailed = EFalse; |
|
1512 |
|
1513 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nTransfer-Encoding: chunked\r\nServer: CERN/3.0 libwww/2.17\r\n\r\n4\r\nThis\r\nA\r\n is the da\r\n15\r\nta that is being sent\r\n0\r\n\r\n"); |
|
1514 _LIT8(KStartLine1, "HTTP/1.1"); |
|
1515 _LIT8(KStartLine2, "200"); |
|
1516 _LIT8(KStartLine3, "Ok"); |
|
1517 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
1518 _LIT8(KHeaderName2, "Transfer-Encoding"); _LIT8(KHeaderValue2, "chunked"); |
|
1519 _LIT8(KHeaderName3, "Server"); _LIT8(KHeaderValue3, "CERN/3.0 libwww/2.17"); |
|
1520 _LIT8(KBodyPart1, "This"); |
|
1521 _LIT8(KBodyPart2, " is the da"); |
|
1522 _LIT8(KBodyPart3, ""); |
|
1523 _LIT8(KBodyPart4, "ta that is being sent"); |
|
1524 |
|
1525 // Create the http message parser driver |
|
1526 CMessageComposerDriver* messageComposer = CMessageComposerDriver::NewL(*this); |
|
1527 CleanupStack::PushL(messageComposer); |
|
1528 |
|
1529 // Set the message data... |
|
1530 messageComposer->SetMessageData(KMessageData()); |
|
1531 |
|
1532 // Set the start-line |
|
1533 messageComposer->SetStartLine(KStartLine1(), KStartLine2(), KStartLine3()); |
|
1534 |
|
1535 // Set the headers... |
|
1536 messageComposer->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1537 messageComposer->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
1538 messageComposer->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
1539 |
|
1540 // Set body... |
|
1541 messageComposer->SetBodyDataL(KBodyPart1()); |
|
1542 messageComposer->SetBodyDataL(KBodyPart2()); |
|
1543 messageComposer->SetBodyDataL(KBodyPart3()); |
|
1544 messageComposer->SetBodyDataL(KBodyPart4()); |
|
1545 messageComposer->SetBodySize(KErrNotFound); |
|
1546 |
|
1547 // Start the composer... |
|
1548 messageComposer->Start(KErrNone); |
|
1549 |
|
1550 CActiveScheduler::Start(); |
|
1551 |
|
1552 CleanupStack::PopAndDestroy(messageComposer); |
|
1553 } |
|
1554 |
|
1555 void CTestEngine::DoComposeChunkEncodedBodyWithTrailersL() |
|
1556 { |
|
1557 // Reset test flags. |
|
1558 iTestCount = 0; |
|
1559 iTestFailed = EFalse; |
|
1560 |
|
1561 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nTransfer-Encoding: chunked\r\nTrailer: Server, ETag\r\n\r\n4\r\nThis\r\nA\r\n is the da\r\n15\r\nta that is being sent\r\n0\r\nServer: CERN/3.0 libwww/2.17\r\nETag: \"dave\"\r\n\r\n"); |
|
1562 _LIT8(KStartLine1, "HTTP/1.1"); |
|
1563 _LIT8(KStartLine2, "200"); |
|
1564 _LIT8(KStartLine3, "Ok"); |
|
1565 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
1566 _LIT8(KHeaderName2, "Transfer-Encoding"); _LIT8(KHeaderValue2, "chunked"); |
|
1567 _LIT8(KHeaderName3, "Trailer"); _LIT8(KHeaderValue3, "Server, ETag"); |
|
1568 _LIT8(KTrailerName1, "Server"); _LIT8(KTrailerValue1, "CERN/3.0 libwww/2.17"); |
|
1569 _LIT8(KTrailerName2, "ETag"); _LIT8(KTrailerValue2, "\"dave\""); |
|
1570 _LIT8(KBodyPart1, "This"); |
|
1571 _LIT8(KBodyPart2, " is the da"); |
|
1572 _LIT8(KBodyPart3, "ta that is being sent"); |
|
1573 _LIT8(KBodyPart4, ""); |
|
1574 |
|
1575 // Create the http message parser driver |
|
1576 CMessageComposerDriver* messageComposer = CMessageComposerDriver::NewL(*this); |
|
1577 CleanupStack::PushL(messageComposer); |
|
1578 |
|
1579 // Set the message data... |
|
1580 messageComposer->SetMessageData(KMessageData()); |
|
1581 |
|
1582 // Set the start-line |
|
1583 messageComposer->SetStartLine(KStartLine1(), KStartLine2(), KStartLine3()); |
|
1584 |
|
1585 // Set the headers... |
|
1586 messageComposer->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1587 messageComposer->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
1588 messageComposer->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
1589 |
|
1590 // Set body... |
|
1591 messageComposer->SetBodyDataL(KBodyPart1()); |
|
1592 messageComposer->SetBodyDataL(KBodyPart2()); |
|
1593 messageComposer->SetBodyDataL(KBodyPart3()); |
|
1594 messageComposer->SetBodyDataL(KBodyPart4()); |
|
1595 messageComposer->SetBodySize(KErrNotFound); |
|
1596 |
|
1597 // Set trailers... |
|
1598 messageComposer->SetTrailerL(KTrailerName1(), KTrailerValue1()); |
|
1599 messageComposer->SetTrailerL(KTrailerName2(), KTrailerValue2()); |
|
1600 |
|
1601 // Start the composer... |
|
1602 messageComposer->Start(KErrNone); |
|
1603 |
|
1604 CActiveScheduler::Start(); |
|
1605 |
|
1606 CleanupStack::PopAndDestroy(messageComposer); |
|
1607 } |
|
1608 |
|
1609 void CTestEngine::DoComposeTooMuchEntityBodyDataL() |
|
1610 { |
|
1611 // Reset test flags. |
|
1612 iTestCount = 0; |
|
1613 iTestFailed = EFalse; |
|
1614 |
|
1615 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nContent-Length: 35\r\nServer: CERN/3.0 libwww/2.17\r\n\r\nThis is the data that is being sent"); |
|
1616 _LIT8(KStartLine1, "HTTP/1.1"); |
|
1617 _LIT8(KStartLine2, "200"); |
|
1618 _LIT8(KStartLine3, "Ok"); |
|
1619 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
1620 _LIT8(KHeaderName2, "Content-Length"); _LIT8(KHeaderValue2, "35"); |
|
1621 _LIT8(KHeaderName3, "Server"); _LIT8(KHeaderValue3, "CERN/3.0 libwww/2.17"); |
|
1622 _LIT8(KBodyPart1, "This is the da"); |
|
1623 _LIT8(KBodyPart2, "ta that is being sent"); |
|
1624 _LIT8(KBodyPart3, "extra data"); |
|
1625 |
|
1626 // Create the http message parser driver |
|
1627 CMessageComposerDriver* messageComposer = CMessageComposerDriver::NewL(*this); |
|
1628 CleanupStack::PushL(messageComposer); |
|
1629 |
|
1630 // Set the message data... |
|
1631 messageComposer->SetMessageData(KMessageData()); |
|
1632 |
|
1633 // Set the start-line |
|
1634 messageComposer->SetStartLine(KStartLine1(), KStartLine2(), KStartLine3()); |
|
1635 |
|
1636 // Set the headers... |
|
1637 messageComposer->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1638 messageComposer->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
1639 messageComposer->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
1640 |
|
1641 // Set body... |
|
1642 messageComposer->SetBodyDataL(KBodyPart1()); |
|
1643 messageComposer->SetBodyDataL(KBodyPart2()); |
|
1644 messageComposer->SetBodyDataL(KBodyPart3()); |
|
1645 messageComposer->SetBodySize(35); |
|
1646 |
|
1647 // Start the composer... |
|
1648 messageComposer->Start(KErrCorrupt); |
|
1649 |
|
1650 CActiveScheduler::Start(); |
|
1651 |
|
1652 CleanupStack::PopAndDestroy(messageComposer); |
|
1653 } |
|
1654 |
|
1655 void CTestEngine::DoComposeTooLittleEntityBodyDataL() |
|
1656 { |
|
1657 // Reset test flags. |
|
1658 iTestCount = 0; |
|
1659 iTestFailed = EFalse; |
|
1660 |
|
1661 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nContent-Length: 35\r\nServer: CERN/3.0 libwww/2.17\r\n\r\nThis is the data that is being sent"); |
|
1662 _LIT8(KStartLine1, "HTTP/1.1"); |
|
1663 _LIT8(KStartLine2, "200"); |
|
1664 _LIT8(KStartLine3, "Ok"); |
|
1665 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
1666 _LIT8(KHeaderName2, "Content-Length"); _LIT8(KHeaderValue2, "35"); |
|
1667 _LIT8(KHeaderName3, "Server"); _LIT8(KHeaderValue3, "CERN/3.0 libwww/2.17"); |
|
1668 _LIT8(KBodyPart1, "This is the da"); |
|
1669 |
|
1670 // Create the http message parser driver |
|
1671 CMessageComposerDriver* messageComposer = CMessageComposerDriver::NewL(*this); |
|
1672 CleanupStack::PushL(messageComposer); |
|
1673 |
|
1674 // Set the message data... |
|
1675 messageComposer->SetMessageData(KMessageData()); |
|
1676 |
|
1677 // Set the start-line |
|
1678 messageComposer->SetStartLine(KStartLine1(), KStartLine2(), KStartLine3()); |
|
1679 |
|
1680 // Set the headers... |
|
1681 messageComposer->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1682 messageComposer->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
1683 messageComposer->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
1684 |
|
1685 // Set body... |
|
1686 messageComposer->SetBodyDataL(KBodyPart1()); |
|
1687 messageComposer->SetBodySize(35); |
|
1688 |
|
1689 // Start the composer... |
|
1690 messageComposer->Start(KErrCorrupt); |
|
1691 |
|
1692 CActiveScheduler::Start(); |
|
1693 |
|
1694 CleanupStack::PopAndDestroy(messageComposer); |
|
1695 } |
|
1696 |
|
1697 void CTestEngine::DoComposeLongHeaderL() |
|
1698 { |
|
1699 // Reset test flags. |
|
1700 iTestCount = 0; |
|
1701 iTestFailed = EFalse; |
|
1702 |
|
1703 _LIT8(KMessageData, "HTTP/1.1 204 No Content\r\nLong-Header: AVeryLongHeaderIndeedFullOfRubbishAndNotReallyHavingAnyMeaningAtAllInFactItJustNeedToBeOver128BytesInLengthAndThatIsReallyItOkJustALIttlMoreAndThatIsAll\r\n\r\n"); |
|
1704 _LIT8(KStartLine1, "HTTP/1.1"); |
|
1705 _LIT8(KStartLine2, "204"); |
|
1706 _LIT8(KStartLine3, "No Content"); |
|
1707 _LIT8(KHeaderName1, "Long-Header"); _LIT8(KHeaderValue1, "AVeryLongHeaderIndeedFullOfRubbishAndNotReallyHavingAnyMeaningAtAllInFactItJustNeedToBeOver128BytesInLengthAndThatIsReallyItOkJustALIttlMoreAndThatIsAll"); |
|
1708 |
|
1709 // Create the http message parser driver |
|
1710 CMessageComposerDriver* messageComposer = CMessageComposerDriver::NewL(*this); |
|
1711 CleanupStack::PushL(messageComposer); |
|
1712 |
|
1713 // Set the message data... |
|
1714 messageComposer->SetMessageData(KMessageData()); |
|
1715 |
|
1716 // Set the start-line |
|
1717 messageComposer->SetStartLine(KStartLine1(), KStartLine2(), KStartLine3()); |
|
1718 |
|
1719 // Set the headers... |
|
1720 messageComposer->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1721 |
|
1722 // Start the composer... |
|
1723 messageComposer->Start(KErrNone); |
|
1724 |
|
1725 CActiveScheduler::Start(); |
|
1726 |
|
1727 CleanupStack::PopAndDestroy(messageComposer); |
|
1728 } |
|
1729 |
|
1730 void CTestEngine::DoComposeNonEncodedBodyResetL() |
|
1731 { |
|
1732 // Reset test flags. |
|
1733 iTestCount = 0; |
|
1734 iTestFailed = EFalse; |
|
1735 |
|
1736 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nContent-Length: 35\r\nServer: CERN/3.0 libwww/2.17\r\n\r\nThis is the data that is being sent"); |
|
1737 _LIT8(KStartLine1, "HTTP/1.1"); |
|
1738 _LIT8(KStartLine2, "200"); |
|
1739 _LIT8(KStartLine3, "Ok"); |
|
1740 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
1741 _LIT8(KHeaderName2, "Content-Length"); _LIT8(KHeaderValue2, "35"); |
|
1742 _LIT8(KHeaderName3, "Server"); _LIT8(KHeaderValue3, "CERN/3.0 libwww/2.17"); |
|
1743 _LIT8(KBodyPart1, "This is the da"); |
|
1744 _LIT8(KBodyPart2, ""); |
|
1745 _LIT8(KBodyPart3, "ta that is being sent"); |
|
1746 |
|
1747 // Create the http message parser driver |
|
1748 CMessageComposerDriver* messageComposer = CMessageComposerDriver::NewL(*this); |
|
1749 CleanupStack::PushL(messageComposer); |
|
1750 |
|
1751 // Set the message data... |
|
1752 messageComposer->SetMessageData(KMessageData()); |
|
1753 |
|
1754 // Set the start-line |
|
1755 messageComposer->SetStartLine(KStartLine1(), KStartLine2(), KStartLine3()); |
|
1756 |
|
1757 // Set the headers... |
|
1758 messageComposer->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1759 messageComposer->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
1760 messageComposer->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
1761 |
|
1762 // Set body... |
|
1763 messageComposer->SetBodyDataL(KBodyPart1()); |
|
1764 messageComposer->SetBodyDataL(KBodyPart2()); |
|
1765 messageComposer->SetBodyDataL(KBodyPart3()); |
|
1766 messageComposer->SetBodySize(35); |
|
1767 |
|
1768 |
|
1769 // Start the composer... |
|
1770 messageComposer->Start(KErrNone, ETrue); |
|
1771 |
|
1772 CActiveScheduler::Start(); |
|
1773 |
|
1774 CleanupStack::PopAndDestroy(messageComposer); |
|
1775 } |
|
1776 |
|
1777 void CTestEngine::DoComposeChunkEncodedBodyWithTrailersResetL() |
|
1778 { |
|
1779 // Reset test flags. |
|
1780 iTestCount = 0; |
|
1781 iTestFailed = EFalse; |
|
1782 |
|
1783 _LIT8(KMessageData, "HTTP/1.1 200 Ok\r\nContent-Type: text/plain\r\nTransfer-Encoding: chunked\r\nTrailer: Server, ETag\r\n\r\n4\r\nThis\r\nA\r\n is the da\r\n15\r\nta that is being sent\r\n0\r\nServer: CERN/3.0 libwww/2.17\r\nETag: \"dave\"\r\n\r\n"); |
|
1784 _LIT8(KStartLine1, "HTTP/1.1"); |
|
1785 _LIT8(KStartLine2, "200"); |
|
1786 _LIT8(KStartLine3, "Ok"); |
|
1787 _LIT8(KHeaderName1, "Content-Type"); _LIT8(KHeaderValue1, "text/plain"); |
|
1788 _LIT8(KHeaderName2, "Transfer-Encoding"); _LIT8(KHeaderValue2, "chunked"); |
|
1789 _LIT8(KHeaderName3, "Trailer"); _LIT8(KHeaderValue3, "Server, ETag"); |
|
1790 _LIT8(KTrailerName1, "Server"); _LIT8(KTrailerValue1, "CERN/3.0 libwww/2.17"); |
|
1791 _LIT8(KTrailerName2, "ETag"); _LIT8(KTrailerValue2, "\"dave\""); |
|
1792 _LIT8(KBodyPart1, "This"); |
|
1793 _LIT8(KBodyPart2, " is the da"); |
|
1794 _LIT8(KBodyPart3, "ta that is being sent"); |
|
1795 _LIT8(KBodyPart4, ""); |
|
1796 |
|
1797 // Create the http message parser driver |
|
1798 CMessageComposerDriver* messageComposer = CMessageComposerDriver::NewL(*this); |
|
1799 CleanupStack::PushL(messageComposer); |
|
1800 |
|
1801 // Set the message data... |
|
1802 messageComposer->SetMessageData(KMessageData()); |
|
1803 |
|
1804 // Set the start-line |
|
1805 messageComposer->SetStartLine(KStartLine1(), KStartLine2(), KStartLine3()); |
|
1806 |
|
1807 // Set the headers... |
|
1808 messageComposer->SetHeaderL(KHeaderName1(), KHeaderValue1()); |
|
1809 messageComposer->SetHeaderL(KHeaderName2(), KHeaderValue2()); |
|
1810 messageComposer->SetHeaderL(KHeaderName3(), KHeaderValue3()); |
|
1811 |
|
1812 // Set body... |
|
1813 messageComposer->SetBodyDataL(KBodyPart1()); |
|
1814 messageComposer->SetBodyDataL(KBodyPart2()); |
|
1815 messageComposer->SetBodyDataL(KBodyPart3()); |
|
1816 messageComposer->SetBodyDataL(KBodyPart4()); |
|
1817 messageComposer->SetBodySize(KErrNotFound); |
|
1818 |
|
1819 // Set trailers... |
|
1820 messageComposer->SetTrailerL(KTrailerName1(), KTrailerValue1()); |
|
1821 messageComposer->SetTrailerL(KTrailerName2(), KTrailerValue2()); |
|
1822 |
|
1823 // Start the composer... |
|
1824 messageComposer->Start(KErrNone, ETrue); |
|
1825 |
|
1826 CActiveScheduler::Start(); |
|
1827 |
|
1828 CleanupStack::PopAndDestroy(messageComposer); |
|
1829 } |
|
1830 |
|
1831 /* |
|
1832 * Methods from MDriverObserver |
|
1833 */ |
|
1834 |
|
1835 void CTestEngine::NotifyError(TInt aError) |
|
1836 { |
|
1837 if( !iTestFailed ) |
|
1838 { |
|
1839 // This is the first failure - stop the scheduler |
|
1840 iTestFailed = ETrue; |
|
1841 |
|
1842 // Log the failure - do not log this to summary file - go silent |
|
1843 iTestUtils->SetSilent(ETrue); |
|
1844 |
|
1845 // Log the comment... |
|
1846 TBuf<KLogBufSize> comment; |
|
1847 comment.Format(_L("Test error %d"), aError); |
|
1848 iTestUtils->LogIt(comment); |
|
1849 |
|
1850 // Go back to non-silent |
|
1851 iTestUtils->SetSilent(EFalse); |
|
1852 |
|
1853 // Stop the scheduler |
|
1854 CActiveScheduler::Stop(); |
|
1855 } |
|
1856 } |
|
1857 |
|
1858 void CTestEngine::NotifyStart() |
|
1859 { |
|
1860 ++iTestCount; |
|
1861 } |
|
1862 |
|
1863 void CTestEngine::NotifyComplete() |
|
1864 { |
|
1865 --iTestCount; |
|
1866 if( iTestCount == 0 ) |
|
1867 { |
|
1868 // Log success - do not log this to summary file - go silent |
|
1869 iTestUtils->SetSilent(ETrue); |
|
1870 |
|
1871 // Log the comment... |
|
1872 iTestUtils->LogIt(_L("Test completed")); |
|
1873 |
|
1874 // Go back to non-silent |
|
1875 iTestUtils->SetSilent(EFalse); |
|
1876 |
|
1877 // All tests have completed - stop the scheduler |
|
1878 CActiveScheduler::Stop(); |
|
1879 } |
|
1880 } |
|
1881 |
|
1882 void CTestEngine::Log(const TDesC& aCmt) |
|
1883 { |
|
1884 // Only log if not doing OOM testing |
|
1885 if( !iOOMTesting ) |
|
1886 { |
|
1887 // Do not log this to summary file - go silent |
|
1888 iTestUtils->SetSilent(ETrue); |
|
1889 |
|
1890 // Log the comment... |
|
1891 iTestUtils->LogIt(aCmt); |
|
1892 |
|
1893 // Go back to non-silent |
|
1894 iTestUtils->SetSilent(EFalse); |
|
1895 } |
|
1896 } |
|
1897 |
|
1898 void CTestEngine::Dump(const TDesC8& aData) |
|
1899 { |
|
1900 // Only log if not doing OOM testing |
|
1901 if( !iOOMTesting ) |
|
1902 { |
|
1903 // Do not log this to summary file - go silent |
|
1904 iTestUtils->SetSilent(ETrue); |
|
1905 |
|
1906 // Do the data dump... |
|
1907 iTestUtils->DumpData(aData, ETrue); |
|
1908 |
|
1909 // Go back to non-silent |
|
1910 iTestUtils->SetSilent(EFalse); |
|
1911 } |
|
1912 } |