|
1 /* |
|
2 * Copyright (c) 2001 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /** |
|
20 @file WspHeaderWriterUnitTest.cpp |
|
21 Comments : The unit test class implementations for the CWspHeaderWriter class. |
|
22 */ |
|
23 |
|
24 #include "WspHeaderWriterUnitTest.h" |
|
25 |
|
26 // ______________________________________________________________________________ |
|
27 // |
|
28 _LIT(KWspHeaderWriterCreateAndDestroyUnitTest,"CWspHeaderWriter_CreateAndDestroy_UnitTest"); |
|
29 |
|
30 CWspHeaderWriter_CreateAndDestroy_UnitTest* CWspHeaderWriter_CreateAndDestroy_UnitTest::NewL(CDataLogger& aDataLogger, |
|
31 MUnitTestObserver& aObserver) |
|
32 { |
|
33 CWspHeaderWriter_CreateAndDestroy_UnitTest* self = |
|
34 new(ELeave) CWspHeaderWriter_CreateAndDestroy_UnitTest(aDataLogger, |
|
35 aObserver); |
|
36 CleanupStack::PushL(self); |
|
37 self->ConstructL(); |
|
38 CleanupStack::Pop(self); |
|
39 return self; |
|
40 } |
|
41 |
|
42 inline TInt CWspHeaderWriter_CreateAndDestroy_UnitTest::RunError(TInt aError) |
|
43 { |
|
44 // The RunL left so chain to the base first and then cleanup |
|
45 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
46 delete iUTContext; |
|
47 iUTContext = NULL; |
|
48 delete iStateAccessor; |
|
49 iStateAccessor = NULL; |
|
50 /* delete any validators used */ |
|
51 delete iCtorValidator; |
|
52 iCtorValidator = NULL; |
|
53 delete iDtorValidator; |
|
54 iDtorValidator = NULL; |
|
55 return error; |
|
56 } |
|
57 |
|
58 inline CWspHeaderWriter_CreateAndDestroy_UnitTest::~CWspHeaderWriter_CreateAndDestroy_UnitTest() |
|
59 { |
|
60 // Simply delete our test class instance |
|
61 delete iUTContext; |
|
62 delete iStateAccessor; |
|
63 /* delete any validators used */ |
|
64 delete iCtorValidator; |
|
65 delete iDtorValidator; |
|
66 } |
|
67 |
|
68 inline CWspHeaderWriter_CreateAndDestroy_UnitTest::CWspHeaderWriter_CreateAndDestroy_UnitTest(CDataLogger& aDataLogger, |
|
69 MUnitTestObserver& aObserver) |
|
70 : CUnitTest(KWspHeaderWriterCreateAndDestroyUnitTest, aDataLogger, aObserver) |
|
71 { |
|
72 //Do nothing |
|
73 } |
|
74 |
|
75 // Now the Individual transitions need to be added. |
|
76 inline void CWspHeaderWriter_CreateAndDestroy_UnitTest::ConstructL() |
|
77 { |
|
78 // Perform the base class initialization |
|
79 UnitTestConstructL(); |
|
80 |
|
81 // Create the Unit test state accessor |
|
82 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
83 // Construct the Unit test context. |
|
84 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
85 iUTContext->ConstructL(WSP::EAccept); |
|
86 |
|
87 // Add the Transitions in the order they are to run |
|
88 // C'tor first, D'tor last... |
|
89 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
90 using constructor and destuctor validators */ |
|
91 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
92 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
93 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
94 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
95 } |
|
96 |
|
97 // ______________________________________________________________________________ |
|
98 // |
|
99 _LIT(KWspHeaderWriterUserAgentUnitTest,"CWspHeaderWriter_UserAgent_UnitTest"); |
|
100 |
|
101 CWspHeaderWriter_UserAgent_UnitTest* CWspHeaderWriter_UserAgent_UnitTest::NewL(CDataLogger& aDataLogger, |
|
102 MUnitTestObserver& aObserver) |
|
103 { |
|
104 CWspHeaderWriter_UserAgent_UnitTest* self = |
|
105 new(ELeave) CWspHeaderWriter_UserAgent_UnitTest(aDataLogger, |
|
106 aObserver); |
|
107 CleanupStack::PushL(self); |
|
108 self->ConstructL(); |
|
109 CleanupStack::Pop(self); |
|
110 return self; |
|
111 } |
|
112 |
|
113 inline TInt CWspHeaderWriter_UserAgent_UnitTest::RunError(TInt aError) |
|
114 { |
|
115 // The RunL left so chain to the base first and then cleanup |
|
116 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
117 delete iUTContext; |
|
118 iUTContext = NULL; |
|
119 delete iStateAccessor; |
|
120 iStateAccessor = NULL; |
|
121 /* delete any validators used */ |
|
122 delete iCtorValidator; |
|
123 iCtorValidator = NULL; |
|
124 delete iUserAgentValidator; |
|
125 iUserAgentValidator = NULL; |
|
126 delete iDtorValidator; |
|
127 iDtorValidator = NULL; |
|
128 return error; |
|
129 } |
|
130 |
|
131 inline CWspHeaderWriter_UserAgent_UnitTest::~CWspHeaderWriter_UserAgent_UnitTest() |
|
132 { |
|
133 // Simply delete our test class instance |
|
134 delete iUTContext; |
|
135 delete iStateAccessor; |
|
136 /* delete any validators used */ |
|
137 delete iCtorValidator; |
|
138 delete iUserAgentValidator; |
|
139 delete iDtorValidator; |
|
140 } |
|
141 |
|
142 inline CWspHeaderWriter_UserAgent_UnitTest::CWspHeaderWriter_UserAgent_UnitTest(CDataLogger& aDataLogger, |
|
143 MUnitTestObserver& aObserver) |
|
144 : CUnitTest(KWspHeaderWriterUserAgentUnitTest, aDataLogger, aObserver) |
|
145 { |
|
146 //Do nothing |
|
147 } |
|
148 |
|
149 // Now the Individual transitions need to be added. |
|
150 inline void CWspHeaderWriter_UserAgent_UnitTest::ConstructL() |
|
151 { |
|
152 // Perform the base class initialization |
|
153 UnitTestConstructL(); |
|
154 |
|
155 // Create the Unit test state accessor |
|
156 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
157 // Construct the Unit test context. |
|
158 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
159 iUTContext->ConstructL(WSP::EUserAgent); |
|
160 |
|
161 _LIT8(KTxtData, "user-agent-text"); |
|
162 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtData); |
|
163 CleanupClosePushL(stringVal); |
|
164 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
165 CleanupStack::PushL(part1); |
|
166 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
167 CleanupStack::Pop(part1); |
|
168 CleanupStack::PopAndDestroy(&stringVal); |
|
169 |
|
170 TBuf8<256> expectedBuf; |
|
171 expectedBuf.Append(KTxtData); |
|
172 expectedBuf.Append(0x00); |
|
173 iUTContext->SetExpectedL(expectedBuf); |
|
174 |
|
175 // Add the Transitions in the order they are to run |
|
176 // C'tor first, D'tor last... |
|
177 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
178 using constructor and destuctor validators */ |
|
179 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
180 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
181 iUserAgentValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
182 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iUserAgentValidator)); |
|
183 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
184 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
185 } |
|
186 |
|
187 // ______________________________________________________________________________ |
|
188 // |
|
189 _LIT(KWspHeaderWriterUserAgentNullTextUnitTest,"CWspHeaderWriter_UserAgentNullText_UnitTest"); |
|
190 |
|
191 CWspHeaderWriter_UserAgentNullText_UnitTest* CWspHeaderWriter_UserAgentNullText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
192 MUnitTestObserver& aObserver) |
|
193 { |
|
194 CWspHeaderWriter_UserAgentNullText_UnitTest* self = |
|
195 new(ELeave) CWspHeaderWriter_UserAgentNullText_UnitTest(aDataLogger, |
|
196 aObserver); |
|
197 CleanupStack::PushL(self); |
|
198 self->ConstructL(); |
|
199 CleanupStack::Pop(self); |
|
200 return self; |
|
201 } |
|
202 |
|
203 inline TInt CWspHeaderWriter_UserAgentNullText_UnitTest::RunError(TInt aError) |
|
204 { |
|
205 // The RunL left so chain to the base first and then cleanup |
|
206 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
207 delete iUTContext; |
|
208 iUTContext = NULL; |
|
209 delete iStateAccessor; |
|
210 iStateAccessor = NULL; |
|
211 /* delete any validators used */ |
|
212 delete iCtorValidator; |
|
213 iCtorValidator = NULL; |
|
214 delete iUserAgentNullTextValidator; |
|
215 iUserAgentNullTextValidator = NULL; |
|
216 delete iDtorValidator; |
|
217 iDtorValidator = NULL; |
|
218 return error; |
|
219 } |
|
220 |
|
221 inline CWspHeaderWriter_UserAgentNullText_UnitTest::~CWspHeaderWriter_UserAgentNullText_UnitTest() |
|
222 { |
|
223 // Simply delete our test class instance |
|
224 delete iUTContext; |
|
225 delete iStateAccessor; |
|
226 /* delete any validators used */ |
|
227 delete iCtorValidator; |
|
228 delete iUserAgentNullTextValidator; |
|
229 delete iDtorValidator; |
|
230 } |
|
231 |
|
232 inline CWspHeaderWriter_UserAgentNullText_UnitTest::CWspHeaderWriter_UserAgentNullText_UnitTest(CDataLogger& aDataLogger, |
|
233 MUnitTestObserver& aObserver) |
|
234 : CUnitTest(KWspHeaderWriterUserAgentNullTextUnitTest, aDataLogger, aObserver) |
|
235 { |
|
236 //Do nothing |
|
237 } |
|
238 |
|
239 // Now the Individual transitions need to be added. |
|
240 inline void CWspHeaderWriter_UserAgentNullText_UnitTest::ConstructL() |
|
241 { |
|
242 // Perform the base class initialization |
|
243 UnitTestConstructL(); |
|
244 |
|
245 // Create the Unit test state accessor |
|
246 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
247 // Construct the Unit test context. |
|
248 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
249 iUTContext->ConstructL(WSP::EUserAgent); |
|
250 |
|
251 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KNullDesC8()); |
|
252 CleanupClosePushL(stringVal); |
|
253 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
254 CleanupStack::PushL(part1); |
|
255 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
256 CleanupStack::Pop(part1); |
|
257 CleanupStack::PopAndDestroy(&stringVal); |
|
258 |
|
259 TBuf8<256> expectedBuf; |
|
260 expectedBuf.Append(0x00); |
|
261 iUTContext->SetExpectedL(expectedBuf); |
|
262 |
|
263 // Add the Transitions in the order they are to run |
|
264 // C'tor first, D'tor last... |
|
265 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
266 using constructor and destuctor validators */ |
|
267 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
268 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
269 iUserAgentNullTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
270 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iUserAgentNullTextValidator)); |
|
271 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
272 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
273 } |
|
274 |
|
275 // ______________________________________________________________________________ |
|
276 // |
|
277 _LIT(KWspHeaderWriterAuthorizationBasicUnitTest,"CWspHeaderWriter_AuthorizationBasic_UnitTest"); |
|
278 |
|
279 CWspHeaderWriter_AuthorizationBasic_UnitTest* CWspHeaderWriter_AuthorizationBasic_UnitTest::NewL(CDataLogger& aDataLogger, |
|
280 MUnitTestObserver& aObserver) |
|
281 { |
|
282 CWspHeaderWriter_AuthorizationBasic_UnitTest* self = |
|
283 new(ELeave) CWspHeaderWriter_AuthorizationBasic_UnitTest(aDataLogger, |
|
284 aObserver); |
|
285 CleanupStack::PushL(self); |
|
286 self->ConstructL(); |
|
287 CleanupStack::Pop(self); |
|
288 return self; |
|
289 } |
|
290 |
|
291 inline TInt CWspHeaderWriter_AuthorizationBasic_UnitTest::RunError(TInt aError) |
|
292 { |
|
293 // The RunL left so chain to the base first and then cleanup |
|
294 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
295 delete iUTContext; |
|
296 iUTContext = NULL; |
|
297 delete iStateAccessor; |
|
298 iStateAccessor = NULL; |
|
299 /* delete any validators used */ |
|
300 delete iCtorValidator; |
|
301 iCtorValidator = NULL; |
|
302 delete iAuthorizationBasicValidator; |
|
303 iAuthorizationBasicValidator = NULL; |
|
304 delete iDtorValidator; |
|
305 iDtorValidator = NULL; |
|
306 return error; |
|
307 } |
|
308 |
|
309 inline CWspHeaderWriter_AuthorizationBasic_UnitTest::~CWspHeaderWriter_AuthorizationBasic_UnitTest() |
|
310 { |
|
311 // Simply delete our test class instance |
|
312 delete iUTContext; |
|
313 delete iStateAccessor; |
|
314 /* delete any validators used */ |
|
315 delete iCtorValidator; |
|
316 delete iAuthorizationBasicValidator; |
|
317 delete iDtorValidator; |
|
318 } |
|
319 |
|
320 inline CWspHeaderWriter_AuthorizationBasic_UnitTest::CWspHeaderWriter_AuthorizationBasic_UnitTest(CDataLogger& aDataLogger, |
|
321 MUnitTestObserver& aObserver) |
|
322 : CUnitTest(KWspHeaderWriterAuthorizationBasicUnitTest, aDataLogger, aObserver) |
|
323 { |
|
324 //Do nothing |
|
325 } |
|
326 |
|
327 // Now the Individual transitions need to be added. |
|
328 inline void CWspHeaderWriter_AuthorizationBasic_UnitTest::ConstructL() |
|
329 { |
|
330 // Perform the base class initialization |
|
331 UnitTestConstructL(); |
|
332 |
|
333 // Create the Unit test state accessor |
|
334 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
335 // Construct the Unit test context. |
|
336 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
337 iUTContext->ConstructL(WSP::EAuthorization); |
|
338 |
|
339 // Part1 |
|
340 _LIT8(KTxtBasic, "Basic"); |
|
341 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtBasic); |
|
342 CleanupClosePushL(stringVal); |
|
343 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
344 CleanupStack::PushL(part1); |
|
345 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
346 CleanupStack::Pop(part1); |
|
347 CleanupStack::PopAndDestroy(&stringVal); |
|
348 |
|
349 // Part2 |
|
350 _LIT8(KTxtUser, "myuserid"); |
|
351 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtUser); |
|
352 CleanupClosePushL(stringVal2); |
|
353 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringVal2); |
|
354 CleanupStack::PushL(part2); |
|
355 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
356 CleanupStack::Pop(part2); |
|
357 CleanupStack::PopAndDestroy(&stringVal2); |
|
358 |
|
359 // Part2 |
|
360 _LIT8(KTxtPassword, "mypass"); |
|
361 RStringF stringVal3 = iUTContext->iStrPool.OpenFStringL(KTxtPassword); |
|
362 CleanupClosePushL(stringVal3); |
|
363 CHeaderFieldPart* part3 = CHeaderFieldPart::NewL(stringVal3); |
|
364 CleanupStack::PushL(part3); |
|
365 iUTContext->iTestHeader->SetPartL(part3, 2); |
|
366 CleanupStack::Pop(part3); |
|
367 CleanupStack::PopAndDestroy(&stringVal3); |
|
368 |
|
369 TBuf8<256> expectedBuf; |
|
370 expectedBuf.Append(0x11); // value-length for 17 |
|
371 expectedBuf.Append(0x80); |
|
372 expectedBuf.Append(KTxtUser); |
|
373 expectedBuf.Append(0x00); |
|
374 expectedBuf.Append(KTxtPassword); |
|
375 expectedBuf.Append(0x00); |
|
376 iUTContext->SetExpectedL(expectedBuf); |
|
377 |
|
378 // Add the Transitions in the order they are to run |
|
379 // C'tor first, D'tor last... |
|
380 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
381 using constructor and destuctor validators */ |
|
382 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
383 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
384 iAuthorizationBasicValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
385 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAuthorizationBasicValidator)); |
|
386 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
387 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
388 } |
|
389 |
|
390 // ______________________________________________________________________________ |
|
391 // |
|
392 _LIT(KWspHeaderWriterAuthorizationBasicNullUserUnitTest,"CWspHeaderWriter_AuthorizationBasicNullUser_UnitTest"); |
|
393 |
|
394 CWspHeaderWriter_AuthorizationBasicNullUser_UnitTest* CWspHeaderWriter_AuthorizationBasicNullUser_UnitTest::NewL(CDataLogger& aDataLogger, |
|
395 MUnitTestObserver& aObserver) |
|
396 { |
|
397 CWspHeaderWriter_AuthorizationBasicNullUser_UnitTest* self = |
|
398 new(ELeave) CWspHeaderWriter_AuthorizationBasicNullUser_UnitTest(aDataLogger, |
|
399 aObserver); |
|
400 CleanupStack::PushL(self); |
|
401 self->ConstructL(); |
|
402 CleanupStack::Pop(self); |
|
403 return self; |
|
404 } |
|
405 |
|
406 inline TInt CWspHeaderWriter_AuthorizationBasicNullUser_UnitTest::RunError(TInt aError) |
|
407 { |
|
408 // The RunL left so chain to the base first and then cleanup |
|
409 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
410 delete iUTContext; |
|
411 iUTContext = NULL; |
|
412 delete iStateAccessor; |
|
413 iStateAccessor = NULL; |
|
414 /* delete any validators used */ |
|
415 delete iCtorValidator; |
|
416 iCtorValidator = NULL; |
|
417 delete iAuthorizationBasicNullUserValidator; |
|
418 iAuthorizationBasicNullUserValidator = NULL; |
|
419 delete iDtorValidator; |
|
420 iDtorValidator = NULL; |
|
421 return error; |
|
422 } |
|
423 |
|
424 inline CWspHeaderWriter_AuthorizationBasicNullUser_UnitTest::~CWspHeaderWriter_AuthorizationBasicNullUser_UnitTest() |
|
425 { |
|
426 // Simply delete our test class instance |
|
427 delete iUTContext; |
|
428 delete iStateAccessor; |
|
429 /* delete any validators used */ |
|
430 delete iCtorValidator; |
|
431 delete iAuthorizationBasicNullUserValidator; |
|
432 delete iDtorValidator; |
|
433 } |
|
434 |
|
435 inline CWspHeaderWriter_AuthorizationBasicNullUser_UnitTest::CWspHeaderWriter_AuthorizationBasicNullUser_UnitTest(CDataLogger& aDataLogger, |
|
436 MUnitTestObserver& aObserver) |
|
437 : CUnitTest(KWspHeaderWriterAuthorizationBasicNullUserUnitTest, aDataLogger, aObserver) |
|
438 { |
|
439 //Do nothing |
|
440 } |
|
441 |
|
442 // Now the Individual transitions need to be added. |
|
443 inline void CWspHeaderWriter_AuthorizationBasicNullUser_UnitTest::ConstructL() |
|
444 { |
|
445 // Perform the base class initialization |
|
446 UnitTestConstructL(); |
|
447 |
|
448 // Create the Unit test state accessor |
|
449 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
450 // Construct the Unit test context. |
|
451 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
452 iUTContext->ConstructL(WSP::EAuthorization); |
|
453 |
|
454 // Part1 |
|
455 _LIT8(KTxtBasic, "Basic"); |
|
456 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtBasic); |
|
457 CleanupClosePushL(stringVal); |
|
458 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
459 CleanupStack::PushL(part1); |
|
460 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
461 CleanupStack::Pop(part1); |
|
462 CleanupStack::PopAndDestroy(&stringVal); |
|
463 |
|
464 // Part2 |
|
465 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KNullDesC8()); |
|
466 CleanupClosePushL(stringVal2); |
|
467 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringVal2); |
|
468 CleanupStack::PushL(part2); |
|
469 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
470 CleanupStack::Pop(part2); |
|
471 CleanupStack::PopAndDestroy(&stringVal2); |
|
472 |
|
473 // Part2 |
|
474 _LIT8(KTxtPassword, "mypass"); |
|
475 RStringF stringVal3 = iUTContext->iStrPool.OpenFStringL(KTxtPassword); |
|
476 CleanupClosePushL(stringVal3); |
|
477 CHeaderFieldPart* part3 = CHeaderFieldPart::NewL(stringVal3); |
|
478 CleanupStack::PushL(part3); |
|
479 iUTContext->iTestHeader->SetPartL(part3, 2); |
|
480 CleanupStack::Pop(part3); |
|
481 CleanupStack::PopAndDestroy(&stringVal3); |
|
482 |
|
483 TBuf8<256> expectedBuf; |
|
484 expectedBuf.Append(0x09); // value-length for 9 |
|
485 expectedBuf.Append(0x80); |
|
486 expectedBuf.Append(0x00); |
|
487 expectedBuf.Append(KTxtPassword); |
|
488 expectedBuf.Append(0x00); |
|
489 iUTContext->SetExpectedL(expectedBuf); |
|
490 |
|
491 // Add the Transitions in the order they are to run |
|
492 // C'tor first, D'tor last... |
|
493 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
494 using constructor and destuctor validators */ |
|
495 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
496 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
497 iAuthorizationBasicNullUserValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
498 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAuthorizationBasicNullUserValidator)); |
|
499 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
500 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
501 } |
|
502 |
|
503 // ______________________________________________________________________________ |
|
504 // |
|
505 _LIT(KWspHeaderWriterBasicNullPasswordUnitTest,"CWspHeaderWriter_BasicNullPassword_UnitTest"); |
|
506 |
|
507 CWspHeaderWriter_BasicNullPassword_UnitTest* CWspHeaderWriter_BasicNullPassword_UnitTest::NewL(CDataLogger& aDataLogger, |
|
508 MUnitTestObserver& aObserver) |
|
509 { |
|
510 CWspHeaderWriter_BasicNullPassword_UnitTest* self = |
|
511 new(ELeave) CWspHeaderWriter_BasicNullPassword_UnitTest(aDataLogger, |
|
512 aObserver); |
|
513 CleanupStack::PushL(self); |
|
514 self->ConstructL(); |
|
515 CleanupStack::Pop(self); |
|
516 return self; |
|
517 } |
|
518 |
|
519 inline TInt CWspHeaderWriter_BasicNullPassword_UnitTest::RunError(TInt aError) |
|
520 { |
|
521 // The RunL left so chain to the base first and then cleanup |
|
522 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
523 delete iUTContext; |
|
524 iUTContext = NULL; |
|
525 delete iStateAccessor; |
|
526 iStateAccessor = NULL; |
|
527 /* delete any validators used */ |
|
528 delete iCtorValidator; |
|
529 iCtorValidator = NULL; |
|
530 delete iBasicNullPasswordValidator; |
|
531 iBasicNullPasswordValidator = NULL; |
|
532 delete iDtorValidator; |
|
533 iDtorValidator = NULL; |
|
534 return error; |
|
535 } |
|
536 |
|
537 inline CWspHeaderWriter_BasicNullPassword_UnitTest::~CWspHeaderWriter_BasicNullPassword_UnitTest() |
|
538 { |
|
539 // Simply delete our test class instance |
|
540 delete iUTContext; |
|
541 delete iStateAccessor; |
|
542 /* delete any validators used */ |
|
543 delete iCtorValidator; |
|
544 delete iBasicNullPasswordValidator; |
|
545 delete iDtorValidator; |
|
546 } |
|
547 |
|
548 inline CWspHeaderWriter_BasicNullPassword_UnitTest::CWspHeaderWriter_BasicNullPassword_UnitTest(CDataLogger& aDataLogger, |
|
549 MUnitTestObserver& aObserver) |
|
550 : CUnitTest(KWspHeaderWriterBasicNullPasswordUnitTest, aDataLogger, aObserver) |
|
551 { |
|
552 //Do nothing |
|
553 } |
|
554 |
|
555 // Now the Individual transitions need to be added. |
|
556 inline void CWspHeaderWriter_BasicNullPassword_UnitTest::ConstructL() |
|
557 { |
|
558 // Perform the base class initialization |
|
559 UnitTestConstructL(); |
|
560 |
|
561 // Create the Unit test state accessor |
|
562 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
563 // Construct the Unit test context. |
|
564 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
565 iUTContext->ConstructL(WSP::EAuthorization); |
|
566 |
|
567 // Part1 |
|
568 _LIT8(KTxtBasic, "Basic"); |
|
569 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtBasic); |
|
570 CleanupClosePushL(stringVal); |
|
571 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
572 CleanupStack::PushL(part1); |
|
573 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
574 CleanupStack::Pop(part1); |
|
575 CleanupStack::PopAndDestroy(&stringVal); |
|
576 |
|
577 // Part2 |
|
578 _LIT8(KTxtUser, "myuserid"); |
|
579 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtUser); |
|
580 CleanupClosePushL(stringVal2); |
|
581 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringVal2); |
|
582 CleanupStack::PushL(part2); |
|
583 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
584 CleanupStack::Pop(part2); |
|
585 CleanupStack::PopAndDestroy(&stringVal2); |
|
586 |
|
587 // Part2 |
|
588 RStringF stringVal3 = iUTContext->iStrPool.OpenFStringL(KNullDesC8()); |
|
589 CleanupClosePushL(stringVal3); |
|
590 CHeaderFieldPart* part3 = CHeaderFieldPart::NewL(stringVal3); |
|
591 CleanupStack::PushL(part3); |
|
592 iUTContext->iTestHeader->SetPartL(part3, 2); |
|
593 CleanupStack::Pop(part3); |
|
594 CleanupStack::PopAndDestroy(&stringVal3); |
|
595 |
|
596 TBuf8<256> expectedBuf; |
|
597 expectedBuf.Append(0x0B); // value-length for 11 |
|
598 expectedBuf.Append(0x80); |
|
599 expectedBuf.Append(KTxtUser); |
|
600 expectedBuf.Append(0x00); |
|
601 expectedBuf.Append(0x00); |
|
602 iUTContext->SetExpectedL(expectedBuf); |
|
603 |
|
604 // Add the Transitions in the order they are to run |
|
605 // C'tor first, D'tor last... |
|
606 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
607 using constructor and destuctor validators */ |
|
608 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
609 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
610 iBasicNullPasswordValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
611 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iBasicNullPasswordValidator)); |
|
612 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
613 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
614 } |
|
615 |
|
616 // ______________________________________________________________________________ |
|
617 // |
|
618 _LIT(KWspHeaderWriterBasicNullUserNullPassUnitTest,"CWspHeaderWriter_BasicNullUserNullPass_UnitTest"); |
|
619 |
|
620 CWspHeaderWriter_BasicNullUserNullPass_UnitTest* CWspHeaderWriter_BasicNullUserNullPass_UnitTest::NewL(CDataLogger& aDataLogger, |
|
621 MUnitTestObserver& aObserver) |
|
622 { |
|
623 CWspHeaderWriter_BasicNullUserNullPass_UnitTest* self = |
|
624 new(ELeave) CWspHeaderWriter_BasicNullUserNullPass_UnitTest(aDataLogger, |
|
625 aObserver); |
|
626 CleanupStack::PushL(self); |
|
627 self->ConstructL(); |
|
628 CleanupStack::Pop(self); |
|
629 return self; |
|
630 } |
|
631 |
|
632 inline TInt CWspHeaderWriter_BasicNullUserNullPass_UnitTest::RunError(TInt aError) |
|
633 { |
|
634 // The RunL left so chain to the base first and then cleanup |
|
635 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
636 delete iUTContext; |
|
637 iUTContext = NULL; |
|
638 delete iStateAccessor; |
|
639 iStateAccessor = NULL; |
|
640 /* delete any validators used */ |
|
641 delete iCtorValidator; |
|
642 iCtorValidator = NULL; |
|
643 delete iBasicNullUserNullPassValidator; |
|
644 iBasicNullUserNullPassValidator = NULL; |
|
645 delete iDtorValidator; |
|
646 iDtorValidator = NULL; |
|
647 return error; |
|
648 } |
|
649 |
|
650 inline CWspHeaderWriter_BasicNullUserNullPass_UnitTest::~CWspHeaderWriter_BasicNullUserNullPass_UnitTest() |
|
651 { |
|
652 // Simply delete our test class instance |
|
653 delete iUTContext; |
|
654 delete iStateAccessor; |
|
655 /* delete any validators used */ |
|
656 delete iCtorValidator; |
|
657 delete iBasicNullUserNullPassValidator; |
|
658 delete iDtorValidator; |
|
659 } |
|
660 |
|
661 inline CWspHeaderWriter_BasicNullUserNullPass_UnitTest::CWspHeaderWriter_BasicNullUserNullPass_UnitTest(CDataLogger& aDataLogger, |
|
662 MUnitTestObserver& aObserver) |
|
663 : CUnitTest(KWspHeaderWriterBasicNullUserNullPassUnitTest, aDataLogger, aObserver) |
|
664 { |
|
665 //Do nothing |
|
666 } |
|
667 |
|
668 // Now the Individual transitions need to be added. |
|
669 inline void CWspHeaderWriter_BasicNullUserNullPass_UnitTest::ConstructL() |
|
670 { |
|
671 // Perform the base class initialization |
|
672 UnitTestConstructL(); |
|
673 |
|
674 // Create the Unit test state accessor |
|
675 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
676 // Construct the Unit test context. |
|
677 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
678 iUTContext->ConstructL(WSP::EAuthorization); |
|
679 |
|
680 // Part1 |
|
681 _LIT8(KTxtBasic, "Basic"); |
|
682 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtBasic); |
|
683 CleanupClosePushL(stringVal); |
|
684 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
685 CleanupStack::PushL(part1); |
|
686 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
687 CleanupStack::Pop(part1); |
|
688 CleanupStack::PopAndDestroy(&stringVal); |
|
689 |
|
690 // Part2 |
|
691 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KNullDesC8()); |
|
692 CleanupClosePushL(stringVal2); |
|
693 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringVal2); |
|
694 CleanupStack::PushL(part2); |
|
695 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
696 CleanupStack::Pop(part2); |
|
697 CleanupStack::PopAndDestroy(&stringVal2); |
|
698 |
|
699 // Part2 |
|
700 RStringF stringVal3 = iUTContext->iStrPool.OpenFStringL(KNullDesC8()); |
|
701 CleanupClosePushL(stringVal3); |
|
702 CHeaderFieldPart* part3 = CHeaderFieldPart::NewL(stringVal3); |
|
703 CleanupStack::PushL(part3); |
|
704 iUTContext->iTestHeader->SetPartL(part3, 2); |
|
705 CleanupStack::Pop(part3); |
|
706 CleanupStack::PopAndDestroy(&stringVal3); |
|
707 |
|
708 TBuf8<256> expectedBuf; |
|
709 expectedBuf.Append(0x03); // value-length for 3 |
|
710 expectedBuf.Append(0x80); |
|
711 expectedBuf.Append(0x00); |
|
712 expectedBuf.Append(0x00); |
|
713 iUTContext->SetExpectedL(expectedBuf); |
|
714 |
|
715 // Add the Transitions in the order they are to run |
|
716 // C'tor first, D'tor last... |
|
717 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
718 using constructor and destuctor validators */ |
|
719 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
720 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
721 iBasicNullUserNullPassValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
722 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iBasicNullUserNullPassValidator)); |
|
723 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
724 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
725 } |
|
726 |
|
727 // ______________________________________________________________________________ |
|
728 // |
|
729 _LIT(KWspHeaderWriterAuthorizationSchemeNoParamUnitTest,"CWspHeaderWriter_AuthorizationSchemeNoParam_UnitTest"); |
|
730 |
|
731 CWspHeaderWriter_AuthorizationSchemeNoParam_UnitTest* CWspHeaderWriter_AuthorizationSchemeNoParam_UnitTest::NewL(CDataLogger& aDataLogger, |
|
732 MUnitTestObserver& aObserver) |
|
733 { |
|
734 CWspHeaderWriter_AuthorizationSchemeNoParam_UnitTest* self = |
|
735 new(ELeave) CWspHeaderWriter_AuthorizationSchemeNoParam_UnitTest(aDataLogger, |
|
736 aObserver); |
|
737 CleanupStack::PushL(self); |
|
738 self->ConstructL(); |
|
739 CleanupStack::Pop(self); |
|
740 return self; |
|
741 } |
|
742 |
|
743 inline TInt CWspHeaderWriter_AuthorizationSchemeNoParam_UnitTest::RunError(TInt aError) |
|
744 { |
|
745 // The RunL left so chain to the base first and then cleanup |
|
746 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
747 delete iUTContext; |
|
748 iUTContext = NULL; |
|
749 delete iStateAccessor; |
|
750 iStateAccessor = NULL; |
|
751 /* delete any validators used */ |
|
752 delete iCtorValidator; |
|
753 iCtorValidator = NULL; |
|
754 delete iAuthorizationSchemeNoParamValidator; |
|
755 iAuthorizationSchemeNoParamValidator = NULL; |
|
756 delete iDtorValidator; |
|
757 iDtorValidator = NULL; |
|
758 return error; |
|
759 } |
|
760 |
|
761 inline CWspHeaderWriter_AuthorizationSchemeNoParam_UnitTest::~CWspHeaderWriter_AuthorizationSchemeNoParam_UnitTest() |
|
762 { |
|
763 // Simply delete our test class instance |
|
764 delete iUTContext; |
|
765 delete iStateAccessor; |
|
766 /* delete any validators used */ |
|
767 delete iCtorValidator; |
|
768 delete iAuthorizationSchemeNoParamValidator; |
|
769 delete iDtorValidator; |
|
770 } |
|
771 |
|
772 inline CWspHeaderWriter_AuthorizationSchemeNoParam_UnitTest::CWspHeaderWriter_AuthorizationSchemeNoParam_UnitTest(CDataLogger& aDataLogger, |
|
773 MUnitTestObserver& aObserver) |
|
774 : CUnitTest(KWspHeaderWriterAuthorizationSchemeNoParamUnitTest, aDataLogger, aObserver) |
|
775 { |
|
776 //Do nothing |
|
777 } |
|
778 |
|
779 // Now the Individual transitions need to be added. |
|
780 inline void CWspHeaderWriter_AuthorizationSchemeNoParam_UnitTest::ConstructL() |
|
781 { |
|
782 // Perform the base class initialization |
|
783 UnitTestConstructL(); |
|
784 |
|
785 // Create the Unit test state accessor |
|
786 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
787 // Construct the Unit test context. |
|
788 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
789 iUTContext->ConstructL(WSP::EAuthorization); |
|
790 |
|
791 // Part1 |
|
792 _LIT8(KTxtScheme, "authscheme"); |
|
793 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtScheme); |
|
794 CleanupClosePushL(stringVal); |
|
795 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
796 CleanupStack::PushL(part1); |
|
797 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
798 CleanupStack::Pop(part1); |
|
799 CleanupStack::PopAndDestroy(&stringVal); |
|
800 |
|
801 TBuf8<256> expectedBuf; |
|
802 expectedBuf.Append(0x0B); // value-length for 11 |
|
803 expectedBuf.Append(KTxtScheme); |
|
804 expectedBuf.Append(0x00); |
|
805 iUTContext->SetExpectedL(expectedBuf); |
|
806 |
|
807 // Add the Transitions in the order they are to run |
|
808 // C'tor first, D'tor last... |
|
809 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
810 using constructor and destuctor validators */ |
|
811 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
812 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
813 iAuthorizationSchemeNoParamValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
814 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAuthorizationSchemeNoParamValidator)); |
|
815 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
816 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
817 } |
|
818 |
|
819 // ______________________________________________________________________________ |
|
820 // |
|
821 _LIT(KWspHeaderWriterAuthorizationInvalidSchemeTokenUnitTest,"CWspHeaderWriter_AuthorizationInvalidSchemeToken_UnitTest"); |
|
822 |
|
823 CWspHeaderWriter_AuthorizationInvalidSchemeToken_UnitTest* CWspHeaderWriter_AuthorizationInvalidSchemeToken_UnitTest::NewL(CDataLogger& aDataLogger, |
|
824 MUnitTestObserver& aObserver) |
|
825 { |
|
826 CWspHeaderWriter_AuthorizationInvalidSchemeToken_UnitTest* self = |
|
827 new(ELeave) CWspHeaderWriter_AuthorizationInvalidSchemeToken_UnitTest(aDataLogger, |
|
828 aObserver); |
|
829 CleanupStack::PushL(self); |
|
830 self->ConstructL(); |
|
831 CleanupStack::Pop(self); |
|
832 return self; |
|
833 } |
|
834 |
|
835 inline TInt CWspHeaderWriter_AuthorizationInvalidSchemeToken_UnitTest::RunError(TInt aError) |
|
836 { |
|
837 // The RunL left so chain to the base first and then cleanup |
|
838 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
839 delete iUTContext; |
|
840 iUTContext = NULL; |
|
841 delete iStateAccessor; |
|
842 iStateAccessor = NULL; |
|
843 /* delete any validators used */ |
|
844 delete iCtorValidator; |
|
845 iCtorValidator = NULL; |
|
846 delete iAuthorizationInvalidSchemeTokenValidator; |
|
847 iAuthorizationInvalidSchemeTokenValidator = NULL; |
|
848 delete iDtorValidator; |
|
849 iDtorValidator = NULL; |
|
850 return error; |
|
851 } |
|
852 |
|
853 inline CWspHeaderWriter_AuthorizationInvalidSchemeToken_UnitTest::~CWspHeaderWriter_AuthorizationInvalidSchemeToken_UnitTest() |
|
854 { |
|
855 // Simply delete our test class instance |
|
856 delete iUTContext; |
|
857 delete iStateAccessor; |
|
858 /* delete any validators used */ |
|
859 delete iCtorValidator; |
|
860 delete iAuthorizationInvalidSchemeTokenValidator; |
|
861 delete iDtorValidator; |
|
862 } |
|
863 |
|
864 inline CWspHeaderWriter_AuthorizationInvalidSchemeToken_UnitTest::CWspHeaderWriter_AuthorizationInvalidSchemeToken_UnitTest(CDataLogger& aDataLogger, |
|
865 MUnitTestObserver& aObserver) |
|
866 : CUnitTest(KWspHeaderWriterAuthorizationInvalidSchemeTokenUnitTest, aDataLogger, aObserver) |
|
867 { |
|
868 //Do nothing |
|
869 } |
|
870 |
|
871 // Now the Individual transitions need to be added. |
|
872 inline void CWspHeaderWriter_AuthorizationInvalidSchemeToken_UnitTest::ConstructL() |
|
873 { |
|
874 // Perform the base class initialization |
|
875 UnitTestConstructL(); |
|
876 |
|
877 // Create the Unit test state accessor |
|
878 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
879 // Construct the Unit test context. |
|
880 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
881 iUTContext->ConstructL(WSP::EAuthorization); |
|
882 |
|
883 // Part1 |
|
884 _LIT8(KTxtScheme, "auth@scheme"); |
|
885 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtScheme); |
|
886 CleanupClosePushL(stringVal); |
|
887 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
888 CleanupStack::PushL(part1); |
|
889 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
890 CleanupStack::Pop(part1); |
|
891 CleanupStack::PopAndDestroy(&stringVal); |
|
892 |
|
893 TBuf8<256> expectedBuf; |
|
894 _LIT8(KTxtExpected, "-20"); |
|
895 expectedBuf.Append(KTxtExpected); |
|
896 iUTContext->SetExpectedL(expectedBuf); |
|
897 |
|
898 // Add the Transitions in the order they are to run |
|
899 // C'tor first, D'tor last... |
|
900 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
901 using constructor and destuctor validators */ |
|
902 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
903 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
904 iAuthorizationInvalidSchemeTokenValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
905 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderLTrap_Transition(*iUTContext,*iAuthorizationInvalidSchemeTokenValidator)); |
|
906 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
907 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
908 } |
|
909 |
|
910 // ______________________________________________________________________________ |
|
911 // |
|
912 _LIT(KWspHeaderWriterAuthorizationScheme2ParamsUnitTest,"CWspHeaderWriter_AuthorizationScheme2Params_UnitTest"); |
|
913 |
|
914 CWspHeaderWriter_AuthorizationScheme2Params_UnitTest* CWspHeaderWriter_AuthorizationScheme2Params_UnitTest::NewL(CDataLogger& aDataLogger, |
|
915 MUnitTestObserver& aObserver) |
|
916 { |
|
917 CWspHeaderWriter_AuthorizationScheme2Params_UnitTest* self = |
|
918 new(ELeave) CWspHeaderWriter_AuthorizationScheme2Params_UnitTest(aDataLogger, |
|
919 aObserver); |
|
920 CleanupStack::PushL(self); |
|
921 self->ConstructL(); |
|
922 CleanupStack::Pop(self); |
|
923 return self; |
|
924 } |
|
925 |
|
926 inline TInt CWspHeaderWriter_AuthorizationScheme2Params_UnitTest::RunError(TInt aError) |
|
927 { |
|
928 // The RunL left so chain to the base first and then cleanup |
|
929 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
930 delete iUTContext; |
|
931 iUTContext = NULL; |
|
932 delete iStateAccessor; |
|
933 iStateAccessor = NULL; |
|
934 /* delete any validators used */ |
|
935 delete iCtorValidator; |
|
936 iCtorValidator = NULL; |
|
937 delete iAuthorizationScheme2ParamsValidator; |
|
938 iAuthorizationScheme2ParamsValidator = NULL; |
|
939 delete iDtorValidator; |
|
940 iDtorValidator = NULL; |
|
941 return error; |
|
942 } |
|
943 |
|
944 inline CWspHeaderWriter_AuthorizationScheme2Params_UnitTest::~CWspHeaderWriter_AuthorizationScheme2Params_UnitTest() |
|
945 { |
|
946 // Simply delete our test class instance |
|
947 delete iUTContext; |
|
948 delete iStateAccessor; |
|
949 /* delete any validators used */ |
|
950 delete iCtorValidator; |
|
951 delete iAuthorizationScheme2ParamsValidator; |
|
952 delete iDtorValidator; |
|
953 } |
|
954 |
|
955 inline CWspHeaderWriter_AuthorizationScheme2Params_UnitTest::CWspHeaderWriter_AuthorizationScheme2Params_UnitTest(CDataLogger& aDataLogger, |
|
956 MUnitTestObserver& aObserver) |
|
957 : CUnitTest(KWspHeaderWriterAuthorizationScheme2ParamsUnitTest, aDataLogger, aObserver) |
|
958 { |
|
959 //Do nothing |
|
960 } |
|
961 |
|
962 // Now the Individual transitions need to be added. |
|
963 inline void CWspHeaderWriter_AuthorizationScheme2Params_UnitTest::ConstructL() |
|
964 { |
|
965 // Perform the base class initialization |
|
966 UnitTestConstructL(); |
|
967 |
|
968 // Create the Unit test state accessor |
|
969 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
970 // Construct the Unit test context. |
|
971 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
972 iUTContext->ConstructL(WSP::EAuthorization); |
|
973 |
|
974 // Part1 |
|
975 _LIT8(KTxtScheme, "authscheme"); |
|
976 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtScheme); |
|
977 CleanupClosePushL(stringVal); |
|
978 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
979 CleanupStack::PushL(part1); |
|
980 |
|
981 // Param1 |
|
982 _LIT8(KTxtParam1Name, "Name"); |
|
983 _LIT8(KTxtParam1Value, "myname"); |
|
984 RStringF paramName1 = iUTContext->iStrPool.OpenFStringL(KTxtParam1Name); |
|
985 CleanupClosePushL(paramName1); |
|
986 RStringF paramValueStr1 = iUTContext->iStrPool.OpenFStringL(KTxtParam1Value); |
|
987 CleanupClosePushL(paramValueStr1); |
|
988 THTTPHdrVal paramValue1(paramValueStr1); |
|
989 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(paramName1, paramValue1); |
|
990 CleanupStack::PushL(param1); |
|
991 part1->AddParamL(param1); |
|
992 CleanupStack::Pop(param1); |
|
993 |
|
994 // Param2 |
|
995 _LIT8(KTxtParam2Name, "Q"); |
|
996 _LIT8(KTxtParam2Value, "0.333"); |
|
997 RStringF paramName2 = iUTContext->iStrPool.OpenFStringL(KTxtParam2Name); |
|
998 CleanupClosePushL(paramName2); |
|
999 RStringF paramValueStr2 = iUTContext->iStrPool.OpenFStringL(KTxtParam2Value); |
|
1000 CleanupClosePushL(paramValueStr2); |
|
1001 THTTPHdrVal paramValue2(paramValueStr2); |
|
1002 CHeaderFieldParam* param2 = CHeaderFieldParam::NewL(paramName2, paramValue2); |
|
1003 CleanupStack::PushL(param2); |
|
1004 part1->AddParamL(param2); |
|
1005 CleanupStack::Pop(param2); |
|
1006 |
|
1007 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
1008 CleanupStack::PopAndDestroy(4, ¶mName1); |
|
1009 CleanupStack::Pop(part1); |
|
1010 CleanupStack::PopAndDestroy(&stringVal); |
|
1011 |
|
1012 TBuf8<256> expectedBuf; |
|
1013 expectedBuf.Append(0x16); // value length for 22 |
|
1014 expectedBuf.Append(KTxtScheme); |
|
1015 expectedBuf.Append(0x00); |
|
1016 expectedBuf.Append(0x97); // token for param1 "Name" using encoding version 1.4 |
|
1017 expectedBuf.Append(KTxtParam1Value); |
|
1018 expectedBuf.Append(0x00); |
|
1019 expectedBuf.Append(0x80); // token for param2 "Q" |
|
1020 expectedBuf.Append(0x83); // encoding for 0.333... |
|
1021 expectedBuf.Append(0x31); // ... |
|
1022 iUTContext->SetExpectedL(expectedBuf); |
|
1023 |
|
1024 // Add the Transitions in the order they are to run |
|
1025 // C'tor first, D'tor last... |
|
1026 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
1027 using constructor and destuctor validators */ |
|
1028 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
1029 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
1030 iAuthorizationScheme2ParamsValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
1031 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAuthorizationScheme2ParamsValidator)); |
|
1032 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
1033 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
1034 } |
|
1035 |
|
1036 // ______________________________________________________________________________ |
|
1037 // |
|
1038 _LIT(KWspHeaderWriterAuthorizationScheme2ParamV1_2UnitTest,"CWspHeaderWriter_AuthorizationScheme2ParamV1_2_UnitTest"); |
|
1039 |
|
1040 CWspHeaderWriter_AuthorizationScheme2ParamV1_2_UnitTest* CWspHeaderWriter_AuthorizationScheme2ParamV1_2_UnitTest::NewL(CDataLogger& aDataLogger, |
|
1041 MUnitTestObserver& aObserver) |
|
1042 { |
|
1043 CWspHeaderWriter_AuthorizationScheme2ParamV1_2_UnitTest* self = |
|
1044 new(ELeave) CWspHeaderWriter_AuthorizationScheme2ParamV1_2_UnitTest(aDataLogger, |
|
1045 aObserver); |
|
1046 CleanupStack::PushL(self); |
|
1047 self->ConstructL(); |
|
1048 CleanupStack::Pop(self); |
|
1049 return self; |
|
1050 } |
|
1051 |
|
1052 inline TInt CWspHeaderWriter_AuthorizationScheme2ParamV1_2_UnitTest::RunError(TInt aError) |
|
1053 { |
|
1054 // The RunL left so chain to the base first and then cleanup |
|
1055 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
1056 delete iUTContext; |
|
1057 iUTContext = NULL; |
|
1058 delete iStateAccessor; |
|
1059 iStateAccessor = NULL; |
|
1060 /* delete any validators used */ |
|
1061 delete iCtorValidator; |
|
1062 iCtorValidator = NULL; |
|
1063 delete iAuthorizationScheme2ParamV1_2Validator; |
|
1064 iAuthorizationScheme2ParamV1_2Validator = NULL; |
|
1065 delete iDtorValidator; |
|
1066 iDtorValidator = NULL; |
|
1067 return error; |
|
1068 } |
|
1069 |
|
1070 inline CWspHeaderWriter_AuthorizationScheme2ParamV1_2_UnitTest::~CWspHeaderWriter_AuthorizationScheme2ParamV1_2_UnitTest() |
|
1071 { |
|
1072 // Simply delete our test class instance |
|
1073 delete iUTContext; |
|
1074 delete iStateAccessor; |
|
1075 /* delete any validators used */ |
|
1076 delete iCtorValidator; |
|
1077 delete iAuthorizationScheme2ParamV1_2Validator; |
|
1078 delete iDtorValidator; |
|
1079 } |
|
1080 |
|
1081 inline CWspHeaderWriter_AuthorizationScheme2ParamV1_2_UnitTest::CWspHeaderWriter_AuthorizationScheme2ParamV1_2_UnitTest(CDataLogger& aDataLogger, |
|
1082 MUnitTestObserver& aObserver) |
|
1083 : CUnitTest(KWspHeaderWriterAuthorizationScheme2ParamV1_2UnitTest, aDataLogger, aObserver) |
|
1084 { |
|
1085 //Do nothing |
|
1086 } |
|
1087 |
|
1088 // Now the Individual transitions need to be added. |
|
1089 inline void CWspHeaderWriter_AuthorizationScheme2ParamV1_2_UnitTest::ConstructL() |
|
1090 { |
|
1091 // Perform the base class initialization |
|
1092 UnitTestConstructL(); |
|
1093 |
|
1094 // Create the Unit test state accessor |
|
1095 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
1096 // Construct the Unit test context. |
|
1097 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
1098 iUTContext->ConstructL(WSP::EAuthorization); |
|
1099 (REINTERPRET_CAST(CWspHeaderCodec*, iUTContext->iCodec))->SetWspVersion(CWspHeaderCodec::EVersion1_2); |
|
1100 |
|
1101 // Part1 |
|
1102 _LIT8(KTxtScheme, "authscheme"); |
|
1103 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtScheme); |
|
1104 CleanupClosePushL(stringVal); |
|
1105 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
1106 CleanupStack::PushL(part1); |
|
1107 |
|
1108 // Param1 |
|
1109 _LIT8(KTxtParam1Name, "Name"); |
|
1110 _LIT8(KTxtParam1Value, "myname"); |
|
1111 RStringF paramName1 = iUTContext->iStrPool.OpenFStringL(KTxtParam1Name); |
|
1112 CleanupClosePushL(paramName1); |
|
1113 RStringF paramValueStr1 = iUTContext->iStrPool.OpenFStringL(KTxtParam1Value); |
|
1114 CleanupClosePushL(paramValueStr1); |
|
1115 THTTPHdrVal paramValue1(paramValueStr1); |
|
1116 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(paramName1, paramValue1); |
|
1117 CleanupStack::PushL(param1); |
|
1118 part1->AddParamL(param1); |
|
1119 CleanupStack::Pop(param1); |
|
1120 |
|
1121 // Param2 |
|
1122 _LIT8(KTxtParam2Name, "Q"); |
|
1123 _LIT8(KTxtParam2Value, "0.333"); |
|
1124 RStringF paramName2 = iUTContext->iStrPool.OpenFStringL(KTxtParam2Name); |
|
1125 CleanupClosePushL(paramName2); |
|
1126 RStringF paramValueStr2 = iUTContext->iStrPool.OpenFStringL(KTxtParam2Value); |
|
1127 CleanupClosePushL(paramValueStr2); |
|
1128 THTTPHdrVal paramValue2(paramValueStr2); |
|
1129 CHeaderFieldParam* param2 = CHeaderFieldParam::NewL(paramName2, paramValue2); |
|
1130 CleanupStack::PushL(param2); |
|
1131 part1->AddParamL(param2); |
|
1132 CleanupStack::Pop(param2); |
|
1133 |
|
1134 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
1135 CleanupStack::PopAndDestroy(4, ¶mName1); |
|
1136 CleanupStack::Pop(part1); |
|
1137 CleanupStack::PopAndDestroy(&stringVal); |
|
1138 |
|
1139 TBuf8<256> expectedBuf; |
|
1140 expectedBuf.Append(0x16); // value length for 22 |
|
1141 expectedBuf.Append(KTxtScheme); |
|
1142 expectedBuf.Append(0x00); |
|
1143 expectedBuf.Append(0x85); // token for param1 "Name" using encoding version 1.2 |
|
1144 expectedBuf.Append(KTxtParam1Value); |
|
1145 expectedBuf.Append(0x00); |
|
1146 expectedBuf.Append(0x80); // token for param2 "Q" |
|
1147 expectedBuf.Append(0x83); // encoding for 0.333... |
|
1148 expectedBuf.Append(0x31); // ... |
|
1149 iUTContext->SetExpectedL(expectedBuf); |
|
1150 |
|
1151 // Add the Transitions in the order they are to run |
|
1152 // C'tor first, D'tor last... |
|
1153 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
1154 using constructor and destuctor validators */ |
|
1155 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
1156 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
1157 iAuthorizationScheme2ParamV1_2Validator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
1158 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAuthorizationScheme2ParamV1_2Validator)); |
|
1159 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
1160 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
1161 } |
|
1162 |
|
1163 // ______________________________________________________________________________ |
|
1164 // |
|
1165 _LIT(KWspHeaderWriterContentLocationUnitTest,"CWspHeaderWriter_ContentLocation_UnitTest"); |
|
1166 |
|
1167 CWspHeaderWriter_ContentLocation_UnitTest* CWspHeaderWriter_ContentLocation_UnitTest::NewL(CDataLogger& aDataLogger, |
|
1168 MUnitTestObserver& aObserver) |
|
1169 { |
|
1170 CWspHeaderWriter_ContentLocation_UnitTest* self = |
|
1171 new(ELeave) CWspHeaderWriter_ContentLocation_UnitTest(aDataLogger, |
|
1172 aObserver); |
|
1173 CleanupStack::PushL(self); |
|
1174 self->ConstructL(); |
|
1175 CleanupStack::Pop(self); |
|
1176 return self; |
|
1177 } |
|
1178 |
|
1179 inline TInt CWspHeaderWriter_ContentLocation_UnitTest::RunError(TInt aError) |
|
1180 { |
|
1181 // The RunL left so chain to the base first and then cleanup |
|
1182 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
1183 delete iUTContext; |
|
1184 iUTContext = NULL; |
|
1185 delete iStateAccessor; |
|
1186 iStateAccessor = NULL; |
|
1187 /* delete any validators used */ |
|
1188 delete iCtorValidator; |
|
1189 iCtorValidator = NULL; |
|
1190 delete iContentLocationValidator; |
|
1191 iContentLocationValidator = NULL; |
|
1192 delete iDtorValidator; |
|
1193 iDtorValidator = NULL; |
|
1194 return error; |
|
1195 } |
|
1196 |
|
1197 inline CWspHeaderWriter_ContentLocation_UnitTest::~CWspHeaderWriter_ContentLocation_UnitTest() |
|
1198 { |
|
1199 // Simply delete our test class instance |
|
1200 delete iUTContext; |
|
1201 delete iStateAccessor; |
|
1202 /* delete any validators used */ |
|
1203 delete iCtorValidator; |
|
1204 delete iContentLocationValidator; |
|
1205 delete iDtorValidator; |
|
1206 } |
|
1207 |
|
1208 inline CWspHeaderWriter_ContentLocation_UnitTest::CWspHeaderWriter_ContentLocation_UnitTest(CDataLogger& aDataLogger, |
|
1209 MUnitTestObserver& aObserver) |
|
1210 : CUnitTest(KWspHeaderWriterContentLocationUnitTest, aDataLogger, aObserver) |
|
1211 { |
|
1212 //Do nothing |
|
1213 } |
|
1214 |
|
1215 // Now the Individual transitions need to be added. |
|
1216 inline void CWspHeaderWriter_ContentLocation_UnitTest::ConstructL() |
|
1217 { |
|
1218 // Perform the base class initialization |
|
1219 UnitTestConstructL(); |
|
1220 |
|
1221 // Create the Unit test state accessor |
|
1222 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
1223 // Construct the Unit test context. |
|
1224 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
1225 iUTContext->ConstructL(WSP::EContentLocation); |
|
1226 |
|
1227 // Part1 |
|
1228 _LIT8(KTxtUri, "http://www.symbian.com"); |
|
1229 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtUri); |
|
1230 CleanupClosePushL(stringVal); |
|
1231 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
1232 CleanupStack::PushL(part1); |
|
1233 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
1234 CleanupStack::Pop(part1); |
|
1235 CleanupStack::PopAndDestroy(&stringVal); |
|
1236 |
|
1237 TBuf8<256> expectedBuf; |
|
1238 expectedBuf.Append(KTxtUri); |
|
1239 expectedBuf.Append(0x00); |
|
1240 iUTContext->SetExpectedL(expectedBuf); |
|
1241 |
|
1242 // Add the Transitions in the order they are to run |
|
1243 // C'tor first, D'tor last... |
|
1244 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
1245 using constructor and destuctor validators */ |
|
1246 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
1247 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
1248 iContentLocationValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
1249 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentLocationValidator)); |
|
1250 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
1251 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
1252 } |
|
1253 |
|
1254 // ______________________________________________________________________________ |
|
1255 // |
|
1256 _LIT(KWspHeaderWriterContentLocationNullTextUnitTest,"CWspHeaderWriter_ContentLocationNullText_UnitTest"); |
|
1257 |
|
1258 CWspHeaderWriter_ContentLocationNullText_UnitTest* CWspHeaderWriter_ContentLocationNullText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
1259 MUnitTestObserver& aObserver) |
|
1260 { |
|
1261 CWspHeaderWriter_ContentLocationNullText_UnitTest* self = |
|
1262 new(ELeave) CWspHeaderWriter_ContentLocationNullText_UnitTest(aDataLogger, |
|
1263 aObserver); |
|
1264 CleanupStack::PushL(self); |
|
1265 self->ConstructL(); |
|
1266 CleanupStack::Pop(self); |
|
1267 return self; |
|
1268 } |
|
1269 |
|
1270 inline TInt CWspHeaderWriter_ContentLocationNullText_UnitTest::RunError(TInt aError) |
|
1271 { |
|
1272 // The RunL left so chain to the base first and then cleanup |
|
1273 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
1274 delete iUTContext; |
|
1275 iUTContext = NULL; |
|
1276 delete iStateAccessor; |
|
1277 iStateAccessor = NULL; |
|
1278 /* delete any validators used */ |
|
1279 delete iCtorValidator; |
|
1280 iCtorValidator = NULL; |
|
1281 delete iContentLocationNullTextValidator; |
|
1282 iContentLocationNullTextValidator = NULL; |
|
1283 delete iDtorValidator; |
|
1284 iDtorValidator = NULL; |
|
1285 return error; |
|
1286 } |
|
1287 |
|
1288 inline CWspHeaderWriter_ContentLocationNullText_UnitTest::~CWspHeaderWriter_ContentLocationNullText_UnitTest() |
|
1289 { |
|
1290 // Simply delete our test class instance |
|
1291 delete iUTContext; |
|
1292 delete iStateAccessor; |
|
1293 /* delete any validators used */ |
|
1294 delete iCtorValidator; |
|
1295 delete iContentLocationNullTextValidator; |
|
1296 delete iDtorValidator; |
|
1297 } |
|
1298 |
|
1299 inline CWspHeaderWriter_ContentLocationNullText_UnitTest::CWspHeaderWriter_ContentLocationNullText_UnitTest(CDataLogger& aDataLogger, |
|
1300 MUnitTestObserver& aObserver) |
|
1301 : CUnitTest(KWspHeaderWriterContentLocationNullTextUnitTest, aDataLogger, aObserver) |
|
1302 { |
|
1303 //Do nothing |
|
1304 } |
|
1305 |
|
1306 // Now the Individual transitions need to be added. |
|
1307 inline void CWspHeaderWriter_ContentLocationNullText_UnitTest::ConstructL() |
|
1308 { |
|
1309 // Perform the base class initialization |
|
1310 UnitTestConstructL(); |
|
1311 |
|
1312 // Create the Unit test state accessor |
|
1313 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
1314 // Construct the Unit test context. |
|
1315 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
1316 iUTContext->ConstructL(WSP::EContentLocation); |
|
1317 |
|
1318 // Part1 |
|
1319 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KNullDesC8()); |
|
1320 CleanupClosePushL(stringVal); |
|
1321 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
1322 CleanupStack::PushL(part1); |
|
1323 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
1324 CleanupStack::Pop(part1); |
|
1325 CleanupStack::PopAndDestroy(&stringVal); |
|
1326 |
|
1327 TBuf8<256> expectedBuf; |
|
1328 expectedBuf.Append(0x00); |
|
1329 iUTContext->SetExpectedL(expectedBuf); |
|
1330 |
|
1331 // Add the Transitions in the order they are to run |
|
1332 // C'tor first, D'tor last... |
|
1333 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
1334 using constructor and destuctor validators */ |
|
1335 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
1336 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
1337 iContentLocationNullTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
1338 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentLocationNullTextValidator)); |
|
1339 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
1340 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
1341 } |
|
1342 |
|
1343 // ______________________________________________________________________________ |
|
1344 // |
|
1345 _LIT(KWspHeaderWriterContentTypeShortIntUnitTest,"CWspHeaderWriter_ContentTypeShortInt_UnitTest"); |
|
1346 |
|
1347 CWspHeaderWriter_ContentTypeShortInt_UnitTest* CWspHeaderWriter_ContentTypeShortInt_UnitTest::NewL(CDataLogger& aDataLogger, |
|
1348 MUnitTestObserver& aObserver) |
|
1349 { |
|
1350 CWspHeaderWriter_ContentTypeShortInt_UnitTest* self = |
|
1351 new(ELeave) CWspHeaderWriter_ContentTypeShortInt_UnitTest(aDataLogger, |
|
1352 aObserver); |
|
1353 CleanupStack::PushL(self); |
|
1354 self->ConstructL(); |
|
1355 CleanupStack::Pop(self); |
|
1356 return self; |
|
1357 } |
|
1358 |
|
1359 inline TInt CWspHeaderWriter_ContentTypeShortInt_UnitTest::RunError(TInt aError) |
|
1360 { |
|
1361 // The RunL left so chain to the base first and then cleanup |
|
1362 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
1363 delete iUTContext; |
|
1364 iUTContext = NULL; |
|
1365 delete iStateAccessor; |
|
1366 iStateAccessor = NULL; |
|
1367 /* delete any validators used */ |
|
1368 delete iCtorValidator; |
|
1369 iCtorValidator = NULL; |
|
1370 delete iContentTypeShortIntValidator; |
|
1371 iContentTypeShortIntValidator = NULL; |
|
1372 delete iDtorValidator; |
|
1373 iDtorValidator = NULL; |
|
1374 return error; |
|
1375 } |
|
1376 |
|
1377 inline CWspHeaderWriter_ContentTypeShortInt_UnitTest::~CWspHeaderWriter_ContentTypeShortInt_UnitTest() |
|
1378 { |
|
1379 // Simply delete our test class instance |
|
1380 delete iUTContext; |
|
1381 delete iStateAccessor; |
|
1382 /* delete any validators used */ |
|
1383 delete iCtorValidator; |
|
1384 delete iContentTypeShortIntValidator; |
|
1385 delete iDtorValidator; |
|
1386 } |
|
1387 |
|
1388 inline CWspHeaderWriter_ContentTypeShortInt_UnitTest::CWspHeaderWriter_ContentTypeShortInt_UnitTest(CDataLogger& aDataLogger, |
|
1389 MUnitTestObserver& aObserver) |
|
1390 : CUnitTest(KWspHeaderWriterContentTypeShortIntUnitTest, aDataLogger, aObserver) |
|
1391 { |
|
1392 //Do nothing |
|
1393 } |
|
1394 |
|
1395 // Now the Individual transitions need to be added. |
|
1396 inline void CWspHeaderWriter_ContentTypeShortInt_UnitTest::ConstructL() |
|
1397 { |
|
1398 // Perform the base class initialization |
|
1399 UnitTestConstructL(); |
|
1400 |
|
1401 // Create the Unit test state accessor |
|
1402 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
1403 // Construct the Unit test context. |
|
1404 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
1405 iUTContext->ConstructL(WSP::EContentType); |
|
1406 |
|
1407 // Part1 |
|
1408 _LIT8(KTxtTypeToken, "application/vnd.wap.wbxml"); |
|
1409 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTypeToken); |
|
1410 CleanupClosePushL(stringVal); |
|
1411 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
1412 CleanupStack::PushL(part1); |
|
1413 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
1414 CleanupStack::Pop(part1); |
|
1415 CleanupStack::PopAndDestroy(&stringVal); |
|
1416 |
|
1417 TBuf8<256> expectedBuf; |
|
1418 expectedBuf.Append(0xA9); // encoded token for type above with top bit set |
|
1419 iUTContext->SetExpectedL(expectedBuf); |
|
1420 |
|
1421 // Add the Transitions in the order they are to run |
|
1422 // C'tor first, D'tor last... |
|
1423 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
1424 using constructor and destuctor validators */ |
|
1425 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
1426 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
1427 iContentTypeShortIntValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
1428 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentTypeShortIntValidator)); |
|
1429 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
1430 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
1431 } |
|
1432 |
|
1433 // ______________________________________________________________________________ |
|
1434 // |
|
1435 _LIT(KWspHeaderWriterContentTypeConstrainedTextUnitTest,"CWspHeaderWriter_ContentTypeConstrainedText_UnitTest"); |
|
1436 |
|
1437 CWspHeaderWriter_ContentTypeConstrainedText_UnitTest* CWspHeaderWriter_ContentTypeConstrainedText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
1438 MUnitTestObserver& aObserver) |
|
1439 { |
|
1440 CWspHeaderWriter_ContentTypeConstrainedText_UnitTest* self = |
|
1441 new(ELeave) CWspHeaderWriter_ContentTypeConstrainedText_UnitTest(aDataLogger, |
|
1442 aObserver); |
|
1443 CleanupStack::PushL(self); |
|
1444 self->ConstructL(); |
|
1445 CleanupStack::Pop(self); |
|
1446 return self; |
|
1447 } |
|
1448 |
|
1449 inline TInt CWspHeaderWriter_ContentTypeConstrainedText_UnitTest::RunError(TInt aError) |
|
1450 { |
|
1451 // The RunL left so chain to the base first and then cleanup |
|
1452 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
1453 delete iUTContext; |
|
1454 iUTContext = NULL; |
|
1455 delete iStateAccessor; |
|
1456 iStateAccessor = NULL; |
|
1457 /* delete any validators used */ |
|
1458 delete iCtorValidator; |
|
1459 iCtorValidator = NULL; |
|
1460 delete iContentTypeConstrainedTextValidator; |
|
1461 iContentTypeConstrainedTextValidator = NULL; |
|
1462 delete iDtorValidator; |
|
1463 iDtorValidator = NULL; |
|
1464 return error; |
|
1465 } |
|
1466 |
|
1467 inline CWspHeaderWriter_ContentTypeConstrainedText_UnitTest::~CWspHeaderWriter_ContentTypeConstrainedText_UnitTest() |
|
1468 { |
|
1469 // Simply delete our test class instance |
|
1470 delete iUTContext; |
|
1471 delete iStateAccessor; |
|
1472 /* delete any validators used */ |
|
1473 delete iCtorValidator; |
|
1474 delete iContentTypeConstrainedTextValidator; |
|
1475 delete iDtorValidator; |
|
1476 } |
|
1477 |
|
1478 inline CWspHeaderWriter_ContentTypeConstrainedText_UnitTest::CWspHeaderWriter_ContentTypeConstrainedText_UnitTest(CDataLogger& aDataLogger, |
|
1479 MUnitTestObserver& aObserver) |
|
1480 : CUnitTest(KWspHeaderWriterContentTypeConstrainedTextUnitTest, aDataLogger, aObserver) |
|
1481 { |
|
1482 //Do nothing |
|
1483 } |
|
1484 |
|
1485 // Now the Individual transitions need to be added. |
|
1486 inline void CWspHeaderWriter_ContentTypeConstrainedText_UnitTest::ConstructL() |
|
1487 { |
|
1488 // Perform the base class initialization |
|
1489 UnitTestConstructL(); |
|
1490 |
|
1491 // Create the Unit test state accessor |
|
1492 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
1493 // Construct the Unit test context. |
|
1494 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
1495 iUTContext->ConstructL(WSP::EContentType); |
|
1496 |
|
1497 // Part1 |
|
1498 _LIT8(KTxtTypeToken, "application/my-app.exe"); |
|
1499 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTypeToken); |
|
1500 CleanupClosePushL(stringVal); |
|
1501 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
1502 CleanupStack::PushL(part1); |
|
1503 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
1504 CleanupStack::Pop(part1); |
|
1505 CleanupStack::PopAndDestroy(&stringVal); |
|
1506 |
|
1507 TBuf8<256> expectedBuf; |
|
1508 expectedBuf.Append(KTxtTypeToken); |
|
1509 expectedBuf.Append(0x00); |
|
1510 iUTContext->SetExpectedL(expectedBuf); |
|
1511 |
|
1512 // Add the Transitions in the order they are to run |
|
1513 // C'tor first, D'tor last... |
|
1514 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
1515 using constructor and destuctor validators */ |
|
1516 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
1517 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
1518 iContentTypeConstrainedTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
1519 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentTypeConstrainedTextValidator)); |
|
1520 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
1521 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
1522 } |
|
1523 |
|
1524 // ______________________________________________________________________________ |
|
1525 // |
|
1526 _LIT(KWspHeaderWriterContentTypeConstrainedNullTextUnitTest,"CWspHeaderWriter_ContentTypeConstrainedNullText_UnitTest"); |
|
1527 |
|
1528 CWspHeaderWriter_ContentTypeConstrainedNullText_UnitTest* CWspHeaderWriter_ContentTypeConstrainedNullText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
1529 MUnitTestObserver& aObserver) |
|
1530 { |
|
1531 CWspHeaderWriter_ContentTypeConstrainedNullText_UnitTest* self = |
|
1532 new(ELeave) CWspHeaderWriter_ContentTypeConstrainedNullText_UnitTest(aDataLogger, |
|
1533 aObserver); |
|
1534 CleanupStack::PushL(self); |
|
1535 self->ConstructL(); |
|
1536 CleanupStack::Pop(self); |
|
1537 return self; |
|
1538 } |
|
1539 |
|
1540 inline TInt CWspHeaderWriter_ContentTypeConstrainedNullText_UnitTest::RunError(TInt aError) |
|
1541 { |
|
1542 // The RunL left so chain to the base first and then cleanup |
|
1543 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
1544 delete iUTContext; |
|
1545 iUTContext = NULL; |
|
1546 delete iStateAccessor; |
|
1547 iStateAccessor = NULL; |
|
1548 /* delete any validators used */ |
|
1549 delete iCtorValidator; |
|
1550 iCtorValidator = NULL; |
|
1551 delete iContentTypeConstrainedNullTextValidator; |
|
1552 iContentTypeConstrainedNullTextValidator = NULL; |
|
1553 delete iDtorValidator; |
|
1554 iDtorValidator = NULL; |
|
1555 return error; |
|
1556 } |
|
1557 |
|
1558 inline CWspHeaderWriter_ContentTypeConstrainedNullText_UnitTest::~CWspHeaderWriter_ContentTypeConstrainedNullText_UnitTest() |
|
1559 { |
|
1560 // Simply delete our test class instance |
|
1561 delete iUTContext; |
|
1562 delete iStateAccessor; |
|
1563 /* delete any validators used */ |
|
1564 delete iCtorValidator; |
|
1565 delete iContentTypeConstrainedNullTextValidator; |
|
1566 delete iDtorValidator; |
|
1567 } |
|
1568 |
|
1569 inline CWspHeaderWriter_ContentTypeConstrainedNullText_UnitTest::CWspHeaderWriter_ContentTypeConstrainedNullText_UnitTest(CDataLogger& aDataLogger, |
|
1570 MUnitTestObserver& aObserver) |
|
1571 : CUnitTest(KWspHeaderWriterContentTypeConstrainedNullTextUnitTest, aDataLogger, aObserver) |
|
1572 { |
|
1573 //Do nothing |
|
1574 } |
|
1575 |
|
1576 // Now the Individual transitions need to be added. |
|
1577 inline void CWspHeaderWriter_ContentTypeConstrainedNullText_UnitTest::ConstructL() |
|
1578 { |
|
1579 // Perform the base class initialization |
|
1580 UnitTestConstructL(); |
|
1581 |
|
1582 // Create the Unit test state accessor |
|
1583 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
1584 // Construct the Unit test context. |
|
1585 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
1586 iUTContext->ConstructL(WSP::EContentType); |
|
1587 |
|
1588 // Part1 |
|
1589 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KNullDesC8); |
|
1590 CleanupClosePushL(stringVal); |
|
1591 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
1592 CleanupStack::PushL(part1); |
|
1593 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
1594 CleanupStack::Pop(part1); |
|
1595 CleanupStack::PopAndDestroy(&stringVal); |
|
1596 |
|
1597 TBuf8<256> expectedBuf; |
|
1598 expectedBuf.Append(0x00); |
|
1599 iUTContext->SetExpectedL(expectedBuf); |
|
1600 |
|
1601 // Add the Transitions in the order they are to run |
|
1602 // C'tor first, D'tor last... |
|
1603 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
1604 using constructor and destuctor validators */ |
|
1605 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
1606 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
1607 iContentTypeConstrainedNullTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
1608 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentTypeConstrainedNullTextValidator)); |
|
1609 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
1610 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
1611 } |
|
1612 |
|
1613 // ______________________________________________________________________________ |
|
1614 // |
|
1615 _LIT(KWspHeaderWriterContentTypeGeneralShortInt1ParamUnitTest,"CWspHeaderWriter_ContentTypeGeneralShortInt1Param_UnitTest"); |
|
1616 |
|
1617 CWspHeaderWriter_ContentTypeGeneralShortInt1Param_UnitTest* CWspHeaderWriter_ContentTypeGeneralShortInt1Param_UnitTest::NewL(CDataLogger& aDataLogger, |
|
1618 MUnitTestObserver& aObserver) |
|
1619 { |
|
1620 CWspHeaderWriter_ContentTypeGeneralShortInt1Param_UnitTest* self = |
|
1621 new(ELeave) CWspHeaderWriter_ContentTypeGeneralShortInt1Param_UnitTest(aDataLogger, |
|
1622 aObserver); |
|
1623 CleanupStack::PushL(self); |
|
1624 self->ConstructL(); |
|
1625 CleanupStack::Pop(self); |
|
1626 return self; |
|
1627 } |
|
1628 |
|
1629 inline TInt CWspHeaderWriter_ContentTypeGeneralShortInt1Param_UnitTest::RunError(TInt aError) |
|
1630 { |
|
1631 // The RunL left so chain to the base first and then cleanup |
|
1632 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
1633 delete iUTContext; |
|
1634 iUTContext = NULL; |
|
1635 delete iStateAccessor; |
|
1636 iStateAccessor = NULL; |
|
1637 /* delete any validators used */ |
|
1638 delete iCtorValidator; |
|
1639 iCtorValidator = NULL; |
|
1640 delete iContentTypeGeneralShortInt1ParamValidator; |
|
1641 iContentTypeGeneralShortInt1ParamValidator = NULL; |
|
1642 delete iDtorValidator; |
|
1643 iDtorValidator = NULL; |
|
1644 return error; |
|
1645 } |
|
1646 |
|
1647 inline CWspHeaderWriter_ContentTypeGeneralShortInt1Param_UnitTest::~CWspHeaderWriter_ContentTypeGeneralShortInt1Param_UnitTest() |
|
1648 { |
|
1649 // Simply delete our test class instance |
|
1650 delete iUTContext; |
|
1651 delete iStateAccessor; |
|
1652 /* delete any validators used */ |
|
1653 delete iCtorValidator; |
|
1654 delete iContentTypeGeneralShortInt1ParamValidator; |
|
1655 delete iDtorValidator; |
|
1656 } |
|
1657 |
|
1658 inline CWspHeaderWriter_ContentTypeGeneralShortInt1Param_UnitTest::CWspHeaderWriter_ContentTypeGeneralShortInt1Param_UnitTest(CDataLogger& aDataLogger, |
|
1659 MUnitTestObserver& aObserver) |
|
1660 : CUnitTest(KWspHeaderWriterContentTypeGeneralShortInt1ParamUnitTest, aDataLogger, aObserver) |
|
1661 { |
|
1662 //Do nothing |
|
1663 } |
|
1664 |
|
1665 // Now the Individual transitions need to be added. |
|
1666 inline void CWspHeaderWriter_ContentTypeGeneralShortInt1Param_UnitTest::ConstructL() |
|
1667 { |
|
1668 // Perform the base class initialization |
|
1669 UnitTestConstructL(); |
|
1670 |
|
1671 // Create the Unit test state accessor |
|
1672 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
1673 // Construct the Unit test context. |
|
1674 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
1675 iUTContext->ConstructL(WSP::EContentType); |
|
1676 |
|
1677 // Part1 |
|
1678 _LIT8(KTxtTypeToken, "application/*"); |
|
1679 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTypeToken); |
|
1680 CleanupClosePushL(stringVal); |
|
1681 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
1682 CleanupStack::PushL(part1); |
|
1683 |
|
1684 // Param1 |
|
1685 _LIT8(KTxtParam1Name, "Level"); |
|
1686 _LIT8(KTxtParam1Value, "1.1"); |
|
1687 RStringF param1Name = iUTContext->iStrPool.OpenFStringL(KTxtParam1Name); |
|
1688 CleanupClosePushL(param1Name); |
|
1689 RStringF param1Value = iUTContext->iStrPool.OpenFStringL(KTxtParam1Value); |
|
1690 CleanupClosePushL(param1Value); |
|
1691 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(param1Name, param1Value); |
|
1692 CleanupStack::PushL(param1); |
|
1693 part1->AddParamL(param1); |
|
1694 CleanupStack::Pop(param1); |
|
1695 |
|
1696 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
1697 CleanupStack::PopAndDestroy(2, ¶m1Name); |
|
1698 CleanupStack::Pop(part1); |
|
1699 CleanupStack::PopAndDestroy(&stringVal); |
|
1700 |
|
1701 TBuf8<256> expectedBuf; |
|
1702 expectedBuf.Append(0x03); // length value |
|
1703 expectedBuf.Append(0x90); // token for application |
|
1704 expectedBuf.Append(0x82); // token for value param |
|
1705 expectedBuf.Append(0x91); // token for version 1.1 |
|
1706 |
|
1707 iUTContext->SetExpectedL(expectedBuf); |
|
1708 |
|
1709 // Add the Transitions in the order they are to run |
|
1710 // C'tor first, D'tor last... |
|
1711 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
1712 using constructor and destuctor validators */ |
|
1713 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
1714 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
1715 iContentTypeGeneralShortInt1ParamValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
1716 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentTypeGeneralShortInt1ParamValidator)); |
|
1717 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
1718 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
1719 } |
|
1720 |
|
1721 // ______________________________________________________________________________ |
|
1722 // |
|
1723 _LIT(KWspHeaderWriterContentTypeGeneralLongIntUnitTest,"CWspHeaderWriter_ContentTypeGeneralLongInt_UnitTest"); |
|
1724 |
|
1725 CWspHeaderWriter_ContentTypeGeneralLongInt_UnitTest* CWspHeaderWriter_ContentTypeGeneralLongInt_UnitTest::NewL(CDataLogger& aDataLogger, |
|
1726 MUnitTestObserver& aObserver) |
|
1727 { |
|
1728 CWspHeaderWriter_ContentTypeGeneralLongInt_UnitTest* self = |
|
1729 new(ELeave) CWspHeaderWriter_ContentTypeGeneralLongInt_UnitTest(aDataLogger, |
|
1730 aObserver); |
|
1731 CleanupStack::PushL(self); |
|
1732 self->ConstructL(); |
|
1733 CleanupStack::Pop(self); |
|
1734 return self; |
|
1735 } |
|
1736 |
|
1737 inline TInt CWspHeaderWriter_ContentTypeGeneralLongInt_UnitTest::RunError(TInt aError) |
|
1738 { |
|
1739 // The RunL left so chain to the base first and then cleanup |
|
1740 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
1741 delete iUTContext; |
|
1742 iUTContext = NULL; |
|
1743 delete iStateAccessor; |
|
1744 iStateAccessor = NULL; |
|
1745 /* delete any validators used */ |
|
1746 delete iCtorValidator; |
|
1747 iCtorValidator = NULL; |
|
1748 delete iContentTypeGeneralLongIntValidator; |
|
1749 iContentTypeGeneralLongIntValidator = NULL; |
|
1750 delete iDtorValidator; |
|
1751 iDtorValidator = NULL; |
|
1752 return error; |
|
1753 } |
|
1754 |
|
1755 inline CWspHeaderWriter_ContentTypeGeneralLongInt_UnitTest::~CWspHeaderWriter_ContentTypeGeneralLongInt_UnitTest() |
|
1756 { |
|
1757 // Simply delete our test class instance |
|
1758 delete iUTContext; |
|
1759 delete iStateAccessor; |
|
1760 /* delete any validators used */ |
|
1761 delete iCtorValidator; |
|
1762 delete iContentTypeGeneralLongIntValidator; |
|
1763 delete iDtorValidator; |
|
1764 } |
|
1765 |
|
1766 inline CWspHeaderWriter_ContentTypeGeneralLongInt_UnitTest::CWspHeaderWriter_ContentTypeGeneralLongInt_UnitTest(CDataLogger& aDataLogger, |
|
1767 MUnitTestObserver& aObserver) |
|
1768 : CUnitTest(KWspHeaderWriterContentTypeGeneralLongIntUnitTest, aDataLogger, aObserver) |
|
1769 { |
|
1770 //Do nothing |
|
1771 } |
|
1772 |
|
1773 // Now the Individual transitions need to be added. |
|
1774 inline void CWspHeaderWriter_ContentTypeGeneralLongInt_UnitTest::ConstructL() |
|
1775 { |
|
1776 // Perform the base class initialization |
|
1777 UnitTestConstructL(); |
|
1778 |
|
1779 // Create the Unit test state accessor |
|
1780 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
1781 // Construct the Unit test context. |
|
1782 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
1783 iUTContext->ConstructL(WSP::EContentType); |
|
1784 |
|
1785 // Part1 |
|
1786 _LIT8(KTxtTypeToken, "application/vnd.nokia.syncset+wbxml"); |
|
1787 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTypeToken); |
|
1788 CleanupClosePushL(stringVal); |
|
1789 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
1790 CleanupStack::PushL(part1); |
|
1791 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
1792 CleanupStack::Pop(part1); |
|
1793 CleanupStack::PopAndDestroy(&stringVal); |
|
1794 |
|
1795 TBuf8<256> expectedBuf; |
|
1796 expectedBuf.Append(0x03); // length value |
|
1797 expectedBuf.Append(0x02); // long int length |
|
1798 expectedBuf.Append(0x02); // long int for application/vnd.nokia... |
|
1799 expectedBuf.Append(0x0B); // ... |
|
1800 |
|
1801 iUTContext->SetExpectedL(expectedBuf); |
|
1802 |
|
1803 // Add the Transitions in the order they are to run |
|
1804 // C'tor first, D'tor last... |
|
1805 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
1806 using constructor and destuctor validators */ |
|
1807 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
1808 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
1809 iContentTypeGeneralLongIntValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
1810 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentTypeGeneralLongIntValidator)); |
|
1811 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
1812 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
1813 } |
|
1814 |
|
1815 // ______________________________________________________________________________ |
|
1816 // |
|
1817 _LIT(KWspHeaderWriterContentTypeGeneralLongInt2ParamsUnitTest,"CWspHeaderWriter_ContentTypeGeneralLongInt2Params_UnitTest"); |
|
1818 |
|
1819 CWspHeaderWriter_ContentTypeGeneralLongInt2Params_UnitTest* CWspHeaderWriter_ContentTypeGeneralLongInt2Params_UnitTest::NewL(CDataLogger& aDataLogger, |
|
1820 MUnitTestObserver& aObserver) |
|
1821 { |
|
1822 CWspHeaderWriter_ContentTypeGeneralLongInt2Params_UnitTest* self = |
|
1823 new(ELeave) CWspHeaderWriter_ContentTypeGeneralLongInt2Params_UnitTest(aDataLogger, |
|
1824 aObserver); |
|
1825 CleanupStack::PushL(self); |
|
1826 self->ConstructL(); |
|
1827 CleanupStack::Pop(self); |
|
1828 return self; |
|
1829 } |
|
1830 |
|
1831 inline TInt CWspHeaderWriter_ContentTypeGeneralLongInt2Params_UnitTest::RunError(TInt aError) |
|
1832 { |
|
1833 // The RunL left so chain to the base first and then cleanup |
|
1834 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
1835 delete iUTContext; |
|
1836 iUTContext = NULL; |
|
1837 delete iStateAccessor; |
|
1838 iStateAccessor = NULL; |
|
1839 /* delete any validators used */ |
|
1840 delete iCtorValidator; |
|
1841 iCtorValidator = NULL; |
|
1842 delete iContentTypeGeneralLongInt2ParamsValidator; |
|
1843 iContentTypeGeneralLongInt2ParamsValidator = NULL; |
|
1844 delete iDtorValidator; |
|
1845 iDtorValidator = NULL; |
|
1846 return error; |
|
1847 } |
|
1848 |
|
1849 inline CWspHeaderWriter_ContentTypeGeneralLongInt2Params_UnitTest::~CWspHeaderWriter_ContentTypeGeneralLongInt2Params_UnitTest() |
|
1850 { |
|
1851 // Simply delete our test class instance |
|
1852 delete iUTContext; |
|
1853 delete iStateAccessor; |
|
1854 /* delete any validators used */ |
|
1855 delete iCtorValidator; |
|
1856 delete iContentTypeGeneralLongInt2ParamsValidator; |
|
1857 delete iDtorValidator; |
|
1858 } |
|
1859 |
|
1860 inline CWspHeaderWriter_ContentTypeGeneralLongInt2Params_UnitTest::CWspHeaderWriter_ContentTypeGeneralLongInt2Params_UnitTest(CDataLogger& aDataLogger, |
|
1861 MUnitTestObserver& aObserver) |
|
1862 : CUnitTest(KWspHeaderWriterContentTypeGeneralLongInt2ParamsUnitTest, aDataLogger, aObserver) |
|
1863 { |
|
1864 //Do nothing |
|
1865 } |
|
1866 |
|
1867 // Now the Individual transitions need to be added. |
|
1868 inline void CWspHeaderWriter_ContentTypeGeneralLongInt2Params_UnitTest::ConstructL() |
|
1869 { |
|
1870 // Perform the base class initialization |
|
1871 UnitTestConstructL(); |
|
1872 |
|
1873 // Create the Unit test state accessor |
|
1874 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
1875 // Construct the Unit test context. |
|
1876 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
1877 iUTContext->ConstructL(WSP::EContentType); |
|
1878 |
|
1879 // Part1 |
|
1880 _LIT8(KTxtTypeToken, "application/vnd.uplanet.cacheop-wbxml"); |
|
1881 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTypeToken); |
|
1882 CleanupClosePushL(stringVal); |
|
1883 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
1884 CleanupStack::PushL(part1); |
|
1885 |
|
1886 // Param1 |
|
1887 _LIT8(KTxtParam1Name, "Read-date"); |
|
1888 TDateTime dateTime(1970, EJanuary, 0, 0, 0, 0, 0); |
|
1889 TTime time(dateTime); |
|
1890 time+=TTimeIntervalSeconds(654321); |
|
1891 TDateTime param1Value = time.DateTime(); |
|
1892 RStringF paramName1 = iUTContext->iStrPool.OpenFStringL(KTxtParam1Name); |
|
1893 CleanupClosePushL(paramName1); |
|
1894 THTTPHdrVal paramValue1(param1Value); |
|
1895 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(paramName1, paramValue1); |
|
1896 CleanupStack::PushL(param1); |
|
1897 part1->AddParamL(param1); |
|
1898 CleanupStack::Pop(param1); |
|
1899 |
|
1900 // Param2 |
|
1901 _LIT8(KTxtParam2Name, "Charset"); |
|
1902 _LIT8(KTxtParam2Value, "utf-8"); |
|
1903 RStringF paramName2 = iUTContext->iStrPool.OpenFStringL(KTxtParam2Name); |
|
1904 CleanupClosePushL(paramName2); |
|
1905 RStringF paramValueStr2 = iUTContext->iStrPool.OpenFStringL(KTxtParam2Value); |
|
1906 CleanupClosePushL(paramValueStr2); |
|
1907 THTTPHdrVal paramValue2(paramValueStr2); |
|
1908 CHeaderFieldParam* param2 = CHeaderFieldParam::NewL(paramName2, paramValue2); |
|
1909 CleanupStack::PushL(param2); |
|
1910 part1->AddParamL(param2); |
|
1911 CleanupStack::Pop(param2); |
|
1912 |
|
1913 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
1914 CleanupStack::PopAndDestroy(3, ¶mName1); |
|
1915 CleanupStack::Pop(part1); |
|
1916 CleanupStack::PopAndDestroy(&stringVal); |
|
1917 |
|
1918 TBuf8<256> expectedBuf; |
|
1919 expectedBuf.Append(0x0A); // length value |
|
1920 expectedBuf.Append(0x02); // long int length |
|
1921 expectedBuf.Append(0x02); // long int for application/vnd.nokia... |
|
1922 expectedBuf.Append(0x01); // ... |
|
1923 expectedBuf.Append(0x95); // encoded token for read-date |
|
1924 expectedBuf.Append(0x03); // length of date value |
|
1925 expectedBuf.Append(0x09); |
|
1926 expectedBuf.Append(0xFB); |
|
1927 expectedBuf.Append(0xF1); |
|
1928 expectedBuf.Append(0x81); // encoded tiken for charset |
|
1929 expectedBuf.Append(0xEA); // encoded token for 'utf-8' |
|
1930 |
|
1931 iUTContext->SetExpectedL(expectedBuf); |
|
1932 |
|
1933 // Add the Transitions in the order they are to run |
|
1934 // C'tor first, D'tor last... |
|
1935 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
1936 using constructor and destuctor validators */ |
|
1937 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
1938 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
1939 iContentTypeGeneralLongInt2ParamsValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
1940 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentTypeGeneralLongInt2ParamsValidator)); |
|
1941 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
1942 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
1943 } |
|
1944 |
|
1945 // ______________________________________________________________________________ |
|
1946 // |
|
1947 _LIT(KWspHeaderWriterContentTypeGeneralTextUnitTest,"CWspHeaderWriter_ContentTypeGeneralText_UnitTest"); |
|
1948 |
|
1949 CWspHeaderWriter_ContentTypeGeneralText_UnitTest* CWspHeaderWriter_ContentTypeGeneralText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
1950 MUnitTestObserver& aObserver) |
|
1951 { |
|
1952 CWspHeaderWriter_ContentTypeGeneralText_UnitTest* self = |
|
1953 new(ELeave) CWspHeaderWriter_ContentTypeGeneralText_UnitTest(aDataLogger, |
|
1954 aObserver); |
|
1955 CleanupStack::PushL(self); |
|
1956 self->ConstructL(); |
|
1957 CleanupStack::Pop(self); |
|
1958 return self; |
|
1959 } |
|
1960 |
|
1961 inline TInt CWspHeaderWriter_ContentTypeGeneralText_UnitTest::RunError(TInt aError) |
|
1962 { |
|
1963 // The RunL left so chain to the base first and then cleanup |
|
1964 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
1965 delete iUTContext; |
|
1966 iUTContext = NULL; |
|
1967 delete iStateAccessor; |
|
1968 iStateAccessor = NULL; |
|
1969 /* delete any validators used */ |
|
1970 delete iCtorValidator; |
|
1971 iCtorValidator = NULL; |
|
1972 delete iContentTypeGeneralTextValidator; |
|
1973 iContentTypeGeneralTextValidator = NULL; |
|
1974 delete iDtorValidator; |
|
1975 iDtorValidator = NULL; |
|
1976 return error; |
|
1977 } |
|
1978 |
|
1979 inline CWspHeaderWriter_ContentTypeGeneralText_UnitTest::~CWspHeaderWriter_ContentTypeGeneralText_UnitTest() |
|
1980 { |
|
1981 // Simply delete our test class instance |
|
1982 delete iUTContext; |
|
1983 delete iStateAccessor; |
|
1984 /* delete any validators used */ |
|
1985 delete iCtorValidator; |
|
1986 delete iContentTypeGeneralTextValidator; |
|
1987 delete iDtorValidator; |
|
1988 } |
|
1989 |
|
1990 inline CWspHeaderWriter_ContentTypeGeneralText_UnitTest::CWspHeaderWriter_ContentTypeGeneralText_UnitTest(CDataLogger& aDataLogger, |
|
1991 MUnitTestObserver& aObserver) |
|
1992 : CUnitTest(KWspHeaderWriterContentTypeGeneralTextUnitTest, aDataLogger, aObserver) |
|
1993 { |
|
1994 //Do nothing |
|
1995 } |
|
1996 |
|
1997 // Now the Individual transitions need to be added. |
|
1998 inline void CWspHeaderWriter_ContentTypeGeneralText_UnitTest::ConstructL() |
|
1999 { |
|
2000 // Perform the base class initialization |
|
2001 UnitTestConstructL(); |
|
2002 |
|
2003 // Create the Unit test state accessor |
|
2004 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
2005 // Construct the Unit test context. |
|
2006 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
2007 iUTContext->ConstructL(WSP::EContentType); |
|
2008 |
|
2009 // Part1 |
|
2010 _LIT8(KTxtTypeToken, "my-content-type"); |
|
2011 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTypeToken); |
|
2012 CleanupClosePushL(stringVal); |
|
2013 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
2014 CleanupStack::PushL(part1); |
|
2015 // Param1 |
|
2016 _LIT8(KTxtParam1Name, "Differences"); |
|
2017 _LIT8(KTxtParam1Value, "Pragma"); |
|
2018 RStringF param1Name = iUTContext->iStrPool.OpenFStringL(KTxtParam1Name); |
|
2019 CleanupClosePushL(param1Name); |
|
2020 RStringF param1Value = iUTContext->iStrPool.OpenFStringL(KTxtParam1Value); |
|
2021 CleanupClosePushL(param1Value); |
|
2022 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(param1Name, param1Value); |
|
2023 CleanupStack::PushL(param1); |
|
2024 part1->AddParamL(param1); |
|
2025 CleanupStack::Pop(param1); |
|
2026 |
|
2027 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
2028 CleanupStack::PopAndDestroy(2, ¶m1Name); |
|
2029 CleanupStack::Pop(part1); |
|
2030 CleanupStack::PopAndDestroy(&stringVal); |
|
2031 |
|
2032 TBuf8<256> expectedBuf; |
|
2033 expectedBuf.Append(0x12); // length value |
|
2034 expectedBuf.Append(KTxtTypeToken); |
|
2035 expectedBuf.Append(0x00); |
|
2036 expectedBuf.Append(0x87); // encoded token for 'Differences' |
|
2037 expectedBuf.Append(0x9F); // encoded token for 'Pragma' |
|
2038 |
|
2039 iUTContext->SetExpectedL(expectedBuf); |
|
2040 |
|
2041 // Add the Transitions in the order they are to run |
|
2042 // C'tor first, D'tor last... |
|
2043 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
2044 using constructor and destuctor validators */ |
|
2045 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
2046 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
2047 iContentTypeGeneralTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
2048 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentTypeGeneralTextValidator)); |
|
2049 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
2050 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
2051 } |
|
2052 |
|
2053 // ______________________________________________________________________________ |
|
2054 // |
|
2055 _LIT(KWspHeaderWriterContentTypeGeneralNullTextUnitTest,"CWspHeaderWriter_ContentTypeGeneralNullText_UnitTest"); |
|
2056 |
|
2057 CWspHeaderWriter_ContentTypeGeneralNullText_UnitTest* CWspHeaderWriter_ContentTypeGeneralNullText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
2058 MUnitTestObserver& aObserver) |
|
2059 { |
|
2060 CWspHeaderWriter_ContentTypeGeneralNullText_UnitTest* self = |
|
2061 new(ELeave) CWspHeaderWriter_ContentTypeGeneralNullText_UnitTest(aDataLogger, |
|
2062 aObserver); |
|
2063 CleanupStack::PushL(self); |
|
2064 self->ConstructL(); |
|
2065 CleanupStack::Pop(self); |
|
2066 return self; |
|
2067 } |
|
2068 |
|
2069 inline TInt CWspHeaderWriter_ContentTypeGeneralNullText_UnitTest::RunError(TInt aError) |
|
2070 { |
|
2071 // The RunL left so chain to the base first and then cleanup |
|
2072 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
2073 delete iUTContext; |
|
2074 iUTContext = NULL; |
|
2075 delete iStateAccessor; |
|
2076 iStateAccessor = NULL; |
|
2077 /* delete any validators used */ |
|
2078 delete iCtorValidator; |
|
2079 iCtorValidator = NULL; |
|
2080 delete iContentTypeGeneralNullTextValidator; |
|
2081 iContentTypeGeneralNullTextValidator = NULL; |
|
2082 delete iDtorValidator; |
|
2083 iDtorValidator = NULL; |
|
2084 return error; |
|
2085 } |
|
2086 |
|
2087 inline CWspHeaderWriter_ContentTypeGeneralNullText_UnitTest::~CWspHeaderWriter_ContentTypeGeneralNullText_UnitTest() |
|
2088 { |
|
2089 // Simply delete our test class instance |
|
2090 delete iUTContext; |
|
2091 delete iStateAccessor; |
|
2092 /* delete any validators used */ |
|
2093 delete iCtorValidator; |
|
2094 delete iContentTypeGeneralNullTextValidator; |
|
2095 delete iDtorValidator; |
|
2096 } |
|
2097 |
|
2098 inline CWspHeaderWriter_ContentTypeGeneralNullText_UnitTest::CWspHeaderWriter_ContentTypeGeneralNullText_UnitTest(CDataLogger& aDataLogger, |
|
2099 MUnitTestObserver& aObserver) |
|
2100 : CUnitTest(KWspHeaderWriterContentTypeGeneralNullTextUnitTest, aDataLogger, aObserver) |
|
2101 { |
|
2102 //Do nothing |
|
2103 } |
|
2104 |
|
2105 // Now the Individual transitions need to be added. |
|
2106 inline void CWspHeaderWriter_ContentTypeGeneralNullText_UnitTest::ConstructL() |
|
2107 { |
|
2108 // Perform the base class initialization |
|
2109 UnitTestConstructL(); |
|
2110 |
|
2111 // Create the Unit test state accessor |
|
2112 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
2113 // Construct the Unit test context. |
|
2114 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
2115 iUTContext->ConstructL(WSP::EContentType); |
|
2116 |
|
2117 // Part1 |
|
2118 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KNullDesC8); |
|
2119 CleanupClosePushL(stringVal); |
|
2120 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
2121 CleanupStack::PushL(part1); |
|
2122 // Param1 |
|
2123 _LIT8(KTxtParam1Name, "Level"); |
|
2124 _LIT8(KTxtParam1Value, "3"); |
|
2125 RStringF param1Name = iUTContext->iStrPool.OpenFStringL(KTxtParam1Name); |
|
2126 CleanupClosePushL(param1Name); |
|
2127 RStringF param1Value = iUTContext->iStrPool.OpenFStringL(KTxtParam1Value); |
|
2128 CleanupClosePushL(param1Value); |
|
2129 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(param1Name, param1Value); |
|
2130 CleanupStack::PushL(param1); |
|
2131 part1->AddParamL(param1); |
|
2132 CleanupStack::Pop(param1); |
|
2133 |
|
2134 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
2135 CleanupStack::PopAndDestroy(2, ¶m1Name); |
|
2136 CleanupStack::Pop(part1); |
|
2137 CleanupStack::PopAndDestroy(&stringVal); |
|
2138 |
|
2139 TBuf8<256> expectedBuf; |
|
2140 expectedBuf.Append(0x03); // length value |
|
2141 expectedBuf.Append(0x00); |
|
2142 expectedBuf.Append(0x82); // encoded token for 'Level' |
|
2143 expectedBuf.Append(0xBF); // encoded token for version 3 |
|
2144 |
|
2145 iUTContext->SetExpectedL(expectedBuf); |
|
2146 |
|
2147 // Add the Transitions in the order they are to run |
|
2148 // C'tor first, D'tor last... |
|
2149 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
2150 using constructor and destuctor validators */ |
|
2151 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
2152 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
2153 iContentTypeGeneralNullTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
2154 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentTypeGeneralNullTextValidator)); |
|
2155 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
2156 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
2157 } |
|
2158 |
|
2159 // ______________________________________________________________________________ |
|
2160 // |
|
2161 _LIT(KWspHeaderWriterAcceptCharsetShortIntUnitTest,"CWspHeaderWriter_AcceptCharsetShortInt_UnitTest"); |
|
2162 |
|
2163 CWspHeaderWriter_AcceptCharsetShortInt_UnitTest* CWspHeaderWriter_AcceptCharsetShortInt_UnitTest::NewL(CDataLogger& aDataLogger, |
|
2164 MUnitTestObserver& aObserver) |
|
2165 { |
|
2166 CWspHeaderWriter_AcceptCharsetShortInt_UnitTest* self = |
|
2167 new(ELeave) CWspHeaderWriter_AcceptCharsetShortInt_UnitTest(aDataLogger, |
|
2168 aObserver); |
|
2169 CleanupStack::PushL(self); |
|
2170 self->ConstructL(); |
|
2171 CleanupStack::Pop(self); |
|
2172 return self; |
|
2173 } |
|
2174 |
|
2175 inline TInt CWspHeaderWriter_AcceptCharsetShortInt_UnitTest::RunError(TInt aError) |
|
2176 { |
|
2177 // The RunL left so chain to the base first and then cleanup |
|
2178 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
2179 delete iUTContext; |
|
2180 iUTContext = NULL; |
|
2181 delete iStateAccessor; |
|
2182 iStateAccessor = NULL; |
|
2183 /* delete any validators used */ |
|
2184 delete iCtorValidator; |
|
2185 iCtorValidator = NULL; |
|
2186 delete iAcceptCharsetShortIntValidator; |
|
2187 iAcceptCharsetShortIntValidator = NULL; |
|
2188 delete iDtorValidator; |
|
2189 iDtorValidator = NULL; |
|
2190 return error; |
|
2191 } |
|
2192 |
|
2193 inline CWspHeaderWriter_AcceptCharsetShortInt_UnitTest::~CWspHeaderWriter_AcceptCharsetShortInt_UnitTest() |
|
2194 { |
|
2195 // Simply delete our test class instance |
|
2196 delete iUTContext; |
|
2197 delete iStateAccessor; |
|
2198 /* delete any validators used */ |
|
2199 delete iCtorValidator; |
|
2200 delete iAcceptCharsetShortIntValidator; |
|
2201 delete iDtorValidator; |
|
2202 } |
|
2203 |
|
2204 inline CWspHeaderWriter_AcceptCharsetShortInt_UnitTest::CWspHeaderWriter_AcceptCharsetShortInt_UnitTest(CDataLogger& aDataLogger, |
|
2205 MUnitTestObserver& aObserver) |
|
2206 : CUnitTest(KWspHeaderWriterAcceptCharsetShortIntUnitTest, aDataLogger, aObserver) |
|
2207 { |
|
2208 //Do nothing |
|
2209 } |
|
2210 |
|
2211 // Now the Individual transitions need to be added. |
|
2212 inline void CWspHeaderWriter_AcceptCharsetShortInt_UnitTest::ConstructL() |
|
2213 { |
|
2214 // Perform the base class initialization |
|
2215 UnitTestConstructL(); |
|
2216 |
|
2217 // Create the Unit test state accessor |
|
2218 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
2219 // Construct the Unit test context. |
|
2220 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
2221 iUTContext->ConstructL(WSP::EAcceptCharset); |
|
2222 |
|
2223 // Part1 |
|
2224 _LIT8(KTxtCharset, "iso-8859-9"); |
|
2225 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtCharset); |
|
2226 CleanupClosePushL(stringVal); |
|
2227 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
2228 CleanupStack::PushL(part1); |
|
2229 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
2230 CleanupStack::Pop(part1); |
|
2231 CleanupStack::PopAndDestroy(&stringVal); |
|
2232 |
|
2233 TBuf8<256> expectedBuf; |
|
2234 expectedBuf.Append(0x8C); |
|
2235 iUTContext->SetExpectedL(expectedBuf); |
|
2236 |
|
2237 // Add the Transitions in the order they are to run |
|
2238 // C'tor first, D'tor last... |
|
2239 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
2240 using constructor and destuctor validators */ |
|
2241 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
2242 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
2243 iAcceptCharsetShortIntValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
2244 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptCharsetShortIntValidator)); |
|
2245 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
2246 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
2247 } |
|
2248 |
|
2249 // ______________________________________________________________________________ |
|
2250 // |
|
2251 _LIT(KWspHeaderWriterAcceptCharsetTextUnitTest,"CWspHeaderWriter_AcceptCharsetText_UnitTest"); |
|
2252 |
|
2253 CWspHeaderWriter_AcceptCharsetText_UnitTest* CWspHeaderWriter_AcceptCharsetText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
2254 MUnitTestObserver& aObserver) |
|
2255 { |
|
2256 CWspHeaderWriter_AcceptCharsetText_UnitTest* self = |
|
2257 new(ELeave) CWspHeaderWriter_AcceptCharsetText_UnitTest(aDataLogger, |
|
2258 aObserver); |
|
2259 CleanupStack::PushL(self); |
|
2260 self->ConstructL(); |
|
2261 CleanupStack::Pop(self); |
|
2262 return self; |
|
2263 } |
|
2264 |
|
2265 inline TInt CWspHeaderWriter_AcceptCharsetText_UnitTest::RunError(TInt aError) |
|
2266 { |
|
2267 // The RunL left so chain to the base first and then cleanup |
|
2268 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
2269 delete iUTContext; |
|
2270 iUTContext = NULL; |
|
2271 delete iStateAccessor; |
|
2272 iStateAccessor = NULL; |
|
2273 /* delete any validators used */ |
|
2274 delete iCtorValidator; |
|
2275 iCtorValidator = NULL; |
|
2276 delete iAcceptCharsetTextValidator; |
|
2277 iAcceptCharsetTextValidator = NULL; |
|
2278 delete iDtorValidator; |
|
2279 iDtorValidator = NULL; |
|
2280 return error; |
|
2281 } |
|
2282 |
|
2283 inline CWspHeaderWriter_AcceptCharsetText_UnitTest::~CWspHeaderWriter_AcceptCharsetText_UnitTest() |
|
2284 { |
|
2285 // Simply delete our test class instance |
|
2286 delete iUTContext; |
|
2287 delete iStateAccessor; |
|
2288 /* delete any validators used */ |
|
2289 delete iCtorValidator; |
|
2290 delete iAcceptCharsetTextValidator; |
|
2291 delete iDtorValidator; |
|
2292 } |
|
2293 |
|
2294 inline CWspHeaderWriter_AcceptCharsetText_UnitTest::CWspHeaderWriter_AcceptCharsetText_UnitTest(CDataLogger& aDataLogger, |
|
2295 MUnitTestObserver& aObserver) |
|
2296 : CUnitTest(KWspHeaderWriterAcceptCharsetTextUnitTest, aDataLogger, aObserver) |
|
2297 { |
|
2298 //Do nothing |
|
2299 } |
|
2300 |
|
2301 // Now the Individual transitions need to be added. |
|
2302 inline void CWspHeaderWriter_AcceptCharsetText_UnitTest::ConstructL() |
|
2303 { |
|
2304 // Perform the base class initialization |
|
2305 UnitTestConstructL(); |
|
2306 |
|
2307 // Create the Unit test state accessor |
|
2308 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
2309 // Construct the Unit test context. |
|
2310 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
2311 iUTContext->ConstructL(WSP::EAcceptCharset); |
|
2312 |
|
2313 // Part1 |
|
2314 _LIT8(KTxtCharset, "my-new-charset"); |
|
2315 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtCharset); |
|
2316 CleanupClosePushL(stringVal); |
|
2317 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
2318 CleanupStack::PushL(part1); |
|
2319 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
2320 CleanupStack::Pop(part1); |
|
2321 CleanupStack::PopAndDestroy(&stringVal); |
|
2322 |
|
2323 TBuf8<256> expectedBuf; |
|
2324 expectedBuf.Append(KTxtCharset); |
|
2325 expectedBuf.Append(0x00); |
|
2326 iUTContext->SetExpectedL(expectedBuf); |
|
2327 |
|
2328 // Add the Transitions in the order they are to run |
|
2329 // C'tor first, D'tor last... |
|
2330 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
2331 using constructor and destuctor validators */ |
|
2332 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
2333 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
2334 iAcceptCharsetTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
2335 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptCharsetTextValidator)); |
|
2336 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
2337 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
2338 } |
|
2339 |
|
2340 // ______________________________________________________________________________ |
|
2341 // |
|
2342 _LIT(KWspHeaderWriterAcceptCharsetAnyCharsetUnitTest,"CWspHeaderWriter_AcceptCharsetAnyCharset_UnitTest"); |
|
2343 |
|
2344 CWspHeaderWriter_AcceptCharsetAnyCharset_UnitTest* CWspHeaderWriter_AcceptCharsetAnyCharset_UnitTest::NewL(CDataLogger& aDataLogger, |
|
2345 MUnitTestObserver& aObserver) |
|
2346 { |
|
2347 CWspHeaderWriter_AcceptCharsetAnyCharset_UnitTest* self = |
|
2348 new(ELeave) CWspHeaderWriter_AcceptCharsetAnyCharset_UnitTest(aDataLogger, |
|
2349 aObserver); |
|
2350 CleanupStack::PushL(self); |
|
2351 self->ConstructL(); |
|
2352 CleanupStack::Pop(self); |
|
2353 return self; |
|
2354 } |
|
2355 |
|
2356 inline TInt CWspHeaderWriter_AcceptCharsetAnyCharset_UnitTest::RunError(TInt aError) |
|
2357 { |
|
2358 // The RunL left so chain to the base first and then cleanup |
|
2359 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
2360 delete iUTContext; |
|
2361 iUTContext = NULL; |
|
2362 delete iStateAccessor; |
|
2363 iStateAccessor = NULL; |
|
2364 /* delete any validators used */ |
|
2365 delete iCtorValidator; |
|
2366 iCtorValidator = NULL; |
|
2367 delete iAcceptCharsetAnyCharsetValidator; |
|
2368 iAcceptCharsetAnyCharsetValidator = NULL; |
|
2369 delete iDtorValidator; |
|
2370 iDtorValidator = NULL; |
|
2371 return error; |
|
2372 } |
|
2373 |
|
2374 inline CWspHeaderWriter_AcceptCharsetAnyCharset_UnitTest::~CWspHeaderWriter_AcceptCharsetAnyCharset_UnitTest() |
|
2375 { |
|
2376 // Simply delete our test class instance |
|
2377 delete iUTContext; |
|
2378 delete iStateAccessor; |
|
2379 /* delete any validators used */ |
|
2380 delete iCtorValidator; |
|
2381 delete iAcceptCharsetAnyCharsetValidator; |
|
2382 delete iDtorValidator; |
|
2383 } |
|
2384 |
|
2385 inline CWspHeaderWriter_AcceptCharsetAnyCharset_UnitTest::CWspHeaderWriter_AcceptCharsetAnyCharset_UnitTest(CDataLogger& aDataLogger, |
|
2386 MUnitTestObserver& aObserver) |
|
2387 : CUnitTest(KWspHeaderWriterAcceptCharsetAnyCharsetUnitTest, aDataLogger, aObserver) |
|
2388 { |
|
2389 //Do nothing |
|
2390 } |
|
2391 |
|
2392 // Now the Individual transitions need to be added. |
|
2393 inline void CWspHeaderWriter_AcceptCharsetAnyCharset_UnitTest::ConstructL() |
|
2394 { |
|
2395 // Perform the base class initialization |
|
2396 UnitTestConstructL(); |
|
2397 |
|
2398 // Create the Unit test state accessor |
|
2399 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
2400 // Construct the Unit test context. |
|
2401 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
2402 iUTContext->ConstructL(WSP::EAcceptCharset); |
|
2403 |
|
2404 // Part1 |
|
2405 _LIT8(KTxtCharset, "*"); |
|
2406 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtCharset); |
|
2407 CleanupClosePushL(stringVal); |
|
2408 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
2409 CleanupStack::PushL(part1); |
|
2410 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
2411 CleanupStack::Pop(part1); |
|
2412 CleanupStack::PopAndDestroy(&stringVal); |
|
2413 |
|
2414 TBuf8<256> expectedBuf; |
|
2415 expectedBuf.Append(0x80); |
|
2416 iUTContext->SetExpectedL(expectedBuf); |
|
2417 |
|
2418 // Add the Transitions in the order they are to run |
|
2419 // C'tor first, D'tor last... |
|
2420 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
2421 using constructor and destuctor validators */ |
|
2422 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
2423 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
2424 iAcceptCharsetAnyCharsetValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
2425 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptCharsetAnyCharsetValidator)); |
|
2426 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
2427 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
2428 } |
|
2429 |
|
2430 // ______________________________________________________________________________ |
|
2431 // |
|
2432 _LIT(KWspHeaderWriterAcceptCharsetGeneralShortIntWithQValUnitTest,"CWspHeaderWriter_AcceptCharsetGeneralShortIntWithQVal_UnitTest"); |
|
2433 |
|
2434 CWspHeaderWriter_AcceptCharsetGeneralShortIntWithQVal_UnitTest* CWspHeaderWriter_AcceptCharsetGeneralShortIntWithQVal_UnitTest::NewL(CDataLogger& aDataLogger, |
|
2435 MUnitTestObserver& aObserver) |
|
2436 { |
|
2437 CWspHeaderWriter_AcceptCharsetGeneralShortIntWithQVal_UnitTest* self = |
|
2438 new(ELeave) CWspHeaderWriter_AcceptCharsetGeneralShortIntWithQVal_UnitTest(aDataLogger, |
|
2439 aObserver); |
|
2440 CleanupStack::PushL(self); |
|
2441 self->ConstructL(); |
|
2442 CleanupStack::Pop(self); |
|
2443 return self; |
|
2444 } |
|
2445 |
|
2446 inline TInt CWspHeaderWriter_AcceptCharsetGeneralShortIntWithQVal_UnitTest::RunError(TInt aError) |
|
2447 { |
|
2448 // The RunL left so chain to the base first and then cleanup |
|
2449 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
2450 delete iUTContext; |
|
2451 iUTContext = NULL; |
|
2452 delete iStateAccessor; |
|
2453 iStateAccessor = NULL; |
|
2454 /* delete any validators used */ |
|
2455 delete iCtorValidator; |
|
2456 iCtorValidator = NULL; |
|
2457 delete iAcceptCharsetGeneralShortIntWithQValValidator; |
|
2458 iAcceptCharsetGeneralShortIntWithQValValidator = NULL; |
|
2459 delete iDtorValidator; |
|
2460 iDtorValidator = NULL; |
|
2461 return error; |
|
2462 } |
|
2463 |
|
2464 inline CWspHeaderWriter_AcceptCharsetGeneralShortIntWithQVal_UnitTest::~CWspHeaderWriter_AcceptCharsetGeneralShortIntWithQVal_UnitTest() |
|
2465 { |
|
2466 // Simply delete our test class instance |
|
2467 delete iUTContext; |
|
2468 delete iStateAccessor; |
|
2469 /* delete any validators used */ |
|
2470 delete iCtorValidator; |
|
2471 delete iAcceptCharsetGeneralShortIntWithQValValidator; |
|
2472 delete iDtorValidator; |
|
2473 } |
|
2474 |
|
2475 inline CWspHeaderWriter_AcceptCharsetGeneralShortIntWithQVal_UnitTest::CWspHeaderWriter_AcceptCharsetGeneralShortIntWithQVal_UnitTest(CDataLogger& aDataLogger, |
|
2476 MUnitTestObserver& aObserver) |
|
2477 : CUnitTest(KWspHeaderWriterAcceptCharsetGeneralShortIntWithQValUnitTest, aDataLogger, aObserver) |
|
2478 { |
|
2479 //Do nothing |
|
2480 } |
|
2481 |
|
2482 // Now the Individual transitions need to be added. |
|
2483 inline void CWspHeaderWriter_AcceptCharsetGeneralShortIntWithQVal_UnitTest::ConstructL() |
|
2484 { |
|
2485 // Perform the base class initialization |
|
2486 UnitTestConstructL(); |
|
2487 |
|
2488 // Create the Unit test state accessor |
|
2489 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
2490 // Construct the Unit test context. |
|
2491 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
2492 iUTContext->ConstructL(WSP::EAcceptCharset); |
|
2493 |
|
2494 // Part1 |
|
2495 _LIT8(KTxtCharset, "utf-8"); |
|
2496 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtCharset); |
|
2497 CleanupClosePushL(stringVal); |
|
2498 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
2499 CleanupStack::PushL(part1); |
|
2500 |
|
2501 // Param1 |
|
2502 _LIT8(KTxtQName, "Q"); |
|
2503 _LIT8(KTxtQVal, "0.333"); |
|
2504 RStringF stringVal1 = iUTContext->iStrPool.OpenFStringL(KTxtQName); |
|
2505 CleanupClosePushL(stringVal1); |
|
2506 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtQVal); |
|
2507 CleanupClosePushL(stringVal2); |
|
2508 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(stringVal1, stringVal2); |
|
2509 CleanupStack::PushL(param1); |
|
2510 part1->AddParamL(param1); |
|
2511 CleanupStack::Pop(param1); |
|
2512 |
|
2513 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
2514 CleanupStack::PopAndDestroy(2, &stringVal1); |
|
2515 CleanupStack::Pop(part1); |
|
2516 CleanupStack::PopAndDestroy(&stringVal); |
|
2517 |
|
2518 TBuf8<256> expectedBuf; |
|
2519 expectedBuf.Append(0x03); // length-val |
|
2520 expectedBuf.Append(0xEA); // Encoded token for utf-8 |
|
2521 expectedBuf.Append(0x83); // encoding for Q 0.333... |
|
2522 expectedBuf.Append(0x31); // ... |
|
2523 iUTContext->SetExpectedL(expectedBuf); |
|
2524 |
|
2525 // Add the Transitions in the order they are to run |
|
2526 // C'tor first, D'tor last... |
|
2527 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
2528 using constructor and destuctor validators */ |
|
2529 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
2530 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
2531 iAcceptCharsetGeneralShortIntWithQValValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
2532 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptCharsetGeneralShortIntWithQValValidator)); |
|
2533 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
2534 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
2535 } |
|
2536 |
|
2537 // ______________________________________________________________________________ |
|
2538 // |
|
2539 _LIT(KWspHeaderWriterAcceptCharsetGeneralLongIntQValUnitTest,"CWspHeaderWriter_AcceptCharsetGeneralLongIntQVal_UnitTest"); |
|
2540 |
|
2541 CWspHeaderWriter_AcceptCharsetGeneralLongIntQVal_UnitTest* CWspHeaderWriter_AcceptCharsetGeneralLongIntQVal_UnitTest::NewL(CDataLogger& aDataLogger, |
|
2542 MUnitTestObserver& aObserver) |
|
2543 { |
|
2544 CWspHeaderWriter_AcceptCharsetGeneralLongIntQVal_UnitTest* self = |
|
2545 new(ELeave) CWspHeaderWriter_AcceptCharsetGeneralLongIntQVal_UnitTest(aDataLogger, |
|
2546 aObserver); |
|
2547 CleanupStack::PushL(self); |
|
2548 self->ConstructL(); |
|
2549 CleanupStack::Pop(self); |
|
2550 return self; |
|
2551 } |
|
2552 |
|
2553 inline TInt CWspHeaderWriter_AcceptCharsetGeneralLongIntQVal_UnitTest::RunError(TInt aError) |
|
2554 { |
|
2555 // The RunL left so chain to the base first and then cleanup |
|
2556 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
2557 delete iUTContext; |
|
2558 iUTContext = NULL; |
|
2559 delete iStateAccessor; |
|
2560 iStateAccessor = NULL; |
|
2561 /* delete any validators used */ |
|
2562 delete iCtorValidator; |
|
2563 iCtorValidator = NULL; |
|
2564 delete iAcceptCharsetGeneralLongIntQValValidator; |
|
2565 iAcceptCharsetGeneralLongIntQValValidator = NULL; |
|
2566 delete iDtorValidator; |
|
2567 iDtorValidator = NULL; |
|
2568 return error; |
|
2569 } |
|
2570 |
|
2571 inline CWspHeaderWriter_AcceptCharsetGeneralLongIntQVal_UnitTest::~CWspHeaderWriter_AcceptCharsetGeneralLongIntQVal_UnitTest() |
|
2572 { |
|
2573 // Simply delete our test class instance |
|
2574 delete iUTContext; |
|
2575 delete iStateAccessor; |
|
2576 /* delete any validators used */ |
|
2577 delete iCtorValidator; |
|
2578 delete iAcceptCharsetGeneralLongIntQValValidator; |
|
2579 delete iDtorValidator; |
|
2580 } |
|
2581 |
|
2582 inline CWspHeaderWriter_AcceptCharsetGeneralLongIntQVal_UnitTest::CWspHeaderWriter_AcceptCharsetGeneralLongIntQVal_UnitTest(CDataLogger& aDataLogger, |
|
2583 MUnitTestObserver& aObserver) |
|
2584 : CUnitTest(KWspHeaderWriterAcceptCharsetGeneralLongIntQValUnitTest, aDataLogger, aObserver) |
|
2585 { |
|
2586 //Do nothing |
|
2587 } |
|
2588 |
|
2589 // Now the Individual transitions need to be added. |
|
2590 inline void CWspHeaderWriter_AcceptCharsetGeneralLongIntQVal_UnitTest::ConstructL() |
|
2591 { |
|
2592 // Perform the base class initialization |
|
2593 UnitTestConstructL(); |
|
2594 |
|
2595 // Create the Unit test state accessor |
|
2596 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
2597 // Construct the Unit test context. |
|
2598 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
2599 iUTContext->ConstructL(WSP::EAcceptCharset); |
|
2600 |
|
2601 // Part1 |
|
2602 _LIT8(KTxtCharset, "big5"); |
|
2603 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtCharset); |
|
2604 CleanupClosePushL(stringVal); |
|
2605 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
2606 CleanupStack::PushL(part1); |
|
2607 |
|
2608 // Param1 |
|
2609 _LIT8(KTxtQName, "Q"); |
|
2610 _LIT8(KTxtQVal, "0.333"); |
|
2611 RStringF stringVal1 = iUTContext->iStrPool.OpenFStringL(KTxtQName); |
|
2612 CleanupClosePushL(stringVal1); |
|
2613 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtQVal); |
|
2614 CleanupClosePushL(stringVal2); |
|
2615 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(stringVal1, stringVal2); |
|
2616 CleanupStack::PushL(param1); |
|
2617 part1->AddParamL(param1); |
|
2618 CleanupStack::Pop(param1); |
|
2619 |
|
2620 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
2621 CleanupStack::PopAndDestroy(2, &stringVal1); |
|
2622 CleanupStack::Pop(part1); |
|
2623 CleanupStack::PopAndDestroy(&stringVal); |
|
2624 |
|
2625 TBuf8<256> expectedBuf; |
|
2626 expectedBuf.Append(0x05); // length-val |
|
2627 expectedBuf.Append(0x02); // length of long int |
|
2628 expectedBuf.Append(0x07); // long int encoding of big5... |
|
2629 expectedBuf.Append(0xEA); // .. |
|
2630 expectedBuf.Append(0x83); // encoding for Q 0.333... |
|
2631 expectedBuf.Append(0x31); // ... |
|
2632 iUTContext->SetExpectedL(expectedBuf); |
|
2633 |
|
2634 // Add the Transitions in the order they are to run |
|
2635 // C'tor first, D'tor last... |
|
2636 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
2637 using constructor and destuctor validators */ |
|
2638 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
2639 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
2640 iAcceptCharsetGeneralLongIntQValValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
2641 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptCharsetGeneralLongIntQValValidator)); |
|
2642 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
2643 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
2644 } |
|
2645 |
|
2646 // ______________________________________________________________________________ |
|
2647 // |
|
2648 _LIT(KWspHeaderWriterAcceptCharsetGeneralTextQValUnitTest,"CWspHeaderWriter_AcceptCharsetGeneralTextQVal_UnitTest"); |
|
2649 |
|
2650 CWspHeaderWriter_AcceptCharsetGeneralTextQVal_UnitTest* CWspHeaderWriter_AcceptCharsetGeneralTextQVal_UnitTest::NewL(CDataLogger& aDataLogger, |
|
2651 MUnitTestObserver& aObserver) |
|
2652 { |
|
2653 CWspHeaderWriter_AcceptCharsetGeneralTextQVal_UnitTest* self = |
|
2654 new(ELeave) CWspHeaderWriter_AcceptCharsetGeneralTextQVal_UnitTest(aDataLogger, |
|
2655 aObserver); |
|
2656 CleanupStack::PushL(self); |
|
2657 self->ConstructL(); |
|
2658 CleanupStack::Pop(self); |
|
2659 return self; |
|
2660 } |
|
2661 |
|
2662 inline TInt CWspHeaderWriter_AcceptCharsetGeneralTextQVal_UnitTest::RunError(TInt aError) |
|
2663 { |
|
2664 // The RunL left so chain to the base first and then cleanup |
|
2665 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
2666 delete iUTContext; |
|
2667 iUTContext = NULL; |
|
2668 delete iStateAccessor; |
|
2669 iStateAccessor = NULL; |
|
2670 /* delete any validators used */ |
|
2671 delete iCtorValidator; |
|
2672 iCtorValidator = NULL; |
|
2673 delete iAcceptCharsetGeneralTextQValValidator; |
|
2674 iAcceptCharsetGeneralTextQValValidator = NULL; |
|
2675 delete iDtorValidator; |
|
2676 iDtorValidator = NULL; |
|
2677 return error; |
|
2678 } |
|
2679 |
|
2680 inline CWspHeaderWriter_AcceptCharsetGeneralTextQVal_UnitTest::~CWspHeaderWriter_AcceptCharsetGeneralTextQVal_UnitTest() |
|
2681 { |
|
2682 // Simply delete our test class instance |
|
2683 delete iUTContext; |
|
2684 delete iStateAccessor; |
|
2685 /* delete any validators used */ |
|
2686 delete iCtorValidator; |
|
2687 delete iAcceptCharsetGeneralTextQValValidator; |
|
2688 delete iDtorValidator; |
|
2689 } |
|
2690 |
|
2691 inline CWspHeaderWriter_AcceptCharsetGeneralTextQVal_UnitTest::CWspHeaderWriter_AcceptCharsetGeneralTextQVal_UnitTest(CDataLogger& aDataLogger, |
|
2692 MUnitTestObserver& aObserver) |
|
2693 : CUnitTest(KWspHeaderWriterAcceptCharsetGeneralTextQValUnitTest, aDataLogger, aObserver) |
|
2694 { |
|
2695 //Do nothing |
|
2696 } |
|
2697 |
|
2698 // Now the Individual transitions need to be added. |
|
2699 inline void CWspHeaderWriter_AcceptCharsetGeneralTextQVal_UnitTest::ConstructL() |
|
2700 { |
|
2701 // Perform the base class initialization |
|
2702 UnitTestConstructL(); |
|
2703 |
|
2704 // Create the Unit test state accessor |
|
2705 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
2706 // Construct the Unit test context. |
|
2707 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
2708 iUTContext->ConstructL(WSP::EAcceptCharset); |
|
2709 |
|
2710 // Part1 |
|
2711 _LIT8(KTxtCharset, "my-new-charset"); |
|
2712 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtCharset); |
|
2713 CleanupClosePushL(stringVal); |
|
2714 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
2715 CleanupStack::PushL(part1); |
|
2716 |
|
2717 // Param1 |
|
2718 _LIT8(KTxtQName, "Q"); |
|
2719 _LIT8(KTxtQVal, "0.333"); |
|
2720 RStringF stringVal1 = iUTContext->iStrPool.OpenFStringL(KTxtQName); |
|
2721 CleanupClosePushL(stringVal1); |
|
2722 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtQVal); |
|
2723 CleanupClosePushL(stringVal2); |
|
2724 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(stringVal1, stringVal2); |
|
2725 CleanupStack::PushL(param1); |
|
2726 part1->AddParamL(param1); |
|
2727 CleanupStack::Pop(param1); |
|
2728 |
|
2729 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
2730 CleanupStack::PopAndDestroy(2, &stringVal1); |
|
2731 CleanupStack::Pop(part1); |
|
2732 CleanupStack::PopAndDestroy(&stringVal); |
|
2733 |
|
2734 TBuf8<256> expectedBuf; |
|
2735 expectedBuf.Append(0x11); // length-val |
|
2736 expectedBuf.Append(KTxtCharset); // charset text |
|
2737 expectedBuf.Append(0x00); // null terminator |
|
2738 expectedBuf.Append(0x83); // encoding for Q 0.333... |
|
2739 expectedBuf.Append(0x31); // ... |
|
2740 iUTContext->SetExpectedL(expectedBuf); |
|
2741 |
|
2742 // Add the Transitions in the order they are to run |
|
2743 // C'tor first, D'tor last... |
|
2744 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
2745 using constructor and destuctor validators */ |
|
2746 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
2747 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
2748 iAcceptCharsetGeneralTextQValValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
2749 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptCharsetGeneralTextQValValidator)); |
|
2750 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
2751 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
2752 } |
|
2753 |
|
2754 // ______________________________________________________________________________ |
|
2755 // |
|
2756 _LIT(KWspHeaderWriterAcceptCharsetAnyCharsetV1_2UnitTest,"CWspHeaderWriter_AcceptCharsetAnyCharsetV1_2_UnitTest"); |
|
2757 |
|
2758 CWspHeaderWriter_AcceptCharsetAnyCharsetV1_2_UnitTest* CWspHeaderWriter_AcceptCharsetAnyCharsetV1_2_UnitTest::NewL(CDataLogger& aDataLogger, |
|
2759 MUnitTestObserver& aObserver) |
|
2760 { |
|
2761 CWspHeaderWriter_AcceptCharsetAnyCharsetV1_2_UnitTest* self = |
|
2762 new(ELeave) CWspHeaderWriter_AcceptCharsetAnyCharsetV1_2_UnitTest(aDataLogger, |
|
2763 aObserver); |
|
2764 CleanupStack::PushL(self); |
|
2765 self->ConstructL(); |
|
2766 CleanupStack::Pop(self); |
|
2767 return self; |
|
2768 } |
|
2769 |
|
2770 inline TInt CWspHeaderWriter_AcceptCharsetAnyCharsetV1_2_UnitTest::RunError(TInt aError) |
|
2771 { |
|
2772 // The RunL left so chain to the base first and then cleanup |
|
2773 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
2774 delete iUTContext; |
|
2775 iUTContext = NULL; |
|
2776 delete iStateAccessor; |
|
2777 iStateAccessor = NULL; |
|
2778 /* delete any validators used */ |
|
2779 delete iCtorValidator; |
|
2780 iCtorValidator = NULL; |
|
2781 delete iAcceptCharsetAnyCharsetV1_2Validator; |
|
2782 iAcceptCharsetAnyCharsetV1_2Validator = NULL; |
|
2783 delete iDtorValidator; |
|
2784 iDtorValidator = NULL; |
|
2785 return error; |
|
2786 } |
|
2787 |
|
2788 inline CWspHeaderWriter_AcceptCharsetAnyCharsetV1_2_UnitTest::~CWspHeaderWriter_AcceptCharsetAnyCharsetV1_2_UnitTest() |
|
2789 { |
|
2790 // Simply delete our test class instance |
|
2791 delete iUTContext; |
|
2792 delete iStateAccessor; |
|
2793 /* delete any validators used */ |
|
2794 delete iCtorValidator; |
|
2795 delete iAcceptCharsetAnyCharsetV1_2Validator; |
|
2796 delete iDtorValidator; |
|
2797 } |
|
2798 |
|
2799 inline CWspHeaderWriter_AcceptCharsetAnyCharsetV1_2_UnitTest::CWspHeaderWriter_AcceptCharsetAnyCharsetV1_2_UnitTest(CDataLogger& aDataLogger, |
|
2800 MUnitTestObserver& aObserver) |
|
2801 : CUnitTest(KWspHeaderWriterAcceptCharsetAnyCharsetV1_2UnitTest, aDataLogger, aObserver) |
|
2802 { |
|
2803 //Do nothing |
|
2804 } |
|
2805 |
|
2806 // Now the Individual transitions need to be added. |
|
2807 inline void CWspHeaderWriter_AcceptCharsetAnyCharsetV1_2_UnitTest::ConstructL() |
|
2808 { |
|
2809 // Perform the base class initialization |
|
2810 UnitTestConstructL(); |
|
2811 |
|
2812 // Create the Unit test state accessor |
|
2813 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
2814 // Construct the Unit test context. |
|
2815 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
2816 iUTContext->ConstructL(WSP::EAcceptCharset); |
|
2817 (REINTERPRET_CAST(CWspHeaderCodec*, iUTContext->iCodec))->SetWspVersion(CWspHeaderCodec::EVersion1_2); |
|
2818 |
|
2819 // Part1 |
|
2820 _LIT8(KTxtCharset, "*"); |
|
2821 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtCharset); |
|
2822 CleanupClosePushL(stringVal); |
|
2823 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
2824 CleanupStack::PushL(part1); |
|
2825 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
2826 CleanupStack::Pop(part1); |
|
2827 CleanupStack::PopAndDestroy(&stringVal); |
|
2828 |
|
2829 TBuf8<256> expectedBuf; |
|
2830 expectedBuf.Append(KTxtCharset); |
|
2831 expectedBuf.Append(0x00); |
|
2832 iUTContext->SetExpectedL(expectedBuf); |
|
2833 |
|
2834 // Add the Transitions in the order they are to run |
|
2835 // C'tor first, D'tor last... |
|
2836 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
2837 using constructor and destuctor validators */ |
|
2838 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
2839 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
2840 iAcceptCharsetAnyCharsetV1_2Validator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
2841 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptCharsetAnyCharsetV1_2Validator)); |
|
2842 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
2843 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
2844 } |
|
2845 |
|
2846 // ______________________________________________________________________________ |
|
2847 // |
|
2848 _LIT(KWspHeaderWriterAcceptLanguageShortIntUnitTest,"CWspHeaderWriter_AcceptLanguageShortInt_UnitTest"); |
|
2849 |
|
2850 CWspHeaderWriter_AcceptLanguageShortInt_UnitTest* CWspHeaderWriter_AcceptLanguageShortInt_UnitTest::NewL(CDataLogger& aDataLogger, |
|
2851 MUnitTestObserver& aObserver) |
|
2852 { |
|
2853 CWspHeaderWriter_AcceptLanguageShortInt_UnitTest* self = |
|
2854 new(ELeave) CWspHeaderWriter_AcceptLanguageShortInt_UnitTest(aDataLogger, |
|
2855 aObserver); |
|
2856 CleanupStack::PushL(self); |
|
2857 self->ConstructL(); |
|
2858 CleanupStack::Pop(self); |
|
2859 return self; |
|
2860 } |
|
2861 |
|
2862 inline TInt CWspHeaderWriter_AcceptLanguageShortInt_UnitTest::RunError(TInt aError) |
|
2863 { |
|
2864 // The RunL left so chain to the base first and then cleanup |
|
2865 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
2866 delete iUTContext; |
|
2867 iUTContext = NULL; |
|
2868 delete iStateAccessor; |
|
2869 iStateAccessor = NULL; |
|
2870 /* delete any validators used */ |
|
2871 delete iCtorValidator; |
|
2872 iCtorValidator = NULL; |
|
2873 delete iAcceptLanguageShortIntValidator; |
|
2874 iAcceptLanguageShortIntValidator = NULL; |
|
2875 delete iDtorValidator; |
|
2876 iDtorValidator = NULL; |
|
2877 return error; |
|
2878 } |
|
2879 |
|
2880 inline CWspHeaderWriter_AcceptLanguageShortInt_UnitTest::~CWspHeaderWriter_AcceptLanguageShortInt_UnitTest() |
|
2881 { |
|
2882 // Simply delete our test class instance |
|
2883 delete iUTContext; |
|
2884 delete iStateAccessor; |
|
2885 /* delete any validators used */ |
|
2886 delete iCtorValidator; |
|
2887 delete iAcceptLanguageShortIntValidator; |
|
2888 delete iDtorValidator; |
|
2889 } |
|
2890 |
|
2891 inline CWspHeaderWriter_AcceptLanguageShortInt_UnitTest::CWspHeaderWriter_AcceptLanguageShortInt_UnitTest(CDataLogger& aDataLogger, |
|
2892 MUnitTestObserver& aObserver) |
|
2893 : CUnitTest(KWspHeaderWriterAcceptLanguageShortIntUnitTest, aDataLogger, aObserver) |
|
2894 { |
|
2895 //Do nothing |
|
2896 } |
|
2897 |
|
2898 // Now the Individual transitions need to be added. |
|
2899 inline void CWspHeaderWriter_AcceptLanguageShortInt_UnitTest::ConstructL() |
|
2900 { |
|
2901 // Perform the base class initialization |
|
2902 UnitTestConstructL(); |
|
2903 |
|
2904 // Create the Unit test state accessor |
|
2905 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
2906 // Construct the Unit test context. |
|
2907 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
2908 iUTContext->ConstructL(WSP::EAcceptLanguage); |
|
2909 |
|
2910 // Part1 |
|
2911 _LIT8(KTxtLang, "en"); |
|
2912 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtLang); |
|
2913 CleanupClosePushL(stringVal); |
|
2914 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
2915 CleanupStack::PushL(part1); |
|
2916 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
2917 CleanupStack::Pop(part1); |
|
2918 CleanupStack::PopAndDestroy(&stringVal); |
|
2919 |
|
2920 TBuf8<256> expectedBuf; |
|
2921 expectedBuf.Append(0x99); // encoded token for 'en' |
|
2922 iUTContext->SetExpectedL(expectedBuf); |
|
2923 |
|
2924 // Add the Transitions in the order they are to run |
|
2925 // C'tor first, D'tor last... |
|
2926 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
2927 using constructor and destuctor validators */ |
|
2928 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
2929 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
2930 iAcceptLanguageShortIntValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
2931 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptLanguageShortIntValidator)); |
|
2932 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
2933 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
2934 } |
|
2935 |
|
2936 // ______________________________________________________________________________ |
|
2937 // |
|
2938 _LIT(KWspHeaderWriterAcceptLanguageAnyLangUnitTest,"CWspHeaderWriter_AcceptLanguageAnyLang_UnitTest"); |
|
2939 |
|
2940 CWspHeaderWriter_AcceptLanguageAnyLang_UnitTest* CWspHeaderWriter_AcceptLanguageAnyLang_UnitTest::NewL(CDataLogger& aDataLogger, |
|
2941 MUnitTestObserver& aObserver) |
|
2942 { |
|
2943 CWspHeaderWriter_AcceptLanguageAnyLang_UnitTest* self = |
|
2944 new(ELeave) CWspHeaderWriter_AcceptLanguageAnyLang_UnitTest(aDataLogger, |
|
2945 aObserver); |
|
2946 CleanupStack::PushL(self); |
|
2947 self->ConstructL(); |
|
2948 CleanupStack::Pop(self); |
|
2949 return self; |
|
2950 } |
|
2951 |
|
2952 inline TInt CWspHeaderWriter_AcceptLanguageAnyLang_UnitTest::RunError(TInt aError) |
|
2953 { |
|
2954 // The RunL left so chain to the base first and then cleanup |
|
2955 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
2956 delete iUTContext; |
|
2957 iUTContext = NULL; |
|
2958 delete iStateAccessor; |
|
2959 iStateAccessor = NULL; |
|
2960 /* delete any validators used */ |
|
2961 delete iCtorValidator; |
|
2962 iCtorValidator = NULL; |
|
2963 delete iAcceptLanguageAnyLangValidator; |
|
2964 iAcceptLanguageAnyLangValidator = NULL; |
|
2965 delete iDtorValidator; |
|
2966 iDtorValidator = NULL; |
|
2967 return error; |
|
2968 } |
|
2969 |
|
2970 inline CWspHeaderWriter_AcceptLanguageAnyLang_UnitTest::~CWspHeaderWriter_AcceptLanguageAnyLang_UnitTest() |
|
2971 { |
|
2972 // Simply delete our test class instance |
|
2973 delete iUTContext; |
|
2974 delete iStateAccessor; |
|
2975 /* delete any validators used */ |
|
2976 delete iCtorValidator; |
|
2977 delete iAcceptLanguageAnyLangValidator; |
|
2978 delete iDtorValidator; |
|
2979 } |
|
2980 |
|
2981 inline CWspHeaderWriter_AcceptLanguageAnyLang_UnitTest::CWspHeaderWriter_AcceptLanguageAnyLang_UnitTest(CDataLogger& aDataLogger, |
|
2982 MUnitTestObserver& aObserver) |
|
2983 : CUnitTest(KWspHeaderWriterAcceptLanguageAnyLangUnitTest, aDataLogger, aObserver) |
|
2984 { |
|
2985 //Do nothing |
|
2986 } |
|
2987 |
|
2988 // Now the Individual transitions need to be added. |
|
2989 inline void CWspHeaderWriter_AcceptLanguageAnyLang_UnitTest::ConstructL() |
|
2990 { |
|
2991 // Perform the base class initialization |
|
2992 UnitTestConstructL(); |
|
2993 |
|
2994 // Create the Unit test state accessor |
|
2995 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
2996 // Construct the Unit test context. |
|
2997 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
2998 iUTContext->ConstructL(WSP::EAcceptLanguage); |
|
2999 |
|
3000 // Part1 |
|
3001 _LIT8(KTxtLang, "*"); |
|
3002 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtLang); |
|
3003 CleanupClosePushL(stringVal); |
|
3004 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
3005 CleanupStack::PushL(part1); |
|
3006 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
3007 CleanupStack::Pop(part1); |
|
3008 CleanupStack::PopAndDestroy(&stringVal); |
|
3009 |
|
3010 TBuf8<256> expectedBuf; |
|
3011 expectedBuf.Append(0x80); // encoded token for 'en' |
|
3012 iUTContext->SetExpectedL(expectedBuf); |
|
3013 |
|
3014 // Add the Transitions in the order they are to run |
|
3015 // C'tor first, D'tor last... |
|
3016 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
3017 using constructor and destuctor validators */ |
|
3018 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
3019 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
3020 iAcceptLanguageAnyLangValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
3021 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptLanguageAnyLangValidator)); |
|
3022 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
3023 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
3024 } |
|
3025 |
|
3026 // ______________________________________________________________________________ |
|
3027 // |
|
3028 _LIT(KWspHeaderWriterAcceptLanguageGeneralShortQValUnitTest,"CWspHeaderWriter_AcceptLanguageGeneralShortQVal_UnitTest"); |
|
3029 |
|
3030 CWspHeaderWriter_AcceptLanguageGeneralShortQVal_UnitTest* CWspHeaderWriter_AcceptLanguageGeneralShortQVal_UnitTest::NewL(CDataLogger& aDataLogger, |
|
3031 MUnitTestObserver& aObserver) |
|
3032 { |
|
3033 CWspHeaderWriter_AcceptLanguageGeneralShortQVal_UnitTest* self = |
|
3034 new(ELeave) CWspHeaderWriter_AcceptLanguageGeneralShortQVal_UnitTest(aDataLogger, |
|
3035 aObserver); |
|
3036 CleanupStack::PushL(self); |
|
3037 self->ConstructL(); |
|
3038 CleanupStack::Pop(self); |
|
3039 return self; |
|
3040 } |
|
3041 |
|
3042 inline TInt CWspHeaderWriter_AcceptLanguageGeneralShortQVal_UnitTest::RunError(TInt aError) |
|
3043 { |
|
3044 // The RunL left so chain to the base first and then cleanup |
|
3045 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
3046 delete iUTContext; |
|
3047 iUTContext = NULL; |
|
3048 delete iStateAccessor; |
|
3049 iStateAccessor = NULL; |
|
3050 /* delete any validators used */ |
|
3051 delete iCtorValidator; |
|
3052 iCtorValidator = NULL; |
|
3053 delete iAcceptLanguageGeneralShortQValValidator; |
|
3054 iAcceptLanguageGeneralShortQValValidator = NULL; |
|
3055 delete iDtorValidator; |
|
3056 iDtorValidator = NULL; |
|
3057 return error; |
|
3058 } |
|
3059 |
|
3060 inline CWspHeaderWriter_AcceptLanguageGeneralShortQVal_UnitTest::~CWspHeaderWriter_AcceptLanguageGeneralShortQVal_UnitTest() |
|
3061 { |
|
3062 // Simply delete our test class instance |
|
3063 delete iUTContext; |
|
3064 delete iStateAccessor; |
|
3065 /* delete any validators used */ |
|
3066 delete iCtorValidator; |
|
3067 delete iAcceptLanguageGeneralShortQValValidator; |
|
3068 delete iDtorValidator; |
|
3069 } |
|
3070 |
|
3071 inline CWspHeaderWriter_AcceptLanguageGeneralShortQVal_UnitTest::CWspHeaderWriter_AcceptLanguageGeneralShortQVal_UnitTest(CDataLogger& aDataLogger, |
|
3072 MUnitTestObserver& aObserver) |
|
3073 : CUnitTest(KWspHeaderWriterAcceptLanguageGeneralShortQValUnitTest, aDataLogger, aObserver) |
|
3074 { |
|
3075 //Do nothing |
|
3076 } |
|
3077 |
|
3078 // Now the Individual transitions need to be added. |
|
3079 inline void CWspHeaderWriter_AcceptLanguageGeneralShortQVal_UnitTest::ConstructL() |
|
3080 { |
|
3081 // Perform the base class initialization |
|
3082 UnitTestConstructL(); |
|
3083 |
|
3084 // Create the Unit test state accessor |
|
3085 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
3086 // Construct the Unit test context. |
|
3087 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
3088 iUTContext->ConstructL(WSP::EAcceptLanguage); |
|
3089 |
|
3090 // Part1 |
|
3091 _LIT8(KTxtLang, "en"); |
|
3092 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtLang); |
|
3093 CleanupClosePushL(stringVal); |
|
3094 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
3095 CleanupStack::PushL(part1); |
|
3096 |
|
3097 // Param1 |
|
3098 _LIT8(KTxtQName, "Q"); |
|
3099 _LIT8(KTxtQVal, "0.333"); |
|
3100 RStringF stringVal1 = iUTContext->iStrPool.OpenFStringL(KTxtQName); |
|
3101 CleanupClosePushL(stringVal1); |
|
3102 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtQVal); |
|
3103 CleanupClosePushL(stringVal2); |
|
3104 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(stringVal1, stringVal2); |
|
3105 CleanupStack::PushL(param1); |
|
3106 part1->AddParamL(param1); |
|
3107 CleanupStack::Pop(param1); |
|
3108 |
|
3109 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
3110 CleanupStack::PopAndDestroy(2, &stringVal1); |
|
3111 CleanupStack::Pop(part1); |
|
3112 CleanupStack::PopAndDestroy(&stringVal); |
|
3113 |
|
3114 TBuf8<256> expectedBuf; |
|
3115 expectedBuf.Append(0x03); // value-length |
|
3116 expectedBuf.Append(0x99); // encoded token for 'en' |
|
3117 expectedBuf.Append(0x83); // encoding for Q 0.333... |
|
3118 expectedBuf.Append(0x31); // ... |
|
3119 iUTContext->SetExpectedL(expectedBuf); |
|
3120 |
|
3121 // Add the Transitions in the order they are to run |
|
3122 // C'tor first, D'tor last... |
|
3123 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
3124 using constructor and destuctor validators */ |
|
3125 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
3126 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
3127 iAcceptLanguageGeneralShortQValValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
3128 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptLanguageGeneralShortQValValidator)); |
|
3129 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
3130 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
3131 } |
|
3132 |
|
3133 // ______________________________________________________________________________ |
|
3134 // |
|
3135 _LIT(KWspHeaderWriterContentLanguageGeneralLongIntUnitTest,"CWspHeaderWriter_ContentLanguageGeneralLongInt_UnitTest"); |
|
3136 |
|
3137 CWspHeaderWriter_ContentLanguageGeneralLongInt_UnitTest* CWspHeaderWriter_ContentLanguageGeneralLongInt_UnitTest::NewL(CDataLogger& aDataLogger, |
|
3138 MUnitTestObserver& aObserver) |
|
3139 { |
|
3140 CWspHeaderWriter_ContentLanguageGeneralLongInt_UnitTest* self = |
|
3141 new(ELeave) CWspHeaderWriter_ContentLanguageGeneralLongInt_UnitTest(aDataLogger, |
|
3142 aObserver); |
|
3143 CleanupStack::PushL(self); |
|
3144 self->ConstructL(); |
|
3145 CleanupStack::Pop(self); |
|
3146 return self; |
|
3147 } |
|
3148 |
|
3149 inline TInt CWspHeaderWriter_ContentLanguageGeneralLongInt_UnitTest::RunError(TInt aError) |
|
3150 { |
|
3151 // The RunL left so chain to the base first and then cleanup |
|
3152 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
3153 delete iUTContext; |
|
3154 iUTContext = NULL; |
|
3155 delete iStateAccessor; |
|
3156 iStateAccessor = NULL; |
|
3157 /* delete any validators used */ |
|
3158 delete iCtorValidator; |
|
3159 iCtorValidator = NULL; |
|
3160 delete iContentLanguageGeneralLongIntValidator; |
|
3161 iContentLanguageGeneralLongIntValidator = NULL; |
|
3162 delete iDtorValidator; |
|
3163 iDtorValidator = NULL; |
|
3164 return error; |
|
3165 } |
|
3166 |
|
3167 inline CWspHeaderWriter_ContentLanguageGeneralLongInt_UnitTest::~CWspHeaderWriter_ContentLanguageGeneralLongInt_UnitTest() |
|
3168 { |
|
3169 // Simply delete our test class instance |
|
3170 delete iUTContext; |
|
3171 delete iStateAccessor; |
|
3172 /* delete any validators used */ |
|
3173 delete iCtorValidator; |
|
3174 delete iContentLanguageGeneralLongIntValidator; |
|
3175 delete iDtorValidator; |
|
3176 } |
|
3177 |
|
3178 inline CWspHeaderWriter_ContentLanguageGeneralLongInt_UnitTest::CWspHeaderWriter_ContentLanguageGeneralLongInt_UnitTest(CDataLogger& aDataLogger, |
|
3179 MUnitTestObserver& aObserver) |
|
3180 : CUnitTest(KWspHeaderWriterContentLanguageGeneralLongIntUnitTest, aDataLogger, aObserver) |
|
3181 { |
|
3182 //Do nothing |
|
3183 } |
|
3184 |
|
3185 // Now the Individual transitions need to be added. |
|
3186 inline void CWspHeaderWriter_ContentLanguageGeneralLongInt_UnitTest::ConstructL() |
|
3187 { |
|
3188 // Perform the base class initialization |
|
3189 UnitTestConstructL(); |
|
3190 |
|
3191 // Create the Unit test state accessor |
|
3192 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
3193 // Construct the Unit test context. |
|
3194 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
3195 iUTContext->ConstructL(WSP::EAcceptLanguage); |
|
3196 |
|
3197 // Part1 |
|
3198 _LIT8(KTxtLang, "fy"); |
|
3199 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtLang); |
|
3200 CleanupClosePushL(stringVal); |
|
3201 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
3202 CleanupStack::PushL(part1); |
|
3203 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
3204 CleanupStack::Pop(part1); |
|
3205 CleanupStack::PopAndDestroy(&stringVal); |
|
3206 |
|
3207 TBuf8<256> expectedBuf; |
|
3208 expectedBuf.Append(0x02); // value-length |
|
3209 expectedBuf.Append(0x01); // long int encoded token for 'fy' ... |
|
3210 expectedBuf.Append(0x83); // .. |
|
3211 iUTContext->SetExpectedL(expectedBuf); |
|
3212 |
|
3213 // Add the Transitions in the order they are to run |
|
3214 // C'tor first, D'tor last... |
|
3215 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
3216 using constructor and destuctor validators */ |
|
3217 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
3218 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
3219 iContentLanguageGeneralLongIntValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
3220 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentLanguageGeneralLongIntValidator)); |
|
3221 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
3222 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
3223 } |
|
3224 |
|
3225 // ______________________________________________________________________________ |
|
3226 // |
|
3227 _LIT(KWspHeaderWriterAcceptLanguageGeneralTextQValUnitTest,"CWspHeaderWriter_AcceptLanguageGeneralTextQVal_UnitTest"); |
|
3228 |
|
3229 CWspHeaderWriter_AcceptLanguageGeneralTextQVal_UnitTest* CWspHeaderWriter_AcceptLanguageGeneralTextQVal_UnitTest::NewL(CDataLogger& aDataLogger, |
|
3230 MUnitTestObserver& aObserver) |
|
3231 { |
|
3232 CWspHeaderWriter_AcceptLanguageGeneralTextQVal_UnitTest* self = |
|
3233 new(ELeave) CWspHeaderWriter_AcceptLanguageGeneralTextQVal_UnitTest(aDataLogger, |
|
3234 aObserver); |
|
3235 CleanupStack::PushL(self); |
|
3236 self->ConstructL(); |
|
3237 CleanupStack::Pop(self); |
|
3238 return self; |
|
3239 } |
|
3240 |
|
3241 inline TInt CWspHeaderWriter_AcceptLanguageGeneralTextQVal_UnitTest::RunError(TInt aError) |
|
3242 { |
|
3243 // The RunL left so chain to the base first and then cleanup |
|
3244 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
3245 delete iUTContext; |
|
3246 iUTContext = NULL; |
|
3247 delete iStateAccessor; |
|
3248 iStateAccessor = NULL; |
|
3249 /* delete any validators used */ |
|
3250 delete iCtorValidator; |
|
3251 iCtorValidator = NULL; |
|
3252 delete iAcceptLanguageGeneralTextQValValidator; |
|
3253 iAcceptLanguageGeneralTextQValValidator = NULL; |
|
3254 delete iDtorValidator; |
|
3255 iDtorValidator = NULL; |
|
3256 return error; |
|
3257 } |
|
3258 |
|
3259 inline CWspHeaderWriter_AcceptLanguageGeneralTextQVal_UnitTest::~CWspHeaderWriter_AcceptLanguageGeneralTextQVal_UnitTest() |
|
3260 { |
|
3261 // Simply delete our test class instance |
|
3262 delete iUTContext; |
|
3263 delete iStateAccessor; |
|
3264 /* delete any validators used */ |
|
3265 delete iCtorValidator; |
|
3266 delete iAcceptLanguageGeneralTextQValValidator; |
|
3267 delete iDtorValidator; |
|
3268 } |
|
3269 |
|
3270 inline CWspHeaderWriter_AcceptLanguageGeneralTextQVal_UnitTest::CWspHeaderWriter_AcceptLanguageGeneralTextQVal_UnitTest(CDataLogger& aDataLogger, |
|
3271 MUnitTestObserver& aObserver) |
|
3272 : CUnitTest(KWspHeaderWriterAcceptLanguageGeneralTextQValUnitTest, aDataLogger, aObserver) |
|
3273 { |
|
3274 //Do nothing |
|
3275 } |
|
3276 |
|
3277 // Now the Individual transitions need to be added. |
|
3278 inline void CWspHeaderWriter_AcceptLanguageGeneralTextQVal_UnitTest::ConstructL() |
|
3279 { |
|
3280 // Perform the base class initialization |
|
3281 UnitTestConstructL(); |
|
3282 |
|
3283 // Create the Unit test state accessor |
|
3284 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
3285 // Construct the Unit test context. |
|
3286 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
3287 iUTContext->ConstructL(WSP::EAcceptLanguage); |
|
3288 |
|
3289 // Part1 |
|
3290 _LIT8(KTxtLang, "my-new-language"); |
|
3291 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtLang); |
|
3292 CleanupClosePushL(stringVal); |
|
3293 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
3294 CleanupStack::PushL(part1); |
|
3295 |
|
3296 // Param1 |
|
3297 _LIT8(KTxtQName, "Q"); |
|
3298 _LIT8(KTxtQVal, "0.333"); |
|
3299 RStringF stringVal1 = iUTContext->iStrPool.OpenFStringL(KTxtQName); |
|
3300 CleanupClosePushL(stringVal1); |
|
3301 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtQVal); |
|
3302 CleanupClosePushL(stringVal2); |
|
3303 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(stringVal1, stringVal2); |
|
3304 CleanupStack::PushL(param1); |
|
3305 part1->AddParamL(param1); |
|
3306 CleanupStack::Pop(param1); |
|
3307 |
|
3308 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
3309 CleanupStack::PopAndDestroy(2, &stringVal1); |
|
3310 CleanupStack::Pop(part1); |
|
3311 CleanupStack::PopAndDestroy(&stringVal); |
|
3312 |
|
3313 TBuf8<256> expectedBuf; |
|
3314 expectedBuf.Append(0x12); // value-length |
|
3315 expectedBuf.Append(KTxtLang); |
|
3316 expectedBuf.Append(0x00); |
|
3317 expectedBuf.Append(0x83); // encoding for Q 0.333... |
|
3318 expectedBuf.Append(0x31); // ... |
|
3319 iUTContext->SetExpectedL(expectedBuf); |
|
3320 |
|
3321 // Add the Transitions in the order they are to run |
|
3322 // C'tor first, D'tor last... |
|
3323 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
3324 using constructor and destuctor validators */ |
|
3325 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
3326 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
3327 iAcceptLanguageGeneralTextQValValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
3328 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptLanguageGeneralTextQValValidator)); |
|
3329 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
3330 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
3331 } |
|
3332 |
|
3333 // ______________________________________________________________________________ |
|
3334 // |
|
3335 _LIT(KWspHeaderWriterAcceptLanguageTextUnitTest,"CWspHeaderWriter_AcceptLanguageText_UnitTest"); |
|
3336 |
|
3337 CWspHeaderWriter_AcceptLanguageText_UnitTest* CWspHeaderWriter_AcceptLanguageText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
3338 MUnitTestObserver& aObserver) |
|
3339 { |
|
3340 CWspHeaderWriter_AcceptLanguageText_UnitTest* self = |
|
3341 new(ELeave) CWspHeaderWriter_AcceptLanguageText_UnitTest(aDataLogger, |
|
3342 aObserver); |
|
3343 CleanupStack::PushL(self); |
|
3344 self->ConstructL(); |
|
3345 CleanupStack::Pop(self); |
|
3346 return self; |
|
3347 } |
|
3348 |
|
3349 inline TInt CWspHeaderWriter_AcceptLanguageText_UnitTest::RunError(TInt aError) |
|
3350 { |
|
3351 // The RunL left so chain to the base first and then cleanup |
|
3352 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
3353 delete iUTContext; |
|
3354 iUTContext = NULL; |
|
3355 delete iStateAccessor; |
|
3356 iStateAccessor = NULL; |
|
3357 /* delete any validators used */ |
|
3358 delete iCtorValidator; |
|
3359 iCtorValidator = NULL; |
|
3360 delete iAcceptLanguageTextValidator; |
|
3361 iAcceptLanguageTextValidator = NULL; |
|
3362 delete iDtorValidator; |
|
3363 iDtorValidator = NULL; |
|
3364 return error; |
|
3365 } |
|
3366 |
|
3367 inline CWspHeaderWriter_AcceptLanguageText_UnitTest::~CWspHeaderWriter_AcceptLanguageText_UnitTest() |
|
3368 { |
|
3369 // Simply delete our test class instance |
|
3370 delete iUTContext; |
|
3371 delete iStateAccessor; |
|
3372 /* delete any validators used */ |
|
3373 delete iCtorValidator; |
|
3374 delete iAcceptLanguageTextValidator; |
|
3375 delete iDtorValidator; |
|
3376 } |
|
3377 |
|
3378 inline CWspHeaderWriter_AcceptLanguageText_UnitTest::CWspHeaderWriter_AcceptLanguageText_UnitTest(CDataLogger& aDataLogger, |
|
3379 MUnitTestObserver& aObserver) |
|
3380 : CUnitTest(KWspHeaderWriterAcceptLanguageTextUnitTest, aDataLogger, aObserver) |
|
3381 { |
|
3382 //Do nothing |
|
3383 } |
|
3384 |
|
3385 // Now the Individual transitions need to be added. |
|
3386 inline void CWspHeaderWriter_AcceptLanguageText_UnitTest::ConstructL() |
|
3387 { |
|
3388 // Perform the base class initialization |
|
3389 UnitTestConstructL(); |
|
3390 |
|
3391 // Create the Unit test state accessor |
|
3392 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
3393 // Construct the Unit test context. |
|
3394 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
3395 iUTContext->ConstructL(WSP::EAcceptLanguage); |
|
3396 |
|
3397 // Part1 |
|
3398 _LIT8(KTxtLang, "my-new-language"); |
|
3399 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtLang); |
|
3400 CleanupClosePushL(stringVal); |
|
3401 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
3402 CleanupStack::PushL(part1); |
|
3403 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
3404 CleanupStack::Pop(part1); |
|
3405 CleanupStack::PopAndDestroy(&stringVal); |
|
3406 |
|
3407 TBuf8<256> expectedBuf; |
|
3408 expectedBuf.Append(KTxtLang); |
|
3409 expectedBuf.Append(0x00); |
|
3410 iUTContext->SetExpectedL(expectedBuf); |
|
3411 |
|
3412 // Add the Transitions in the order they are to run |
|
3413 // C'tor first, D'tor last... |
|
3414 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
3415 using constructor and destuctor validators */ |
|
3416 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
3417 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
3418 iAcceptLanguageTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
3419 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptLanguageTextValidator)); |
|
3420 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
3421 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
3422 } |
|
3423 |
|
3424 // ______________________________________________________________________________ |
|
3425 // |
|
3426 _LIT(KWspHeaderWriterContentEncodingGZipUnitTest,"CWspHeaderWriter_ContentEncodingGZip_UnitTest"); |
|
3427 |
|
3428 CWspHeaderWriter_ContentEncodingGZip_UnitTest* CWspHeaderWriter_ContentEncodingGZip_UnitTest::NewL(CDataLogger& aDataLogger, |
|
3429 MUnitTestObserver& aObserver) |
|
3430 { |
|
3431 CWspHeaderWriter_ContentEncodingGZip_UnitTest* self = |
|
3432 new(ELeave) CWspHeaderWriter_ContentEncodingGZip_UnitTest(aDataLogger, |
|
3433 aObserver); |
|
3434 CleanupStack::PushL(self); |
|
3435 self->ConstructL(); |
|
3436 CleanupStack::Pop(self); |
|
3437 return self; |
|
3438 } |
|
3439 |
|
3440 inline TInt CWspHeaderWriter_ContentEncodingGZip_UnitTest::RunError(TInt aError) |
|
3441 { |
|
3442 // The RunL left so chain to the base first and then cleanup |
|
3443 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
3444 delete iUTContext; |
|
3445 iUTContext = NULL; |
|
3446 delete iStateAccessor; |
|
3447 iStateAccessor = NULL; |
|
3448 /* delete any validators used */ |
|
3449 delete iCtorValidator; |
|
3450 iCtorValidator = NULL; |
|
3451 delete iContentEncodingGZipValidator; |
|
3452 iContentEncodingGZipValidator = NULL; |
|
3453 delete iDtorValidator; |
|
3454 iDtorValidator = NULL; |
|
3455 return error; |
|
3456 } |
|
3457 |
|
3458 inline CWspHeaderWriter_ContentEncodingGZip_UnitTest::~CWspHeaderWriter_ContentEncodingGZip_UnitTest() |
|
3459 { |
|
3460 // Simply delete our test class instance |
|
3461 delete iUTContext; |
|
3462 delete iStateAccessor; |
|
3463 /* delete any validators used */ |
|
3464 delete iCtorValidator; |
|
3465 delete iContentEncodingGZipValidator; |
|
3466 delete iDtorValidator; |
|
3467 } |
|
3468 |
|
3469 inline CWspHeaderWriter_ContentEncodingGZip_UnitTest::CWspHeaderWriter_ContentEncodingGZip_UnitTest(CDataLogger& aDataLogger, |
|
3470 MUnitTestObserver& aObserver) |
|
3471 : CUnitTest(KWspHeaderWriterContentEncodingGZipUnitTest, aDataLogger, aObserver) |
|
3472 { |
|
3473 //Do nothing |
|
3474 } |
|
3475 |
|
3476 // Now the Individual transitions need to be added. |
|
3477 inline void CWspHeaderWriter_ContentEncodingGZip_UnitTest::ConstructL() |
|
3478 { |
|
3479 // Perform the base class initialization |
|
3480 UnitTestConstructL(); |
|
3481 |
|
3482 // Create the Unit test state accessor |
|
3483 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
3484 // Construct the Unit test context. |
|
3485 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
3486 iUTContext->ConstructL(WSP::EContentEncoding); |
|
3487 |
|
3488 // Part1 |
|
3489 _LIT8(KTxtEncoding, "Gzip"); |
|
3490 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtEncoding); |
|
3491 CleanupClosePushL(stringVal); |
|
3492 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
3493 CleanupStack::PushL(part1); |
|
3494 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
3495 CleanupStack::Pop(part1); |
|
3496 CleanupStack::PopAndDestroy(&stringVal); |
|
3497 |
|
3498 TBuf8<256> expectedBuf; |
|
3499 expectedBuf.Append(0x80); |
|
3500 iUTContext->SetExpectedL(expectedBuf); |
|
3501 |
|
3502 // Add the Transitions in the order they are to run |
|
3503 // C'tor first, D'tor last... |
|
3504 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
3505 using constructor and destuctor validators */ |
|
3506 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
3507 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
3508 iContentEncodingGZipValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
3509 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentEncodingGZipValidator)); |
|
3510 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
3511 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
3512 } |
|
3513 |
|
3514 // ______________________________________________________________________________ |
|
3515 // |
|
3516 _LIT(KWspHeaderWriterContentEncodingCompressUnitTest,"CWspHeaderWriter_ContentEncodingCompress_UnitTest"); |
|
3517 |
|
3518 CWspHeaderWriter_ContentEncodingCompress_UnitTest* CWspHeaderWriter_ContentEncodingCompress_UnitTest::NewL(CDataLogger& aDataLogger, |
|
3519 MUnitTestObserver& aObserver) |
|
3520 { |
|
3521 CWspHeaderWriter_ContentEncodingCompress_UnitTest* self = |
|
3522 new(ELeave) CWspHeaderWriter_ContentEncodingCompress_UnitTest(aDataLogger, |
|
3523 aObserver); |
|
3524 CleanupStack::PushL(self); |
|
3525 self->ConstructL(); |
|
3526 CleanupStack::Pop(self); |
|
3527 return self; |
|
3528 } |
|
3529 |
|
3530 inline TInt CWspHeaderWriter_ContentEncodingCompress_UnitTest::RunError(TInt aError) |
|
3531 { |
|
3532 // The RunL left so chain to the base first and then cleanup |
|
3533 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
3534 delete iUTContext; |
|
3535 iUTContext = NULL; |
|
3536 delete iStateAccessor; |
|
3537 iStateAccessor = NULL; |
|
3538 /* delete any validators used */ |
|
3539 delete iCtorValidator; |
|
3540 iCtorValidator = NULL; |
|
3541 delete iContentEncodingCompressValidator; |
|
3542 iContentEncodingCompressValidator = NULL; |
|
3543 delete iDtorValidator; |
|
3544 iDtorValidator = NULL; |
|
3545 return error; |
|
3546 } |
|
3547 |
|
3548 inline CWspHeaderWriter_ContentEncodingCompress_UnitTest::~CWspHeaderWriter_ContentEncodingCompress_UnitTest() |
|
3549 { |
|
3550 // Simply delete our test class instance |
|
3551 delete iUTContext; |
|
3552 delete iStateAccessor; |
|
3553 /* delete any validators used */ |
|
3554 delete iCtorValidator; |
|
3555 delete iContentEncodingCompressValidator; |
|
3556 delete iDtorValidator; |
|
3557 } |
|
3558 |
|
3559 inline CWspHeaderWriter_ContentEncodingCompress_UnitTest::CWspHeaderWriter_ContentEncodingCompress_UnitTest(CDataLogger& aDataLogger, |
|
3560 MUnitTestObserver& aObserver) |
|
3561 : CUnitTest(KWspHeaderWriterContentEncodingCompressUnitTest, aDataLogger, aObserver) |
|
3562 { |
|
3563 //Do nothing |
|
3564 } |
|
3565 |
|
3566 // Now the Individual transitions need to be added. |
|
3567 inline void CWspHeaderWriter_ContentEncodingCompress_UnitTest::ConstructL() |
|
3568 { |
|
3569 // Perform the base class initialization |
|
3570 UnitTestConstructL(); |
|
3571 |
|
3572 // Create the Unit test state accessor |
|
3573 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
3574 // Construct the Unit test context. |
|
3575 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
3576 iUTContext->ConstructL(WSP::EContentEncoding); |
|
3577 |
|
3578 // Part1 |
|
3579 _LIT8(KTxtEncoding, "Compress"); |
|
3580 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtEncoding); |
|
3581 CleanupClosePushL(stringVal); |
|
3582 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
3583 CleanupStack::PushL(part1); |
|
3584 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
3585 CleanupStack::Pop(part1); |
|
3586 CleanupStack::PopAndDestroy(&stringVal); |
|
3587 |
|
3588 TBuf8<256> expectedBuf; |
|
3589 expectedBuf.Append(0x81); |
|
3590 iUTContext->SetExpectedL(expectedBuf); |
|
3591 |
|
3592 // Add the Transitions in the order they are to run |
|
3593 // C'tor first, D'tor last... |
|
3594 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
3595 using constructor and destuctor validators */ |
|
3596 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
3597 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
3598 iContentEncodingCompressValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
3599 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentEncodingCompressValidator)); |
|
3600 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
3601 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
3602 } |
|
3603 |
|
3604 // ______________________________________________________________________________ |
|
3605 // |
|
3606 _LIT(KWspHeaderWriterContentEncodingDeflateUnitTest,"CWspHeaderWriter_ContentEncodingDeflate_UnitTest"); |
|
3607 |
|
3608 CWspHeaderWriter_ContentEncodingDeflate_UnitTest* CWspHeaderWriter_ContentEncodingDeflate_UnitTest::NewL(CDataLogger& aDataLogger, |
|
3609 MUnitTestObserver& aObserver) |
|
3610 { |
|
3611 CWspHeaderWriter_ContentEncodingDeflate_UnitTest* self = |
|
3612 new(ELeave) CWspHeaderWriter_ContentEncodingDeflate_UnitTest(aDataLogger, |
|
3613 aObserver); |
|
3614 CleanupStack::PushL(self); |
|
3615 self->ConstructL(); |
|
3616 CleanupStack::Pop(self); |
|
3617 return self; |
|
3618 } |
|
3619 |
|
3620 inline TInt CWspHeaderWriter_ContentEncodingDeflate_UnitTest::RunError(TInt aError) |
|
3621 { |
|
3622 // The RunL left so chain to the base first and then cleanup |
|
3623 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
3624 delete iUTContext; |
|
3625 iUTContext = NULL; |
|
3626 delete iStateAccessor; |
|
3627 iStateAccessor = NULL; |
|
3628 /* delete any validators used */ |
|
3629 delete iCtorValidator; |
|
3630 iCtorValidator = NULL; |
|
3631 delete iContentEncodingDeflateValidator; |
|
3632 iContentEncodingDeflateValidator = NULL; |
|
3633 delete iDtorValidator; |
|
3634 iDtorValidator = NULL; |
|
3635 return error; |
|
3636 } |
|
3637 |
|
3638 inline CWspHeaderWriter_ContentEncodingDeflate_UnitTest::~CWspHeaderWriter_ContentEncodingDeflate_UnitTest() |
|
3639 { |
|
3640 // Simply delete our test class instance |
|
3641 delete iUTContext; |
|
3642 delete iStateAccessor; |
|
3643 /* delete any validators used */ |
|
3644 delete iCtorValidator; |
|
3645 delete iContentEncodingDeflateValidator; |
|
3646 delete iDtorValidator; |
|
3647 } |
|
3648 |
|
3649 inline CWspHeaderWriter_ContentEncodingDeflate_UnitTest::CWspHeaderWriter_ContentEncodingDeflate_UnitTest(CDataLogger& aDataLogger, |
|
3650 MUnitTestObserver& aObserver) |
|
3651 : CUnitTest(KWspHeaderWriterContentEncodingDeflateUnitTest, aDataLogger, aObserver) |
|
3652 { |
|
3653 //Do nothing |
|
3654 } |
|
3655 |
|
3656 // Now the Individual transitions need to be added. |
|
3657 inline void CWspHeaderWriter_ContentEncodingDeflate_UnitTest::ConstructL() |
|
3658 { |
|
3659 // Perform the base class initialization |
|
3660 UnitTestConstructL(); |
|
3661 |
|
3662 // Create the Unit test state accessor |
|
3663 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
3664 // Construct the Unit test context. |
|
3665 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
3666 iUTContext->ConstructL(WSP::EContentEncoding); |
|
3667 |
|
3668 // Part1 |
|
3669 _LIT8(KTxtEncoding, "Deflate"); |
|
3670 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtEncoding); |
|
3671 CleanupClosePushL(stringVal); |
|
3672 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
3673 CleanupStack::PushL(part1); |
|
3674 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
3675 CleanupStack::Pop(part1); |
|
3676 CleanupStack::PopAndDestroy(&stringVal); |
|
3677 |
|
3678 TBuf8<256> expectedBuf; |
|
3679 expectedBuf.Append(0x82); |
|
3680 iUTContext->SetExpectedL(expectedBuf); |
|
3681 |
|
3682 // Add the Transitions in the order they are to run |
|
3683 // C'tor first, D'tor last... |
|
3684 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
3685 using constructor and destuctor validators */ |
|
3686 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
3687 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
3688 iContentEncodingDeflateValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
3689 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentEncodingDeflateValidator)); |
|
3690 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
3691 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
3692 } |
|
3693 |
|
3694 // ______________________________________________________________________________ |
|
3695 // |
|
3696 _LIT(KWspHeaderWriterContentEncodingTextUnitTest,"CWspHeaderWriter_ContentEncodingText_UnitTest"); |
|
3697 |
|
3698 CWspHeaderWriter_ContentEncodingText_UnitTest* CWspHeaderWriter_ContentEncodingText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
3699 MUnitTestObserver& aObserver) |
|
3700 { |
|
3701 CWspHeaderWriter_ContentEncodingText_UnitTest* self = |
|
3702 new(ELeave) CWspHeaderWriter_ContentEncodingText_UnitTest(aDataLogger, |
|
3703 aObserver); |
|
3704 CleanupStack::PushL(self); |
|
3705 self->ConstructL(); |
|
3706 CleanupStack::Pop(self); |
|
3707 return self; |
|
3708 } |
|
3709 |
|
3710 inline TInt CWspHeaderWriter_ContentEncodingText_UnitTest::RunError(TInt aError) |
|
3711 { |
|
3712 // The RunL left so chain to the base first and then cleanup |
|
3713 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
3714 delete iUTContext; |
|
3715 iUTContext = NULL; |
|
3716 delete iStateAccessor; |
|
3717 iStateAccessor = NULL; |
|
3718 /* delete any validators used */ |
|
3719 delete iCtorValidator; |
|
3720 iCtorValidator = NULL; |
|
3721 delete iContentEncodingTextValidator; |
|
3722 iContentEncodingTextValidator = NULL; |
|
3723 delete iDtorValidator; |
|
3724 iDtorValidator = NULL; |
|
3725 return error; |
|
3726 } |
|
3727 |
|
3728 inline CWspHeaderWriter_ContentEncodingText_UnitTest::~CWspHeaderWriter_ContentEncodingText_UnitTest() |
|
3729 { |
|
3730 // Simply delete our test class instance |
|
3731 delete iUTContext; |
|
3732 delete iStateAccessor; |
|
3733 /* delete any validators used */ |
|
3734 delete iCtorValidator; |
|
3735 delete iContentEncodingTextValidator; |
|
3736 delete iDtorValidator; |
|
3737 } |
|
3738 |
|
3739 inline CWspHeaderWriter_ContentEncodingText_UnitTest::CWspHeaderWriter_ContentEncodingText_UnitTest(CDataLogger& aDataLogger, |
|
3740 MUnitTestObserver& aObserver) |
|
3741 : CUnitTest(KWspHeaderWriterContentEncodingTextUnitTest, aDataLogger, aObserver) |
|
3742 { |
|
3743 //Do nothing |
|
3744 } |
|
3745 |
|
3746 // Now the Individual transitions need to be added. |
|
3747 inline void CWspHeaderWriter_ContentEncodingText_UnitTest::ConstructL() |
|
3748 { |
|
3749 // Perform the base class initialization |
|
3750 UnitTestConstructL(); |
|
3751 |
|
3752 // Create the Unit test state accessor |
|
3753 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
3754 // Construct the Unit test context. |
|
3755 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
3756 iUTContext->ConstructL(WSP::EContentEncoding); |
|
3757 |
|
3758 // Part1 |
|
3759 _LIT8(KTxtEncoding, "my-encoding"); |
|
3760 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtEncoding); |
|
3761 CleanupClosePushL(stringVal); |
|
3762 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
3763 CleanupStack::PushL(part1); |
|
3764 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
3765 CleanupStack::Pop(part1); |
|
3766 CleanupStack::PopAndDestroy(&stringVal); |
|
3767 |
|
3768 TBuf8<256> expectedBuf; |
|
3769 expectedBuf.Append(KTxtEncoding); |
|
3770 expectedBuf.Append(0x00); |
|
3771 iUTContext->SetExpectedL(expectedBuf); |
|
3772 |
|
3773 // Add the Transitions in the order they are to run |
|
3774 // C'tor first, D'tor last... |
|
3775 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
3776 using constructor and destuctor validators */ |
|
3777 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
3778 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
3779 iContentEncodingTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
3780 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentEncodingTextValidator)); |
|
3781 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
3782 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
3783 } |
|
3784 |
|
3785 // ______________________________________________________________________________ |
|
3786 // |
|
3787 _LIT(KWspHeaderWriterContentLanguageShortIntUnitTest,"CWspHeaderWriter_ContentLanguageShortInt_UnitTest"); |
|
3788 |
|
3789 CWspHeaderWriter_ContentLanguageShortInt_UnitTest* CWspHeaderWriter_ContentLanguageShortInt_UnitTest::NewL(CDataLogger& aDataLogger, |
|
3790 MUnitTestObserver& aObserver) |
|
3791 { |
|
3792 CWspHeaderWriter_ContentLanguageShortInt_UnitTest* self = |
|
3793 new(ELeave) CWspHeaderWriter_ContentLanguageShortInt_UnitTest(aDataLogger, |
|
3794 aObserver); |
|
3795 CleanupStack::PushL(self); |
|
3796 self->ConstructL(); |
|
3797 CleanupStack::Pop(self); |
|
3798 return self; |
|
3799 } |
|
3800 |
|
3801 inline TInt CWspHeaderWriter_ContentLanguageShortInt_UnitTest::RunError(TInt aError) |
|
3802 { |
|
3803 // The RunL left so chain to the base first and then cleanup |
|
3804 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
3805 delete iUTContext; |
|
3806 iUTContext = NULL; |
|
3807 delete iStateAccessor; |
|
3808 iStateAccessor = NULL; |
|
3809 /* delete any validators used */ |
|
3810 delete iCtorValidator; |
|
3811 iCtorValidator = NULL; |
|
3812 delete iContentLanguageShortIntValidator; |
|
3813 iContentLanguageShortIntValidator = NULL; |
|
3814 delete iDtorValidator; |
|
3815 iDtorValidator = NULL; |
|
3816 return error; |
|
3817 } |
|
3818 |
|
3819 inline CWspHeaderWriter_ContentLanguageShortInt_UnitTest::~CWspHeaderWriter_ContentLanguageShortInt_UnitTest() |
|
3820 { |
|
3821 // Simply delete our test class instance |
|
3822 delete iUTContext; |
|
3823 delete iStateAccessor; |
|
3824 /* delete any validators used */ |
|
3825 delete iCtorValidator; |
|
3826 delete iContentLanguageShortIntValidator; |
|
3827 delete iDtorValidator; |
|
3828 } |
|
3829 |
|
3830 inline CWspHeaderWriter_ContentLanguageShortInt_UnitTest::CWspHeaderWriter_ContentLanguageShortInt_UnitTest(CDataLogger& aDataLogger, |
|
3831 MUnitTestObserver& aObserver) |
|
3832 : CUnitTest(KWspHeaderWriterContentLanguageShortIntUnitTest, aDataLogger, aObserver) |
|
3833 { |
|
3834 //Do nothing |
|
3835 } |
|
3836 |
|
3837 // Now the Individual transitions need to be added. |
|
3838 inline void CWspHeaderWriter_ContentLanguageShortInt_UnitTest::ConstructL() |
|
3839 { |
|
3840 // Perform the base class initialization |
|
3841 UnitTestConstructL(); |
|
3842 |
|
3843 // Create the Unit test state accessor |
|
3844 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
3845 // Construct the Unit test context. |
|
3846 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
3847 iUTContext->ConstructL(WSP::EContentLanguage); |
|
3848 |
|
3849 // Part1 |
|
3850 _LIT8(KTxtEncoding, "su"); |
|
3851 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtEncoding); |
|
3852 CleanupClosePushL(stringVal); |
|
3853 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
3854 CleanupStack::PushL(part1); |
|
3855 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
3856 CleanupStack::Pop(part1); |
|
3857 CleanupStack::PopAndDestroy(&stringVal); |
|
3858 |
|
3859 TBuf8<256> expectedBuf; |
|
3860 expectedBuf.Append(0xEF); |
|
3861 iUTContext->SetExpectedL(expectedBuf); |
|
3862 |
|
3863 // Add the Transitions in the order they are to run |
|
3864 // C'tor first, D'tor last... |
|
3865 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
3866 using constructor and destuctor validators */ |
|
3867 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
3868 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
3869 iContentLanguageShortIntValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
3870 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentLanguageShortIntValidator)); |
|
3871 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
3872 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
3873 } |
|
3874 |
|
3875 // ______________________________________________________________________________ |
|
3876 // |
|
3877 _LIT(KWspHeaderWriterContentLanguageLongIntUnitTest,"CWspHeaderWriter_ContentLanguageLongInt_UnitTest"); |
|
3878 |
|
3879 CWspHeaderWriter_ContentLanguageLongInt_UnitTest* CWspHeaderWriter_ContentLanguageLongInt_UnitTest::NewL(CDataLogger& aDataLogger, |
|
3880 MUnitTestObserver& aObserver) |
|
3881 { |
|
3882 CWspHeaderWriter_ContentLanguageLongInt_UnitTest* self = |
|
3883 new(ELeave) CWspHeaderWriter_ContentLanguageLongInt_UnitTest(aDataLogger, |
|
3884 aObserver); |
|
3885 CleanupStack::PushL(self); |
|
3886 self->ConstructL(); |
|
3887 CleanupStack::Pop(self); |
|
3888 return self; |
|
3889 } |
|
3890 |
|
3891 inline TInt CWspHeaderWriter_ContentLanguageLongInt_UnitTest::RunError(TInt aError) |
|
3892 { |
|
3893 // The RunL left so chain to the base first and then cleanup |
|
3894 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
3895 delete iUTContext; |
|
3896 iUTContext = NULL; |
|
3897 delete iStateAccessor; |
|
3898 iStateAccessor = NULL; |
|
3899 /* delete any validators used */ |
|
3900 delete iCtorValidator; |
|
3901 iCtorValidator = NULL; |
|
3902 delete iContentLanguageLongIntValidator; |
|
3903 iContentLanguageLongIntValidator = NULL; |
|
3904 delete iDtorValidator; |
|
3905 iDtorValidator = NULL; |
|
3906 return error; |
|
3907 } |
|
3908 |
|
3909 inline CWspHeaderWriter_ContentLanguageLongInt_UnitTest::~CWspHeaderWriter_ContentLanguageLongInt_UnitTest() |
|
3910 { |
|
3911 // Simply delete our test class instance |
|
3912 delete iUTContext; |
|
3913 delete iStateAccessor; |
|
3914 /* delete any validators used */ |
|
3915 delete iCtorValidator; |
|
3916 delete iContentLanguageLongIntValidator; |
|
3917 delete iDtorValidator; |
|
3918 } |
|
3919 |
|
3920 inline CWspHeaderWriter_ContentLanguageLongInt_UnitTest::CWspHeaderWriter_ContentLanguageLongInt_UnitTest(CDataLogger& aDataLogger, |
|
3921 MUnitTestObserver& aObserver) |
|
3922 : CUnitTest(KWspHeaderWriterContentLanguageLongIntUnitTest, aDataLogger, aObserver) |
|
3923 { |
|
3924 //Do nothing |
|
3925 } |
|
3926 |
|
3927 // Now the Individual transitions need to be added. |
|
3928 inline void CWspHeaderWriter_ContentLanguageLongInt_UnitTest::ConstructL() |
|
3929 { |
|
3930 // Perform the base class initialization |
|
3931 UnitTestConstructL(); |
|
3932 |
|
3933 // Create the Unit test state accessor |
|
3934 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
3935 // Construct the Unit test context. |
|
3936 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
3937 iUTContext->ConstructL(WSP::EContentLanguage); |
|
3938 |
|
3939 // Part1 |
|
3940 _LIT8(KTxtEncoding, "ie"); |
|
3941 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtEncoding); |
|
3942 CleanupClosePushL(stringVal); |
|
3943 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
3944 CleanupStack::PushL(part1); |
|
3945 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
3946 CleanupStack::Pop(part1); |
|
3947 CleanupStack::PopAndDestroy(&stringVal); |
|
3948 |
|
3949 TBuf8<256> expectedBuf; |
|
3950 expectedBuf.Append(0x01); |
|
3951 expectedBuf.Append(0x86); |
|
3952 iUTContext->SetExpectedL(expectedBuf); |
|
3953 |
|
3954 // Add the Transitions in the order they are to run |
|
3955 // C'tor first, D'tor last... |
|
3956 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
3957 using constructor and destuctor validators */ |
|
3958 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
3959 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
3960 iContentLanguageLongIntValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
3961 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentLanguageLongIntValidator)); |
|
3962 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
3963 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
3964 } |
|
3965 |
|
3966 // ______________________________________________________________________________ |
|
3967 // |
|
3968 _LIT(KWspHeaderWriterContentLanguageTextUnitTest,"CWspHeaderWriter_ContentLanguageText_UnitTest"); |
|
3969 |
|
3970 CWspHeaderWriter_ContentLanguageText_UnitTest* CWspHeaderWriter_ContentLanguageText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
3971 MUnitTestObserver& aObserver) |
|
3972 { |
|
3973 CWspHeaderWriter_ContentLanguageText_UnitTest* self = |
|
3974 new(ELeave) CWspHeaderWriter_ContentLanguageText_UnitTest(aDataLogger, |
|
3975 aObserver); |
|
3976 CleanupStack::PushL(self); |
|
3977 self->ConstructL(); |
|
3978 CleanupStack::Pop(self); |
|
3979 return self; |
|
3980 } |
|
3981 |
|
3982 inline TInt CWspHeaderWriter_ContentLanguageText_UnitTest::RunError(TInt aError) |
|
3983 { |
|
3984 // The RunL left so chain to the base first and then cleanup |
|
3985 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
3986 delete iUTContext; |
|
3987 iUTContext = NULL; |
|
3988 delete iStateAccessor; |
|
3989 iStateAccessor = NULL; |
|
3990 /* delete any validators used */ |
|
3991 delete iCtorValidator; |
|
3992 iCtorValidator = NULL; |
|
3993 delete iContentLanguageTextValidator; |
|
3994 iContentLanguageTextValidator = NULL; |
|
3995 delete iDtorValidator; |
|
3996 iDtorValidator = NULL; |
|
3997 return error; |
|
3998 } |
|
3999 |
|
4000 inline CWspHeaderWriter_ContentLanguageText_UnitTest::~CWspHeaderWriter_ContentLanguageText_UnitTest() |
|
4001 { |
|
4002 // Simply delete our test class instance |
|
4003 delete iUTContext; |
|
4004 delete iStateAccessor; |
|
4005 /* delete any validators used */ |
|
4006 delete iCtorValidator; |
|
4007 delete iContentLanguageTextValidator; |
|
4008 delete iDtorValidator; |
|
4009 } |
|
4010 |
|
4011 inline CWspHeaderWriter_ContentLanguageText_UnitTest::CWspHeaderWriter_ContentLanguageText_UnitTest(CDataLogger& aDataLogger, |
|
4012 MUnitTestObserver& aObserver) |
|
4013 : CUnitTest(KWspHeaderWriterContentLanguageTextUnitTest, aDataLogger, aObserver) |
|
4014 { |
|
4015 //Do nothing |
|
4016 } |
|
4017 |
|
4018 // Now the Individual transitions need to be added. |
|
4019 inline void CWspHeaderWriter_ContentLanguageText_UnitTest::ConstructL() |
|
4020 { |
|
4021 // Perform the base class initialization |
|
4022 UnitTestConstructL(); |
|
4023 |
|
4024 // Create the Unit test state accessor |
|
4025 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
4026 // Construct the Unit test context. |
|
4027 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
4028 iUTContext->ConstructL(WSP::EContentLanguage); |
|
4029 |
|
4030 // Part1 |
|
4031 _LIT8(KTxtEncoding, "my-new-language"); |
|
4032 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtEncoding); |
|
4033 CleanupClosePushL(stringVal); |
|
4034 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
4035 CleanupStack::PushL(part1); |
|
4036 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
4037 CleanupStack::Pop(part1); |
|
4038 CleanupStack::PopAndDestroy(&stringVal); |
|
4039 |
|
4040 TBuf8<256> expectedBuf; |
|
4041 expectedBuf.Append(KTxtEncoding); |
|
4042 expectedBuf.Append(0x00); |
|
4043 iUTContext->SetExpectedL(expectedBuf); |
|
4044 |
|
4045 // Add the Transitions in the order they are to run |
|
4046 // C'tor first, D'tor last... |
|
4047 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
4048 using constructor and destuctor validators */ |
|
4049 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
4050 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
4051 iContentLanguageTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
4052 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentLanguageTextValidator)); |
|
4053 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
4054 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
4055 } |
|
4056 |
|
4057 // ______________________________________________________________________________ |
|
4058 // |
|
4059 _LIT(KWspHeaderWriterContentMD516ByteDataUnitTest,"CWspHeaderWriter_ContentMD516ByteData_UnitTest"); |
|
4060 |
|
4061 CWspHeaderWriter_ContentMD516ByteData_UnitTest* CWspHeaderWriter_ContentMD516ByteData_UnitTest::NewL(CDataLogger& aDataLogger, |
|
4062 MUnitTestObserver& aObserver) |
|
4063 { |
|
4064 CWspHeaderWriter_ContentMD516ByteData_UnitTest* self = |
|
4065 new(ELeave) CWspHeaderWriter_ContentMD516ByteData_UnitTest(aDataLogger, |
|
4066 aObserver); |
|
4067 CleanupStack::PushL(self); |
|
4068 self->ConstructL(); |
|
4069 CleanupStack::Pop(self); |
|
4070 return self; |
|
4071 } |
|
4072 |
|
4073 inline TInt CWspHeaderWriter_ContentMD516ByteData_UnitTest::RunError(TInt aError) |
|
4074 { |
|
4075 // The RunL left so chain to the base first and then cleanup |
|
4076 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
4077 delete iUTContext; |
|
4078 iUTContext = NULL; |
|
4079 delete iStateAccessor; |
|
4080 iStateAccessor = NULL; |
|
4081 /* delete any validators used */ |
|
4082 delete iCtorValidator; |
|
4083 iCtorValidator = NULL; |
|
4084 delete iContentMD516ByteDataValidator; |
|
4085 iContentMD516ByteDataValidator = NULL; |
|
4086 delete iDtorValidator; |
|
4087 iDtorValidator = NULL; |
|
4088 return error; |
|
4089 } |
|
4090 |
|
4091 inline CWspHeaderWriter_ContentMD516ByteData_UnitTest::~CWspHeaderWriter_ContentMD516ByteData_UnitTest() |
|
4092 { |
|
4093 // Simply delete our test class instance |
|
4094 delete iUTContext; |
|
4095 delete iStateAccessor; |
|
4096 /* delete any validators used */ |
|
4097 delete iCtorValidator; |
|
4098 delete iContentMD516ByteDataValidator; |
|
4099 delete iDtorValidator; |
|
4100 } |
|
4101 |
|
4102 inline CWspHeaderWriter_ContentMD516ByteData_UnitTest::CWspHeaderWriter_ContentMD516ByteData_UnitTest(CDataLogger& aDataLogger, |
|
4103 MUnitTestObserver& aObserver) |
|
4104 : CUnitTest(KWspHeaderWriterContentMD516ByteDataUnitTest, aDataLogger, aObserver) |
|
4105 { |
|
4106 //Do nothing |
|
4107 } |
|
4108 |
|
4109 // Now the Individual transitions need to be added. |
|
4110 inline void CWspHeaderWriter_ContentMD516ByteData_UnitTest::ConstructL() |
|
4111 { |
|
4112 // Perform the base class initialization |
|
4113 UnitTestConstructL(); |
|
4114 |
|
4115 // Create the Unit test state accessor |
|
4116 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
4117 // Construct the Unit test context. |
|
4118 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
4119 iUTContext->ConstructL(WSP::EContentMD5); |
|
4120 |
|
4121 // Part1 |
|
4122 _LIT8(KTxtEncoding, "encrypteddata_16"); |
|
4123 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtEncoding); |
|
4124 CleanupClosePushL(stringVal); |
|
4125 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
4126 CleanupStack::PushL(part1); |
|
4127 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
4128 CleanupStack::Pop(part1); |
|
4129 CleanupStack::PopAndDestroy(&stringVal); |
|
4130 |
|
4131 TBuf8<256> expectedBuf; |
|
4132 expectedBuf.Append(0x10); // value length |
|
4133 expectedBuf.Append(KTxtEncoding); |
|
4134 iUTContext->SetExpectedL(expectedBuf); |
|
4135 |
|
4136 // Add the Transitions in the order they are to run |
|
4137 // C'tor first, D'tor last... |
|
4138 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
4139 using constructor and destuctor validators */ |
|
4140 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
4141 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
4142 iContentMD516ByteDataValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
4143 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentMD516ByteDataValidator)); |
|
4144 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
4145 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
4146 } |
|
4147 |
|
4148 // ______________________________________________________________________________ |
|
4149 // |
|
4150 _LIT(KWspHeaderWriterContentMD531ByteDataUnitTest,"CWspHeaderWriter_ContentMD531ByteData_UnitTest"); |
|
4151 |
|
4152 CWspHeaderWriter_ContentMD531ByteData_UnitTest* CWspHeaderWriter_ContentMD531ByteData_UnitTest::NewL(CDataLogger& aDataLogger, |
|
4153 MUnitTestObserver& aObserver) |
|
4154 { |
|
4155 CWspHeaderWriter_ContentMD531ByteData_UnitTest* self = |
|
4156 new(ELeave) CWspHeaderWriter_ContentMD531ByteData_UnitTest(aDataLogger, |
|
4157 aObserver); |
|
4158 CleanupStack::PushL(self); |
|
4159 self->ConstructL(); |
|
4160 CleanupStack::Pop(self); |
|
4161 return self; |
|
4162 } |
|
4163 |
|
4164 inline TInt CWspHeaderWriter_ContentMD531ByteData_UnitTest::RunError(TInt aError) |
|
4165 { |
|
4166 // The RunL left so chain to the base first and then cleanup |
|
4167 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
4168 delete iUTContext; |
|
4169 iUTContext = NULL; |
|
4170 delete iStateAccessor; |
|
4171 iStateAccessor = NULL; |
|
4172 /* delete any validators used */ |
|
4173 delete iCtorValidator; |
|
4174 iCtorValidator = NULL; |
|
4175 delete iContentMD531ByteDataValidator; |
|
4176 iContentMD531ByteDataValidator = NULL; |
|
4177 delete iDtorValidator; |
|
4178 iDtorValidator = NULL; |
|
4179 return error; |
|
4180 } |
|
4181 |
|
4182 inline CWspHeaderWriter_ContentMD531ByteData_UnitTest::~CWspHeaderWriter_ContentMD531ByteData_UnitTest() |
|
4183 { |
|
4184 // Simply delete our test class instance |
|
4185 delete iUTContext; |
|
4186 delete iStateAccessor; |
|
4187 /* delete any validators used */ |
|
4188 delete iCtorValidator; |
|
4189 delete iContentMD531ByteDataValidator; |
|
4190 delete iDtorValidator; |
|
4191 } |
|
4192 |
|
4193 inline CWspHeaderWriter_ContentMD531ByteData_UnitTest::CWspHeaderWriter_ContentMD531ByteData_UnitTest(CDataLogger& aDataLogger, |
|
4194 MUnitTestObserver& aObserver) |
|
4195 : CUnitTest(KWspHeaderWriterContentMD531ByteDataUnitTest, aDataLogger, aObserver) |
|
4196 { |
|
4197 //Do nothing |
|
4198 } |
|
4199 |
|
4200 // Now the Individual transitions need to be added. |
|
4201 inline void CWspHeaderWriter_ContentMD531ByteData_UnitTest::ConstructL() |
|
4202 { |
|
4203 // Perform the base class initialization |
|
4204 UnitTestConstructL(); |
|
4205 |
|
4206 // Create the Unit test state accessor |
|
4207 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
4208 // Construct the Unit test context. |
|
4209 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
4210 iUTContext->ConstructL(WSP::EContentMD5); |
|
4211 |
|
4212 // Part1 |
|
4213 _LIT8(KTxtEncoding, "my_encrypteddataencrypteddata31"); |
|
4214 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtEncoding); |
|
4215 CleanupClosePushL(stringVal); |
|
4216 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
4217 CleanupStack::PushL(part1); |
|
4218 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
4219 CleanupStack::Pop(part1); |
|
4220 CleanupStack::PopAndDestroy(&stringVal); |
|
4221 |
|
4222 TBuf8<256> expectedBuf; |
|
4223 expectedBuf.Append(0x1F); // value length <octet 31> |
|
4224 expectedBuf.Append(0x1F); // value length 31 bytes |
|
4225 expectedBuf.Append(KTxtEncoding); |
|
4226 iUTContext->SetExpectedL(expectedBuf); |
|
4227 |
|
4228 // Add the Transitions in the order they are to run |
|
4229 // C'tor first, D'tor last... |
|
4230 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
4231 using constructor and destuctor validators */ |
|
4232 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
4233 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
4234 iContentMD531ByteDataValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
4235 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentMD531ByteDataValidator)); |
|
4236 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
4237 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
4238 } |
|
4239 |
|
4240 // ______________________________________________________________________________ |
|
4241 // |
|
4242 _LIT(KWspHeaderWriterDateUnitTest,"CWspHeaderWriter_Date_UnitTest"); |
|
4243 |
|
4244 CWspHeaderWriter_Date_UnitTest* CWspHeaderWriter_Date_UnitTest::NewL(CDataLogger& aDataLogger, |
|
4245 MUnitTestObserver& aObserver) |
|
4246 { |
|
4247 CWspHeaderWriter_Date_UnitTest* self = |
|
4248 new(ELeave) CWspHeaderWriter_Date_UnitTest(aDataLogger, |
|
4249 aObserver); |
|
4250 CleanupStack::PushL(self); |
|
4251 self->ConstructL(); |
|
4252 CleanupStack::Pop(self); |
|
4253 return self; |
|
4254 } |
|
4255 |
|
4256 inline TInt CWspHeaderWriter_Date_UnitTest::RunError(TInt aError) |
|
4257 { |
|
4258 // The RunL left so chain to the base first and then cleanup |
|
4259 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
4260 delete iUTContext; |
|
4261 iUTContext = NULL; |
|
4262 delete iStateAccessor; |
|
4263 iStateAccessor = NULL; |
|
4264 /* delete any validators used */ |
|
4265 delete iCtorValidator; |
|
4266 iCtorValidator = NULL; |
|
4267 delete iDateValidator; |
|
4268 iDateValidator = NULL; |
|
4269 delete iDtorValidator; |
|
4270 iDtorValidator = NULL; |
|
4271 return error; |
|
4272 } |
|
4273 |
|
4274 inline CWspHeaderWriter_Date_UnitTest::~CWspHeaderWriter_Date_UnitTest() |
|
4275 { |
|
4276 // Simply delete our test class instance |
|
4277 delete iUTContext; |
|
4278 delete iStateAccessor; |
|
4279 /* delete any validators used */ |
|
4280 delete iCtorValidator; |
|
4281 delete iDateValidator; |
|
4282 delete iDtorValidator; |
|
4283 } |
|
4284 |
|
4285 inline CWspHeaderWriter_Date_UnitTest::CWspHeaderWriter_Date_UnitTest(CDataLogger& aDataLogger, |
|
4286 MUnitTestObserver& aObserver) |
|
4287 : CUnitTest(KWspHeaderWriterDateUnitTest, aDataLogger, aObserver) |
|
4288 { |
|
4289 //Do nothing |
|
4290 } |
|
4291 |
|
4292 // Now the Individual transitions need to be added. |
|
4293 inline void CWspHeaderWriter_Date_UnitTest::ConstructL() |
|
4294 { |
|
4295 // Perform the base class initialization |
|
4296 UnitTestConstructL(); |
|
4297 |
|
4298 // Create the Unit test state accessor |
|
4299 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
4300 // Construct the Unit test context. |
|
4301 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
4302 iUTContext->ConstructL(WSP::EDate); |
|
4303 |
|
4304 // Part1 |
|
4305 TDateTime dateTime(1970, EJanuary, 0, 0, 0, 0, 0); |
|
4306 TTime time(dateTime); |
|
4307 time+=TTimeIntervalSeconds(654321); |
|
4308 TDateTime part1Value = time.DateTime(); |
|
4309 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(part1Value); |
|
4310 CleanupStack::PushL(part1); |
|
4311 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
4312 CleanupStack::Pop(part1); |
|
4313 |
|
4314 TBuf8<256> expectedBuf; |
|
4315 expectedBuf.Append(0x03); // value length |
|
4316 expectedBuf.Append(0x09); |
|
4317 expectedBuf.Append(0xFB); |
|
4318 expectedBuf.Append(0xF1); |
|
4319 iUTContext->SetExpectedL(expectedBuf); |
|
4320 |
|
4321 // Add the Transitions in the order they are to run |
|
4322 // C'tor first, D'tor last... |
|
4323 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
4324 using constructor and destuctor validators */ |
|
4325 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
4326 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
4327 iDateValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
4328 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iDateValidator)); |
|
4329 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
4330 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
4331 } |
|
4332 |
|
4333 // ______________________________________________________________________________ |
|
4334 // |
|
4335 _LIT(KWspHeaderWriterFromTextUnitTest,"CWspHeaderWriter_FromText_UnitTest"); |
|
4336 |
|
4337 CWspHeaderWriter_FromText_UnitTest* CWspHeaderWriter_FromText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
4338 MUnitTestObserver& aObserver) |
|
4339 { |
|
4340 CWspHeaderWriter_FromText_UnitTest* self = |
|
4341 new(ELeave) CWspHeaderWriter_FromText_UnitTest(aDataLogger, |
|
4342 aObserver); |
|
4343 CleanupStack::PushL(self); |
|
4344 self->ConstructL(); |
|
4345 CleanupStack::Pop(self); |
|
4346 return self; |
|
4347 } |
|
4348 |
|
4349 inline TInt CWspHeaderWriter_FromText_UnitTest::RunError(TInt aError) |
|
4350 { |
|
4351 // The RunL left so chain to the base first and then cleanup |
|
4352 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
4353 delete iUTContext; |
|
4354 iUTContext = NULL; |
|
4355 delete iStateAccessor; |
|
4356 iStateAccessor = NULL; |
|
4357 /* delete any validators used */ |
|
4358 delete iCtorValidator; |
|
4359 iCtorValidator = NULL; |
|
4360 delete iFromTextValidator; |
|
4361 iFromTextValidator = NULL; |
|
4362 delete iDtorValidator; |
|
4363 iDtorValidator = NULL; |
|
4364 return error; |
|
4365 } |
|
4366 |
|
4367 inline CWspHeaderWriter_FromText_UnitTest::~CWspHeaderWriter_FromText_UnitTest() |
|
4368 { |
|
4369 // Simply delete our test class instance |
|
4370 delete iUTContext; |
|
4371 delete iStateAccessor; |
|
4372 /* delete any validators used */ |
|
4373 delete iCtorValidator; |
|
4374 delete iFromTextValidator; |
|
4375 delete iDtorValidator; |
|
4376 } |
|
4377 |
|
4378 inline CWspHeaderWriter_FromText_UnitTest::CWspHeaderWriter_FromText_UnitTest(CDataLogger& aDataLogger, |
|
4379 MUnitTestObserver& aObserver) |
|
4380 : CUnitTest(KWspHeaderWriterFromTextUnitTest, aDataLogger, aObserver) |
|
4381 { |
|
4382 //Do nothing |
|
4383 } |
|
4384 |
|
4385 // Now the Individual transitions need to be added. |
|
4386 inline void CWspHeaderWriter_FromText_UnitTest::ConstructL() |
|
4387 { |
|
4388 // Perform the base class initialization |
|
4389 UnitTestConstructL(); |
|
4390 |
|
4391 // Create the Unit test state accessor |
|
4392 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
4393 // Construct the Unit test context. |
|
4394 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
4395 iUTContext->ConstructL(WSP::EFrom); |
|
4396 |
|
4397 // Part1 |
|
4398 _LIT8(KTxtFrom, "from-example-value"); |
|
4399 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtFrom); |
|
4400 CleanupClosePushL(stringVal); |
|
4401 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
4402 CleanupStack::PushL(part1); |
|
4403 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
4404 CleanupStack::Pop(part1); |
|
4405 CleanupStack::PopAndDestroy(&stringVal); |
|
4406 |
|
4407 TBuf8<256> expectedBuf; |
|
4408 expectedBuf.Append(KTxtFrom); |
|
4409 expectedBuf.Append(0x00); |
|
4410 iUTContext->SetExpectedL(expectedBuf); |
|
4411 |
|
4412 // Add the Transitions in the order they are to run |
|
4413 // C'tor first, D'tor last... |
|
4414 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
4415 using constructor and destuctor validators */ |
|
4416 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
4417 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
4418 iFromTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
4419 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iFromTextValidator)); |
|
4420 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
4421 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
4422 } |
|
4423 |
|
4424 // ______________________________________________________________________________ |
|
4425 // |
|
4426 _LIT(KWspHeaderWriterFromNullTextUnitTest,"CWspHeaderWriter_FromNullText_UnitTest"); |
|
4427 |
|
4428 CWspHeaderWriter_FromNullText_UnitTest* CWspHeaderWriter_FromNullText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
4429 MUnitTestObserver& aObserver) |
|
4430 { |
|
4431 CWspHeaderWriter_FromNullText_UnitTest* self = |
|
4432 new(ELeave) CWspHeaderWriter_FromNullText_UnitTest(aDataLogger, |
|
4433 aObserver); |
|
4434 CleanupStack::PushL(self); |
|
4435 self->ConstructL(); |
|
4436 CleanupStack::Pop(self); |
|
4437 return self; |
|
4438 } |
|
4439 |
|
4440 inline TInt CWspHeaderWriter_FromNullText_UnitTest::RunError(TInt aError) |
|
4441 { |
|
4442 // The RunL left so chain to the base first and then cleanup |
|
4443 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
4444 delete iUTContext; |
|
4445 iUTContext = NULL; |
|
4446 delete iStateAccessor; |
|
4447 iStateAccessor = NULL; |
|
4448 /* delete any validators used */ |
|
4449 delete iCtorValidator; |
|
4450 iCtorValidator = NULL; |
|
4451 delete iFromNullTextValidator; |
|
4452 iFromNullTextValidator = NULL; |
|
4453 delete iDtorValidator; |
|
4454 iDtorValidator = NULL; |
|
4455 return error; |
|
4456 } |
|
4457 |
|
4458 inline CWspHeaderWriter_FromNullText_UnitTest::~CWspHeaderWriter_FromNullText_UnitTest() |
|
4459 { |
|
4460 // Simply delete our test class instance |
|
4461 delete iUTContext; |
|
4462 delete iStateAccessor; |
|
4463 /* delete any validators used */ |
|
4464 delete iCtorValidator; |
|
4465 delete iFromNullTextValidator; |
|
4466 delete iDtorValidator; |
|
4467 } |
|
4468 |
|
4469 inline CWspHeaderWriter_FromNullText_UnitTest::CWspHeaderWriter_FromNullText_UnitTest(CDataLogger& aDataLogger, |
|
4470 MUnitTestObserver& aObserver) |
|
4471 : CUnitTest(KWspHeaderWriterFromNullTextUnitTest, aDataLogger, aObserver) |
|
4472 { |
|
4473 //Do nothing |
|
4474 } |
|
4475 |
|
4476 // Now the Individual transitions need to be added. |
|
4477 inline void CWspHeaderWriter_FromNullText_UnitTest::ConstructL() |
|
4478 { |
|
4479 // Perform the base class initialization |
|
4480 UnitTestConstructL(); |
|
4481 |
|
4482 // Create the Unit test state accessor |
|
4483 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
4484 // Construct the Unit test context. |
|
4485 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
4486 iUTContext->ConstructL(WSP::EFrom); |
|
4487 |
|
4488 // Part1 |
|
4489 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KNullDesC8); |
|
4490 CleanupClosePushL(stringVal); |
|
4491 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
4492 CleanupStack::PushL(part1); |
|
4493 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
4494 CleanupStack::Pop(part1); |
|
4495 CleanupStack::PopAndDestroy(&stringVal); |
|
4496 |
|
4497 TBuf8<256> expectedBuf; |
|
4498 expectedBuf.Append(0x00); |
|
4499 iUTContext->SetExpectedL(expectedBuf); |
|
4500 |
|
4501 // Add the Transitions in the order they are to run |
|
4502 // C'tor first, D'tor last... |
|
4503 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
4504 using constructor and destuctor validators */ |
|
4505 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
4506 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
4507 iFromNullTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
4508 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iFromNullTextValidator)); |
|
4509 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
4510 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
4511 } |
|
4512 |
|
4513 // ______________________________________________________________________________ |
|
4514 // |
|
4515 _LIT(KWspHeaderWriterLastModifiedUnitTest,"CWspHeaderWriter_LastModified_UnitTest"); |
|
4516 |
|
4517 CWspHeaderWriter_LastModified_UnitTest* CWspHeaderWriter_LastModified_UnitTest::NewL(CDataLogger& aDataLogger, |
|
4518 MUnitTestObserver& aObserver) |
|
4519 { |
|
4520 CWspHeaderWriter_LastModified_UnitTest* self = |
|
4521 new(ELeave) CWspHeaderWriter_LastModified_UnitTest(aDataLogger, |
|
4522 aObserver); |
|
4523 CleanupStack::PushL(self); |
|
4524 self->ConstructL(); |
|
4525 CleanupStack::Pop(self); |
|
4526 return self; |
|
4527 } |
|
4528 |
|
4529 inline TInt CWspHeaderWriter_LastModified_UnitTest::RunError(TInt aError) |
|
4530 { |
|
4531 // The RunL left so chain to the base first and then cleanup |
|
4532 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
4533 delete iUTContext; |
|
4534 iUTContext = NULL; |
|
4535 delete iStateAccessor; |
|
4536 iStateAccessor = NULL; |
|
4537 /* delete any validators used */ |
|
4538 delete iCtorValidator; |
|
4539 iCtorValidator = NULL; |
|
4540 delete iLastModifiedValidator; |
|
4541 iLastModifiedValidator = NULL; |
|
4542 delete iDtorValidator; |
|
4543 iDtorValidator = NULL; |
|
4544 return error; |
|
4545 } |
|
4546 |
|
4547 inline CWspHeaderWriter_LastModified_UnitTest::~CWspHeaderWriter_LastModified_UnitTest() |
|
4548 { |
|
4549 // Simply delete our test class instance |
|
4550 delete iUTContext; |
|
4551 delete iStateAccessor; |
|
4552 /* delete any validators used */ |
|
4553 delete iCtorValidator; |
|
4554 delete iLastModifiedValidator; |
|
4555 delete iDtorValidator; |
|
4556 } |
|
4557 |
|
4558 inline CWspHeaderWriter_LastModified_UnitTest::CWspHeaderWriter_LastModified_UnitTest(CDataLogger& aDataLogger, |
|
4559 MUnitTestObserver& aObserver) |
|
4560 : CUnitTest(KWspHeaderWriterLastModifiedUnitTest, aDataLogger, aObserver) |
|
4561 { |
|
4562 //Do nothing |
|
4563 } |
|
4564 |
|
4565 // Now the Individual transitions need to be added. |
|
4566 inline void CWspHeaderWriter_LastModified_UnitTest::ConstructL() |
|
4567 { |
|
4568 // Perform the base class initialization |
|
4569 UnitTestConstructL(); |
|
4570 |
|
4571 // Create the Unit test state accessor |
|
4572 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
4573 // Construct the Unit test context. |
|
4574 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
4575 iUTContext->ConstructL(WSP::ELastModified); |
|
4576 |
|
4577 // Part1 |
|
4578 TDateTime dateTime(1970, EJanuary, 0, 0, 0, 0, 0); |
|
4579 TTime time(dateTime); |
|
4580 time+=TTimeIntervalSeconds(5654321); |
|
4581 TDateTime part1Value = time.DateTime(); |
|
4582 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(part1Value); |
|
4583 CleanupStack::PushL(part1); |
|
4584 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
4585 CleanupStack::Pop(part1); |
|
4586 |
|
4587 TBuf8<256> expectedBuf; |
|
4588 expectedBuf.Append(0x03); // value length |
|
4589 expectedBuf.Append(0x56); |
|
4590 expectedBuf.Append(0x47); |
|
4591 expectedBuf.Append(0x31); |
|
4592 iUTContext->SetExpectedL(expectedBuf); |
|
4593 |
|
4594 // Add the Transitions in the order they are to run |
|
4595 // C'tor first, D'tor last... |
|
4596 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
4597 using constructor and destuctor validators */ |
|
4598 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
4599 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
4600 iLastModifiedValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
4601 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iLastModifiedValidator)); |
|
4602 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
4603 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
4604 } |
|
4605 |
|
4606 // ______________________________________________________________________________ |
|
4607 // |
|
4608 _LIT(KWspHeaderWriterRangeByteRangeNoLastPosUnitTest,"CWspHeaderWriter_RangeByteRangeNoLastPos_UnitTest"); |
|
4609 |
|
4610 CWspHeaderWriter_RangeByteRangeNoLastPos_UnitTest* CWspHeaderWriter_RangeByteRangeNoLastPos_UnitTest::NewL(CDataLogger& aDataLogger, |
|
4611 MUnitTestObserver& aObserver) |
|
4612 { |
|
4613 CWspHeaderWriter_RangeByteRangeNoLastPos_UnitTest* self = |
|
4614 new(ELeave) CWspHeaderWriter_RangeByteRangeNoLastPos_UnitTest(aDataLogger, |
|
4615 aObserver); |
|
4616 CleanupStack::PushL(self); |
|
4617 self->ConstructL(); |
|
4618 CleanupStack::Pop(self); |
|
4619 return self; |
|
4620 } |
|
4621 |
|
4622 inline TInt CWspHeaderWriter_RangeByteRangeNoLastPos_UnitTest::RunError(TInt aError) |
|
4623 { |
|
4624 // The RunL left so chain to the base first and then cleanup |
|
4625 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
4626 delete iUTContext; |
|
4627 iUTContext = NULL; |
|
4628 delete iStateAccessor; |
|
4629 iStateAccessor = NULL; |
|
4630 /* delete any validators used */ |
|
4631 delete iCtorValidator; |
|
4632 iCtorValidator = NULL; |
|
4633 delete iRangeByteRangeNoLastPosValidator; |
|
4634 iRangeByteRangeNoLastPosValidator = NULL; |
|
4635 delete iDtorValidator; |
|
4636 iDtorValidator = NULL; |
|
4637 return error; |
|
4638 } |
|
4639 |
|
4640 inline CWspHeaderWriter_RangeByteRangeNoLastPos_UnitTest::~CWspHeaderWriter_RangeByteRangeNoLastPos_UnitTest() |
|
4641 { |
|
4642 // Simply delete our test class instance |
|
4643 delete iUTContext; |
|
4644 delete iStateAccessor; |
|
4645 /* delete any validators used */ |
|
4646 delete iCtorValidator; |
|
4647 delete iRangeByteRangeNoLastPosValidator; |
|
4648 delete iDtorValidator; |
|
4649 } |
|
4650 |
|
4651 inline CWspHeaderWriter_RangeByteRangeNoLastPos_UnitTest::CWspHeaderWriter_RangeByteRangeNoLastPos_UnitTest(CDataLogger& aDataLogger, |
|
4652 MUnitTestObserver& aObserver) |
|
4653 : CUnitTest(KWspHeaderWriterRangeByteRangeNoLastPosUnitTest, aDataLogger, aObserver) |
|
4654 { |
|
4655 //Do nothing |
|
4656 } |
|
4657 |
|
4658 // Now the Individual transitions need to be added. |
|
4659 inline void CWspHeaderWriter_RangeByteRangeNoLastPos_UnitTest::ConstructL() |
|
4660 { |
|
4661 // Perform the base class initialization |
|
4662 UnitTestConstructL(); |
|
4663 |
|
4664 // Create the Unit test state accessor |
|
4665 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
4666 // Construct the Unit test context. |
|
4667 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
4668 iUTContext->ConstructL(WSP::ERange); |
|
4669 |
|
4670 // Part1 |
|
4671 _LIT8(KTxtRange, "Byte-range"); |
|
4672 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtRange); |
|
4673 CleanupClosePushL(stringVal); |
|
4674 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
4675 CleanupStack::PushL(part1); |
|
4676 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
4677 CleanupStack::Pop(part1); |
|
4678 CleanupStack::PopAndDestroy(&stringVal); |
|
4679 |
|
4680 // Part2 |
|
4681 TInt firstBytePos = 145; |
|
4682 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(firstBytePos); |
|
4683 CleanupStack::PushL(part2); |
|
4684 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
4685 CleanupStack::Pop(part2); |
|
4686 |
|
4687 TBuf8<256> expectedBuf; |
|
4688 expectedBuf.Append(0x03); // value length |
|
4689 expectedBuf.Append(0x80); // encoded token for 'byte-range' |
|
4690 expectedBuf.Append(0x81); // value-length for 145 ... |
|
4691 expectedBuf.Append(0x11); // ... |
|
4692 iUTContext->SetExpectedL(expectedBuf); |
|
4693 |
|
4694 // Add the Transitions in the order they are to run |
|
4695 // C'tor first, D'tor last... |
|
4696 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
4697 using constructor and destuctor validators */ |
|
4698 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
4699 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
4700 iRangeByteRangeNoLastPosValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
4701 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iRangeByteRangeNoLastPosValidator)); |
|
4702 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
4703 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
4704 } |
|
4705 |
|
4706 // ______________________________________________________________________________ |
|
4707 // |
|
4708 _LIT(KWspHeaderWriterRangeByteRangeWithLastPosUnitTest,"CWspHeaderWriter_RangeByteRangeWithLastPos_UnitTest"); |
|
4709 |
|
4710 CWspHeaderWriter_RangeByteRangeWithLastPos_UnitTest* CWspHeaderWriter_RangeByteRangeWithLastPos_UnitTest::NewL(CDataLogger& aDataLogger, |
|
4711 MUnitTestObserver& aObserver) |
|
4712 { |
|
4713 CWspHeaderWriter_RangeByteRangeWithLastPos_UnitTest* self = |
|
4714 new(ELeave) CWspHeaderWriter_RangeByteRangeWithLastPos_UnitTest(aDataLogger, |
|
4715 aObserver); |
|
4716 CleanupStack::PushL(self); |
|
4717 self->ConstructL(); |
|
4718 CleanupStack::Pop(self); |
|
4719 return self; |
|
4720 } |
|
4721 |
|
4722 inline TInt CWspHeaderWriter_RangeByteRangeWithLastPos_UnitTest::RunError(TInt aError) |
|
4723 { |
|
4724 // The RunL left so chain to the base first and then cleanup |
|
4725 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
4726 delete iUTContext; |
|
4727 iUTContext = NULL; |
|
4728 delete iStateAccessor; |
|
4729 iStateAccessor = NULL; |
|
4730 /* delete any validators used */ |
|
4731 delete iCtorValidator; |
|
4732 iCtorValidator = NULL; |
|
4733 delete iRangeByteRangeWithLastPosValidator; |
|
4734 iRangeByteRangeWithLastPosValidator = NULL; |
|
4735 delete iDtorValidator; |
|
4736 iDtorValidator = NULL; |
|
4737 return error; |
|
4738 } |
|
4739 |
|
4740 inline CWspHeaderWriter_RangeByteRangeWithLastPos_UnitTest::~CWspHeaderWriter_RangeByteRangeWithLastPos_UnitTest() |
|
4741 { |
|
4742 // Simply delete our test class instance |
|
4743 delete iUTContext; |
|
4744 delete iStateAccessor; |
|
4745 /* delete any validators used */ |
|
4746 delete iCtorValidator; |
|
4747 delete iRangeByteRangeWithLastPosValidator; |
|
4748 delete iDtorValidator; |
|
4749 } |
|
4750 |
|
4751 inline CWspHeaderWriter_RangeByteRangeWithLastPos_UnitTest::CWspHeaderWriter_RangeByteRangeWithLastPos_UnitTest(CDataLogger& aDataLogger, |
|
4752 MUnitTestObserver& aObserver) |
|
4753 : CUnitTest(KWspHeaderWriterRangeByteRangeWithLastPosUnitTest, aDataLogger, aObserver) |
|
4754 { |
|
4755 //Do nothing |
|
4756 } |
|
4757 |
|
4758 // Now the Individual transitions need to be added. |
|
4759 inline void CWspHeaderWriter_RangeByteRangeWithLastPos_UnitTest::ConstructL() |
|
4760 { |
|
4761 // Perform the base class initialization |
|
4762 UnitTestConstructL(); |
|
4763 |
|
4764 // Create the Unit test state accessor |
|
4765 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
4766 // Construct the Unit test context. |
|
4767 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
4768 iUTContext->ConstructL(WSP::ERange); |
|
4769 |
|
4770 // Part1 |
|
4771 _LIT8(KTxtRange, "Byte-range"); |
|
4772 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtRange); |
|
4773 CleanupClosePushL(stringVal); |
|
4774 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
4775 CleanupStack::PushL(part1); |
|
4776 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
4777 CleanupStack::Pop(part1); |
|
4778 CleanupStack::PopAndDestroy(&stringVal); |
|
4779 |
|
4780 // Part2 |
|
4781 TInt firstBytePos = 145; |
|
4782 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(firstBytePos); |
|
4783 CleanupStack::PushL(part2); |
|
4784 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
4785 CleanupStack::Pop(part2); |
|
4786 |
|
4787 // Part3 |
|
4788 TInt lastBytePos = 300; |
|
4789 CHeaderFieldPart* part3 = CHeaderFieldPart::NewL(lastBytePos); |
|
4790 CleanupStack::PushL(part3); |
|
4791 iUTContext->iTestHeader->SetPartL(part3, 2); |
|
4792 CleanupStack::Pop(part3); |
|
4793 |
|
4794 TBuf8<256> expectedBuf; |
|
4795 expectedBuf.Append(0x05); // value length |
|
4796 expectedBuf.Append(0x80); // encoded token for 'byte-range' |
|
4797 expectedBuf.Append(0x81); // value-length for 145 ... |
|
4798 expectedBuf.Append(0x11); // ... |
|
4799 expectedBuf.Append(0x82); // value-length for 300 ... |
|
4800 expectedBuf.Append(0x2C); // ... |
|
4801 iUTContext->SetExpectedL(expectedBuf); |
|
4802 |
|
4803 // Add the Transitions in the order they are to run |
|
4804 // C'tor first, D'tor last... |
|
4805 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
4806 using constructor and destuctor validators */ |
|
4807 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
4808 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
4809 iRangeByteRangeWithLastPosValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
4810 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iRangeByteRangeWithLastPosValidator)); |
|
4811 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
4812 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
4813 } |
|
4814 |
|
4815 // ______________________________________________________________________________ |
|
4816 // |
|
4817 _LIT(KWspHeaderWriterRangeSuffixRangeUnitTest,"CWspHeaderWriter_RangeSuffixRange_UnitTest"); |
|
4818 |
|
4819 CWspHeaderWriter_RangeSuffixRange_UnitTest* CWspHeaderWriter_RangeSuffixRange_UnitTest::NewL(CDataLogger& aDataLogger, |
|
4820 MUnitTestObserver& aObserver) |
|
4821 { |
|
4822 CWspHeaderWriter_RangeSuffixRange_UnitTest* self = |
|
4823 new(ELeave) CWspHeaderWriter_RangeSuffixRange_UnitTest(aDataLogger, |
|
4824 aObserver); |
|
4825 CleanupStack::PushL(self); |
|
4826 self->ConstructL(); |
|
4827 CleanupStack::Pop(self); |
|
4828 return self; |
|
4829 } |
|
4830 |
|
4831 inline TInt CWspHeaderWriter_RangeSuffixRange_UnitTest::RunError(TInt aError) |
|
4832 { |
|
4833 // The RunL left so chain to the base first and then cleanup |
|
4834 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
4835 delete iUTContext; |
|
4836 iUTContext = NULL; |
|
4837 delete iStateAccessor; |
|
4838 iStateAccessor = NULL; |
|
4839 /* delete any validators used */ |
|
4840 delete iCtorValidator; |
|
4841 iCtorValidator = NULL; |
|
4842 delete iRangeSuffixRangeValidator; |
|
4843 iRangeSuffixRangeValidator = NULL; |
|
4844 delete iDtorValidator; |
|
4845 iDtorValidator = NULL; |
|
4846 return error; |
|
4847 } |
|
4848 |
|
4849 inline CWspHeaderWriter_RangeSuffixRange_UnitTest::~CWspHeaderWriter_RangeSuffixRange_UnitTest() |
|
4850 { |
|
4851 // Simply delete our test class instance |
|
4852 delete iUTContext; |
|
4853 delete iStateAccessor; |
|
4854 /* delete any validators used */ |
|
4855 delete iCtorValidator; |
|
4856 delete iRangeSuffixRangeValidator; |
|
4857 delete iDtorValidator; |
|
4858 } |
|
4859 |
|
4860 inline CWspHeaderWriter_RangeSuffixRange_UnitTest::CWspHeaderWriter_RangeSuffixRange_UnitTest(CDataLogger& aDataLogger, |
|
4861 MUnitTestObserver& aObserver) |
|
4862 : CUnitTest(KWspHeaderWriterRangeSuffixRangeUnitTest, aDataLogger, aObserver) |
|
4863 { |
|
4864 //Do nothing |
|
4865 } |
|
4866 |
|
4867 // Now the Individual transitions need to be added. |
|
4868 inline void CWspHeaderWriter_RangeSuffixRange_UnitTest::ConstructL() |
|
4869 { |
|
4870 // Perform the base class initialization |
|
4871 UnitTestConstructL(); |
|
4872 |
|
4873 // Create the Unit test state accessor |
|
4874 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
4875 // Construct the Unit test context. |
|
4876 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
4877 iUTContext->ConstructL(WSP::ERange); |
|
4878 |
|
4879 // Part1 |
|
4880 _LIT8(KTxtRange, "Suffix-byte-range"); |
|
4881 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtRange); |
|
4882 CleanupClosePushL(stringVal); |
|
4883 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
4884 CleanupStack::PushL(part1); |
|
4885 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
4886 CleanupStack::Pop(part1); |
|
4887 CleanupStack::PopAndDestroy(&stringVal); |
|
4888 |
|
4889 // Part2 |
|
4890 TInt firstBytePos = 145; |
|
4891 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(firstBytePos); |
|
4892 CleanupStack::PushL(part2); |
|
4893 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
4894 CleanupStack::Pop(part2); |
|
4895 |
|
4896 TBuf8<256> expectedBuf; |
|
4897 expectedBuf.Append(0x03); // value length |
|
4898 expectedBuf.Append(0x81); // encoded token for 'suffix-byte-range' |
|
4899 expectedBuf.Append(0x81); // value-length for 145 ... |
|
4900 expectedBuf.Append(0x11); // ... |
|
4901 iUTContext->SetExpectedL(expectedBuf); |
|
4902 |
|
4903 // Add the Transitions in the order they are to run |
|
4904 // C'tor first, D'tor last... |
|
4905 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
4906 using constructor and destuctor validators */ |
|
4907 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
4908 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
4909 iRangeSuffixRangeValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
4910 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iRangeSuffixRangeValidator)); |
|
4911 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
4912 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
4913 } |
|
4914 |
|
4915 // ______________________________________________________________________________ |
|
4916 // |
|
4917 _LIT(KWspHeaderWriterRefererUriUnitTest,"CWspHeaderWriter_RefererUri_UnitTest"); |
|
4918 |
|
4919 CWspHeaderWriter_RefererUri_UnitTest* CWspHeaderWriter_RefererUri_UnitTest::NewL(CDataLogger& aDataLogger, |
|
4920 MUnitTestObserver& aObserver) |
|
4921 { |
|
4922 CWspHeaderWriter_RefererUri_UnitTest* self = |
|
4923 new(ELeave) CWspHeaderWriter_RefererUri_UnitTest(aDataLogger, |
|
4924 aObserver); |
|
4925 CleanupStack::PushL(self); |
|
4926 self->ConstructL(); |
|
4927 CleanupStack::Pop(self); |
|
4928 return self; |
|
4929 } |
|
4930 |
|
4931 inline TInt CWspHeaderWriter_RefererUri_UnitTest::RunError(TInt aError) |
|
4932 { |
|
4933 // The RunL left so chain to the base first and then cleanup |
|
4934 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
4935 delete iUTContext; |
|
4936 iUTContext = NULL; |
|
4937 delete iStateAccessor; |
|
4938 iStateAccessor = NULL; |
|
4939 /* delete any validators used */ |
|
4940 delete iCtorValidator; |
|
4941 iCtorValidator = NULL; |
|
4942 delete iRefererUriValidator; |
|
4943 iRefererUriValidator = NULL; |
|
4944 delete iDtorValidator; |
|
4945 iDtorValidator = NULL; |
|
4946 return error; |
|
4947 } |
|
4948 |
|
4949 inline CWspHeaderWriter_RefererUri_UnitTest::~CWspHeaderWriter_RefererUri_UnitTest() |
|
4950 { |
|
4951 // Simply delete our test class instance |
|
4952 delete iUTContext; |
|
4953 delete iStateAccessor; |
|
4954 /* delete any validators used */ |
|
4955 delete iCtorValidator; |
|
4956 delete iRefererUriValidator; |
|
4957 delete iDtorValidator; |
|
4958 } |
|
4959 |
|
4960 inline CWspHeaderWriter_RefererUri_UnitTest::CWspHeaderWriter_RefererUri_UnitTest(CDataLogger& aDataLogger, |
|
4961 MUnitTestObserver& aObserver) |
|
4962 : CUnitTest(KWspHeaderWriterRefererUriUnitTest, aDataLogger, aObserver) |
|
4963 { |
|
4964 //Do nothing |
|
4965 } |
|
4966 |
|
4967 // Now the Individual transitions need to be added. |
|
4968 inline void CWspHeaderWriter_RefererUri_UnitTest::ConstructL() |
|
4969 { |
|
4970 // Perform the base class initialization |
|
4971 UnitTestConstructL(); |
|
4972 |
|
4973 // Create the Unit test state accessor |
|
4974 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
4975 // Construct the Unit test context. |
|
4976 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
4977 iUTContext->ConstructL(WSP::EReferer); |
|
4978 |
|
4979 // Part1 |
|
4980 _LIT8(KTxtReferer, "http://www.symbian.com"); |
|
4981 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtReferer); |
|
4982 CleanupClosePushL(stringVal); |
|
4983 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
4984 CleanupStack::PushL(part1); |
|
4985 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
4986 CleanupStack::Pop(part1); |
|
4987 CleanupStack::PopAndDestroy(&stringVal); |
|
4988 |
|
4989 TBuf8<256> expectedBuf; |
|
4990 expectedBuf.Append(KTxtReferer); |
|
4991 expectedBuf.Append(0x00); |
|
4992 iUTContext->SetExpectedL(expectedBuf); |
|
4993 |
|
4994 // Add the Transitions in the order they are to run |
|
4995 // C'tor first, D'tor last... |
|
4996 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
4997 using constructor and destuctor validators */ |
|
4998 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
4999 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
5000 iRefererUriValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
5001 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iRefererUriValidator)); |
|
5002 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
5003 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
5004 } |
|
5005 |
|
5006 // ______________________________________________________________________________ |
|
5007 // |
|
5008 _LIT(KWspHeaderWriterRefererNullTextUnitTest,"CWspHeaderWriter_RefererNullText_UnitTest"); |
|
5009 |
|
5010 CWspHeaderWriter_RefererNullText_UnitTest* CWspHeaderWriter_RefererNullText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
5011 MUnitTestObserver& aObserver) |
|
5012 { |
|
5013 CWspHeaderWriter_RefererNullText_UnitTest* self = |
|
5014 new(ELeave) CWspHeaderWriter_RefererNullText_UnitTest(aDataLogger, |
|
5015 aObserver); |
|
5016 CleanupStack::PushL(self); |
|
5017 self->ConstructL(); |
|
5018 CleanupStack::Pop(self); |
|
5019 return self; |
|
5020 } |
|
5021 |
|
5022 inline TInt CWspHeaderWriter_RefererNullText_UnitTest::RunError(TInt aError) |
|
5023 { |
|
5024 // The RunL left so chain to the base first and then cleanup |
|
5025 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
5026 delete iUTContext; |
|
5027 iUTContext = NULL; |
|
5028 delete iStateAccessor; |
|
5029 iStateAccessor = NULL; |
|
5030 /* delete any validators used */ |
|
5031 delete iCtorValidator; |
|
5032 iCtorValidator = NULL; |
|
5033 delete iRefererNullTextValidator; |
|
5034 iRefererNullTextValidator = NULL; |
|
5035 delete iDtorValidator; |
|
5036 iDtorValidator = NULL; |
|
5037 return error; |
|
5038 } |
|
5039 |
|
5040 inline CWspHeaderWriter_RefererNullText_UnitTest::~CWspHeaderWriter_RefererNullText_UnitTest() |
|
5041 { |
|
5042 // Simply delete our test class instance |
|
5043 delete iUTContext; |
|
5044 delete iStateAccessor; |
|
5045 /* delete any validators used */ |
|
5046 delete iCtorValidator; |
|
5047 delete iRefererNullTextValidator; |
|
5048 delete iDtorValidator; |
|
5049 } |
|
5050 |
|
5051 inline CWspHeaderWriter_RefererNullText_UnitTest::CWspHeaderWriter_RefererNullText_UnitTest(CDataLogger& aDataLogger, |
|
5052 MUnitTestObserver& aObserver) |
|
5053 : CUnitTest(KWspHeaderWriterRefererNullTextUnitTest, aDataLogger, aObserver) |
|
5054 { |
|
5055 //Do nothing |
|
5056 } |
|
5057 |
|
5058 // Now the Individual transitions need to be added. |
|
5059 inline void CWspHeaderWriter_RefererNullText_UnitTest::ConstructL() |
|
5060 { |
|
5061 // Perform the base class initialization |
|
5062 UnitTestConstructL(); |
|
5063 |
|
5064 // Create the Unit test state accessor |
|
5065 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
5066 // Construct the Unit test context. |
|
5067 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
5068 iUTContext->ConstructL(WSP::EReferer); |
|
5069 |
|
5070 // Part1 |
|
5071 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KNullDesC8); |
|
5072 CleanupClosePushL(stringVal); |
|
5073 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
5074 CleanupStack::PushL(part1); |
|
5075 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
5076 CleanupStack::Pop(part1); |
|
5077 CleanupStack::PopAndDestroy(&stringVal); |
|
5078 |
|
5079 TBuf8<256> expectedBuf; |
|
5080 expectedBuf.Append(0x00); |
|
5081 iUTContext->SetExpectedL(expectedBuf); |
|
5082 |
|
5083 // Add the Transitions in the order they are to run |
|
5084 // C'tor first, D'tor last... |
|
5085 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
5086 using constructor and destuctor validators */ |
|
5087 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
5088 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
5089 iRefererNullTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
5090 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iRefererNullTextValidator)); |
|
5091 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
5092 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
5093 } |
|
5094 |
|
5095 // ______________________________________________________________________________ |
|
5096 // |
|
5097 _LIT(KWspHeaderWriterViaUriUnitTest,"CWspHeaderWriter_ViaUri_UnitTest"); |
|
5098 |
|
5099 CWspHeaderWriter_ViaUri_UnitTest* CWspHeaderWriter_ViaUri_UnitTest::NewL(CDataLogger& aDataLogger, |
|
5100 MUnitTestObserver& aObserver) |
|
5101 { |
|
5102 CWspHeaderWriter_ViaUri_UnitTest* self = |
|
5103 new(ELeave) CWspHeaderWriter_ViaUri_UnitTest(aDataLogger, |
|
5104 aObserver); |
|
5105 CleanupStack::PushL(self); |
|
5106 self->ConstructL(); |
|
5107 CleanupStack::Pop(self); |
|
5108 return self; |
|
5109 } |
|
5110 |
|
5111 inline TInt CWspHeaderWriter_ViaUri_UnitTest::RunError(TInt aError) |
|
5112 { |
|
5113 // The RunL left so chain to the base first and then cleanup |
|
5114 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
5115 delete iUTContext; |
|
5116 iUTContext = NULL; |
|
5117 delete iStateAccessor; |
|
5118 iStateAccessor = NULL; |
|
5119 /* delete any validators used */ |
|
5120 delete iCtorValidator; |
|
5121 iCtorValidator = NULL; |
|
5122 delete iViaUriValidator; |
|
5123 iViaUriValidator = NULL; |
|
5124 delete iDtorValidator; |
|
5125 iDtorValidator = NULL; |
|
5126 return error; |
|
5127 } |
|
5128 |
|
5129 inline CWspHeaderWriter_ViaUri_UnitTest::~CWspHeaderWriter_ViaUri_UnitTest() |
|
5130 { |
|
5131 // Simply delete our test class instance |
|
5132 delete iUTContext; |
|
5133 delete iStateAccessor; |
|
5134 /* delete any validators used */ |
|
5135 delete iCtorValidator; |
|
5136 delete iViaUriValidator; |
|
5137 delete iDtorValidator; |
|
5138 } |
|
5139 |
|
5140 inline CWspHeaderWriter_ViaUri_UnitTest::CWspHeaderWriter_ViaUri_UnitTest(CDataLogger& aDataLogger, |
|
5141 MUnitTestObserver& aObserver) |
|
5142 : CUnitTest(KWspHeaderWriterViaUriUnitTest, aDataLogger, aObserver) |
|
5143 { |
|
5144 //Do nothing |
|
5145 } |
|
5146 |
|
5147 // Now the Individual transitions need to be added. |
|
5148 inline void CWspHeaderWriter_ViaUri_UnitTest::ConstructL() |
|
5149 { |
|
5150 // Perform the base class initialization |
|
5151 UnitTestConstructL(); |
|
5152 |
|
5153 // Create the Unit test state accessor |
|
5154 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
5155 // Construct the Unit test context. |
|
5156 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
5157 iUTContext->ConstructL(WSP::EVia); |
|
5158 |
|
5159 // Part1 |
|
5160 _LIT8(KTxtReferer, "http://www.symbian.com"); |
|
5161 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtReferer); |
|
5162 CleanupClosePushL(stringVal); |
|
5163 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
5164 CleanupStack::PushL(part1); |
|
5165 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
5166 CleanupStack::Pop(part1); |
|
5167 CleanupStack::PopAndDestroy(&stringVal); |
|
5168 |
|
5169 TBuf8<256> expectedBuf; |
|
5170 expectedBuf.Append(KTxtReferer); |
|
5171 expectedBuf.Append(0x00); |
|
5172 iUTContext->SetExpectedL(expectedBuf); |
|
5173 |
|
5174 // Add the Transitions in the order they are to run |
|
5175 // C'tor first, D'tor last... |
|
5176 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
5177 using constructor and destuctor validators */ |
|
5178 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
5179 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
5180 iViaUriValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
5181 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iViaUriValidator)); |
|
5182 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
5183 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
5184 } |
|
5185 |
|
5186 // ______________________________________________________________________________ |
|
5187 // |
|
5188 _LIT(KWspHeaderWriterViaNullTextUnitTest,"CWspHeaderWriter_ViaNullText_UnitTest"); |
|
5189 |
|
5190 CWspHeaderWriter_ViaNullText_UnitTest* CWspHeaderWriter_ViaNullText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
5191 MUnitTestObserver& aObserver) |
|
5192 { |
|
5193 CWspHeaderWriter_ViaNullText_UnitTest* self = |
|
5194 new(ELeave) CWspHeaderWriter_ViaNullText_UnitTest(aDataLogger, |
|
5195 aObserver); |
|
5196 CleanupStack::PushL(self); |
|
5197 self->ConstructL(); |
|
5198 CleanupStack::Pop(self); |
|
5199 return self; |
|
5200 } |
|
5201 |
|
5202 inline TInt CWspHeaderWriter_ViaNullText_UnitTest::RunError(TInt aError) |
|
5203 { |
|
5204 // The RunL left so chain to the base first and then cleanup |
|
5205 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
5206 delete iUTContext; |
|
5207 iUTContext = NULL; |
|
5208 delete iStateAccessor; |
|
5209 iStateAccessor = NULL; |
|
5210 /* delete any validators used */ |
|
5211 delete iCtorValidator; |
|
5212 iCtorValidator = NULL; |
|
5213 delete iViaNullTextValidator; |
|
5214 iViaNullTextValidator = NULL; |
|
5215 delete iDtorValidator; |
|
5216 iDtorValidator = NULL; |
|
5217 return error; |
|
5218 } |
|
5219 |
|
5220 inline CWspHeaderWriter_ViaNullText_UnitTest::~CWspHeaderWriter_ViaNullText_UnitTest() |
|
5221 { |
|
5222 // Simply delete our test class instance |
|
5223 delete iUTContext; |
|
5224 delete iStateAccessor; |
|
5225 /* delete any validators used */ |
|
5226 delete iCtorValidator; |
|
5227 delete iViaNullTextValidator; |
|
5228 delete iDtorValidator; |
|
5229 } |
|
5230 |
|
5231 inline CWspHeaderWriter_ViaNullText_UnitTest::CWspHeaderWriter_ViaNullText_UnitTest(CDataLogger& aDataLogger, |
|
5232 MUnitTestObserver& aObserver) |
|
5233 : CUnitTest(KWspHeaderWriterViaNullTextUnitTest, aDataLogger, aObserver) |
|
5234 { |
|
5235 //Do nothing |
|
5236 } |
|
5237 |
|
5238 // Now the Individual transitions need to be added. |
|
5239 inline void CWspHeaderWriter_ViaNullText_UnitTest::ConstructL() |
|
5240 { |
|
5241 // Perform the base class initialization |
|
5242 UnitTestConstructL(); |
|
5243 |
|
5244 // Create the Unit test state accessor |
|
5245 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
5246 // Construct the Unit test context. |
|
5247 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
5248 iUTContext->ConstructL(WSP::EVia); |
|
5249 |
|
5250 // Part1 |
|
5251 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KNullDesC8); |
|
5252 CleanupClosePushL(stringVal); |
|
5253 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
5254 CleanupStack::PushL(part1); |
|
5255 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
5256 CleanupStack::Pop(part1); |
|
5257 CleanupStack::PopAndDestroy(&stringVal); |
|
5258 |
|
5259 TBuf8<256> expectedBuf; |
|
5260 expectedBuf.Append(0x00); |
|
5261 iUTContext->SetExpectedL(expectedBuf); |
|
5262 |
|
5263 // Add the Transitions in the order they are to run |
|
5264 // C'tor first, D'tor last... |
|
5265 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
5266 using constructor and destuctor validators */ |
|
5267 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
5268 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
5269 iViaNullTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
5270 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iViaNullTextValidator)); |
|
5271 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
5272 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
5273 } |
|
5274 |
|
5275 // ______________________________________________________________________________ |
|
5276 // |
|
5277 _LIT(KWspHeaderWriterXWapAppIdUriUnitTest,"CWspHeaderWriter_XWapAppIdUri_UnitTest"); |
|
5278 |
|
5279 CWspHeaderWriter_XWapAppIdUri_UnitTest* CWspHeaderWriter_XWapAppIdUri_UnitTest::NewL(CDataLogger& aDataLogger, |
|
5280 MUnitTestObserver& aObserver) |
|
5281 { |
|
5282 CWspHeaderWriter_XWapAppIdUri_UnitTest* self = |
|
5283 new(ELeave) CWspHeaderWriter_XWapAppIdUri_UnitTest(aDataLogger, |
|
5284 aObserver); |
|
5285 CleanupStack::PushL(self); |
|
5286 self->ConstructL(); |
|
5287 CleanupStack::Pop(self); |
|
5288 return self; |
|
5289 } |
|
5290 |
|
5291 inline TInt CWspHeaderWriter_XWapAppIdUri_UnitTest::RunError(TInt aError) |
|
5292 { |
|
5293 // The RunL left so chain to the base first and then cleanup |
|
5294 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
5295 delete iUTContext; |
|
5296 iUTContext = NULL; |
|
5297 delete iStateAccessor; |
|
5298 iStateAccessor = NULL; |
|
5299 /* delete any validators used */ |
|
5300 delete iCtorValidator; |
|
5301 iCtorValidator = NULL; |
|
5302 delete iXWapAppIdUriValidator; |
|
5303 iXWapAppIdUriValidator = NULL; |
|
5304 delete iDtorValidator; |
|
5305 iDtorValidator = NULL; |
|
5306 return error; |
|
5307 } |
|
5308 |
|
5309 inline CWspHeaderWriter_XWapAppIdUri_UnitTest::~CWspHeaderWriter_XWapAppIdUri_UnitTest() |
|
5310 { |
|
5311 // Simply delete our test class instance |
|
5312 delete iUTContext; |
|
5313 delete iStateAccessor; |
|
5314 /* delete any validators used */ |
|
5315 delete iCtorValidator; |
|
5316 delete iXWapAppIdUriValidator; |
|
5317 delete iDtorValidator; |
|
5318 } |
|
5319 |
|
5320 inline CWspHeaderWriter_XWapAppIdUri_UnitTest::CWspHeaderWriter_XWapAppIdUri_UnitTest(CDataLogger& aDataLogger, |
|
5321 MUnitTestObserver& aObserver) |
|
5322 : CUnitTest(KWspHeaderWriterXWapAppIdUriUnitTest, aDataLogger, aObserver) |
|
5323 { |
|
5324 //Do nothing |
|
5325 } |
|
5326 |
|
5327 // Now the Individual transitions need to be added. |
|
5328 inline void CWspHeaderWriter_XWapAppIdUri_UnitTest::ConstructL() |
|
5329 { |
|
5330 // Perform the base class initialization |
|
5331 UnitTestConstructL(); |
|
5332 |
|
5333 // Create the Unit test state accessor |
|
5334 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
5335 // Construct the Unit test context. |
|
5336 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
5337 iUTContext->ConstructL(WSP::EXWapApplicationId); |
|
5338 |
|
5339 // Part1 |
|
5340 _LIT8(KTxtUri, "http://www.symbian.com"); |
|
5341 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtUri); |
|
5342 CleanupClosePushL(stringVal); |
|
5343 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
5344 CleanupStack::PushL(part1); |
|
5345 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
5346 CleanupStack::Pop(part1); |
|
5347 CleanupStack::PopAndDestroy(&stringVal); |
|
5348 |
|
5349 TBuf8<256> expectedBuf; |
|
5350 expectedBuf.Append(KTxtUri); |
|
5351 expectedBuf.Append(0x00); |
|
5352 iUTContext->SetExpectedL(expectedBuf); |
|
5353 |
|
5354 // Add the Transitions in the order they are to run |
|
5355 // C'tor first, D'tor last... |
|
5356 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
5357 using constructor and destuctor validators */ |
|
5358 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
5359 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
5360 iXWapAppIdUriValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
5361 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iXWapAppIdUriValidator)); |
|
5362 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
5363 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
5364 } |
|
5365 |
|
5366 // ______________________________________________________________________________ |
|
5367 // |
|
5368 _LIT(KWspHeaderWriterXWapAppIdNullTextUnitTest,"CWspHeaderWriter_XWapAppIdNullText_UnitTest"); |
|
5369 |
|
5370 CWspHeaderWriter_XWapAppIdNullText_UnitTest* CWspHeaderWriter_XWapAppIdNullText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
5371 MUnitTestObserver& aObserver) |
|
5372 { |
|
5373 CWspHeaderWriter_XWapAppIdNullText_UnitTest* self = |
|
5374 new(ELeave) CWspHeaderWriter_XWapAppIdNullText_UnitTest(aDataLogger, |
|
5375 aObserver); |
|
5376 CleanupStack::PushL(self); |
|
5377 self->ConstructL(); |
|
5378 CleanupStack::Pop(self); |
|
5379 return self; |
|
5380 } |
|
5381 |
|
5382 inline TInt CWspHeaderWriter_XWapAppIdNullText_UnitTest::RunError(TInt aError) |
|
5383 { |
|
5384 // The RunL left so chain to the base first and then cleanup |
|
5385 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
5386 delete iUTContext; |
|
5387 iUTContext = NULL; |
|
5388 delete iStateAccessor; |
|
5389 iStateAccessor = NULL; |
|
5390 /* delete any validators used */ |
|
5391 delete iCtorValidator; |
|
5392 iCtorValidator = NULL; |
|
5393 delete iXWapAppIdNullTextValidator; |
|
5394 iXWapAppIdNullTextValidator = NULL; |
|
5395 delete iDtorValidator; |
|
5396 iDtorValidator = NULL; |
|
5397 return error; |
|
5398 } |
|
5399 |
|
5400 inline CWspHeaderWriter_XWapAppIdNullText_UnitTest::~CWspHeaderWriter_XWapAppIdNullText_UnitTest() |
|
5401 { |
|
5402 // Simply delete our test class instance |
|
5403 delete iUTContext; |
|
5404 delete iStateAccessor; |
|
5405 /* delete any validators used */ |
|
5406 delete iCtorValidator; |
|
5407 delete iXWapAppIdNullTextValidator; |
|
5408 delete iDtorValidator; |
|
5409 } |
|
5410 |
|
5411 inline CWspHeaderWriter_XWapAppIdNullText_UnitTest::CWspHeaderWriter_XWapAppIdNullText_UnitTest(CDataLogger& aDataLogger, |
|
5412 MUnitTestObserver& aObserver) |
|
5413 : CUnitTest(KWspHeaderWriterXWapAppIdNullTextUnitTest, aDataLogger, aObserver) |
|
5414 { |
|
5415 //Do nothing |
|
5416 } |
|
5417 |
|
5418 // Now the Individual transitions need to be added. |
|
5419 inline void CWspHeaderWriter_XWapAppIdNullText_UnitTest::ConstructL() |
|
5420 { |
|
5421 // Perform the base class initialization |
|
5422 UnitTestConstructL(); |
|
5423 |
|
5424 // Create the Unit test state accessor |
|
5425 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
5426 // Construct the Unit test context. |
|
5427 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
5428 iUTContext->ConstructL(WSP::EXWapApplicationId); |
|
5429 |
|
5430 // Part1 |
|
5431 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KNullDesC8); |
|
5432 CleanupClosePushL(stringVal); |
|
5433 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
5434 CleanupStack::PushL(part1); |
|
5435 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
5436 CleanupStack::Pop(part1); |
|
5437 CleanupStack::PopAndDestroy(&stringVal); |
|
5438 |
|
5439 TBuf8<256> expectedBuf; |
|
5440 expectedBuf.Append(0x00); |
|
5441 iUTContext->SetExpectedL(expectedBuf); |
|
5442 |
|
5443 // Add the Transitions in the order they are to run |
|
5444 // C'tor first, D'tor last... |
|
5445 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
5446 using constructor and destuctor validators */ |
|
5447 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
5448 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
5449 iXWapAppIdNullTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
5450 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iXWapAppIdNullTextValidator)); |
|
5451 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
5452 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
5453 } |
|
5454 |
|
5455 // ______________________________________________________________________________ |
|
5456 // |
|
5457 _LIT(KWspHeaderWriterXWapAppIdShortIntUnitTest,"CWspHeaderWriter_XWapAppIdShortInt_UnitTest"); |
|
5458 |
|
5459 CWspHeaderWriter_XWapAppIdShortInt_UnitTest* CWspHeaderWriter_XWapAppIdShortInt_UnitTest::NewL(CDataLogger& aDataLogger, |
|
5460 MUnitTestObserver& aObserver) |
|
5461 { |
|
5462 CWspHeaderWriter_XWapAppIdShortInt_UnitTest* self = |
|
5463 new(ELeave) CWspHeaderWriter_XWapAppIdShortInt_UnitTest(aDataLogger, |
|
5464 aObserver); |
|
5465 CleanupStack::PushL(self); |
|
5466 self->ConstructL(); |
|
5467 CleanupStack::Pop(self); |
|
5468 return self; |
|
5469 } |
|
5470 |
|
5471 inline TInt CWspHeaderWriter_XWapAppIdShortInt_UnitTest::RunError(TInt aError) |
|
5472 { |
|
5473 // The RunL left so chain to the base first and then cleanup |
|
5474 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
5475 delete iUTContext; |
|
5476 iUTContext = NULL; |
|
5477 delete iStateAccessor; |
|
5478 iStateAccessor = NULL; |
|
5479 /* delete any validators used */ |
|
5480 delete iCtorValidator; |
|
5481 iCtorValidator = NULL; |
|
5482 delete iXWapAppIdShortIntValidator; |
|
5483 iXWapAppIdShortIntValidator = NULL; |
|
5484 delete iDtorValidator; |
|
5485 iDtorValidator = NULL; |
|
5486 return error; |
|
5487 } |
|
5488 |
|
5489 inline CWspHeaderWriter_XWapAppIdShortInt_UnitTest::~CWspHeaderWriter_XWapAppIdShortInt_UnitTest() |
|
5490 { |
|
5491 // Simply delete our test class instance |
|
5492 delete iUTContext; |
|
5493 delete iStateAccessor; |
|
5494 /* delete any validators used */ |
|
5495 delete iCtorValidator; |
|
5496 delete iXWapAppIdShortIntValidator; |
|
5497 delete iDtorValidator; |
|
5498 } |
|
5499 |
|
5500 inline CWspHeaderWriter_XWapAppIdShortInt_UnitTest::CWspHeaderWriter_XWapAppIdShortInt_UnitTest(CDataLogger& aDataLogger, |
|
5501 MUnitTestObserver& aObserver) |
|
5502 : CUnitTest(KWspHeaderWriterXWapAppIdShortIntUnitTest, aDataLogger, aObserver) |
|
5503 { |
|
5504 //Do nothing |
|
5505 } |
|
5506 |
|
5507 // Now the Individual transitions need to be added. |
|
5508 inline void CWspHeaderWriter_XWapAppIdShortInt_UnitTest::ConstructL() |
|
5509 { |
|
5510 // Perform the base class initialization |
|
5511 UnitTestConstructL(); |
|
5512 |
|
5513 // Create the Unit test state accessor |
|
5514 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
5515 // Construct the Unit test context. |
|
5516 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
5517 iUTContext->ConstructL(WSP::EXWapApplicationId); |
|
5518 |
|
5519 // Part1 |
|
5520 TInt shortInt = 100; |
|
5521 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(shortInt); |
|
5522 CleanupStack::PushL(part1); |
|
5523 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
5524 CleanupStack::Pop(part1); |
|
5525 |
|
5526 TBuf8<256> expectedBuf; |
|
5527 expectedBuf.Append(0xE4); // encoded short int for 100 |
|
5528 iUTContext->SetExpectedL(expectedBuf); |
|
5529 |
|
5530 // Add the Transitions in the order they are to run |
|
5531 // C'tor first, D'tor last... |
|
5532 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
5533 using constructor and destuctor validators */ |
|
5534 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
5535 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
5536 iXWapAppIdShortIntValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
5537 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iXWapAppIdShortIntValidator)); |
|
5538 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
5539 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
5540 } |
|
5541 |
|
5542 // ______________________________________________________________________________ |
|
5543 // |
|
5544 _LIT(KWspHeaderWriterXWapAppIdLongIntUnitTest,"CWspHeaderWriter_XWapAppIdLongInt_UnitTest"); |
|
5545 |
|
5546 CWspHeaderWriter_XWapAppIdLongInt_UnitTest* CWspHeaderWriter_XWapAppIdLongInt_UnitTest::NewL(CDataLogger& aDataLogger, |
|
5547 MUnitTestObserver& aObserver) |
|
5548 { |
|
5549 CWspHeaderWriter_XWapAppIdLongInt_UnitTest* self = |
|
5550 new(ELeave) CWspHeaderWriter_XWapAppIdLongInt_UnitTest(aDataLogger, |
|
5551 aObserver); |
|
5552 CleanupStack::PushL(self); |
|
5553 self->ConstructL(); |
|
5554 CleanupStack::Pop(self); |
|
5555 return self; |
|
5556 } |
|
5557 |
|
5558 inline TInt CWspHeaderWriter_XWapAppIdLongInt_UnitTest::RunError(TInt aError) |
|
5559 { |
|
5560 // The RunL left so chain to the base first and then cleanup |
|
5561 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
5562 delete iUTContext; |
|
5563 iUTContext = NULL; |
|
5564 delete iStateAccessor; |
|
5565 iStateAccessor = NULL; |
|
5566 /* delete any validators used */ |
|
5567 delete iCtorValidator; |
|
5568 iCtorValidator = NULL; |
|
5569 delete iXWapAppIdLongIntValidator; |
|
5570 iXWapAppIdLongIntValidator = NULL; |
|
5571 delete iDtorValidator; |
|
5572 iDtorValidator = NULL; |
|
5573 return error; |
|
5574 } |
|
5575 |
|
5576 inline CWspHeaderWriter_XWapAppIdLongInt_UnitTest::~CWspHeaderWriter_XWapAppIdLongInt_UnitTest() |
|
5577 { |
|
5578 // Simply delete our test class instance |
|
5579 delete iUTContext; |
|
5580 delete iStateAccessor; |
|
5581 /* delete any validators used */ |
|
5582 delete iCtorValidator; |
|
5583 delete iXWapAppIdLongIntValidator; |
|
5584 delete iDtorValidator; |
|
5585 } |
|
5586 |
|
5587 inline CWspHeaderWriter_XWapAppIdLongInt_UnitTest::CWspHeaderWriter_XWapAppIdLongInt_UnitTest(CDataLogger& aDataLogger, |
|
5588 MUnitTestObserver& aObserver) |
|
5589 : CUnitTest(KWspHeaderWriterXWapAppIdLongIntUnitTest, aDataLogger, aObserver) |
|
5590 { |
|
5591 //Do nothing |
|
5592 } |
|
5593 |
|
5594 // Now the Individual transitions need to be added. |
|
5595 inline void CWspHeaderWriter_XWapAppIdLongInt_UnitTest::ConstructL() |
|
5596 { |
|
5597 // Perform the base class initialization |
|
5598 UnitTestConstructL(); |
|
5599 |
|
5600 // Create the Unit test state accessor |
|
5601 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
5602 // Construct the Unit test context. |
|
5603 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
5604 iUTContext->ConstructL(WSP::EXWapApplicationId); |
|
5605 |
|
5606 // Part1 |
|
5607 TInt longInt = 654321; |
|
5608 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(longInt); |
|
5609 CleanupStack::PushL(part1); |
|
5610 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
5611 CleanupStack::Pop(part1); |
|
5612 |
|
5613 TBuf8<256> expectedBuf; |
|
5614 expectedBuf.Append(0x03); // encoded long int for 654321 ... |
|
5615 expectedBuf.Append(0x09); // ... |
|
5616 expectedBuf.Append(0xFB); // ... |
|
5617 expectedBuf.Append(0xF1); // ... |
|
5618 iUTContext->SetExpectedL(expectedBuf); |
|
5619 |
|
5620 // Add the Transitions in the order they are to run |
|
5621 // C'tor first, D'tor last... |
|
5622 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
5623 using constructor and destuctor validators */ |
|
5624 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
5625 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
5626 iXWapAppIdLongIntValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
5627 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iXWapAppIdLongIntValidator)); |
|
5628 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
5629 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
5630 } |
|
5631 |
|
5632 // ______________________________________________________________________________ |
|
5633 // |
|
5634 _LIT(KWspHeaderWriterEncodingVersionUnitTest,"CWspHeaderWriter_EncodingVersion_UnitTest"); |
|
5635 |
|
5636 CWspHeaderWriter_EncodingVersion_UnitTest* CWspHeaderWriter_EncodingVersion_UnitTest::NewL(CDataLogger& aDataLogger, |
|
5637 MUnitTestObserver& aObserver) |
|
5638 { |
|
5639 CWspHeaderWriter_EncodingVersion_UnitTest* self = |
|
5640 new(ELeave) CWspHeaderWriter_EncodingVersion_UnitTest(aDataLogger, |
|
5641 aObserver); |
|
5642 CleanupStack::PushL(self); |
|
5643 self->ConstructL(); |
|
5644 CleanupStack::Pop(self); |
|
5645 return self; |
|
5646 } |
|
5647 |
|
5648 inline TInt CWspHeaderWriter_EncodingVersion_UnitTest::RunError(TInt aError) |
|
5649 { |
|
5650 // The RunL left so chain to the base first and then cleanup |
|
5651 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
5652 delete iUTContext; |
|
5653 iUTContext = NULL; |
|
5654 delete iStateAccessor; |
|
5655 iStateAccessor = NULL; |
|
5656 /* delete any validators used */ |
|
5657 delete iCtorValidator; |
|
5658 iCtorValidator = NULL; |
|
5659 delete iEncodingVersionValidator; |
|
5660 iEncodingVersionValidator = NULL; |
|
5661 delete iDtorValidator; |
|
5662 iDtorValidator = NULL; |
|
5663 return error; |
|
5664 } |
|
5665 |
|
5666 inline CWspHeaderWriter_EncodingVersion_UnitTest::~CWspHeaderWriter_EncodingVersion_UnitTest() |
|
5667 { |
|
5668 // Simply delete our test class instance |
|
5669 delete iUTContext; |
|
5670 delete iStateAccessor; |
|
5671 /* delete any validators used */ |
|
5672 delete iCtorValidator; |
|
5673 delete iEncodingVersionValidator; |
|
5674 delete iDtorValidator; |
|
5675 } |
|
5676 |
|
5677 inline CWspHeaderWriter_EncodingVersion_UnitTest::CWspHeaderWriter_EncodingVersion_UnitTest(CDataLogger& aDataLogger, |
|
5678 MUnitTestObserver& aObserver) |
|
5679 : CUnitTest(KWspHeaderWriterEncodingVersionUnitTest, aDataLogger, aObserver) |
|
5680 { |
|
5681 //Do nothing |
|
5682 } |
|
5683 |
|
5684 // Now the Individual transitions need to be added. |
|
5685 inline void CWspHeaderWriter_EncodingVersion_UnitTest::ConstructL() |
|
5686 { |
|
5687 // Perform the base class initialization |
|
5688 UnitTestConstructL(); |
|
5689 |
|
5690 // Create the Unit test state accessor |
|
5691 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
5692 // Construct the Unit test context. |
|
5693 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
5694 iUTContext->ConstructL(WSP::EEncodingVersion); |
|
5695 |
|
5696 // Part1 |
|
5697 _LIT8(KTxtVersion, "1.4"); |
|
5698 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtVersion); |
|
5699 CleanupClosePushL(stringVal); |
|
5700 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
5701 CleanupStack::PushL(part1); |
|
5702 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
5703 CleanupStack::Pop(part1); |
|
5704 CleanupStack::PopAndDestroy(&stringVal); |
|
5705 |
|
5706 TBuf8<256> expectedBuf; |
|
5707 expectedBuf.Append(0x94); // encoding for v1.4 |
|
5708 iUTContext->SetExpectedL(expectedBuf); |
|
5709 |
|
5710 // Add the Transitions in the order they are to run |
|
5711 // C'tor first, D'tor last... |
|
5712 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
5713 using constructor and destuctor validators */ |
|
5714 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
5715 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
5716 iEncodingVersionValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
5717 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iEncodingVersionValidator)); |
|
5718 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
5719 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
5720 } |
|
5721 |
|
5722 // ______________________________________________________________________________ |
|
5723 // |
|
5724 _LIT(KWspHeaderWriterEncodingVersionCodePageIntUnitTest,"CWspHeaderWriter_EncodingVersionCodePageInt_UnitTest"); |
|
5725 |
|
5726 CWspHeaderWriter_EncodingVersionCodePageInt_UnitTest* CWspHeaderWriter_EncodingVersionCodePageInt_UnitTest::NewL(CDataLogger& aDataLogger, |
|
5727 MUnitTestObserver& aObserver) |
|
5728 { |
|
5729 CWspHeaderWriter_EncodingVersionCodePageInt_UnitTest* self = |
|
5730 new(ELeave) CWspHeaderWriter_EncodingVersionCodePageInt_UnitTest(aDataLogger, |
|
5731 aObserver); |
|
5732 CleanupStack::PushL(self); |
|
5733 self->ConstructL(); |
|
5734 CleanupStack::Pop(self); |
|
5735 return self; |
|
5736 } |
|
5737 |
|
5738 inline TInt CWspHeaderWriter_EncodingVersionCodePageInt_UnitTest::RunError(TInt aError) |
|
5739 { |
|
5740 // The RunL left so chain to the base first and then cleanup |
|
5741 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
5742 delete iUTContext; |
|
5743 iUTContext = NULL; |
|
5744 delete iStateAccessor; |
|
5745 iStateAccessor = NULL; |
|
5746 /* delete any validators used */ |
|
5747 delete iCtorValidator; |
|
5748 iCtorValidator = NULL; |
|
5749 delete iEncodingVersionCodePageIntValidator; |
|
5750 iEncodingVersionCodePageIntValidator = NULL; |
|
5751 delete iDtorValidator; |
|
5752 iDtorValidator = NULL; |
|
5753 return error; |
|
5754 } |
|
5755 |
|
5756 inline CWspHeaderWriter_EncodingVersionCodePageInt_UnitTest::~CWspHeaderWriter_EncodingVersionCodePageInt_UnitTest() |
|
5757 { |
|
5758 // Simply delete our test class instance |
|
5759 delete iUTContext; |
|
5760 delete iStateAccessor; |
|
5761 /* delete any validators used */ |
|
5762 delete iCtorValidator; |
|
5763 delete iEncodingVersionCodePageIntValidator; |
|
5764 delete iDtorValidator; |
|
5765 } |
|
5766 |
|
5767 inline CWspHeaderWriter_EncodingVersionCodePageInt_UnitTest::CWspHeaderWriter_EncodingVersionCodePageInt_UnitTest(CDataLogger& aDataLogger, |
|
5768 MUnitTestObserver& aObserver) |
|
5769 : CUnitTest(KWspHeaderWriterEncodingVersionCodePageIntUnitTest, aDataLogger, aObserver) |
|
5770 { |
|
5771 //Do nothing |
|
5772 } |
|
5773 |
|
5774 // Now the Individual transitions need to be added. |
|
5775 inline void CWspHeaderWriter_EncodingVersionCodePageInt_UnitTest::ConstructL() |
|
5776 { |
|
5777 // Perform the base class initialization |
|
5778 UnitTestConstructL(); |
|
5779 |
|
5780 // Create the Unit test state accessor |
|
5781 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
5782 // Construct the Unit test context. |
|
5783 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
5784 iUTContext->ConstructL(WSP::EEncodingVersion); |
|
5785 |
|
5786 // Part1 |
|
5787 TInt codePage = 1; |
|
5788 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(codePage); |
|
5789 CleanupStack::PushL(part1); |
|
5790 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
5791 CleanupStack::Pop(part1); |
|
5792 |
|
5793 TBuf8<256> expectedBuf; |
|
5794 expectedBuf.Append(0x01); // value length |
|
5795 expectedBuf.Append(0x81); // encoding for short int 1 |
|
5796 iUTContext->SetExpectedL(expectedBuf); |
|
5797 |
|
5798 // Add the Transitions in the order they are to run |
|
5799 // C'tor first, D'tor last... |
|
5800 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
5801 using constructor and destuctor validators */ |
|
5802 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
5803 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
5804 iEncodingVersionCodePageIntValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
5805 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iEncodingVersionCodePageIntValidator)); |
|
5806 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
5807 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
5808 } |
|
5809 |
|
5810 // ______________________________________________________________________________ |
|
5811 // |
|
5812 _LIT(KWspHeaderWriterEncodingVersionCodePageIntWithVersionUnitTest,"CWspHeaderWriter_EncodingVersionCodePageIntWithVersion_UnitTest"); |
|
5813 |
|
5814 CWspHeaderWriter_EncodingVersionCodePageIntWithVersion_UnitTest* CWspHeaderWriter_EncodingVersionCodePageIntWithVersion_UnitTest::NewL(CDataLogger& aDataLogger, |
|
5815 MUnitTestObserver& aObserver) |
|
5816 { |
|
5817 CWspHeaderWriter_EncodingVersionCodePageIntWithVersion_UnitTest* self = |
|
5818 new(ELeave) CWspHeaderWriter_EncodingVersionCodePageIntWithVersion_UnitTest(aDataLogger, |
|
5819 aObserver); |
|
5820 CleanupStack::PushL(self); |
|
5821 self->ConstructL(); |
|
5822 CleanupStack::Pop(self); |
|
5823 return self; |
|
5824 } |
|
5825 |
|
5826 inline TInt CWspHeaderWriter_EncodingVersionCodePageIntWithVersion_UnitTest::RunError(TInt aError) |
|
5827 { |
|
5828 // The RunL left so chain to the base first and then cleanup |
|
5829 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
5830 delete iUTContext; |
|
5831 iUTContext = NULL; |
|
5832 delete iStateAccessor; |
|
5833 iStateAccessor = NULL; |
|
5834 /* delete any validators used */ |
|
5835 delete iCtorValidator; |
|
5836 iCtorValidator = NULL; |
|
5837 delete iEncodingVersionCodePageIntWithVersionValidator; |
|
5838 iEncodingVersionCodePageIntWithVersionValidator = NULL; |
|
5839 delete iDtorValidator; |
|
5840 iDtorValidator = NULL; |
|
5841 return error; |
|
5842 } |
|
5843 |
|
5844 inline CWspHeaderWriter_EncodingVersionCodePageIntWithVersion_UnitTest::~CWspHeaderWriter_EncodingVersionCodePageIntWithVersion_UnitTest() |
|
5845 { |
|
5846 // Simply delete our test class instance |
|
5847 delete iUTContext; |
|
5848 delete iStateAccessor; |
|
5849 /* delete any validators used */ |
|
5850 delete iCtorValidator; |
|
5851 delete iEncodingVersionCodePageIntWithVersionValidator; |
|
5852 delete iDtorValidator; |
|
5853 } |
|
5854 |
|
5855 inline CWspHeaderWriter_EncodingVersionCodePageIntWithVersion_UnitTest::CWspHeaderWriter_EncodingVersionCodePageIntWithVersion_UnitTest(CDataLogger& aDataLogger, |
|
5856 MUnitTestObserver& aObserver) |
|
5857 : CUnitTest(KWspHeaderWriterEncodingVersionCodePageIntWithVersionUnitTest, aDataLogger, aObserver) |
|
5858 { |
|
5859 //Do nothing |
|
5860 } |
|
5861 |
|
5862 // Now the Individual transitions need to be added. |
|
5863 inline void CWspHeaderWriter_EncodingVersionCodePageIntWithVersion_UnitTest::ConstructL() |
|
5864 { |
|
5865 // Perform the base class initialization |
|
5866 UnitTestConstructL(); |
|
5867 |
|
5868 // Create the Unit test state accessor |
|
5869 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
5870 // Construct the Unit test context. |
|
5871 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
5872 iUTContext->ConstructL(WSP::EEncodingVersion); |
|
5873 |
|
5874 // Part1 |
|
5875 TInt codePage = 1; |
|
5876 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(codePage); |
|
5877 CleanupStack::PushL(part1); |
|
5878 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
5879 CleanupStack::Pop(part1); |
|
5880 |
|
5881 // Part2 |
|
5882 _LIT8(KTxtVersion, "1.4"); |
|
5883 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtVersion); |
|
5884 CleanupClosePushL(stringVal); |
|
5885 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringVal); |
|
5886 CleanupStack::PushL(part2); |
|
5887 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
5888 CleanupStack::Pop(part2); |
|
5889 CleanupStack::PopAndDestroy(&stringVal); |
|
5890 |
|
5891 TBuf8<256> expectedBuf; |
|
5892 expectedBuf.Append(0x02); // value length |
|
5893 expectedBuf.Append(0x81); // encoding for code page short int 1 |
|
5894 expectedBuf.Append(0x94); // encoding for version 1.4 |
|
5895 iUTContext->SetExpectedL(expectedBuf); |
|
5896 |
|
5897 // Add the Transitions in the order they are to run |
|
5898 // C'tor first, D'tor last... |
|
5899 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
5900 using constructor and destuctor validators */ |
|
5901 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
5902 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
5903 iEncodingVersionCodePageIntWithVersionValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
5904 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iEncodingVersionCodePageIntWithVersionValidator)); |
|
5905 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
5906 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
5907 } |
|
5908 |
|
5909 // ______________________________________________________________________________ |
|
5910 // |
|
5911 _LIT(KWspHeaderWriterExpect100ContinueUnitTest,"CWspHeaderWriter_Expect100Continue_UnitTest"); |
|
5912 |
|
5913 CWspHeaderWriter_Expect100Continue_UnitTest* CWspHeaderWriter_Expect100Continue_UnitTest::NewL(CDataLogger& aDataLogger, |
|
5914 MUnitTestObserver& aObserver) |
|
5915 { |
|
5916 CWspHeaderWriter_Expect100Continue_UnitTest* self = |
|
5917 new(ELeave) CWspHeaderWriter_Expect100Continue_UnitTest(aDataLogger, |
|
5918 aObserver); |
|
5919 CleanupStack::PushL(self); |
|
5920 self->ConstructL(); |
|
5921 CleanupStack::Pop(self); |
|
5922 return self; |
|
5923 } |
|
5924 |
|
5925 inline TInt CWspHeaderWriter_Expect100Continue_UnitTest::RunError(TInt aError) |
|
5926 { |
|
5927 // The RunL left so chain to the base first and then cleanup |
|
5928 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
5929 delete iUTContext; |
|
5930 iUTContext = NULL; |
|
5931 delete iStateAccessor; |
|
5932 iStateAccessor = NULL; |
|
5933 /* delete any validators used */ |
|
5934 delete iCtorValidator; |
|
5935 iCtorValidator = NULL; |
|
5936 delete iExpect100ContinueValidator; |
|
5937 iExpect100ContinueValidator = NULL; |
|
5938 delete iDtorValidator; |
|
5939 iDtorValidator = NULL; |
|
5940 return error; |
|
5941 } |
|
5942 |
|
5943 inline CWspHeaderWriter_Expect100Continue_UnitTest::~CWspHeaderWriter_Expect100Continue_UnitTest() |
|
5944 { |
|
5945 // Simply delete our test class instance |
|
5946 delete iUTContext; |
|
5947 delete iStateAccessor; |
|
5948 /* delete any validators used */ |
|
5949 delete iCtorValidator; |
|
5950 delete iExpect100ContinueValidator; |
|
5951 delete iDtorValidator; |
|
5952 } |
|
5953 |
|
5954 inline CWspHeaderWriter_Expect100Continue_UnitTest::CWspHeaderWriter_Expect100Continue_UnitTest(CDataLogger& aDataLogger, |
|
5955 MUnitTestObserver& aObserver) |
|
5956 : CUnitTest(KWspHeaderWriterExpect100ContinueUnitTest, aDataLogger, aObserver) |
|
5957 { |
|
5958 //Do nothing |
|
5959 } |
|
5960 |
|
5961 // Now the Individual transitions need to be added. |
|
5962 inline void CWspHeaderWriter_Expect100Continue_UnitTest::ConstructL() |
|
5963 { |
|
5964 // Perform the base class initialization |
|
5965 UnitTestConstructL(); |
|
5966 |
|
5967 // Create the Unit test state accessor |
|
5968 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
5969 // Construct the Unit test context. |
|
5970 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
5971 iUTContext->ConstructL(WSP::EExpect); |
|
5972 |
|
5973 // Part1 |
|
5974 _LIT8(KTxtExpect, "100-Continue"); |
|
5975 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtExpect); |
|
5976 CleanupClosePushL(stringVal); |
|
5977 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
5978 CleanupStack::PushL(part1); |
|
5979 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
5980 CleanupStack::Pop(part1); |
|
5981 CleanupStack::PopAndDestroy(&stringVal); |
|
5982 |
|
5983 TBuf8<256> expectedBuf; |
|
5984 expectedBuf.Append(0x80); // encoding for '100-Continue' |
|
5985 iUTContext->SetExpectedL(expectedBuf); |
|
5986 |
|
5987 // Add the Transitions in the order they are to run |
|
5988 // C'tor first, D'tor last... |
|
5989 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
5990 using constructor and destuctor validators */ |
|
5991 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
5992 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
5993 iExpect100ContinueValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
5994 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iExpect100ContinueValidator)); |
|
5995 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
5996 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
5997 } |
|
5998 |
|
5999 // ______________________________________________________________________________ |
|
6000 // |
|
6001 _LIT(KWspHeaderWriterExpectExpressionTokenTextUnitTest,"CWspHeaderWriter_ExpectExpressionTokenText_UnitTest"); |
|
6002 |
|
6003 CWspHeaderWriter_ExpectExpressionTokenText_UnitTest* CWspHeaderWriter_ExpectExpressionTokenText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
6004 MUnitTestObserver& aObserver) |
|
6005 { |
|
6006 CWspHeaderWriter_ExpectExpressionTokenText_UnitTest* self = |
|
6007 new(ELeave) CWspHeaderWriter_ExpectExpressionTokenText_UnitTest(aDataLogger, |
|
6008 aObserver); |
|
6009 CleanupStack::PushL(self); |
|
6010 self->ConstructL(); |
|
6011 CleanupStack::Pop(self); |
|
6012 return self; |
|
6013 } |
|
6014 |
|
6015 inline TInt CWspHeaderWriter_ExpectExpressionTokenText_UnitTest::RunError(TInt aError) |
|
6016 { |
|
6017 // The RunL left so chain to the base first and then cleanup |
|
6018 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
6019 delete iUTContext; |
|
6020 iUTContext = NULL; |
|
6021 delete iStateAccessor; |
|
6022 iStateAccessor = NULL; |
|
6023 /* delete any validators used */ |
|
6024 delete iCtorValidator; |
|
6025 iCtorValidator = NULL; |
|
6026 delete iExpectExpressionTokenTextValidator; |
|
6027 iExpectExpressionTokenTextValidator = NULL; |
|
6028 delete iDtorValidator; |
|
6029 iDtorValidator = NULL; |
|
6030 return error; |
|
6031 } |
|
6032 |
|
6033 inline CWspHeaderWriter_ExpectExpressionTokenText_UnitTest::~CWspHeaderWriter_ExpectExpressionTokenText_UnitTest() |
|
6034 { |
|
6035 // Simply delete our test class instance |
|
6036 delete iUTContext; |
|
6037 delete iStateAccessor; |
|
6038 /* delete any validators used */ |
|
6039 delete iCtorValidator; |
|
6040 delete iExpectExpressionTokenTextValidator; |
|
6041 delete iDtorValidator; |
|
6042 } |
|
6043 |
|
6044 inline CWspHeaderWriter_ExpectExpressionTokenText_UnitTest::CWspHeaderWriter_ExpectExpressionTokenText_UnitTest(CDataLogger& aDataLogger, |
|
6045 MUnitTestObserver& aObserver) |
|
6046 : CUnitTest(KWspHeaderWriterExpectExpressionTokenTextUnitTest, aDataLogger, aObserver) |
|
6047 { |
|
6048 //Do nothing |
|
6049 } |
|
6050 |
|
6051 // Now the Individual transitions need to be added. |
|
6052 inline void CWspHeaderWriter_ExpectExpressionTokenText_UnitTest::ConstructL() |
|
6053 { |
|
6054 // Perform the base class initialization |
|
6055 UnitTestConstructL(); |
|
6056 |
|
6057 // Create the Unit test state accessor |
|
6058 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
6059 // Construct the Unit test context. |
|
6060 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
6061 iUTContext->ConstructL(WSP::EExpect); |
|
6062 |
|
6063 // Part1 |
|
6064 _LIT8(KTxtExpect, "expect-var"); |
|
6065 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtExpect); |
|
6066 CleanupClosePushL(stringVal); |
|
6067 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
6068 CleanupStack::PushL(part1); |
|
6069 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
6070 CleanupStack::Pop(part1); |
|
6071 CleanupStack::PopAndDestroy(&stringVal); |
|
6072 |
|
6073 // Part2 |
|
6074 _LIT8(KTxtExpect2, "expect-value"); |
|
6075 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtExpect2); |
|
6076 CleanupClosePushL(stringVal2); |
|
6077 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringVal2); |
|
6078 CleanupStack::PushL(part2); |
|
6079 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
6080 CleanupStack::Pop(part2); |
|
6081 CleanupStack::PopAndDestroy(&stringVal2); |
|
6082 |
|
6083 TBuf8<256> expectedBuf; |
|
6084 expectedBuf.Append(0x18); // value-length for 24 bytes |
|
6085 expectedBuf.Append(KTxtExpect); |
|
6086 expectedBuf.Append(0x00); |
|
6087 expectedBuf.Append(KTxtExpect2); |
|
6088 expectedBuf.Append(0x00); |
|
6089 iUTContext->SetExpectedL(expectedBuf); |
|
6090 |
|
6091 // Add the Transitions in the order they are to run |
|
6092 // C'tor first, D'tor last... |
|
6093 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
6094 using constructor and destuctor validators */ |
|
6095 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
6096 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
6097 iExpectExpressionTokenTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
6098 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iExpectExpressionTokenTextValidator)); |
|
6099 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
6100 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
6101 } |
|
6102 |
|
6103 // ______________________________________________________________________________ |
|
6104 // |
|
6105 _LIT(KWspHeaderWriterExpectExpressionQuotedTextUnitTest,"CWspHeaderWriter_ExpectExpressionQuotedText_UnitTest"); |
|
6106 |
|
6107 CWspHeaderWriter_ExpectExpressionQuotedText_UnitTest* CWspHeaderWriter_ExpectExpressionQuotedText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
6108 MUnitTestObserver& aObserver) |
|
6109 { |
|
6110 CWspHeaderWriter_ExpectExpressionQuotedText_UnitTest* self = |
|
6111 new(ELeave) CWspHeaderWriter_ExpectExpressionQuotedText_UnitTest(aDataLogger, |
|
6112 aObserver); |
|
6113 CleanupStack::PushL(self); |
|
6114 self->ConstructL(); |
|
6115 CleanupStack::Pop(self); |
|
6116 return self; |
|
6117 } |
|
6118 |
|
6119 inline TInt CWspHeaderWriter_ExpectExpressionQuotedText_UnitTest::RunError(TInt aError) |
|
6120 { |
|
6121 // The RunL left so chain to the base first and then cleanup |
|
6122 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
6123 delete iUTContext; |
|
6124 iUTContext = NULL; |
|
6125 delete iStateAccessor; |
|
6126 iStateAccessor = NULL; |
|
6127 /* delete any validators used */ |
|
6128 delete iCtorValidator; |
|
6129 iCtorValidator = NULL; |
|
6130 delete iExpectExpressionQuotedTextValidator; |
|
6131 iExpectExpressionQuotedTextValidator = NULL; |
|
6132 delete iDtorValidator; |
|
6133 iDtorValidator = NULL; |
|
6134 return error; |
|
6135 } |
|
6136 |
|
6137 inline CWspHeaderWriter_ExpectExpressionQuotedText_UnitTest::~CWspHeaderWriter_ExpectExpressionQuotedText_UnitTest() |
|
6138 { |
|
6139 // Simply delete our test class instance |
|
6140 delete iUTContext; |
|
6141 delete iStateAccessor; |
|
6142 /* delete any validators used */ |
|
6143 delete iCtorValidator; |
|
6144 delete iExpectExpressionQuotedTextValidator; |
|
6145 delete iDtorValidator; |
|
6146 } |
|
6147 |
|
6148 inline CWspHeaderWriter_ExpectExpressionQuotedText_UnitTest::CWspHeaderWriter_ExpectExpressionQuotedText_UnitTest(CDataLogger& aDataLogger, |
|
6149 MUnitTestObserver& aObserver) |
|
6150 : CUnitTest(KWspHeaderWriterExpectExpressionQuotedTextUnitTest, aDataLogger, aObserver) |
|
6151 { |
|
6152 //Do nothing |
|
6153 } |
|
6154 |
|
6155 // Now the Individual transitions need to be added. |
|
6156 inline void CWspHeaderWriter_ExpectExpressionQuotedText_UnitTest::ConstructL() |
|
6157 { |
|
6158 // Perform the base class initialization |
|
6159 UnitTestConstructL(); |
|
6160 |
|
6161 // Create the Unit test state accessor |
|
6162 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
6163 // Construct the Unit test context. |
|
6164 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
6165 iUTContext->ConstructL(WSP::EExpect); |
|
6166 |
|
6167 // Part1 |
|
6168 _LIT8(KTxtExpect, "expect-var"); |
|
6169 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtExpect); |
|
6170 CleanupClosePushL(stringVal); |
|
6171 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
6172 CleanupStack::PushL(part1); |
|
6173 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
6174 CleanupStack::Pop(part1); |
|
6175 CleanupStack::PopAndDestroy(&stringVal); |
|
6176 |
|
6177 // Part2 |
|
6178 _LIT8(KTxtExpect2, "\"expect-value\""); |
|
6179 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtExpect2); |
|
6180 CleanupClosePushL(stringVal2); |
|
6181 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringVal2); |
|
6182 CleanupStack::PushL(part2); |
|
6183 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
6184 CleanupStack::Pop(part2); |
|
6185 CleanupStack::PopAndDestroy(&stringVal2); |
|
6186 |
|
6187 TPtrC8 quotedData(KTxtExpect2().Left(KTxtExpect2().Length()-1)); |
|
6188 TBuf8<256> expectedBuf; |
|
6189 expectedBuf.Append(0x19); // value-length for 25 bytes |
|
6190 expectedBuf.Append(KTxtExpect); |
|
6191 expectedBuf.Append(0x00); |
|
6192 expectedBuf.Append(quotedData); |
|
6193 expectedBuf.Append(0x00); |
|
6194 iUTContext->SetExpectedL(expectedBuf); |
|
6195 |
|
6196 // Add the Transitions in the order they are to run |
|
6197 // C'tor first, D'tor last... |
|
6198 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
6199 using constructor and destuctor validators */ |
|
6200 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
6201 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
6202 iExpectExpressionQuotedTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
6203 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iExpectExpressionQuotedTextValidator)); |
|
6204 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
6205 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
6206 } |
|
6207 |
|
6208 // ______________________________________________________________________________ |
|
6209 // |
|
6210 _LIT(KWspHeaderWriterExpectExpressionTokenTextParamUnitTest,"CWspHeaderWriter_ExpectExpressionTokenTextParam_UnitTest"); |
|
6211 |
|
6212 CWspHeaderWriter_ExpectExpressionTokenTextParam_UnitTest* CWspHeaderWriter_ExpectExpressionTokenTextParam_UnitTest::NewL(CDataLogger& aDataLogger, |
|
6213 MUnitTestObserver& aObserver) |
|
6214 { |
|
6215 CWspHeaderWriter_ExpectExpressionTokenTextParam_UnitTest* self = |
|
6216 new(ELeave) CWspHeaderWriter_ExpectExpressionTokenTextParam_UnitTest(aDataLogger, |
|
6217 aObserver); |
|
6218 CleanupStack::PushL(self); |
|
6219 self->ConstructL(); |
|
6220 CleanupStack::Pop(self); |
|
6221 return self; |
|
6222 } |
|
6223 |
|
6224 inline TInt CWspHeaderWriter_ExpectExpressionTokenTextParam_UnitTest::RunError(TInt aError) |
|
6225 { |
|
6226 // The RunL left so chain to the base first and then cleanup |
|
6227 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
6228 delete iUTContext; |
|
6229 iUTContext = NULL; |
|
6230 delete iStateAccessor; |
|
6231 iStateAccessor = NULL; |
|
6232 /* delete any validators used */ |
|
6233 delete iCtorValidator; |
|
6234 iCtorValidator = NULL; |
|
6235 delete iExpectExpressionTokenTextParamValidator; |
|
6236 iExpectExpressionTokenTextParamValidator = NULL; |
|
6237 delete iDtorValidator; |
|
6238 iDtorValidator = NULL; |
|
6239 return error; |
|
6240 } |
|
6241 |
|
6242 inline CWspHeaderWriter_ExpectExpressionTokenTextParam_UnitTest::~CWspHeaderWriter_ExpectExpressionTokenTextParam_UnitTest() |
|
6243 { |
|
6244 // Simply delete our test class instance |
|
6245 delete iUTContext; |
|
6246 delete iStateAccessor; |
|
6247 /* delete any validators used */ |
|
6248 delete iCtorValidator; |
|
6249 delete iExpectExpressionTokenTextParamValidator; |
|
6250 delete iDtorValidator; |
|
6251 } |
|
6252 |
|
6253 inline CWspHeaderWriter_ExpectExpressionTokenTextParam_UnitTest::CWspHeaderWriter_ExpectExpressionTokenTextParam_UnitTest(CDataLogger& aDataLogger, |
|
6254 MUnitTestObserver& aObserver) |
|
6255 : CUnitTest(KWspHeaderWriterExpectExpressionTokenTextParamUnitTest, aDataLogger, aObserver) |
|
6256 { |
|
6257 //Do nothing |
|
6258 } |
|
6259 |
|
6260 // Now the Individual transitions need to be added. |
|
6261 inline void CWspHeaderWriter_ExpectExpressionTokenTextParam_UnitTest::ConstructL() |
|
6262 { |
|
6263 // Perform the base class initialization |
|
6264 UnitTestConstructL(); |
|
6265 |
|
6266 // Create the Unit test state accessor |
|
6267 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
6268 // Construct the Unit test context. |
|
6269 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
6270 iUTContext->ConstructL(WSP::EExpect); |
|
6271 |
|
6272 // Part1 |
|
6273 _LIT8(KTxtExpect, "expect-var"); |
|
6274 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtExpect); |
|
6275 CleanupClosePushL(stringVal); |
|
6276 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
6277 CleanupStack::PushL(part1); |
|
6278 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
6279 CleanupStack::Pop(part1); |
|
6280 CleanupStack::PopAndDestroy(&stringVal); |
|
6281 |
|
6282 // Part2 |
|
6283 _LIT8(KTxtExpect2, "expect-value"); |
|
6284 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtExpect2); |
|
6285 CleanupClosePushL(stringVal2); |
|
6286 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringVal2); |
|
6287 CleanupStack::PushL(part2); |
|
6288 _LIT8(KTxtParam1Name, "param-name"); |
|
6289 _LIT8(KTxtParam1Value, "param-value"); |
|
6290 RStringF param1Name = iUTContext->iStrPool.OpenFStringL(KTxtParam1Name); |
|
6291 CleanupClosePushL(param1Name); |
|
6292 RStringF param1Val = iUTContext->iStrPool.OpenFStringL(KTxtParam1Value); |
|
6293 CleanupClosePushL(param1Val); |
|
6294 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(param1Name, param1Val); |
|
6295 CleanupStack::PushL(param1); |
|
6296 part2->AddParamL(param1); |
|
6297 CleanupStack::Pop(param1); |
|
6298 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
6299 CleanupStack::PopAndDestroy(2, ¶m1Name); |
|
6300 CleanupStack::Pop(part2); |
|
6301 CleanupStack::PopAndDestroy(&stringVal2); |
|
6302 |
|
6303 TBuf8<256> expectedBuf; |
|
6304 expectedBuf.Append(0x1F); // value-length for 47 bytes... |
|
6305 expectedBuf.Append(0x2F); // ... |
|
6306 expectedBuf.Append(KTxtExpect); |
|
6307 expectedBuf.Append(0x00); |
|
6308 expectedBuf.Append(KTxtExpect2); |
|
6309 expectedBuf.Append(0x00); |
|
6310 expectedBuf.Append(KTxtParam1Name); |
|
6311 expectedBuf.Append(0x00); |
|
6312 expectedBuf.Append(KTxtParam1Value); |
|
6313 expectedBuf.Append(0x00); |
|
6314 iUTContext->SetExpectedL(expectedBuf); |
|
6315 |
|
6316 // Add the Transitions in the order they are to run |
|
6317 // C'tor first, D'tor last... |
|
6318 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
6319 using constructor and destuctor validators */ |
|
6320 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
6321 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
6322 iExpectExpressionTokenTextParamValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
6323 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iExpectExpressionTokenTextParamValidator)); |
|
6324 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
6325 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
6326 } |
|
6327 |
|
6328 // ______________________________________________________________________________ |
|
6329 // |
|
6330 _LIT(KWspHeaderWriterExpectExpressionQuotedTextParamUnitTest,"CWspHeaderWriter_ExpectExpressionQuotedTextParam_UnitTest"); |
|
6331 |
|
6332 CWspHeaderWriter_ExpectExpressionQuotedTextParam_UnitTest* CWspHeaderWriter_ExpectExpressionQuotedTextParam_UnitTest::NewL(CDataLogger& aDataLogger, |
|
6333 MUnitTestObserver& aObserver) |
|
6334 { |
|
6335 CWspHeaderWriter_ExpectExpressionQuotedTextParam_UnitTest* self = |
|
6336 new(ELeave) CWspHeaderWriter_ExpectExpressionQuotedTextParam_UnitTest(aDataLogger, |
|
6337 aObserver); |
|
6338 CleanupStack::PushL(self); |
|
6339 self->ConstructL(); |
|
6340 CleanupStack::Pop(self); |
|
6341 return self; |
|
6342 } |
|
6343 |
|
6344 inline TInt CWspHeaderWriter_ExpectExpressionQuotedTextParam_UnitTest::RunError(TInt aError) |
|
6345 { |
|
6346 // The RunL left so chain to the base first and then cleanup |
|
6347 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
6348 delete iUTContext; |
|
6349 iUTContext = NULL; |
|
6350 delete iStateAccessor; |
|
6351 iStateAccessor = NULL; |
|
6352 /* delete any validators used */ |
|
6353 delete iCtorValidator; |
|
6354 iCtorValidator = NULL; |
|
6355 delete iExpectExpressionQuotedTextParamValidator; |
|
6356 iExpectExpressionQuotedTextParamValidator = NULL; |
|
6357 delete iDtorValidator; |
|
6358 iDtorValidator = NULL; |
|
6359 return error; |
|
6360 } |
|
6361 |
|
6362 inline CWspHeaderWriter_ExpectExpressionQuotedTextParam_UnitTest::~CWspHeaderWriter_ExpectExpressionQuotedTextParam_UnitTest() |
|
6363 { |
|
6364 // Simply delete our test class instance |
|
6365 delete iUTContext; |
|
6366 delete iStateAccessor; |
|
6367 /* delete any validators used */ |
|
6368 delete iCtorValidator; |
|
6369 delete iExpectExpressionQuotedTextParamValidator; |
|
6370 delete iDtorValidator; |
|
6371 } |
|
6372 |
|
6373 inline CWspHeaderWriter_ExpectExpressionQuotedTextParam_UnitTest::CWspHeaderWriter_ExpectExpressionQuotedTextParam_UnitTest(CDataLogger& aDataLogger, |
|
6374 MUnitTestObserver& aObserver) |
|
6375 : CUnitTest(KWspHeaderWriterExpectExpressionQuotedTextParamUnitTest, aDataLogger, aObserver) |
|
6376 { |
|
6377 //Do nothing |
|
6378 } |
|
6379 |
|
6380 // Now the Individual transitions need to be added. |
|
6381 inline void CWspHeaderWriter_ExpectExpressionQuotedTextParam_UnitTest::ConstructL() |
|
6382 { |
|
6383 // Perform the base class initialization |
|
6384 UnitTestConstructL(); |
|
6385 |
|
6386 // Create the Unit test state accessor |
|
6387 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
6388 // Construct the Unit test context. |
|
6389 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
6390 iUTContext->ConstructL(WSP::EExpect); |
|
6391 |
|
6392 // Part1 |
|
6393 _LIT8(KTxtExpect, "expect-var"); |
|
6394 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtExpect); |
|
6395 CleanupClosePushL(stringVal); |
|
6396 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
6397 CleanupStack::PushL(part1); |
|
6398 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
6399 CleanupStack::Pop(part1); |
|
6400 CleanupStack::PopAndDestroy(&stringVal); |
|
6401 |
|
6402 // Part2 |
|
6403 _LIT8(KTxtExpect2, "expect-value"); |
|
6404 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtExpect2); |
|
6405 CleanupClosePushL(stringVal2); |
|
6406 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringVal2); |
|
6407 CleanupStack::PushL(part2); |
|
6408 _LIT8(KTxtParam1Name, "param-name"); |
|
6409 _LIT8(KTxtParam1Value, "\"param-value\""); |
|
6410 RStringF param1Name = iUTContext->iStrPool.OpenFStringL(KTxtParam1Name); |
|
6411 CleanupClosePushL(param1Name); |
|
6412 RStringF param1Val = iUTContext->iStrPool.OpenFStringL(KTxtParam1Value); |
|
6413 CleanupClosePushL(param1Val); |
|
6414 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(param1Name, param1Val); |
|
6415 CleanupStack::PushL(param1); |
|
6416 part2->AddParamL(param1); |
|
6417 CleanupStack::Pop(param1); |
|
6418 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
6419 CleanupStack::PopAndDestroy(2, ¶m1Name); |
|
6420 CleanupStack::Pop(part2); |
|
6421 CleanupStack::PopAndDestroy(&stringVal2); |
|
6422 |
|
6423 TBuf8<256> expectedBuf; |
|
6424 expectedBuf.Append(0x1F); // value-length for 48 bytes... |
|
6425 expectedBuf.Append(0x30); // ... |
|
6426 expectedBuf.Append(KTxtExpect); |
|
6427 expectedBuf.Append(0x00); |
|
6428 expectedBuf.Append(KTxtExpect2); |
|
6429 expectedBuf.Append(0x00); |
|
6430 expectedBuf.Append(KTxtParam1Name); |
|
6431 expectedBuf.Append(0x00); |
|
6432 expectedBuf.Append(KTxtParam1Value().Left(KTxtParam1Value().Length()-1)); |
|
6433 expectedBuf.Append(0x00); |
|
6434 iUTContext->SetExpectedL(expectedBuf); |
|
6435 |
|
6436 // Add the Transitions in the order they are to run |
|
6437 // C'tor first, D'tor last... |
|
6438 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
6439 using constructor and destuctor validators */ |
|
6440 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
6441 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
6442 iExpectExpressionQuotedTextParamValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
6443 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iExpectExpressionQuotedTextParamValidator)); |
|
6444 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
6445 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
6446 } |
|
6447 |
|
6448 // ______________________________________________________________________________ |
|
6449 // |
|
6450 _LIT(KWspHeaderWriterExpectExpression2ParamsUnitTest,"CWspHeaderWriter_ExpectExpression2Params_UnitTest"); |
|
6451 |
|
6452 CWspHeaderWriter_ExpectExpression2Params_UnitTest* CWspHeaderWriter_ExpectExpression2Params_UnitTest::NewL(CDataLogger& aDataLogger, |
|
6453 MUnitTestObserver& aObserver) |
|
6454 { |
|
6455 CWspHeaderWriter_ExpectExpression2Params_UnitTest* self = |
|
6456 new(ELeave) CWspHeaderWriter_ExpectExpression2Params_UnitTest(aDataLogger, |
|
6457 aObserver); |
|
6458 CleanupStack::PushL(self); |
|
6459 self->ConstructL(); |
|
6460 CleanupStack::Pop(self); |
|
6461 return self; |
|
6462 } |
|
6463 |
|
6464 inline TInt CWspHeaderWriter_ExpectExpression2Params_UnitTest::RunError(TInt aError) |
|
6465 { |
|
6466 // The RunL left so chain to the base first and then cleanup |
|
6467 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
6468 delete iUTContext; |
|
6469 iUTContext = NULL; |
|
6470 delete iStateAccessor; |
|
6471 iStateAccessor = NULL; |
|
6472 /* delete any validators used */ |
|
6473 delete iCtorValidator; |
|
6474 iCtorValidator = NULL; |
|
6475 delete iExpectExpression2ParamsValidator; |
|
6476 iExpectExpression2ParamsValidator = NULL; |
|
6477 delete iDtorValidator; |
|
6478 iDtorValidator = NULL; |
|
6479 return error; |
|
6480 } |
|
6481 |
|
6482 inline CWspHeaderWriter_ExpectExpression2Params_UnitTest::~CWspHeaderWriter_ExpectExpression2Params_UnitTest() |
|
6483 { |
|
6484 // Simply delete our test class instance |
|
6485 delete iUTContext; |
|
6486 delete iStateAccessor; |
|
6487 /* delete any validators used */ |
|
6488 delete iCtorValidator; |
|
6489 delete iExpectExpression2ParamsValidator; |
|
6490 delete iDtorValidator; |
|
6491 } |
|
6492 |
|
6493 inline CWspHeaderWriter_ExpectExpression2Params_UnitTest::CWspHeaderWriter_ExpectExpression2Params_UnitTest(CDataLogger& aDataLogger, |
|
6494 MUnitTestObserver& aObserver) |
|
6495 : CUnitTest(KWspHeaderWriterExpectExpression2ParamsUnitTest, aDataLogger, aObserver) |
|
6496 { |
|
6497 //Do nothing |
|
6498 } |
|
6499 |
|
6500 // Now the Individual transitions need to be added. |
|
6501 inline void CWspHeaderWriter_ExpectExpression2Params_UnitTest::ConstructL() |
|
6502 { |
|
6503 // Perform the base class initialization |
|
6504 UnitTestConstructL(); |
|
6505 |
|
6506 // Create the Unit test state accessor |
|
6507 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
6508 // Construct the Unit test context. |
|
6509 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
6510 iUTContext->ConstructL(WSP::EExpect); |
|
6511 |
|
6512 // Part1 |
|
6513 _LIT8(KTxtExpect, "expect-var"); |
|
6514 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtExpect); |
|
6515 CleanupClosePushL(stringVal); |
|
6516 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
6517 CleanupStack::PushL(part1); |
|
6518 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
6519 CleanupStack::Pop(part1); |
|
6520 CleanupStack::PopAndDestroy(&stringVal); |
|
6521 |
|
6522 // Part2 |
|
6523 _LIT8(KTxtExpect2, "expect-value"); |
|
6524 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtExpect2); |
|
6525 CleanupClosePushL(stringVal2); |
|
6526 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringVal2); |
|
6527 CleanupStack::PushL(part2); |
|
6528 // Param1 |
|
6529 _LIT8(KTxtParam1Name, "param1-name"); |
|
6530 _LIT8(KTxtParam1Value, "\"param1-value\""); |
|
6531 RStringF param1Name = iUTContext->iStrPool.OpenFStringL(KTxtParam1Name); |
|
6532 CleanupClosePushL(param1Name); |
|
6533 RStringF param1Val = iUTContext->iStrPool.OpenFStringL(KTxtParam1Value); |
|
6534 CleanupClosePushL(param1Val); |
|
6535 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(param1Name, param1Val); |
|
6536 CleanupStack::PushL(param1); |
|
6537 part2->AddParamL(param1); |
|
6538 CleanupStack::Pop(param1); |
|
6539 // Param2 |
|
6540 _LIT8(KTxtParam2Name, "param2-name"); |
|
6541 _LIT8(KTxtParam2Value, "param2-value"); |
|
6542 RStringF param2Name = iUTContext->iStrPool.OpenFStringL(KTxtParam2Name); |
|
6543 CleanupClosePushL(param2Name); |
|
6544 RStringF param2Val = iUTContext->iStrPool.OpenFStringL(KTxtParam2Value); |
|
6545 CleanupClosePushL(param2Val); |
|
6546 CHeaderFieldParam* param2 = CHeaderFieldParam::NewL(param2Name, param2Val); |
|
6547 CleanupStack::PushL(param2); |
|
6548 part2->AddParamL(param2); |
|
6549 CleanupStack::Pop(param2); |
|
6550 |
|
6551 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
6552 CleanupStack::PopAndDestroy(4, ¶m1Name); |
|
6553 CleanupStack::Pop(part2); |
|
6554 CleanupStack::PopAndDestroy(&stringVal2); |
|
6555 |
|
6556 TBuf8<256> expectedBuf; |
|
6557 expectedBuf.Append(0x1F); // value-length for 75 bytes... |
|
6558 expectedBuf.Append(0x4B); // ... |
|
6559 expectedBuf.Append(KTxtExpect); |
|
6560 expectedBuf.Append(0x00); |
|
6561 expectedBuf.Append(KTxtExpect2); |
|
6562 expectedBuf.Append(0x00); |
|
6563 expectedBuf.Append(KTxtParam1Name); |
|
6564 expectedBuf.Append(0x00); |
|
6565 expectedBuf.Append(KTxtParam1Value().Left(KTxtParam1Value().Length()-1)); |
|
6566 expectedBuf.Append(0x00); |
|
6567 expectedBuf.Append(KTxtParam2Name); |
|
6568 expectedBuf.Append(0x00); |
|
6569 expectedBuf.Append(KTxtParam2Value); |
|
6570 expectedBuf.Append(0x00); |
|
6571 iUTContext->SetExpectedL(expectedBuf); |
|
6572 |
|
6573 // Add the Transitions in the order they are to run |
|
6574 // C'tor first, D'tor last... |
|
6575 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
6576 using constructor and destuctor validators */ |
|
6577 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
6578 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
6579 iExpectExpression2ParamsValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
6580 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iExpectExpression2ParamsValidator)); |
|
6581 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
6582 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
6583 } |
|
6584 |
|
6585 // ______________________________________________________________________________ |
|
6586 // |
|
6587 _LIT(KWspHeaderWriterTETrailersUnitTest,"CWspHeaderWriter_TETrailers_UnitTest"); |
|
6588 |
|
6589 CWspHeaderWriter_TETrailers_UnitTest* CWspHeaderWriter_TETrailers_UnitTest::NewL(CDataLogger& aDataLogger, |
|
6590 MUnitTestObserver& aObserver) |
|
6591 { |
|
6592 CWspHeaderWriter_TETrailers_UnitTest* self = |
|
6593 new(ELeave) CWspHeaderWriter_TETrailers_UnitTest(aDataLogger, |
|
6594 aObserver); |
|
6595 CleanupStack::PushL(self); |
|
6596 self->ConstructL(); |
|
6597 CleanupStack::Pop(self); |
|
6598 return self; |
|
6599 } |
|
6600 |
|
6601 inline TInt CWspHeaderWriter_TETrailers_UnitTest::RunError(TInt aError) |
|
6602 { |
|
6603 // The RunL left so chain to the base first and then cleanup |
|
6604 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
6605 delete iUTContext; |
|
6606 iUTContext = NULL; |
|
6607 delete iStateAccessor; |
|
6608 iStateAccessor = NULL; |
|
6609 /* delete any validators used */ |
|
6610 delete iCtorValidator; |
|
6611 iCtorValidator = NULL; |
|
6612 delete iTETrailersValidator; |
|
6613 iTETrailersValidator = NULL; |
|
6614 delete iDtorValidator; |
|
6615 iDtorValidator = NULL; |
|
6616 return error; |
|
6617 } |
|
6618 |
|
6619 inline CWspHeaderWriter_TETrailers_UnitTest::~CWspHeaderWriter_TETrailers_UnitTest() |
|
6620 { |
|
6621 // Simply delete our test class instance |
|
6622 delete iUTContext; |
|
6623 delete iStateAccessor; |
|
6624 /* delete any validators used */ |
|
6625 delete iCtorValidator; |
|
6626 delete iTETrailersValidator; |
|
6627 delete iDtorValidator; |
|
6628 } |
|
6629 |
|
6630 inline CWspHeaderWriter_TETrailers_UnitTest::CWspHeaderWriter_TETrailers_UnitTest(CDataLogger& aDataLogger, |
|
6631 MUnitTestObserver& aObserver) |
|
6632 : CUnitTest(KWspHeaderWriterTETrailersUnitTest, aDataLogger, aObserver) |
|
6633 { |
|
6634 //Do nothing |
|
6635 } |
|
6636 |
|
6637 // Now the Individual transitions need to be added. |
|
6638 inline void CWspHeaderWriter_TETrailers_UnitTest::ConstructL() |
|
6639 { |
|
6640 // Perform the base class initialization |
|
6641 UnitTestConstructL(); |
|
6642 |
|
6643 // Create the Unit test state accessor |
|
6644 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
6645 // Construct the Unit test context. |
|
6646 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
6647 iUTContext->ConstructL(WSP::ETE); |
|
6648 |
|
6649 // Part1 |
|
6650 _LIT8(KTxtTE, "Trailers"); |
|
6651 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTE); |
|
6652 CleanupClosePushL(stringVal); |
|
6653 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
6654 CleanupStack::PushL(part1); |
|
6655 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
6656 CleanupStack::Pop(part1); |
|
6657 CleanupStack::PopAndDestroy(&stringVal); |
|
6658 |
|
6659 TBuf8<256> expectedBuf; |
|
6660 expectedBuf.Append(0x81); // encoded token for trailers |
|
6661 iUTContext->SetExpectedL(expectedBuf); |
|
6662 |
|
6663 // Add the Transitions in the order they are to run |
|
6664 // C'tor first, D'tor last... |
|
6665 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
6666 using constructor and destuctor validators */ |
|
6667 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
6668 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
6669 iTETrailersValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
6670 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iTETrailersValidator)); |
|
6671 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
6672 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
6673 } |
|
6674 |
|
6675 // ______________________________________________________________________________ |
|
6676 // |
|
6677 _LIT(KWspHeaderWriterTEChunkedUnitTest,"CWspHeaderWriter_TEChunked_UnitTest"); |
|
6678 |
|
6679 CWspHeaderWriter_TEChunked_UnitTest* CWspHeaderWriter_TEChunked_UnitTest::NewL(CDataLogger& aDataLogger, |
|
6680 MUnitTestObserver& aObserver) |
|
6681 { |
|
6682 CWspHeaderWriter_TEChunked_UnitTest* self = |
|
6683 new(ELeave) CWspHeaderWriter_TEChunked_UnitTest(aDataLogger, |
|
6684 aObserver); |
|
6685 CleanupStack::PushL(self); |
|
6686 self->ConstructL(); |
|
6687 CleanupStack::Pop(self); |
|
6688 return self; |
|
6689 } |
|
6690 |
|
6691 inline TInt CWspHeaderWriter_TEChunked_UnitTest::RunError(TInt aError) |
|
6692 { |
|
6693 // The RunL left so chain to the base first and then cleanup |
|
6694 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
6695 delete iUTContext; |
|
6696 iUTContext = NULL; |
|
6697 delete iStateAccessor; |
|
6698 iStateAccessor = NULL; |
|
6699 /* delete any validators used */ |
|
6700 delete iCtorValidator; |
|
6701 iCtorValidator = NULL; |
|
6702 delete iTEChunkedValidator; |
|
6703 iTEChunkedValidator = NULL; |
|
6704 delete iDtorValidator; |
|
6705 iDtorValidator = NULL; |
|
6706 return error; |
|
6707 } |
|
6708 |
|
6709 inline CWspHeaderWriter_TEChunked_UnitTest::~CWspHeaderWriter_TEChunked_UnitTest() |
|
6710 { |
|
6711 // Simply delete our test class instance |
|
6712 delete iUTContext; |
|
6713 delete iStateAccessor; |
|
6714 /* delete any validators used */ |
|
6715 delete iCtorValidator; |
|
6716 delete iTEChunkedValidator; |
|
6717 delete iDtorValidator; |
|
6718 } |
|
6719 |
|
6720 inline CWspHeaderWriter_TEChunked_UnitTest::CWspHeaderWriter_TEChunked_UnitTest(CDataLogger& aDataLogger, |
|
6721 MUnitTestObserver& aObserver) |
|
6722 : CUnitTest(KWspHeaderWriterTEChunkedUnitTest, aDataLogger, aObserver) |
|
6723 { |
|
6724 //Do nothing |
|
6725 } |
|
6726 |
|
6727 // Now the Individual transitions need to be added. |
|
6728 inline void CWspHeaderWriter_TEChunked_UnitTest::ConstructL() |
|
6729 { |
|
6730 // Perform the base class initialization |
|
6731 UnitTestConstructL(); |
|
6732 |
|
6733 // Create the Unit test state accessor |
|
6734 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
6735 // Construct the Unit test context. |
|
6736 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
6737 iUTContext->ConstructL(WSP::ETE); |
|
6738 |
|
6739 // Part1 |
|
6740 _LIT8(KTxtTE, "Chunked"); |
|
6741 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTE); |
|
6742 CleanupClosePushL(stringVal); |
|
6743 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
6744 CleanupStack::PushL(part1); |
|
6745 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
6746 CleanupStack::Pop(part1); |
|
6747 CleanupStack::PopAndDestroy(&stringVal); |
|
6748 |
|
6749 TBuf8<256> expectedBuf; |
|
6750 expectedBuf.Append(0x01); // value-length |
|
6751 expectedBuf.Append(0x82); // encoded token for chunked |
|
6752 iUTContext->SetExpectedL(expectedBuf); |
|
6753 |
|
6754 // Add the Transitions in the order they are to run |
|
6755 // C'tor first, D'tor last... |
|
6756 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
6757 using constructor and destuctor validators */ |
|
6758 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
6759 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
6760 iTEChunkedValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
6761 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iTEChunkedValidator)); |
|
6762 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
6763 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
6764 } |
|
6765 |
|
6766 // ______________________________________________________________________________ |
|
6767 // |
|
6768 _LIT(KWspHeaderWriterTEIdentitiyWithQValueUnitTest,"CWspHeaderWriter_TEIdentitiyWithQValue_UnitTest"); |
|
6769 |
|
6770 CWspHeaderWriter_TEIdentitiyWithQValue_UnitTest* CWspHeaderWriter_TEIdentitiyWithQValue_UnitTest::NewL(CDataLogger& aDataLogger, |
|
6771 MUnitTestObserver& aObserver) |
|
6772 { |
|
6773 CWspHeaderWriter_TEIdentitiyWithQValue_UnitTest* self = |
|
6774 new(ELeave) CWspHeaderWriter_TEIdentitiyWithQValue_UnitTest(aDataLogger, |
|
6775 aObserver); |
|
6776 CleanupStack::PushL(self); |
|
6777 self->ConstructL(); |
|
6778 CleanupStack::Pop(self); |
|
6779 return self; |
|
6780 } |
|
6781 |
|
6782 inline TInt CWspHeaderWriter_TEIdentitiyWithQValue_UnitTest::RunError(TInt aError) |
|
6783 { |
|
6784 // The RunL left so chain to the base first and then cleanup |
|
6785 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
6786 delete iUTContext; |
|
6787 iUTContext = NULL; |
|
6788 delete iStateAccessor; |
|
6789 iStateAccessor = NULL; |
|
6790 /* delete any validators used */ |
|
6791 delete iCtorValidator; |
|
6792 iCtorValidator = NULL; |
|
6793 delete iTEIdentitiyWithQValueValidator; |
|
6794 iTEIdentitiyWithQValueValidator = NULL; |
|
6795 delete iDtorValidator; |
|
6796 iDtorValidator = NULL; |
|
6797 return error; |
|
6798 } |
|
6799 |
|
6800 inline CWspHeaderWriter_TEIdentitiyWithQValue_UnitTest::~CWspHeaderWriter_TEIdentitiyWithQValue_UnitTest() |
|
6801 { |
|
6802 // Simply delete our test class instance |
|
6803 delete iUTContext; |
|
6804 delete iStateAccessor; |
|
6805 /* delete any validators used */ |
|
6806 delete iCtorValidator; |
|
6807 delete iTEIdentitiyWithQValueValidator; |
|
6808 delete iDtorValidator; |
|
6809 } |
|
6810 |
|
6811 inline CWspHeaderWriter_TEIdentitiyWithQValue_UnitTest::CWspHeaderWriter_TEIdentitiyWithQValue_UnitTest(CDataLogger& aDataLogger, |
|
6812 MUnitTestObserver& aObserver) |
|
6813 : CUnitTest(KWspHeaderWriterTEIdentitiyWithQValueUnitTest, aDataLogger, aObserver) |
|
6814 { |
|
6815 //Do nothing |
|
6816 } |
|
6817 |
|
6818 // Now the Individual transitions need to be added. |
|
6819 inline void CWspHeaderWriter_TEIdentitiyWithQValue_UnitTest::ConstructL() |
|
6820 { |
|
6821 // Perform the base class initialization |
|
6822 UnitTestConstructL(); |
|
6823 |
|
6824 // Create the Unit test state accessor |
|
6825 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
6826 // Construct the Unit test context. |
|
6827 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
6828 iUTContext->ConstructL(WSP::ETE); |
|
6829 |
|
6830 // Part1 |
|
6831 _LIT8(KTxtTE, "Identity"); |
|
6832 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTE); |
|
6833 CleanupClosePushL(stringVal); |
|
6834 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
6835 CleanupStack::PushL(part1); |
|
6836 |
|
6837 // Param1 |
|
6838 _LIT8(KTxtQParamName, "Q"); |
|
6839 _LIT8(KTxtQParamVal, "0.99"); |
|
6840 RStringF paramName = iUTContext->iStrPool.OpenFStringL(KTxtQParamName); |
|
6841 CleanupClosePushL(paramName); |
|
6842 RStringF paramVal = iUTContext->iStrPool.OpenFStringL(KTxtQParamVal); |
|
6843 CleanupClosePushL(paramVal); |
|
6844 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(paramName, paramVal); |
|
6845 CleanupStack::PushL(param1); |
|
6846 part1->AddParamL(param1); |
|
6847 CleanupStack::Pop(param1); |
|
6848 |
|
6849 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
6850 CleanupStack::PopAndDestroy(2, ¶mName); |
|
6851 CleanupStack::Pop(part1); |
|
6852 CleanupStack::PopAndDestroy(&stringVal); |
|
6853 |
|
6854 TBuf8<256> expectedBuf; |
|
6855 expectedBuf.Append(0x03); // value-length |
|
6856 expectedBuf.Append(0x83); // encoded token for identity |
|
6857 expectedBuf.Append(0x80); // encoded token for q-value |
|
6858 expectedBuf.Append(0x64); // encoded token for 0.99 Q value |
|
6859 iUTContext->SetExpectedL(expectedBuf); |
|
6860 |
|
6861 // Add the Transitions in the order they are to run |
|
6862 // C'tor first, D'tor last... |
|
6863 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
6864 using constructor and destuctor validators */ |
|
6865 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
6866 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
6867 iTEIdentitiyWithQValueValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
6868 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iTEIdentitiyWithQValueValidator)); |
|
6869 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
6870 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
6871 } |
|
6872 |
|
6873 // ______________________________________________________________________________ |
|
6874 // |
|
6875 _LIT(KWspHeaderWriterTEGzipUnitTest,"CWspHeaderWriter_TEGzip_UnitTest"); |
|
6876 |
|
6877 CWspHeaderWriter_TEGzip_UnitTest* CWspHeaderWriter_TEGzip_UnitTest::NewL(CDataLogger& aDataLogger, |
|
6878 MUnitTestObserver& aObserver) |
|
6879 { |
|
6880 CWspHeaderWriter_TEGzip_UnitTest* self = |
|
6881 new(ELeave) CWspHeaderWriter_TEGzip_UnitTest(aDataLogger, |
|
6882 aObserver); |
|
6883 CleanupStack::PushL(self); |
|
6884 self->ConstructL(); |
|
6885 CleanupStack::Pop(self); |
|
6886 return self; |
|
6887 } |
|
6888 |
|
6889 inline TInt CWspHeaderWriter_TEGzip_UnitTest::RunError(TInt aError) |
|
6890 { |
|
6891 // The RunL left so chain to the base first and then cleanup |
|
6892 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
6893 delete iUTContext; |
|
6894 iUTContext = NULL; |
|
6895 delete iStateAccessor; |
|
6896 iStateAccessor = NULL; |
|
6897 /* delete any validators used */ |
|
6898 delete iCtorValidator; |
|
6899 iCtorValidator = NULL; |
|
6900 delete iTEGzipValidator; |
|
6901 iTEGzipValidator = NULL; |
|
6902 delete iDtorValidator; |
|
6903 iDtorValidator = NULL; |
|
6904 return error; |
|
6905 } |
|
6906 |
|
6907 inline CWspHeaderWriter_TEGzip_UnitTest::~CWspHeaderWriter_TEGzip_UnitTest() |
|
6908 { |
|
6909 // Simply delete our test class instance |
|
6910 delete iUTContext; |
|
6911 delete iStateAccessor; |
|
6912 /* delete any validators used */ |
|
6913 delete iCtorValidator; |
|
6914 delete iTEGzipValidator; |
|
6915 delete iDtorValidator; |
|
6916 } |
|
6917 |
|
6918 inline CWspHeaderWriter_TEGzip_UnitTest::CWspHeaderWriter_TEGzip_UnitTest(CDataLogger& aDataLogger, |
|
6919 MUnitTestObserver& aObserver) |
|
6920 : CUnitTest(KWspHeaderWriterTEGzipUnitTest, aDataLogger, aObserver) |
|
6921 { |
|
6922 //Do nothing |
|
6923 } |
|
6924 |
|
6925 // Now the Individual transitions need to be added. |
|
6926 inline void CWspHeaderWriter_TEGzip_UnitTest::ConstructL() |
|
6927 { |
|
6928 // Perform the base class initialization |
|
6929 UnitTestConstructL(); |
|
6930 |
|
6931 // Create the Unit test state accessor |
|
6932 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
6933 // Construct the Unit test context. |
|
6934 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
6935 iUTContext->ConstructL(WSP::ETE); |
|
6936 |
|
6937 // Part1 |
|
6938 _LIT8(KTxtTE, "Gzip"); |
|
6939 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTE); |
|
6940 CleanupClosePushL(stringVal); |
|
6941 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
6942 CleanupStack::PushL(part1); |
|
6943 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
6944 CleanupStack::Pop(part1); |
|
6945 CleanupStack::PopAndDestroy(&stringVal); |
|
6946 |
|
6947 TBuf8<256> expectedBuf; |
|
6948 expectedBuf.Append(0x01); // value-length |
|
6949 expectedBuf.Append(0x84); // encoded token for chunked |
|
6950 iUTContext->SetExpectedL(expectedBuf); |
|
6951 |
|
6952 // Add the Transitions in the order they are to run |
|
6953 // C'tor first, D'tor last... |
|
6954 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
6955 using constructor and destuctor validators */ |
|
6956 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
6957 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
6958 iTEGzipValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
6959 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iTEGzipValidator)); |
|
6960 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
6961 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
6962 } |
|
6963 |
|
6964 // ______________________________________________________________________________ |
|
6965 // |
|
6966 _LIT(KWspHeaderWriterTECompressWithQValueUnitTest,"CWspHeaderWriter_TECompressWithQValue_UnitTest"); |
|
6967 |
|
6968 CWspHeaderWriter_TECompressWithQValue_UnitTest* CWspHeaderWriter_TECompressWithQValue_UnitTest::NewL(CDataLogger& aDataLogger, |
|
6969 MUnitTestObserver& aObserver) |
|
6970 { |
|
6971 CWspHeaderWriter_TECompressWithQValue_UnitTest* self = |
|
6972 new(ELeave) CWspHeaderWriter_TECompressWithQValue_UnitTest(aDataLogger, |
|
6973 aObserver); |
|
6974 CleanupStack::PushL(self); |
|
6975 self->ConstructL(); |
|
6976 CleanupStack::Pop(self); |
|
6977 return self; |
|
6978 } |
|
6979 |
|
6980 inline TInt CWspHeaderWriter_TECompressWithQValue_UnitTest::RunError(TInt aError) |
|
6981 { |
|
6982 // The RunL left so chain to the base first and then cleanup |
|
6983 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
6984 delete iUTContext; |
|
6985 iUTContext = NULL; |
|
6986 delete iStateAccessor; |
|
6987 iStateAccessor = NULL; |
|
6988 /* delete any validators used */ |
|
6989 delete iCtorValidator; |
|
6990 iCtorValidator = NULL; |
|
6991 delete iTECompressWithQValueValidator; |
|
6992 iTECompressWithQValueValidator = NULL; |
|
6993 delete iDtorValidator; |
|
6994 iDtorValidator = NULL; |
|
6995 return error; |
|
6996 } |
|
6997 |
|
6998 inline CWspHeaderWriter_TECompressWithQValue_UnitTest::~CWspHeaderWriter_TECompressWithQValue_UnitTest() |
|
6999 { |
|
7000 // Simply delete our test class instance |
|
7001 delete iUTContext; |
|
7002 delete iStateAccessor; |
|
7003 /* delete any validators used */ |
|
7004 delete iCtorValidator; |
|
7005 delete iTECompressWithQValueValidator; |
|
7006 delete iDtorValidator; |
|
7007 } |
|
7008 |
|
7009 inline CWspHeaderWriter_TECompressWithQValue_UnitTest::CWspHeaderWriter_TECompressWithQValue_UnitTest(CDataLogger& aDataLogger, |
|
7010 MUnitTestObserver& aObserver) |
|
7011 : CUnitTest(KWspHeaderWriterTECompressWithQValueUnitTest, aDataLogger, aObserver) |
|
7012 { |
|
7013 //Do nothing |
|
7014 } |
|
7015 |
|
7016 // Now the Individual transitions need to be added. |
|
7017 inline void CWspHeaderWriter_TECompressWithQValue_UnitTest::ConstructL() |
|
7018 { |
|
7019 // Perform the base class initialization |
|
7020 UnitTestConstructL(); |
|
7021 |
|
7022 // Create the Unit test state accessor |
|
7023 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
7024 // Construct the Unit test context. |
|
7025 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
7026 iUTContext->ConstructL(WSP::ETE); |
|
7027 |
|
7028 // Part1 |
|
7029 _LIT8(KTxtTE, "Compress"); |
|
7030 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTE); |
|
7031 CleanupClosePushL(stringVal); |
|
7032 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
7033 CleanupStack::PushL(part1); |
|
7034 |
|
7035 // Param1 |
|
7036 _LIT8(KTxtQParamName, "Q"); |
|
7037 _LIT8(KTxtQParamVal, "0.1"); |
|
7038 RStringF paramName = iUTContext->iStrPool.OpenFStringL(KTxtQParamName); |
|
7039 CleanupClosePushL(paramName); |
|
7040 RStringF paramVal = iUTContext->iStrPool.OpenFStringL(KTxtQParamVal); |
|
7041 CleanupClosePushL(paramVal); |
|
7042 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(paramName, paramVal); |
|
7043 CleanupStack::PushL(param1); |
|
7044 part1->AddParamL(param1); |
|
7045 CleanupStack::Pop(param1); |
|
7046 |
|
7047 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
7048 CleanupStack::PopAndDestroy(2, ¶mName); |
|
7049 CleanupStack::Pop(part1); |
|
7050 CleanupStack::PopAndDestroy(&stringVal); |
|
7051 |
|
7052 TBuf8<256> expectedBuf; |
|
7053 expectedBuf.Append(0x03); // value-length |
|
7054 expectedBuf.Append(0x85); // encoded token for compress |
|
7055 expectedBuf.Append(0x80); // encoded token for q-value |
|
7056 expectedBuf.Append(0x0B); // encoded token for 0.1 Q value |
|
7057 iUTContext->SetExpectedL(expectedBuf); |
|
7058 |
|
7059 // Add the Transitions in the order they are to run |
|
7060 // C'tor first, D'tor last... |
|
7061 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
7062 using constructor and destuctor validators */ |
|
7063 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
7064 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
7065 iTECompressWithQValueValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
7066 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iTECompressWithQValueValidator)); |
|
7067 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
7068 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
7069 } |
|
7070 |
|
7071 // ______________________________________________________________________________ |
|
7072 // |
|
7073 _LIT(KWspHeaderWriterTETokenTextUnitTest,"CWspHeaderWriter_TETokenText_UnitTest"); |
|
7074 |
|
7075 CWspHeaderWriter_TETokenText_UnitTest* CWspHeaderWriter_TETokenText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
7076 MUnitTestObserver& aObserver) |
|
7077 { |
|
7078 CWspHeaderWriter_TETokenText_UnitTest* self = |
|
7079 new(ELeave) CWspHeaderWriter_TETokenText_UnitTest(aDataLogger, |
|
7080 aObserver); |
|
7081 CleanupStack::PushL(self); |
|
7082 self->ConstructL(); |
|
7083 CleanupStack::Pop(self); |
|
7084 return self; |
|
7085 } |
|
7086 |
|
7087 inline TInt CWspHeaderWriter_TETokenText_UnitTest::RunError(TInt aError) |
|
7088 { |
|
7089 // The RunL left so chain to the base first and then cleanup |
|
7090 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
7091 delete iUTContext; |
|
7092 iUTContext = NULL; |
|
7093 delete iStateAccessor; |
|
7094 iStateAccessor = NULL; |
|
7095 /* delete any validators used */ |
|
7096 delete iCtorValidator; |
|
7097 iCtorValidator = NULL; |
|
7098 delete iTETokenTextValidator; |
|
7099 iTETokenTextValidator = NULL; |
|
7100 delete iDtorValidator; |
|
7101 iDtorValidator = NULL; |
|
7102 return error; |
|
7103 } |
|
7104 |
|
7105 inline CWspHeaderWriter_TETokenText_UnitTest::~CWspHeaderWriter_TETokenText_UnitTest() |
|
7106 { |
|
7107 // Simply delete our test class instance |
|
7108 delete iUTContext; |
|
7109 delete iStateAccessor; |
|
7110 /* delete any validators used */ |
|
7111 delete iCtorValidator; |
|
7112 delete iTETokenTextValidator; |
|
7113 delete iDtorValidator; |
|
7114 } |
|
7115 |
|
7116 inline CWspHeaderWriter_TETokenText_UnitTest::CWspHeaderWriter_TETokenText_UnitTest(CDataLogger& aDataLogger, |
|
7117 MUnitTestObserver& aObserver) |
|
7118 : CUnitTest(KWspHeaderWriterTETokenTextUnitTest, aDataLogger, aObserver) |
|
7119 { |
|
7120 //Do nothing |
|
7121 } |
|
7122 |
|
7123 // Now the Individual transitions need to be added. |
|
7124 inline void CWspHeaderWriter_TETokenText_UnitTest::ConstructL() |
|
7125 { |
|
7126 // Perform the base class initialization |
|
7127 UnitTestConstructL(); |
|
7128 |
|
7129 // Create the Unit test state accessor |
|
7130 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
7131 // Construct the Unit test context. |
|
7132 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
7133 iUTContext->ConstructL(WSP::ETE); |
|
7134 |
|
7135 // Part1 |
|
7136 _LIT8(KTxtTE, "my-new-TE-value"); |
|
7137 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTE); |
|
7138 CleanupClosePushL(stringVal); |
|
7139 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
7140 CleanupStack::PushL(part1); |
|
7141 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
7142 CleanupStack::Pop(part1); |
|
7143 CleanupStack::PopAndDestroy(&stringVal); |
|
7144 |
|
7145 TBuf8<256> expectedBuf; |
|
7146 expectedBuf.Append(0x10); // value-length |
|
7147 expectedBuf.Append(KTxtTE); // encoded token for chunked |
|
7148 expectedBuf.Append(0x00); |
|
7149 iUTContext->SetExpectedL(expectedBuf); |
|
7150 |
|
7151 // Add the Transitions in the order they are to run |
|
7152 // C'tor first, D'tor last... |
|
7153 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
7154 using constructor and destuctor validators */ |
|
7155 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
7156 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
7157 iTETokenTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
7158 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iTETokenTextValidator)); |
|
7159 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
7160 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
7161 } |
|
7162 |
|
7163 // ______________________________________________________________________________ |
|
7164 // |
|
7165 _LIT(KWspHeaderWriterTETokenTextWithQValueUnitTest,"CWspHeaderWriter_TETokenTextWithQValue_UnitTest"); |
|
7166 |
|
7167 CWspHeaderWriter_TETokenTextWithQValue_UnitTest* CWspHeaderWriter_TETokenTextWithQValue_UnitTest::NewL(CDataLogger& aDataLogger, |
|
7168 MUnitTestObserver& aObserver) |
|
7169 { |
|
7170 CWspHeaderWriter_TETokenTextWithQValue_UnitTest* self = |
|
7171 new(ELeave) CWspHeaderWriter_TETokenTextWithQValue_UnitTest(aDataLogger, |
|
7172 aObserver); |
|
7173 CleanupStack::PushL(self); |
|
7174 self->ConstructL(); |
|
7175 CleanupStack::Pop(self); |
|
7176 return self; |
|
7177 } |
|
7178 |
|
7179 inline TInt CWspHeaderWriter_TETokenTextWithQValue_UnitTest::RunError(TInt aError) |
|
7180 { |
|
7181 // The RunL left so chain to the base first and then cleanup |
|
7182 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
7183 delete iUTContext; |
|
7184 iUTContext = NULL; |
|
7185 delete iStateAccessor; |
|
7186 iStateAccessor = NULL; |
|
7187 /* delete any validators used */ |
|
7188 delete iCtorValidator; |
|
7189 iCtorValidator = NULL; |
|
7190 delete iTETokenTextWithQValueValidator; |
|
7191 iTETokenTextWithQValueValidator = NULL; |
|
7192 delete iDtorValidator; |
|
7193 iDtorValidator = NULL; |
|
7194 return error; |
|
7195 } |
|
7196 |
|
7197 inline CWspHeaderWriter_TETokenTextWithQValue_UnitTest::~CWspHeaderWriter_TETokenTextWithQValue_UnitTest() |
|
7198 { |
|
7199 // Simply delete our test class instance |
|
7200 delete iUTContext; |
|
7201 delete iStateAccessor; |
|
7202 /* delete any validators used */ |
|
7203 delete iCtorValidator; |
|
7204 delete iTETokenTextWithQValueValidator; |
|
7205 delete iDtorValidator; |
|
7206 } |
|
7207 |
|
7208 inline CWspHeaderWriter_TETokenTextWithQValue_UnitTest::CWspHeaderWriter_TETokenTextWithQValue_UnitTest(CDataLogger& aDataLogger, |
|
7209 MUnitTestObserver& aObserver) |
|
7210 : CUnitTest(KWspHeaderWriterTETokenTextWithQValueUnitTest, aDataLogger, aObserver) |
|
7211 { |
|
7212 //Do nothing |
|
7213 } |
|
7214 |
|
7215 // Now the Individual transitions need to be added. |
|
7216 inline void CWspHeaderWriter_TETokenTextWithQValue_UnitTest::ConstructL() |
|
7217 { |
|
7218 // Perform the base class initialization |
|
7219 UnitTestConstructL(); |
|
7220 |
|
7221 // Create the Unit test state accessor |
|
7222 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
7223 // Construct the Unit test context. |
|
7224 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
7225 iUTContext->ConstructL(WSP::ETE); |
|
7226 |
|
7227 // Part1 |
|
7228 _LIT8(KTxtTE, "my-new-TE-value"); |
|
7229 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTE); |
|
7230 CleanupClosePushL(stringVal); |
|
7231 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
7232 CleanupStack::PushL(part1); |
|
7233 |
|
7234 // Param1 |
|
7235 _LIT8(KTxtQParamName, "Q"); |
|
7236 _LIT8(KTxtQParamVal, "0.333"); |
|
7237 RStringF paramName = iUTContext->iStrPool.OpenFStringL(KTxtQParamName); |
|
7238 CleanupClosePushL(paramName); |
|
7239 RStringF paramVal = iUTContext->iStrPool.OpenFStringL(KTxtQParamVal); |
|
7240 CleanupClosePushL(paramVal); |
|
7241 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(paramName, paramVal); |
|
7242 CleanupStack::PushL(param1); |
|
7243 part1->AddParamL(param1); |
|
7244 CleanupStack::Pop(param1); |
|
7245 |
|
7246 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
7247 CleanupStack::PopAndDestroy(2, ¶mName); |
|
7248 CleanupStack::Pop(part1); |
|
7249 CleanupStack::PopAndDestroy(&stringVal); |
|
7250 |
|
7251 TBuf8<256> expectedBuf; |
|
7252 expectedBuf.Append(0x13); // value-length |
|
7253 expectedBuf.Append(KTxtTE); // encoded token for compress |
|
7254 expectedBuf.Append(0x00); |
|
7255 expectedBuf.Append(0x80); // encoded token for q-value |
|
7256 expectedBuf.Append(0x83); // encoded token for 0.333 Q value ... |
|
7257 expectedBuf.Append(0x31); // ... |
|
7258 iUTContext->SetExpectedL(expectedBuf); |
|
7259 |
|
7260 // Add the Transitions in the order they are to run |
|
7261 // C'tor first, D'tor last... |
|
7262 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
7263 using constructor and destuctor validators */ |
|
7264 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
7265 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
7266 iTETokenTextWithQValueValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
7267 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iTETokenTextWithQValueValidator)); |
|
7268 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
7269 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
7270 } |
|
7271 |
|
7272 // ______________________________________________________________________________ |
|
7273 // |
|
7274 _LIT(KWspHeaderWriterTrailerShortIntUnitTest,"CWspHeaderWriter_TrailerShortInt_UnitTest"); |
|
7275 |
|
7276 CWspHeaderWriter_TrailerShortInt_UnitTest* CWspHeaderWriter_TrailerShortInt_UnitTest::NewL(CDataLogger& aDataLogger, |
|
7277 MUnitTestObserver& aObserver) |
|
7278 { |
|
7279 CWspHeaderWriter_TrailerShortInt_UnitTest* self = |
|
7280 new(ELeave) CWspHeaderWriter_TrailerShortInt_UnitTest(aDataLogger, |
|
7281 aObserver); |
|
7282 CleanupStack::PushL(self); |
|
7283 self->ConstructL(); |
|
7284 CleanupStack::Pop(self); |
|
7285 return self; |
|
7286 } |
|
7287 |
|
7288 inline TInt CWspHeaderWriter_TrailerShortInt_UnitTest::RunError(TInt aError) |
|
7289 { |
|
7290 // The RunL left so chain to the base first and then cleanup |
|
7291 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
7292 delete iUTContext; |
|
7293 iUTContext = NULL; |
|
7294 delete iStateAccessor; |
|
7295 iStateAccessor = NULL; |
|
7296 /* delete any validators used */ |
|
7297 delete iCtorValidator; |
|
7298 iCtorValidator = NULL; |
|
7299 delete iTrailerShortIntValidator; |
|
7300 iTrailerShortIntValidator = NULL; |
|
7301 delete iDtorValidator; |
|
7302 iDtorValidator = NULL; |
|
7303 return error; |
|
7304 } |
|
7305 |
|
7306 inline CWspHeaderWriter_TrailerShortInt_UnitTest::~CWspHeaderWriter_TrailerShortInt_UnitTest() |
|
7307 { |
|
7308 // Simply delete our test class instance |
|
7309 delete iUTContext; |
|
7310 delete iStateAccessor; |
|
7311 /* delete any validators used */ |
|
7312 delete iCtorValidator; |
|
7313 delete iTrailerShortIntValidator; |
|
7314 delete iDtorValidator; |
|
7315 } |
|
7316 |
|
7317 inline CWspHeaderWriter_TrailerShortInt_UnitTest::CWspHeaderWriter_TrailerShortInt_UnitTest(CDataLogger& aDataLogger, |
|
7318 MUnitTestObserver& aObserver) |
|
7319 : CUnitTest(KWspHeaderWriterTrailerShortIntUnitTest, aDataLogger, aObserver) |
|
7320 { |
|
7321 //Do nothing |
|
7322 } |
|
7323 |
|
7324 // Now the Individual transitions need to be added. |
|
7325 inline void CWspHeaderWriter_TrailerShortInt_UnitTest::ConstructL() |
|
7326 { |
|
7327 // Perform the base class initialization |
|
7328 UnitTestConstructL(); |
|
7329 |
|
7330 // Create the Unit test state accessor |
|
7331 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
7332 // Construct the Unit test context. |
|
7333 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
7334 iUTContext->ConstructL(WSP::ETrailer); |
|
7335 |
|
7336 // Part1 |
|
7337 _LIT8(KTxtTrailer, "Accept"); |
|
7338 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTrailer); |
|
7339 CleanupClosePushL(stringVal); |
|
7340 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
7341 CleanupStack::PushL(part1); |
|
7342 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
7343 CleanupStack::Pop(part1); |
|
7344 CleanupStack::PopAndDestroy(&stringVal); |
|
7345 |
|
7346 TBuf8<256> expectedBuf; |
|
7347 expectedBuf.Append(0x80); // encoding for 'accept' |
|
7348 iUTContext->SetExpectedL(expectedBuf); |
|
7349 |
|
7350 // Add the Transitions in the order they are to run |
|
7351 // C'tor first, D'tor last... |
|
7352 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
7353 using constructor and destuctor validators */ |
|
7354 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
7355 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
7356 iTrailerShortIntValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
7357 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iTrailerShortIntValidator)); |
|
7358 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
7359 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
7360 } |
|
7361 |
|
7362 // ______________________________________________________________________________ |
|
7363 // |
|
7364 _LIT(KWspHeaderWriterTrailerv1_4NewShortIntUnitTest,"CWspHeaderWriter_Trailerv1_4NewShortInt_UnitTest"); |
|
7365 |
|
7366 CWspHeaderWriter_Trailerv1_4NewShortInt_UnitTest* CWspHeaderWriter_Trailerv1_4NewShortInt_UnitTest::NewL(CDataLogger& aDataLogger, |
|
7367 MUnitTestObserver& aObserver) |
|
7368 { |
|
7369 CWspHeaderWriter_Trailerv1_4NewShortInt_UnitTest* self = |
|
7370 new(ELeave) CWspHeaderWriter_Trailerv1_4NewShortInt_UnitTest(aDataLogger, |
|
7371 aObserver); |
|
7372 CleanupStack::PushL(self); |
|
7373 self->ConstructL(); |
|
7374 CleanupStack::Pop(self); |
|
7375 return self; |
|
7376 } |
|
7377 |
|
7378 inline TInt CWspHeaderWriter_Trailerv1_4NewShortInt_UnitTest::RunError(TInt aError) |
|
7379 { |
|
7380 // The RunL left so chain to the base first and then cleanup |
|
7381 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
7382 delete iUTContext; |
|
7383 iUTContext = NULL; |
|
7384 delete iStateAccessor; |
|
7385 iStateAccessor = NULL; |
|
7386 /* delete any validators used */ |
|
7387 delete iCtorValidator; |
|
7388 iCtorValidator = NULL; |
|
7389 delete iTrailerv1_4NewShortIntValidator; |
|
7390 iTrailerv1_4NewShortIntValidator = NULL; |
|
7391 delete iDtorValidator; |
|
7392 iDtorValidator = NULL; |
|
7393 return error; |
|
7394 } |
|
7395 |
|
7396 inline CWspHeaderWriter_Trailerv1_4NewShortInt_UnitTest::~CWspHeaderWriter_Trailerv1_4NewShortInt_UnitTest() |
|
7397 { |
|
7398 // Simply delete our test class instance |
|
7399 delete iUTContext; |
|
7400 delete iStateAccessor; |
|
7401 /* delete any validators used */ |
|
7402 delete iCtorValidator; |
|
7403 delete iTrailerv1_4NewShortIntValidator; |
|
7404 delete iDtorValidator; |
|
7405 } |
|
7406 |
|
7407 inline CWspHeaderWriter_Trailerv1_4NewShortInt_UnitTest::CWspHeaderWriter_Trailerv1_4NewShortInt_UnitTest(CDataLogger& aDataLogger, |
|
7408 MUnitTestObserver& aObserver) |
|
7409 : CUnitTest(KWspHeaderWriterTrailerv1_4NewShortIntUnitTest, aDataLogger, aObserver) |
|
7410 { |
|
7411 //Do nothing |
|
7412 } |
|
7413 |
|
7414 // Now the Individual transitions need to be added. |
|
7415 inline void CWspHeaderWriter_Trailerv1_4NewShortInt_UnitTest::ConstructL() |
|
7416 { |
|
7417 // Perform the base class initialization |
|
7418 UnitTestConstructL(); |
|
7419 |
|
7420 // Create the Unit test state accessor |
|
7421 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
7422 // Construct the Unit test context. |
|
7423 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
7424 iUTContext->ConstructL(WSP::ETrailer); |
|
7425 |
|
7426 // Part1 |
|
7427 _LIT8(KTxtTrailer, "Profile-warning"); |
|
7428 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTrailer); |
|
7429 CleanupClosePushL(stringVal); |
|
7430 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
7431 CleanupStack::PushL(part1); |
|
7432 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
7433 CleanupStack::Pop(part1); |
|
7434 CleanupStack::PopAndDestroy(&stringVal); |
|
7435 |
|
7436 TBuf8<256> expectedBuf; |
|
7437 expectedBuf.Append(0xC4); // encoding for 'profile-warning' |
|
7438 iUTContext->SetExpectedL(expectedBuf); |
|
7439 |
|
7440 // Add the Transitions in the order they are to run |
|
7441 // C'tor first, D'tor last... |
|
7442 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
7443 using constructor and destuctor validators */ |
|
7444 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
7445 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
7446 iTrailerv1_4NewShortIntValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
7447 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iTrailerv1_4NewShortIntValidator)); |
|
7448 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
7449 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
7450 } |
|
7451 |
|
7452 // ______________________________________________________________________________ |
|
7453 // |
|
7454 _LIT(KWspHeaderWriterTrailerTokenTextUnitTest,"CWspHeaderWriter_TrailerTokenText_UnitTest"); |
|
7455 |
|
7456 CWspHeaderWriter_TrailerTokenText_UnitTest* CWspHeaderWriter_TrailerTokenText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
7457 MUnitTestObserver& aObserver) |
|
7458 { |
|
7459 CWspHeaderWriter_TrailerTokenText_UnitTest* self = |
|
7460 new(ELeave) CWspHeaderWriter_TrailerTokenText_UnitTest(aDataLogger, |
|
7461 aObserver); |
|
7462 CleanupStack::PushL(self); |
|
7463 self->ConstructL(); |
|
7464 CleanupStack::Pop(self); |
|
7465 return self; |
|
7466 } |
|
7467 |
|
7468 inline TInt CWspHeaderWriter_TrailerTokenText_UnitTest::RunError(TInt aError) |
|
7469 { |
|
7470 // The RunL left so chain to the base first and then cleanup |
|
7471 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
7472 delete iUTContext; |
|
7473 iUTContext = NULL; |
|
7474 delete iStateAccessor; |
|
7475 iStateAccessor = NULL; |
|
7476 /* delete any validators used */ |
|
7477 delete iCtorValidator; |
|
7478 iCtorValidator = NULL; |
|
7479 delete iTrailerTokenTextValidator; |
|
7480 iTrailerTokenTextValidator = NULL; |
|
7481 delete iDtorValidator; |
|
7482 iDtorValidator = NULL; |
|
7483 return error; |
|
7484 } |
|
7485 |
|
7486 inline CWspHeaderWriter_TrailerTokenText_UnitTest::~CWspHeaderWriter_TrailerTokenText_UnitTest() |
|
7487 { |
|
7488 // Simply delete our test class instance |
|
7489 delete iUTContext; |
|
7490 delete iStateAccessor; |
|
7491 /* delete any validators used */ |
|
7492 delete iCtorValidator; |
|
7493 delete iTrailerTokenTextValidator; |
|
7494 delete iDtorValidator; |
|
7495 } |
|
7496 |
|
7497 inline CWspHeaderWriter_TrailerTokenText_UnitTest::CWspHeaderWriter_TrailerTokenText_UnitTest(CDataLogger& aDataLogger, |
|
7498 MUnitTestObserver& aObserver) |
|
7499 : CUnitTest(KWspHeaderWriterTrailerTokenTextUnitTest, aDataLogger, aObserver) |
|
7500 { |
|
7501 //Do nothing |
|
7502 } |
|
7503 |
|
7504 // Now the Individual transitions need to be added. |
|
7505 inline void CWspHeaderWriter_TrailerTokenText_UnitTest::ConstructL() |
|
7506 { |
|
7507 // Perform the base class initialization |
|
7508 UnitTestConstructL(); |
|
7509 |
|
7510 // Create the Unit test state accessor |
|
7511 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
7512 // Construct the Unit test context. |
|
7513 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
7514 iUTContext->ConstructL(WSP::ETrailer); |
|
7515 |
|
7516 // Part1 |
|
7517 _LIT8(KTxtTrailer, "my-new-trailer-token"); |
|
7518 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTrailer); |
|
7519 CleanupClosePushL(stringVal); |
|
7520 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
7521 CleanupStack::PushL(part1); |
|
7522 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
7523 CleanupStack::Pop(part1); |
|
7524 CleanupStack::PopAndDestroy(&stringVal); |
|
7525 |
|
7526 TBuf8<256> expectedBuf; |
|
7527 expectedBuf.Append(KTxtTrailer); |
|
7528 expectedBuf.Append(0x00); |
|
7529 iUTContext->SetExpectedL(expectedBuf); |
|
7530 |
|
7531 // Add the Transitions in the order they are to run |
|
7532 // C'tor first, D'tor last... |
|
7533 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
7534 using constructor and destuctor validators */ |
|
7535 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
7536 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
7537 iTrailerTokenTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
7538 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iTrailerTokenTextValidator)); |
|
7539 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
7540 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
7541 } |
|
7542 |
|
7543 // ______________________________________________________________________________ |
|
7544 // |
|
7545 _LIT(KWspHeaderWriterAcceptEncodingGzipUnitTest,"CWspHeaderWriter_AcceptEncodingGzip_UnitTest"); |
|
7546 |
|
7547 CWspHeaderWriter_AcceptEncodingGzip_UnitTest* CWspHeaderWriter_AcceptEncodingGzip_UnitTest::NewL(CDataLogger& aDataLogger, |
|
7548 MUnitTestObserver& aObserver) |
|
7549 { |
|
7550 CWspHeaderWriter_AcceptEncodingGzip_UnitTest* self = |
|
7551 new(ELeave) CWspHeaderWriter_AcceptEncodingGzip_UnitTest(aDataLogger, |
|
7552 aObserver); |
|
7553 CleanupStack::PushL(self); |
|
7554 self->ConstructL(); |
|
7555 CleanupStack::Pop(self); |
|
7556 return self; |
|
7557 } |
|
7558 |
|
7559 inline TInt CWspHeaderWriter_AcceptEncodingGzip_UnitTest::RunError(TInt aError) |
|
7560 { |
|
7561 // The RunL left so chain to the base first and then cleanup |
|
7562 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
7563 delete iUTContext; |
|
7564 iUTContext = NULL; |
|
7565 delete iStateAccessor; |
|
7566 iStateAccessor = NULL; |
|
7567 /* delete any validators used */ |
|
7568 delete iCtorValidator; |
|
7569 iCtorValidator = NULL; |
|
7570 delete iAcceptEncodingGzipValidator; |
|
7571 iAcceptEncodingGzipValidator = NULL; |
|
7572 delete iDtorValidator; |
|
7573 iDtorValidator = NULL; |
|
7574 return error; |
|
7575 } |
|
7576 |
|
7577 inline CWspHeaderWriter_AcceptEncodingGzip_UnitTest::~CWspHeaderWriter_AcceptEncodingGzip_UnitTest() |
|
7578 { |
|
7579 // Simply delete our test class instance |
|
7580 delete iUTContext; |
|
7581 delete iStateAccessor; |
|
7582 /* delete any validators used */ |
|
7583 delete iCtorValidator; |
|
7584 delete iAcceptEncodingGzipValidator; |
|
7585 delete iDtorValidator; |
|
7586 } |
|
7587 |
|
7588 inline CWspHeaderWriter_AcceptEncodingGzip_UnitTest::CWspHeaderWriter_AcceptEncodingGzip_UnitTest(CDataLogger& aDataLogger, |
|
7589 MUnitTestObserver& aObserver) |
|
7590 : CUnitTest(KWspHeaderWriterAcceptEncodingGzipUnitTest, aDataLogger, aObserver) |
|
7591 { |
|
7592 //Do nothing |
|
7593 } |
|
7594 |
|
7595 // Now the Individual transitions need to be added. |
|
7596 inline void CWspHeaderWriter_AcceptEncodingGzip_UnitTest::ConstructL() |
|
7597 { |
|
7598 // Perform the base class initialization |
|
7599 UnitTestConstructL(); |
|
7600 |
|
7601 // Create the Unit test state accessor |
|
7602 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
7603 // Construct the Unit test context. |
|
7604 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
7605 iUTContext->ConstructL(WSP::EAcceptEncoding); |
|
7606 |
|
7607 // Part1 |
|
7608 _LIT8(KTxtAcceptEncoding, "Gzip"); |
|
7609 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtAcceptEncoding); |
|
7610 CleanupClosePushL(stringVal); |
|
7611 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
7612 CleanupStack::PushL(part1); |
|
7613 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
7614 CleanupStack::Pop(part1); |
|
7615 CleanupStack::PopAndDestroy(&stringVal); |
|
7616 |
|
7617 TBuf8<256> expectedBuf; |
|
7618 expectedBuf.Append(0x80); |
|
7619 iUTContext->SetExpectedL(expectedBuf); |
|
7620 |
|
7621 // Add the Transitions in the order they are to run |
|
7622 // C'tor first, D'tor last... |
|
7623 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
7624 using constructor and destuctor validators */ |
|
7625 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
7626 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
7627 iAcceptEncodingGzipValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
7628 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptEncodingGzipValidator)); |
|
7629 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
7630 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
7631 } |
|
7632 |
|
7633 // ______________________________________________________________________________ |
|
7634 // |
|
7635 _LIT(KWspHeaderWriterAcceptEncodingCompressUnitTest,"CWspHeaderWriter_AcceptEncodingCompress_UnitTest"); |
|
7636 |
|
7637 CWspHeaderWriter_AcceptEncodingCompress_UnitTest* CWspHeaderWriter_AcceptEncodingCompress_UnitTest::NewL(CDataLogger& aDataLogger, |
|
7638 MUnitTestObserver& aObserver) |
|
7639 { |
|
7640 CWspHeaderWriter_AcceptEncodingCompress_UnitTest* self = |
|
7641 new(ELeave) CWspHeaderWriter_AcceptEncodingCompress_UnitTest(aDataLogger, |
|
7642 aObserver); |
|
7643 CleanupStack::PushL(self); |
|
7644 self->ConstructL(); |
|
7645 CleanupStack::Pop(self); |
|
7646 return self; |
|
7647 } |
|
7648 |
|
7649 inline TInt CWspHeaderWriter_AcceptEncodingCompress_UnitTest::RunError(TInt aError) |
|
7650 { |
|
7651 // The RunL left so chain to the base first and then cleanup |
|
7652 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
7653 delete iUTContext; |
|
7654 iUTContext = NULL; |
|
7655 delete iStateAccessor; |
|
7656 iStateAccessor = NULL; |
|
7657 /* delete any validators used */ |
|
7658 delete iCtorValidator; |
|
7659 iCtorValidator = NULL; |
|
7660 delete iAcceptEncodingCompressValidator; |
|
7661 iAcceptEncodingCompressValidator = NULL; |
|
7662 delete iDtorValidator; |
|
7663 iDtorValidator = NULL; |
|
7664 return error; |
|
7665 } |
|
7666 |
|
7667 inline CWspHeaderWriter_AcceptEncodingCompress_UnitTest::~CWspHeaderWriter_AcceptEncodingCompress_UnitTest() |
|
7668 { |
|
7669 // Simply delete our test class instance |
|
7670 delete iUTContext; |
|
7671 delete iStateAccessor; |
|
7672 /* delete any validators used */ |
|
7673 delete iCtorValidator; |
|
7674 delete iAcceptEncodingCompressValidator; |
|
7675 delete iDtorValidator; |
|
7676 } |
|
7677 |
|
7678 inline CWspHeaderWriter_AcceptEncodingCompress_UnitTest::CWspHeaderWriter_AcceptEncodingCompress_UnitTest(CDataLogger& aDataLogger, |
|
7679 MUnitTestObserver& aObserver) |
|
7680 : CUnitTest(KWspHeaderWriterAcceptEncodingCompressUnitTest, aDataLogger, aObserver) |
|
7681 { |
|
7682 //Do nothing |
|
7683 } |
|
7684 |
|
7685 // Now the Individual transitions need to be added. |
|
7686 inline void CWspHeaderWriter_AcceptEncodingCompress_UnitTest::ConstructL() |
|
7687 { |
|
7688 // Perform the base class initialization |
|
7689 UnitTestConstructL(); |
|
7690 |
|
7691 // Create the Unit test state accessor |
|
7692 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
7693 // Construct the Unit test context. |
|
7694 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
7695 iUTContext->ConstructL(WSP::EAcceptEncoding); |
|
7696 |
|
7697 // Part1 |
|
7698 _LIT8(KTxtAcceptEncoding, "Compress"); |
|
7699 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtAcceptEncoding); |
|
7700 CleanupClosePushL(stringVal); |
|
7701 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
7702 CleanupStack::PushL(part1); |
|
7703 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
7704 CleanupStack::Pop(part1); |
|
7705 CleanupStack::PopAndDestroy(&stringVal); |
|
7706 |
|
7707 TBuf8<256> expectedBuf; |
|
7708 expectedBuf.Append(0x81); |
|
7709 iUTContext->SetExpectedL(expectedBuf); |
|
7710 |
|
7711 // Add the Transitions in the order they are to run |
|
7712 // C'tor first, D'tor last... |
|
7713 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
7714 using constructor and destuctor validators */ |
|
7715 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
7716 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
7717 iAcceptEncodingCompressValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
7718 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptEncodingCompressValidator)); |
|
7719 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
7720 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
7721 } |
|
7722 |
|
7723 // ______________________________________________________________________________ |
|
7724 // |
|
7725 _LIT(KWspHeaderWriterAcceptEncodingDeflateUnitTest,"CWspHeaderWriter_AcceptEncodingDeflate_UnitTest"); |
|
7726 |
|
7727 CWspHeaderWriter_AcceptEncodingDeflate_UnitTest* CWspHeaderWriter_AcceptEncodingDeflate_UnitTest::NewL(CDataLogger& aDataLogger, |
|
7728 MUnitTestObserver& aObserver) |
|
7729 { |
|
7730 CWspHeaderWriter_AcceptEncodingDeflate_UnitTest* self = |
|
7731 new(ELeave) CWspHeaderWriter_AcceptEncodingDeflate_UnitTest(aDataLogger, |
|
7732 aObserver); |
|
7733 CleanupStack::PushL(self); |
|
7734 self->ConstructL(); |
|
7735 CleanupStack::Pop(self); |
|
7736 return self; |
|
7737 } |
|
7738 |
|
7739 inline TInt CWspHeaderWriter_AcceptEncodingDeflate_UnitTest::RunError(TInt aError) |
|
7740 { |
|
7741 // The RunL left so chain to the base first and then cleanup |
|
7742 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
7743 delete iUTContext; |
|
7744 iUTContext = NULL; |
|
7745 delete iStateAccessor; |
|
7746 iStateAccessor = NULL; |
|
7747 /* delete any validators used */ |
|
7748 delete iCtorValidator; |
|
7749 iCtorValidator = NULL; |
|
7750 delete iAcceptEncodingDeflateValidator; |
|
7751 iAcceptEncodingDeflateValidator = NULL; |
|
7752 delete iDtorValidator; |
|
7753 iDtorValidator = NULL; |
|
7754 return error; |
|
7755 } |
|
7756 |
|
7757 inline CWspHeaderWriter_AcceptEncodingDeflate_UnitTest::~CWspHeaderWriter_AcceptEncodingDeflate_UnitTest() |
|
7758 { |
|
7759 // Simply delete our test class instance |
|
7760 delete iUTContext; |
|
7761 delete iStateAccessor; |
|
7762 /* delete any validators used */ |
|
7763 delete iCtorValidator; |
|
7764 delete iAcceptEncodingDeflateValidator; |
|
7765 delete iDtorValidator; |
|
7766 } |
|
7767 |
|
7768 inline CWspHeaderWriter_AcceptEncodingDeflate_UnitTest::CWspHeaderWriter_AcceptEncodingDeflate_UnitTest(CDataLogger& aDataLogger, |
|
7769 MUnitTestObserver& aObserver) |
|
7770 : CUnitTest(KWspHeaderWriterAcceptEncodingDeflateUnitTest, aDataLogger, aObserver) |
|
7771 { |
|
7772 //Do nothing |
|
7773 } |
|
7774 |
|
7775 // Now the Individual transitions need to be added. |
|
7776 inline void CWspHeaderWriter_AcceptEncodingDeflate_UnitTest::ConstructL() |
|
7777 { |
|
7778 // Perform the base class initialization |
|
7779 UnitTestConstructL(); |
|
7780 |
|
7781 // Create the Unit test state accessor |
|
7782 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
7783 // Construct the Unit test context. |
|
7784 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
7785 iUTContext->ConstructL(WSP::EAcceptEncoding); |
|
7786 |
|
7787 // Part1 |
|
7788 _LIT8(KTxtAcceptEncoding, "Deflate"); |
|
7789 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtAcceptEncoding); |
|
7790 CleanupClosePushL(stringVal); |
|
7791 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
7792 CleanupStack::PushL(part1); |
|
7793 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
7794 CleanupStack::Pop(part1); |
|
7795 CleanupStack::PopAndDestroy(&stringVal); |
|
7796 |
|
7797 TBuf8<256> expectedBuf; |
|
7798 expectedBuf.Append(0x82); // encoded token for deflate |
|
7799 iUTContext->SetExpectedL(expectedBuf); |
|
7800 |
|
7801 // Add the Transitions in the order they are to run |
|
7802 // C'tor first, D'tor last... |
|
7803 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
7804 using constructor and destuctor validators */ |
|
7805 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
7806 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
7807 iAcceptEncodingDeflateValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
7808 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptEncodingDeflateValidator)); |
|
7809 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
7810 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
7811 } |
|
7812 |
|
7813 // ______________________________________________________________________________ |
|
7814 // |
|
7815 _LIT(KWspHeaderWriterAcceptEncodingTokenTextUnitTest,"CWspHeaderWriter_AcceptEncodingTokenText_UnitTest"); |
|
7816 |
|
7817 CWspHeaderWriter_AcceptEncodingTokenText_UnitTest* CWspHeaderWriter_AcceptEncodingTokenText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
7818 MUnitTestObserver& aObserver) |
|
7819 { |
|
7820 CWspHeaderWriter_AcceptEncodingTokenText_UnitTest* self = |
|
7821 new(ELeave) CWspHeaderWriter_AcceptEncodingTokenText_UnitTest(aDataLogger, |
|
7822 aObserver); |
|
7823 CleanupStack::PushL(self); |
|
7824 self->ConstructL(); |
|
7825 CleanupStack::Pop(self); |
|
7826 return self; |
|
7827 } |
|
7828 |
|
7829 inline TInt CWspHeaderWriter_AcceptEncodingTokenText_UnitTest::RunError(TInt aError) |
|
7830 { |
|
7831 // The RunL left so chain to the base first and then cleanup |
|
7832 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
7833 delete iUTContext; |
|
7834 iUTContext = NULL; |
|
7835 delete iStateAccessor; |
|
7836 iStateAccessor = NULL; |
|
7837 /* delete any validators used */ |
|
7838 delete iCtorValidator; |
|
7839 iCtorValidator = NULL; |
|
7840 delete iAcceptEncodingTokenTextValidator; |
|
7841 iAcceptEncodingTokenTextValidator = NULL; |
|
7842 delete iDtorValidator; |
|
7843 iDtorValidator = NULL; |
|
7844 return error; |
|
7845 } |
|
7846 |
|
7847 inline CWspHeaderWriter_AcceptEncodingTokenText_UnitTest::~CWspHeaderWriter_AcceptEncodingTokenText_UnitTest() |
|
7848 { |
|
7849 // Simply delete our test class instance |
|
7850 delete iUTContext; |
|
7851 delete iStateAccessor; |
|
7852 /* delete any validators used */ |
|
7853 delete iCtorValidator; |
|
7854 delete iAcceptEncodingTokenTextValidator; |
|
7855 delete iDtorValidator; |
|
7856 } |
|
7857 |
|
7858 inline CWspHeaderWriter_AcceptEncodingTokenText_UnitTest::CWspHeaderWriter_AcceptEncodingTokenText_UnitTest(CDataLogger& aDataLogger, |
|
7859 MUnitTestObserver& aObserver) |
|
7860 : CUnitTest(KWspHeaderWriterAcceptEncodingTokenTextUnitTest, aDataLogger, aObserver) |
|
7861 { |
|
7862 //Do nothing |
|
7863 } |
|
7864 |
|
7865 // Now the Individual transitions need to be added. |
|
7866 inline void CWspHeaderWriter_AcceptEncodingTokenText_UnitTest::ConstructL() |
|
7867 { |
|
7868 // Perform the base class initialization |
|
7869 UnitTestConstructL(); |
|
7870 |
|
7871 // Create the Unit test state accessor |
|
7872 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
7873 // Construct the Unit test context. |
|
7874 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
7875 iUTContext->ConstructL(WSP::EAcceptEncoding); |
|
7876 |
|
7877 // Part1 |
|
7878 _LIT8(KTxtAcceptEncoding, "my-accept-encoding-type"); |
|
7879 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtAcceptEncoding); |
|
7880 CleanupClosePushL(stringVal); |
|
7881 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
7882 CleanupStack::PushL(part1); |
|
7883 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
7884 CleanupStack::Pop(part1); |
|
7885 CleanupStack::PopAndDestroy(&stringVal); |
|
7886 |
|
7887 TBuf8<256> expectedBuf; |
|
7888 expectedBuf.Append(KTxtAcceptEncoding); |
|
7889 expectedBuf.Append(0x00); |
|
7890 iUTContext->SetExpectedL(expectedBuf); |
|
7891 |
|
7892 // Add the Transitions in the order they are to run |
|
7893 // C'tor first, D'tor last... |
|
7894 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
7895 using constructor and destuctor validators */ |
|
7896 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
7897 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
7898 iAcceptEncodingTokenTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
7899 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptEncodingTokenTextValidator)); |
|
7900 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
7901 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
7902 } |
|
7903 |
|
7904 // ______________________________________________________________________________ |
|
7905 // |
|
7906 _LIT(KWspHeaderWriterAcceptEncodingGeneralAnyUnitTest,"CWspHeaderWriter_AcceptEncodingGeneralAny_UnitTest"); |
|
7907 |
|
7908 CWspHeaderWriter_AcceptEncodingGeneralAny_UnitTest* CWspHeaderWriter_AcceptEncodingGeneralAny_UnitTest::NewL(CDataLogger& aDataLogger, |
|
7909 MUnitTestObserver& aObserver) |
|
7910 { |
|
7911 CWspHeaderWriter_AcceptEncodingGeneralAny_UnitTest* self = |
|
7912 new(ELeave) CWspHeaderWriter_AcceptEncodingGeneralAny_UnitTest(aDataLogger, |
|
7913 aObserver); |
|
7914 CleanupStack::PushL(self); |
|
7915 self->ConstructL(); |
|
7916 CleanupStack::Pop(self); |
|
7917 return self; |
|
7918 } |
|
7919 |
|
7920 inline TInt CWspHeaderWriter_AcceptEncodingGeneralAny_UnitTest::RunError(TInt aError) |
|
7921 { |
|
7922 // The RunL left so chain to the base first and then cleanup |
|
7923 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
7924 delete iUTContext; |
|
7925 iUTContext = NULL; |
|
7926 delete iStateAccessor; |
|
7927 iStateAccessor = NULL; |
|
7928 /* delete any validators used */ |
|
7929 delete iCtorValidator; |
|
7930 iCtorValidator = NULL; |
|
7931 delete iAcceptEncodingGeneralAnyValidator; |
|
7932 iAcceptEncodingGeneralAnyValidator = NULL; |
|
7933 delete iDtorValidator; |
|
7934 iDtorValidator = NULL; |
|
7935 return error; |
|
7936 } |
|
7937 |
|
7938 inline CWspHeaderWriter_AcceptEncodingGeneralAny_UnitTest::~CWspHeaderWriter_AcceptEncodingGeneralAny_UnitTest() |
|
7939 { |
|
7940 // Simply delete our test class instance |
|
7941 delete iUTContext; |
|
7942 delete iStateAccessor; |
|
7943 /* delete any validators used */ |
|
7944 delete iCtorValidator; |
|
7945 delete iAcceptEncodingGeneralAnyValidator; |
|
7946 delete iDtorValidator; |
|
7947 } |
|
7948 |
|
7949 inline CWspHeaderWriter_AcceptEncodingGeneralAny_UnitTest::CWspHeaderWriter_AcceptEncodingGeneralAny_UnitTest(CDataLogger& aDataLogger, |
|
7950 MUnitTestObserver& aObserver) |
|
7951 : CUnitTest(KWspHeaderWriterAcceptEncodingGeneralAnyUnitTest, aDataLogger, aObserver) |
|
7952 { |
|
7953 //Do nothing |
|
7954 } |
|
7955 |
|
7956 // Now the Individual transitions need to be added. |
|
7957 inline void CWspHeaderWriter_AcceptEncodingGeneralAny_UnitTest::ConstructL() |
|
7958 { |
|
7959 // Perform the base class initialization |
|
7960 UnitTestConstructL(); |
|
7961 |
|
7962 // Create the Unit test state accessor |
|
7963 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
7964 // Construct the Unit test context. |
|
7965 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
7966 iUTContext->ConstructL(WSP::EAcceptEncoding); |
|
7967 |
|
7968 // Part1 |
|
7969 _LIT8(KTxtAcceptEncoding, "*"); |
|
7970 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtAcceptEncoding); |
|
7971 CleanupClosePushL(stringVal); |
|
7972 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
7973 CleanupStack::PushL(part1); |
|
7974 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
7975 CleanupStack::Pop(part1); |
|
7976 CleanupStack::PopAndDestroy(&stringVal); |
|
7977 |
|
7978 TBuf8<256> expectedBuf; |
|
7979 expectedBuf.Append(0x01); |
|
7980 expectedBuf.Append(0x83); |
|
7981 iUTContext->SetExpectedL(expectedBuf); |
|
7982 |
|
7983 // Add the Transitions in the order they are to run |
|
7984 // C'tor first, D'tor last... |
|
7985 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
7986 using constructor and destuctor validators */ |
|
7987 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
7988 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
7989 iAcceptEncodingGeneralAnyValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
7990 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptEncodingGeneralAnyValidator)); |
|
7991 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
7992 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
7993 } |
|
7994 |
|
7995 // ______________________________________________________________________________ |
|
7996 // |
|
7997 _LIT(KWspHeaderWriterAcceptEncodingGeneralAnyQValUnitTest,"CWspHeaderWriter_AcceptEncodingGeneralAnyQVal_UnitTest"); |
|
7998 |
|
7999 CWspHeaderWriter_AcceptEncodingGeneralAnyQVal_UnitTest* CWspHeaderWriter_AcceptEncodingGeneralAnyQVal_UnitTest::NewL(CDataLogger& aDataLogger, |
|
8000 MUnitTestObserver& aObserver) |
|
8001 { |
|
8002 CWspHeaderWriter_AcceptEncodingGeneralAnyQVal_UnitTest* self = |
|
8003 new(ELeave) CWspHeaderWriter_AcceptEncodingGeneralAnyQVal_UnitTest(aDataLogger, |
|
8004 aObserver); |
|
8005 CleanupStack::PushL(self); |
|
8006 self->ConstructL(); |
|
8007 CleanupStack::Pop(self); |
|
8008 return self; |
|
8009 } |
|
8010 |
|
8011 inline TInt CWspHeaderWriter_AcceptEncodingGeneralAnyQVal_UnitTest::RunError(TInt aError) |
|
8012 { |
|
8013 // The RunL left so chain to the base first and then cleanup |
|
8014 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
8015 delete iUTContext; |
|
8016 iUTContext = NULL; |
|
8017 delete iStateAccessor; |
|
8018 iStateAccessor = NULL; |
|
8019 /* delete any validators used */ |
|
8020 delete iCtorValidator; |
|
8021 iCtorValidator = NULL; |
|
8022 delete iAcceptEncodingGeneralAnyQValValidator; |
|
8023 iAcceptEncodingGeneralAnyQValValidator = NULL; |
|
8024 delete iDtorValidator; |
|
8025 iDtorValidator = NULL; |
|
8026 return error; |
|
8027 } |
|
8028 |
|
8029 inline CWspHeaderWriter_AcceptEncodingGeneralAnyQVal_UnitTest::~CWspHeaderWriter_AcceptEncodingGeneralAnyQVal_UnitTest() |
|
8030 { |
|
8031 // Simply delete our test class instance |
|
8032 delete iUTContext; |
|
8033 delete iStateAccessor; |
|
8034 /* delete any validators used */ |
|
8035 delete iCtorValidator; |
|
8036 delete iAcceptEncodingGeneralAnyQValValidator; |
|
8037 delete iDtorValidator; |
|
8038 } |
|
8039 |
|
8040 inline CWspHeaderWriter_AcceptEncodingGeneralAnyQVal_UnitTest::CWspHeaderWriter_AcceptEncodingGeneralAnyQVal_UnitTest(CDataLogger& aDataLogger, |
|
8041 MUnitTestObserver& aObserver) |
|
8042 : CUnitTest(KWspHeaderWriterAcceptEncodingGeneralAnyQValUnitTest, aDataLogger, aObserver) |
|
8043 { |
|
8044 //Do nothing |
|
8045 } |
|
8046 |
|
8047 // Now the Individual transitions need to be added. |
|
8048 inline void CWspHeaderWriter_AcceptEncodingGeneralAnyQVal_UnitTest::ConstructL() |
|
8049 { |
|
8050 // Perform the base class initialization |
|
8051 UnitTestConstructL(); |
|
8052 |
|
8053 // Create the Unit test state accessor |
|
8054 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
8055 // Construct the Unit test context. |
|
8056 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
8057 iUTContext->ConstructL(WSP::EAcceptEncoding); |
|
8058 |
|
8059 // Part1 |
|
8060 _LIT8(KTxtAcceptEncoding, "*"); |
|
8061 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtAcceptEncoding); |
|
8062 CleanupClosePushL(stringVal); |
|
8063 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
8064 CleanupStack::PushL(part1); |
|
8065 |
|
8066 // Param1 |
|
8067 _LIT8(KTxtQName, "Q"); |
|
8068 _LIT8(KTxtQVal, "0.333"); |
|
8069 RStringF stringVal1 = iUTContext->iStrPool.OpenFStringL(KTxtQName); |
|
8070 CleanupClosePushL(stringVal1); |
|
8071 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtQVal); |
|
8072 CleanupClosePushL(stringVal2); |
|
8073 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(stringVal1, stringVal2); |
|
8074 CleanupStack::PushL(param1); |
|
8075 part1->AddParamL(param1); |
|
8076 CleanupStack::Pop(param1); |
|
8077 |
|
8078 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
8079 CleanupStack::PopAndDestroy(2, &stringVal1); |
|
8080 CleanupStack::Pop(part1); |
|
8081 CleanupStack::PopAndDestroy(&stringVal); |
|
8082 |
|
8083 TBuf8<256> expectedBuf; |
|
8084 expectedBuf.Append(0x03); // value-length |
|
8085 expectedBuf.Append(0x83); // token for any '*' |
|
8086 expectedBuf.Append(0x83); // token for for q-value 0.333... |
|
8087 expectedBuf.Append(0x31); // ... |
|
8088 iUTContext->SetExpectedL(expectedBuf); |
|
8089 |
|
8090 // Add the Transitions in the order they are to run |
|
8091 // C'tor first, D'tor last... |
|
8092 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
8093 using constructor and destuctor validators */ |
|
8094 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
8095 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
8096 iAcceptEncodingGeneralAnyQValValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
8097 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptEncodingGeneralAnyQValValidator)); |
|
8098 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
8099 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
8100 } |
|
8101 |
|
8102 // ______________________________________________________________________________ |
|
8103 // |
|
8104 _LIT(KWspHeaderWriterAcceptEncodingGeneralGzipQValUnitTest,"CWspHeaderWriter_AcceptEncodingGeneralGzipQVal_UnitTest"); |
|
8105 |
|
8106 CWspHeaderWriter_AcceptEncodingGeneralGzipQVal_UnitTest* CWspHeaderWriter_AcceptEncodingGeneralGzipQVal_UnitTest::NewL(CDataLogger& aDataLogger, |
|
8107 MUnitTestObserver& aObserver) |
|
8108 { |
|
8109 CWspHeaderWriter_AcceptEncodingGeneralGzipQVal_UnitTest* self = |
|
8110 new(ELeave) CWspHeaderWriter_AcceptEncodingGeneralGzipQVal_UnitTest(aDataLogger, |
|
8111 aObserver); |
|
8112 CleanupStack::PushL(self); |
|
8113 self->ConstructL(); |
|
8114 CleanupStack::Pop(self); |
|
8115 return self; |
|
8116 } |
|
8117 |
|
8118 inline TInt CWspHeaderWriter_AcceptEncodingGeneralGzipQVal_UnitTest::RunError(TInt aError) |
|
8119 { |
|
8120 // The RunL left so chain to the base first and then cleanup |
|
8121 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
8122 delete iUTContext; |
|
8123 iUTContext = NULL; |
|
8124 delete iStateAccessor; |
|
8125 iStateAccessor = NULL; |
|
8126 /* delete any validators used */ |
|
8127 delete iCtorValidator; |
|
8128 iCtorValidator = NULL; |
|
8129 delete iAcceptEncodingGeneralGzipQValValidator; |
|
8130 iAcceptEncodingGeneralGzipQValValidator = NULL; |
|
8131 delete iDtorValidator; |
|
8132 iDtorValidator = NULL; |
|
8133 return error; |
|
8134 } |
|
8135 |
|
8136 inline CWspHeaderWriter_AcceptEncodingGeneralGzipQVal_UnitTest::~CWspHeaderWriter_AcceptEncodingGeneralGzipQVal_UnitTest() |
|
8137 { |
|
8138 // Simply delete our test class instance |
|
8139 delete iUTContext; |
|
8140 delete iStateAccessor; |
|
8141 /* delete any validators used */ |
|
8142 delete iCtorValidator; |
|
8143 delete iAcceptEncodingGeneralGzipQValValidator; |
|
8144 delete iDtorValidator; |
|
8145 } |
|
8146 |
|
8147 inline CWspHeaderWriter_AcceptEncodingGeneralGzipQVal_UnitTest::CWspHeaderWriter_AcceptEncodingGeneralGzipQVal_UnitTest(CDataLogger& aDataLogger, |
|
8148 MUnitTestObserver& aObserver) |
|
8149 : CUnitTest(KWspHeaderWriterAcceptEncodingGeneralGzipQValUnitTest, aDataLogger, aObserver) |
|
8150 { |
|
8151 //Do nothing |
|
8152 } |
|
8153 |
|
8154 // Now the Individual transitions need to be added. |
|
8155 inline void CWspHeaderWriter_AcceptEncodingGeneralGzipQVal_UnitTest::ConstructL() |
|
8156 { |
|
8157 // Perform the base class initialization |
|
8158 UnitTestConstructL(); |
|
8159 |
|
8160 // Create the Unit test state accessor |
|
8161 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
8162 // Construct the Unit test context. |
|
8163 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
8164 iUTContext->ConstructL(WSP::EAcceptEncoding); |
|
8165 |
|
8166 // Part1 |
|
8167 _LIT8(KTxtAcceptEncoding, "Gzip"); |
|
8168 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtAcceptEncoding); |
|
8169 CleanupClosePushL(stringVal); |
|
8170 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
8171 CleanupStack::PushL(part1); |
|
8172 |
|
8173 // Param1 |
|
8174 _LIT8(KTxtQName, "Q"); |
|
8175 _LIT8(KTxtQVal, "0.333"); |
|
8176 RStringF stringVal1 = iUTContext->iStrPool.OpenFStringL(KTxtQName); |
|
8177 CleanupClosePushL(stringVal1); |
|
8178 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtQVal); |
|
8179 CleanupClosePushL(stringVal2); |
|
8180 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(stringVal1, stringVal2); |
|
8181 CleanupStack::PushL(param1); |
|
8182 part1->AddParamL(param1); |
|
8183 CleanupStack::Pop(param1); |
|
8184 |
|
8185 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
8186 CleanupStack::PopAndDestroy(2, &stringVal1); |
|
8187 CleanupStack::Pop(part1); |
|
8188 CleanupStack::PopAndDestroy(&stringVal); |
|
8189 |
|
8190 TBuf8<256> expectedBuf; |
|
8191 expectedBuf.Append(0x03); // value-length |
|
8192 expectedBuf.Append(0x80); // token for 'Gzip' |
|
8193 expectedBuf.Append(0x83); // token for for q-value 0.333... |
|
8194 expectedBuf.Append(0x31); // ... |
|
8195 iUTContext->SetExpectedL(expectedBuf); |
|
8196 |
|
8197 // Add the Transitions in the order they are to run |
|
8198 // C'tor first, D'tor last... |
|
8199 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
8200 using constructor and destuctor validators */ |
|
8201 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
8202 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
8203 iAcceptEncodingGeneralGzipQValValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
8204 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptEncodingGeneralGzipQValValidator)); |
|
8205 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
8206 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
8207 } |
|
8208 |
|
8209 // ______________________________________________________________________________ |
|
8210 // |
|
8211 _LIT(KWspHeaderWriterAcceptEncodingGeneralAnyQValVersion1_2UnitTest,"CWspHeaderWriter_AcceptEncodingGeneralAnyQValVersion1_2_UnitTest"); |
|
8212 |
|
8213 CWspHeaderWriter_AcceptEncodingGeneralAnyQValVersion1_2_UnitTest* CWspHeaderWriter_AcceptEncodingGeneralAnyQValVersion1_2_UnitTest::NewL(CDataLogger& aDataLogger, |
|
8214 MUnitTestObserver& aObserver) |
|
8215 { |
|
8216 CWspHeaderWriter_AcceptEncodingGeneralAnyQValVersion1_2_UnitTest* self = |
|
8217 new(ELeave) CWspHeaderWriter_AcceptEncodingGeneralAnyQValVersion1_2_UnitTest(aDataLogger, |
|
8218 aObserver); |
|
8219 CleanupStack::PushL(self); |
|
8220 self->ConstructL(); |
|
8221 CleanupStack::Pop(self); |
|
8222 return self; |
|
8223 } |
|
8224 |
|
8225 inline TInt CWspHeaderWriter_AcceptEncodingGeneralAnyQValVersion1_2_UnitTest::RunError(TInt aError) |
|
8226 { |
|
8227 // The RunL left so chain to the base first and then cleanup |
|
8228 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
8229 delete iUTContext; |
|
8230 iUTContext = NULL; |
|
8231 delete iStateAccessor; |
|
8232 iStateAccessor = NULL; |
|
8233 /* delete any validators used */ |
|
8234 delete iCtorValidator; |
|
8235 iCtorValidator = NULL; |
|
8236 delete iAcceptEncodingGeneralAnyQValVersion1_2Validator; |
|
8237 iAcceptEncodingGeneralAnyQValVersion1_2Validator = NULL; |
|
8238 delete iDtorValidator; |
|
8239 iDtorValidator = NULL; |
|
8240 return error; |
|
8241 } |
|
8242 |
|
8243 inline CWspHeaderWriter_AcceptEncodingGeneralAnyQValVersion1_2_UnitTest::~CWspHeaderWriter_AcceptEncodingGeneralAnyQValVersion1_2_UnitTest() |
|
8244 { |
|
8245 // Simply delete our test class instance |
|
8246 delete iUTContext; |
|
8247 delete iStateAccessor; |
|
8248 /* delete any validators used */ |
|
8249 delete iCtorValidator; |
|
8250 delete iAcceptEncodingGeneralAnyQValVersion1_2Validator; |
|
8251 delete iDtorValidator; |
|
8252 } |
|
8253 |
|
8254 inline CWspHeaderWriter_AcceptEncodingGeneralAnyQValVersion1_2_UnitTest::CWspHeaderWriter_AcceptEncodingGeneralAnyQValVersion1_2_UnitTest(CDataLogger& aDataLogger, |
|
8255 MUnitTestObserver& aObserver) |
|
8256 : CUnitTest(KWspHeaderWriterAcceptEncodingGeneralAnyQValVersion1_2UnitTest, aDataLogger, aObserver) |
|
8257 { |
|
8258 //Do nothing |
|
8259 } |
|
8260 |
|
8261 // Now the Individual transitions need to be added. |
|
8262 inline void CWspHeaderWriter_AcceptEncodingGeneralAnyQValVersion1_2_UnitTest::ConstructL() |
|
8263 { |
|
8264 // Perform the base class initialization |
|
8265 UnitTestConstructL(); |
|
8266 |
|
8267 // Create the Unit test state accessor |
|
8268 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
8269 // Construct the Unit test context. |
|
8270 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
8271 iUTContext->ConstructL(WSP::EAcceptEncoding); |
|
8272 REINTERPRET_CAST(CWspHeaderCodec*, iUTContext->iCodec)->SetWspVersion(CWspHeaderCodec::EVersion1_2); |
|
8273 |
|
8274 // Part1 |
|
8275 _LIT8(KTxtAcceptEncoding, "*"); |
|
8276 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtAcceptEncoding); |
|
8277 CleanupClosePushL(stringVal); |
|
8278 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
8279 CleanupStack::PushL(part1); |
|
8280 |
|
8281 // Param1 |
|
8282 _LIT8(KTxtQName, "Q"); |
|
8283 _LIT8(KTxtQVal, "0.333"); |
|
8284 RStringF stringVal1 = iUTContext->iStrPool.OpenFStringL(KTxtQName); |
|
8285 CleanupClosePushL(stringVal1); |
|
8286 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtQVal); |
|
8287 CleanupClosePushL(stringVal2); |
|
8288 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(stringVal1, stringVal2); |
|
8289 CleanupStack::PushL(param1); |
|
8290 part1->AddParamL(param1); |
|
8291 CleanupStack::Pop(param1); |
|
8292 |
|
8293 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
8294 CleanupStack::PopAndDestroy(2, &stringVal1); |
|
8295 CleanupStack::Pop(part1); |
|
8296 CleanupStack::PopAndDestroy(&stringVal); |
|
8297 |
|
8298 TBuf8<256> expectedBuf; |
|
8299 expectedBuf.Append(0x04); // value-length |
|
8300 expectedBuf.Append(KTxtAcceptEncoding); |
|
8301 expectedBuf.Append(0x00); |
|
8302 expectedBuf.Append(0x83); // token for for q-value 0.333... |
|
8303 expectedBuf.Append(0x31); // ... |
|
8304 iUTContext->SetExpectedL(expectedBuf); |
|
8305 |
|
8306 // Add the Transitions in the order they are to run |
|
8307 // C'tor first, D'tor last... |
|
8308 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
8309 using constructor and destuctor validators */ |
|
8310 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
8311 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
8312 iAcceptEncodingGeneralAnyQValVersion1_2Validator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
8313 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptEncodingGeneralAnyQValVersion1_2Validator)); |
|
8314 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
8315 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
8316 } |
|
8317 |
|
8318 // ______________________________________________________________________________ |
|
8319 // |
|
8320 _LIT(KWspHeaderWriterContentRangeUnitTest,"CWspHeaderWriter_ContentRange_UnitTest"); |
|
8321 |
|
8322 CWspHeaderWriter_ContentRange_UnitTest* CWspHeaderWriter_ContentRange_UnitTest::NewL(CDataLogger& aDataLogger, |
|
8323 MUnitTestObserver& aObserver) |
|
8324 { |
|
8325 CWspHeaderWriter_ContentRange_UnitTest* self = |
|
8326 new(ELeave) CWspHeaderWriter_ContentRange_UnitTest(aDataLogger, |
|
8327 aObserver); |
|
8328 CleanupStack::PushL(self); |
|
8329 self->ConstructL(); |
|
8330 CleanupStack::Pop(self); |
|
8331 return self; |
|
8332 } |
|
8333 |
|
8334 inline TInt CWspHeaderWriter_ContentRange_UnitTest::RunError(TInt aError) |
|
8335 { |
|
8336 // The RunL left so chain to the base first and then cleanup |
|
8337 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
8338 delete iUTContext; |
|
8339 iUTContext = NULL; |
|
8340 delete iStateAccessor; |
|
8341 iStateAccessor = NULL; |
|
8342 /* delete any validators used */ |
|
8343 delete iCtorValidator; |
|
8344 iCtorValidator = NULL; |
|
8345 delete iContentRangeValidator; |
|
8346 iContentRangeValidator = NULL; |
|
8347 delete iDtorValidator; |
|
8348 iDtorValidator = NULL; |
|
8349 return error; |
|
8350 } |
|
8351 |
|
8352 inline CWspHeaderWriter_ContentRange_UnitTest::~CWspHeaderWriter_ContentRange_UnitTest() |
|
8353 { |
|
8354 // Simply delete our test class instance |
|
8355 delete iUTContext; |
|
8356 delete iStateAccessor; |
|
8357 /* delete any validators used */ |
|
8358 delete iCtorValidator; |
|
8359 delete iContentRangeValidator; |
|
8360 delete iDtorValidator; |
|
8361 } |
|
8362 |
|
8363 inline CWspHeaderWriter_ContentRange_UnitTest::CWspHeaderWriter_ContentRange_UnitTest(CDataLogger& aDataLogger, |
|
8364 MUnitTestObserver& aObserver) |
|
8365 : CUnitTest(KWspHeaderWriterContentRangeUnitTest, aDataLogger, aObserver) |
|
8366 { |
|
8367 //Do nothing |
|
8368 } |
|
8369 |
|
8370 // Now the Individual transitions need to be added. |
|
8371 inline void CWspHeaderWriter_ContentRange_UnitTest::ConstructL() |
|
8372 { |
|
8373 // Perform the base class initialization |
|
8374 UnitTestConstructL(); |
|
8375 |
|
8376 // Create the Unit test state accessor |
|
8377 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
8378 // Construct the Unit test context. |
|
8379 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
8380 iUTContext->ConstructL(WSP::EContentRange); |
|
8381 |
|
8382 // Part1 |
|
8383 TInt firstBytePos = 65; |
|
8384 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(firstBytePos); |
|
8385 CleanupStack::PushL(part1); |
|
8386 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
8387 CleanupStack::Pop(part1); |
|
8388 |
|
8389 // Part2 |
|
8390 TInt entityLength = 512; |
|
8391 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(entityLength); |
|
8392 CleanupStack::PushL(part2); |
|
8393 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
8394 CleanupStack::Pop(part2); |
|
8395 |
|
8396 TBuf8<256> expectedBuf; |
|
8397 expectedBuf.Append(0x03); // value-length |
|
8398 expectedBuf.Append(0x41); |
|
8399 expectedBuf.Append(0x84); |
|
8400 expectedBuf.Append(0x00); |
|
8401 iUTContext->SetExpectedL(expectedBuf); |
|
8402 |
|
8403 // Add the Transitions in the order they are to run |
|
8404 // C'tor first, D'tor last... |
|
8405 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
8406 using constructor and destuctor validators */ |
|
8407 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
8408 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
8409 iContentRangeValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
8410 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentRangeValidator)); |
|
8411 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
8412 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
8413 } |
|
8414 |
|
8415 // ______________________________________________________________________________ |
|
8416 // |
|
8417 _LIT(KWspHeaderWriterContentRangeUnknownLengthUnitTest,"CWspHeaderWriter_ContentRangeUnknownLength_UnitTest"); |
|
8418 |
|
8419 CWspHeaderWriter_ContentRangeUnknownLength_UnitTest* CWspHeaderWriter_ContentRangeUnknownLength_UnitTest::NewL(CDataLogger& aDataLogger, |
|
8420 MUnitTestObserver& aObserver) |
|
8421 { |
|
8422 CWspHeaderWriter_ContentRangeUnknownLength_UnitTest* self = |
|
8423 new(ELeave) CWspHeaderWriter_ContentRangeUnknownLength_UnitTest(aDataLogger, |
|
8424 aObserver); |
|
8425 CleanupStack::PushL(self); |
|
8426 self->ConstructL(); |
|
8427 CleanupStack::Pop(self); |
|
8428 return self; |
|
8429 } |
|
8430 |
|
8431 inline TInt CWspHeaderWriter_ContentRangeUnknownLength_UnitTest::RunError(TInt aError) |
|
8432 { |
|
8433 // The RunL left so chain to the base first and then cleanup |
|
8434 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
8435 delete iUTContext; |
|
8436 iUTContext = NULL; |
|
8437 delete iStateAccessor; |
|
8438 iStateAccessor = NULL; |
|
8439 /* delete any validators used */ |
|
8440 delete iCtorValidator; |
|
8441 iCtorValidator = NULL; |
|
8442 delete iContentRangeUnknownLengthValidator; |
|
8443 iContentRangeUnknownLengthValidator = NULL; |
|
8444 delete iDtorValidator; |
|
8445 iDtorValidator = NULL; |
|
8446 return error; |
|
8447 } |
|
8448 |
|
8449 inline CWspHeaderWriter_ContentRangeUnknownLength_UnitTest::~CWspHeaderWriter_ContentRangeUnknownLength_UnitTest() |
|
8450 { |
|
8451 // Simply delete our test class instance |
|
8452 delete iUTContext; |
|
8453 delete iStateAccessor; |
|
8454 /* delete any validators used */ |
|
8455 delete iCtorValidator; |
|
8456 delete iContentRangeUnknownLengthValidator; |
|
8457 delete iDtorValidator; |
|
8458 } |
|
8459 |
|
8460 inline CWspHeaderWriter_ContentRangeUnknownLength_UnitTest::CWspHeaderWriter_ContentRangeUnknownLength_UnitTest(CDataLogger& aDataLogger, |
|
8461 MUnitTestObserver& aObserver) |
|
8462 : CUnitTest(KWspHeaderWriterContentRangeUnknownLengthUnitTest, aDataLogger, aObserver) |
|
8463 { |
|
8464 //Do nothing |
|
8465 } |
|
8466 |
|
8467 // Now the Individual transitions need to be added. |
|
8468 inline void CWspHeaderWriter_ContentRangeUnknownLength_UnitTest::ConstructL() |
|
8469 { |
|
8470 // Perform the base class initialization |
|
8471 UnitTestConstructL(); |
|
8472 |
|
8473 // Create the Unit test state accessor |
|
8474 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
8475 // Construct the Unit test context. |
|
8476 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
8477 iUTContext->ConstructL(WSP::EContentRange); |
|
8478 |
|
8479 // Part1 |
|
8480 TInt firstBytePos = 65; |
|
8481 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(firstBytePos); |
|
8482 CleanupStack::PushL(part1); |
|
8483 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
8484 CleanupStack::Pop(part1); |
|
8485 |
|
8486 // Part2 |
|
8487 _LIT8(KTxtUnknownLen, "*"); |
|
8488 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtUnknownLen); |
|
8489 CleanupClosePushL(stringVal); |
|
8490 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringVal); |
|
8491 CleanupStack::PushL(part2); |
|
8492 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
8493 CleanupStack::Pop(part2); |
|
8494 CleanupStack::PopAndDestroy(&stringVal); |
|
8495 |
|
8496 TBuf8<256> expectedBuf; |
|
8497 expectedBuf.Append(0x02); // value-length |
|
8498 expectedBuf.Append(0x41); |
|
8499 expectedBuf.Append(0x80); // encoded token for '*' |
|
8500 iUTContext->SetExpectedL(expectedBuf); |
|
8501 |
|
8502 // Add the Transitions in the order they are to run |
|
8503 // C'tor first, D'tor last... |
|
8504 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
8505 using constructor and destuctor validators */ |
|
8506 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
8507 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
8508 iContentRangeUnknownLengthValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
8509 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentRangeUnknownLengthValidator)); |
|
8510 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
8511 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
8512 } |
|
8513 |
|
8514 // ______________________________________________________________________________ |
|
8515 // |
|
8516 _LIT(KWspHeaderWriterAllowGetUnitTest,"CWspHeaderWriter_AllowGet_UnitTest"); |
|
8517 |
|
8518 CWspHeaderWriter_AllowGet_UnitTest* CWspHeaderWriter_AllowGet_UnitTest::NewL(CDataLogger& aDataLogger, |
|
8519 MUnitTestObserver& aObserver) |
|
8520 { |
|
8521 CWspHeaderWriter_AllowGet_UnitTest* self = |
|
8522 new(ELeave) CWspHeaderWriter_AllowGet_UnitTest(aDataLogger, |
|
8523 aObserver); |
|
8524 CleanupStack::PushL(self); |
|
8525 self->ConstructL(); |
|
8526 CleanupStack::Pop(self); |
|
8527 return self; |
|
8528 } |
|
8529 |
|
8530 inline TInt CWspHeaderWriter_AllowGet_UnitTest::RunError(TInt aError) |
|
8531 { |
|
8532 // The RunL left so chain to the base first and then cleanup |
|
8533 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
8534 delete iUTContext; |
|
8535 iUTContext = NULL; |
|
8536 delete iStateAccessor; |
|
8537 iStateAccessor = NULL; |
|
8538 /* delete any validators used */ |
|
8539 delete iCtorValidator; |
|
8540 iCtorValidator = NULL; |
|
8541 delete iAllowGetValidator; |
|
8542 iAllowGetValidator = NULL; |
|
8543 delete iDtorValidator; |
|
8544 iDtorValidator = NULL; |
|
8545 return error; |
|
8546 } |
|
8547 |
|
8548 inline CWspHeaderWriter_AllowGet_UnitTest::~CWspHeaderWriter_AllowGet_UnitTest() |
|
8549 { |
|
8550 // Simply delete our test class instance |
|
8551 delete iUTContext; |
|
8552 delete iStateAccessor; |
|
8553 /* delete any validators used */ |
|
8554 delete iCtorValidator; |
|
8555 delete iAllowGetValidator; |
|
8556 delete iDtorValidator; |
|
8557 } |
|
8558 |
|
8559 inline CWspHeaderWriter_AllowGet_UnitTest::CWspHeaderWriter_AllowGet_UnitTest(CDataLogger& aDataLogger, |
|
8560 MUnitTestObserver& aObserver) |
|
8561 : CUnitTest(KWspHeaderWriterAllowGetUnitTest, aDataLogger, aObserver) |
|
8562 { |
|
8563 //Do nothing |
|
8564 } |
|
8565 |
|
8566 // Now the Individual transitions need to be added. |
|
8567 inline void CWspHeaderWriter_AllowGet_UnitTest::ConstructL() |
|
8568 { |
|
8569 // Perform the base class initialization |
|
8570 UnitTestConstructL(); |
|
8571 |
|
8572 // Create the Unit test state accessor |
|
8573 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
8574 // Construct the Unit test context. |
|
8575 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
8576 iUTContext->ConstructL(WSP::EAllow); |
|
8577 |
|
8578 // Part1 |
|
8579 _LIT8(KTxtUnknownLen, "Get"); |
|
8580 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtUnknownLen); |
|
8581 CleanupClosePushL(stringVal); |
|
8582 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
8583 CleanupStack::PushL(part1); |
|
8584 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
8585 CleanupStack::Pop(part1); |
|
8586 CleanupStack::PopAndDestroy(&stringVal); |
|
8587 |
|
8588 TBuf8<256> expectedBuf; |
|
8589 expectedBuf.Append(0xC0); |
|
8590 iUTContext->SetExpectedL(expectedBuf); |
|
8591 |
|
8592 // Add the Transitions in the order they are to run |
|
8593 // C'tor first, D'tor last... |
|
8594 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
8595 using constructor and destuctor validators */ |
|
8596 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
8597 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
8598 iAllowGetValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
8599 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAllowGetValidator)); |
|
8600 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
8601 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
8602 } |
|
8603 |
|
8604 // ______________________________________________________________________________ |
|
8605 // |
|
8606 _LIT(KWspHeaderWriterAllowPostUnitTest,"CWspHeaderWriter_AllowPost_UnitTest"); |
|
8607 |
|
8608 CWspHeaderWriter_AllowPost_UnitTest* CWspHeaderWriter_AllowPost_UnitTest::NewL(CDataLogger& aDataLogger, |
|
8609 MUnitTestObserver& aObserver) |
|
8610 { |
|
8611 CWspHeaderWriter_AllowPost_UnitTest* self = |
|
8612 new(ELeave) CWspHeaderWriter_AllowPost_UnitTest(aDataLogger, |
|
8613 aObserver); |
|
8614 CleanupStack::PushL(self); |
|
8615 self->ConstructL(); |
|
8616 CleanupStack::Pop(self); |
|
8617 return self; |
|
8618 } |
|
8619 |
|
8620 inline TInt CWspHeaderWriter_AllowPost_UnitTest::RunError(TInt aError) |
|
8621 { |
|
8622 // The RunL left so chain to the base first and then cleanup |
|
8623 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
8624 delete iUTContext; |
|
8625 iUTContext = NULL; |
|
8626 delete iStateAccessor; |
|
8627 iStateAccessor = NULL; |
|
8628 /* delete any validators used */ |
|
8629 delete iCtorValidator; |
|
8630 iCtorValidator = NULL; |
|
8631 delete iAllowPostValidator; |
|
8632 iAllowPostValidator = NULL; |
|
8633 delete iDtorValidator; |
|
8634 iDtorValidator = NULL; |
|
8635 return error; |
|
8636 } |
|
8637 |
|
8638 inline CWspHeaderWriter_AllowPost_UnitTest::~CWspHeaderWriter_AllowPost_UnitTest() |
|
8639 { |
|
8640 // Simply delete our test class instance |
|
8641 delete iUTContext; |
|
8642 delete iStateAccessor; |
|
8643 /* delete any validators used */ |
|
8644 delete iCtorValidator; |
|
8645 delete iAllowPostValidator; |
|
8646 delete iDtorValidator; |
|
8647 } |
|
8648 |
|
8649 inline CWspHeaderWriter_AllowPost_UnitTest::CWspHeaderWriter_AllowPost_UnitTest(CDataLogger& aDataLogger, |
|
8650 MUnitTestObserver& aObserver) |
|
8651 : CUnitTest(KWspHeaderWriterAllowPostUnitTest, aDataLogger, aObserver) |
|
8652 { |
|
8653 //Do nothing |
|
8654 } |
|
8655 |
|
8656 // Now the Individual transitions need to be added. |
|
8657 inline void CWspHeaderWriter_AllowPost_UnitTest::ConstructL() |
|
8658 { |
|
8659 // Perform the base class initialization |
|
8660 UnitTestConstructL(); |
|
8661 |
|
8662 // Create the Unit test state accessor |
|
8663 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
8664 // Construct the Unit test context. |
|
8665 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
8666 iUTContext->ConstructL(WSP::EAllow); |
|
8667 |
|
8668 // Part1 |
|
8669 _LIT8(KTxtUnknownLen, "Post"); |
|
8670 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtUnknownLen); |
|
8671 CleanupClosePushL(stringVal); |
|
8672 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
8673 CleanupStack::PushL(part1); |
|
8674 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
8675 CleanupStack::Pop(part1); |
|
8676 CleanupStack::PopAndDestroy(&stringVal); |
|
8677 |
|
8678 TBuf8<256> expectedBuf; |
|
8679 expectedBuf.Append(0xE0); |
|
8680 iUTContext->SetExpectedL(expectedBuf); |
|
8681 |
|
8682 // Add the Transitions in the order they are to run |
|
8683 // C'tor first, D'tor last... |
|
8684 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
8685 using constructor and destuctor validators */ |
|
8686 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
8687 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
8688 iAllowPostValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
8689 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAllowPostValidator)); |
|
8690 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
8691 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
8692 } |
|
8693 |
|
8694 // ______________________________________________________________________________ |
|
8695 // |
|
8696 _LIT(KWspHeaderWriterAllowInvalidUnitTest,"CWspHeaderWriter_AllowInvalid_UnitTest"); |
|
8697 |
|
8698 CWspHeaderWriter_AllowInvalid_UnitTest* CWspHeaderWriter_AllowInvalid_UnitTest::NewL(CDataLogger& aDataLogger, |
|
8699 MUnitTestObserver& aObserver) |
|
8700 { |
|
8701 CWspHeaderWriter_AllowInvalid_UnitTest* self = |
|
8702 new(ELeave) CWspHeaderWriter_AllowInvalid_UnitTest(aDataLogger, |
|
8703 aObserver); |
|
8704 CleanupStack::PushL(self); |
|
8705 self->ConstructL(); |
|
8706 CleanupStack::Pop(self); |
|
8707 return self; |
|
8708 } |
|
8709 |
|
8710 inline TInt CWspHeaderWriter_AllowInvalid_UnitTest::RunError(TInt aError) |
|
8711 { |
|
8712 // The RunL left so chain to the base first and then cleanup |
|
8713 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
8714 delete iUTContext; |
|
8715 iUTContext = NULL; |
|
8716 delete iStateAccessor; |
|
8717 iStateAccessor = NULL; |
|
8718 /* delete any validators used */ |
|
8719 delete iCtorValidator; |
|
8720 iCtorValidator = NULL; |
|
8721 delete iAllowInvalidValidator; |
|
8722 iAllowInvalidValidator = NULL; |
|
8723 delete iDtorValidator; |
|
8724 iDtorValidator = NULL; |
|
8725 return error; |
|
8726 } |
|
8727 |
|
8728 inline CWspHeaderWriter_AllowInvalid_UnitTest::~CWspHeaderWriter_AllowInvalid_UnitTest() |
|
8729 { |
|
8730 // Simply delete our test class instance |
|
8731 delete iUTContext; |
|
8732 delete iStateAccessor; |
|
8733 /* delete any validators used */ |
|
8734 delete iCtorValidator; |
|
8735 delete iAllowInvalidValidator; |
|
8736 delete iDtorValidator; |
|
8737 } |
|
8738 |
|
8739 inline CWspHeaderWriter_AllowInvalid_UnitTest::CWspHeaderWriter_AllowInvalid_UnitTest(CDataLogger& aDataLogger, |
|
8740 MUnitTestObserver& aObserver) |
|
8741 : CUnitTest(KWspHeaderWriterAllowInvalidUnitTest, aDataLogger, aObserver) |
|
8742 { |
|
8743 //Do nothing |
|
8744 } |
|
8745 |
|
8746 // Now the Individual transitions need to be added. |
|
8747 inline void CWspHeaderWriter_AllowInvalid_UnitTest::ConstructL() |
|
8748 { |
|
8749 // Perform the base class initialization |
|
8750 UnitTestConstructL(); |
|
8751 |
|
8752 // Create the Unit test state accessor |
|
8753 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
8754 // Construct the Unit test context. |
|
8755 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
8756 iUTContext->ConstructL(WSP::EAllow); |
|
8757 |
|
8758 // Part1 |
|
8759 _LIT8(KTxtUnknownLen, "Invalid"); |
|
8760 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtUnknownLen); |
|
8761 CleanupClosePushL(stringVal); |
|
8762 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
8763 CleanupStack::PushL(part1); |
|
8764 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
8765 CleanupStack::Pop(part1); |
|
8766 CleanupStack::PopAndDestroy(&stringVal); |
|
8767 |
|
8768 _LIT8(KTxtExpected, "-1"); |
|
8769 iUTContext->SetExpectedL(KTxtExpected); |
|
8770 |
|
8771 // Add the Transitions in the order they are to run |
|
8772 // C'tor first, D'tor last... |
|
8773 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
8774 using constructor and destuctor validators */ |
|
8775 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
8776 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
8777 iAllowInvalidValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
8778 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderLTrap_Transition(*iUTContext,*iAllowInvalidValidator)); |
|
8779 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
8780 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
8781 } |
|
8782 |
|
8783 // ______________________________________________________________________________ |
|
8784 // |
|
8785 _LIT(KWspHeaderWriterPragmaNoCacheUnitTest,"CWspHeaderWriter_PragmaNoCache_UnitTest"); |
|
8786 |
|
8787 CWspHeaderWriter_PragmaNoCache_UnitTest* CWspHeaderWriter_PragmaNoCache_UnitTest::NewL(CDataLogger& aDataLogger, |
|
8788 MUnitTestObserver& aObserver) |
|
8789 { |
|
8790 CWspHeaderWriter_PragmaNoCache_UnitTest* self = |
|
8791 new(ELeave) CWspHeaderWriter_PragmaNoCache_UnitTest(aDataLogger, |
|
8792 aObserver); |
|
8793 CleanupStack::PushL(self); |
|
8794 self->ConstructL(); |
|
8795 CleanupStack::Pop(self); |
|
8796 return self; |
|
8797 } |
|
8798 |
|
8799 inline TInt CWspHeaderWriter_PragmaNoCache_UnitTest::RunError(TInt aError) |
|
8800 { |
|
8801 // The RunL left so chain to the base first and then cleanup |
|
8802 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
8803 delete iUTContext; |
|
8804 iUTContext = NULL; |
|
8805 delete iStateAccessor; |
|
8806 iStateAccessor = NULL; |
|
8807 /* delete any validators used */ |
|
8808 delete iCtorValidator; |
|
8809 iCtorValidator = NULL; |
|
8810 delete iPragmaNoCacheValidator; |
|
8811 iPragmaNoCacheValidator = NULL; |
|
8812 delete iDtorValidator; |
|
8813 iDtorValidator = NULL; |
|
8814 return error; |
|
8815 } |
|
8816 |
|
8817 inline CWspHeaderWriter_PragmaNoCache_UnitTest::~CWspHeaderWriter_PragmaNoCache_UnitTest() |
|
8818 { |
|
8819 // Simply delete our test class instance |
|
8820 delete iUTContext; |
|
8821 delete iStateAccessor; |
|
8822 /* delete any validators used */ |
|
8823 delete iCtorValidator; |
|
8824 delete iPragmaNoCacheValidator; |
|
8825 delete iDtorValidator; |
|
8826 } |
|
8827 |
|
8828 inline CWspHeaderWriter_PragmaNoCache_UnitTest::CWspHeaderWriter_PragmaNoCache_UnitTest(CDataLogger& aDataLogger, |
|
8829 MUnitTestObserver& aObserver) |
|
8830 : CUnitTest(KWspHeaderWriterPragmaNoCacheUnitTest, aDataLogger, aObserver) |
|
8831 { |
|
8832 //Do nothing |
|
8833 } |
|
8834 |
|
8835 // Now the Individual transitions need to be added. |
|
8836 inline void CWspHeaderWriter_PragmaNoCache_UnitTest::ConstructL() |
|
8837 { |
|
8838 // Perform the base class initialization |
|
8839 UnitTestConstructL(); |
|
8840 |
|
8841 // Create the Unit test state accessor |
|
8842 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
8843 // Construct the Unit test context. |
|
8844 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
8845 iUTContext->ConstructL(WSP::EPragma); |
|
8846 |
|
8847 // Part1 |
|
8848 _LIT8(KTxtUnknownLen, "No-cache"); |
|
8849 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtUnknownLen); |
|
8850 CleanupClosePushL(stringVal); |
|
8851 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
8852 CleanupStack::PushL(part1); |
|
8853 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
8854 CleanupStack::Pop(part1); |
|
8855 CleanupStack::PopAndDestroy(&stringVal); |
|
8856 |
|
8857 TBuf8<256> expectedBuf; |
|
8858 expectedBuf.Append(0x80); // encoded token for 'no-cache; |
|
8859 iUTContext->SetExpectedL(expectedBuf); |
|
8860 |
|
8861 // Add the Transitions in the order they are to run |
|
8862 // C'tor first, D'tor last... |
|
8863 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
8864 using constructor and destuctor validators */ |
|
8865 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
8866 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
8867 iPragmaNoCacheValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
8868 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iPragmaNoCacheValidator)); |
|
8869 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
8870 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
8871 } |
|
8872 |
|
8873 // ______________________________________________________________________________ |
|
8874 // |
|
8875 _LIT(KWspHeaderWriterPragmaParameterUnitTest,"CWspHeaderWriter_PragmaParameter_UnitTest"); |
|
8876 |
|
8877 CWspHeaderWriter_PragmaParameter_UnitTest* CWspHeaderWriter_PragmaParameter_UnitTest::NewL(CDataLogger& aDataLogger, |
|
8878 MUnitTestObserver& aObserver) |
|
8879 { |
|
8880 CWspHeaderWriter_PragmaParameter_UnitTest* self = |
|
8881 new(ELeave) CWspHeaderWriter_PragmaParameter_UnitTest(aDataLogger, |
|
8882 aObserver); |
|
8883 CleanupStack::PushL(self); |
|
8884 self->ConstructL(); |
|
8885 CleanupStack::Pop(self); |
|
8886 return self; |
|
8887 } |
|
8888 |
|
8889 inline TInt CWspHeaderWriter_PragmaParameter_UnitTest::RunError(TInt aError) |
|
8890 { |
|
8891 // The RunL left so chain to the base first and then cleanup |
|
8892 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
8893 delete iUTContext; |
|
8894 iUTContext = NULL; |
|
8895 delete iStateAccessor; |
|
8896 iStateAccessor = NULL; |
|
8897 /* delete any validators used */ |
|
8898 delete iCtorValidator; |
|
8899 iCtorValidator = NULL; |
|
8900 delete iPragmaParameterValidator; |
|
8901 iPragmaParameterValidator = NULL; |
|
8902 delete iDtorValidator; |
|
8903 iDtorValidator = NULL; |
|
8904 return error; |
|
8905 } |
|
8906 |
|
8907 inline CWspHeaderWriter_PragmaParameter_UnitTest::~CWspHeaderWriter_PragmaParameter_UnitTest() |
|
8908 { |
|
8909 // Simply delete our test class instance |
|
8910 delete iUTContext; |
|
8911 delete iStateAccessor; |
|
8912 /* delete any validators used */ |
|
8913 delete iCtorValidator; |
|
8914 delete iPragmaParameterValidator; |
|
8915 delete iDtorValidator; |
|
8916 } |
|
8917 |
|
8918 inline CWspHeaderWriter_PragmaParameter_UnitTest::CWspHeaderWriter_PragmaParameter_UnitTest(CDataLogger& aDataLogger, |
|
8919 MUnitTestObserver& aObserver) |
|
8920 : CUnitTest(KWspHeaderWriterPragmaParameterUnitTest, aDataLogger, aObserver) |
|
8921 { |
|
8922 //Do nothing |
|
8923 } |
|
8924 |
|
8925 // Now the Individual transitions need to be added. |
|
8926 inline void CWspHeaderWriter_PragmaParameter_UnitTest::ConstructL() |
|
8927 { |
|
8928 // Perform the base class initialization |
|
8929 UnitTestConstructL(); |
|
8930 |
|
8931 // Create the Unit test state accessor |
|
8932 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
8933 // Construct the Unit test context. |
|
8934 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
8935 iUTContext->ConstructL(WSP::EPragma); |
|
8936 |
|
8937 // Part1 |
|
8938 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KNullDesC8); |
|
8939 CleanupClosePushL(stringVal); |
|
8940 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
8941 CleanupStack::PushL(part1); |
|
8942 |
|
8943 // Param1 |
|
8944 _LIT8(KTxtQParamName, "Q"); |
|
8945 _LIT8(KTxtQParamVal, "0.1"); |
|
8946 RStringF paramName = iUTContext->iStrPool.OpenFStringL(KTxtQParamName); |
|
8947 CleanupClosePushL(paramName); |
|
8948 RStringF paramVal = iUTContext->iStrPool.OpenFStringL(KTxtQParamVal); |
|
8949 CleanupClosePushL(paramVal); |
|
8950 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(paramName, paramVal); |
|
8951 CleanupStack::PushL(param1); |
|
8952 part1->AddParamL(param1); |
|
8953 CleanupStack::Pop(param1); |
|
8954 |
|
8955 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
8956 CleanupStack::PopAndDestroy(2, ¶mName); |
|
8957 CleanupStack::Pop(part1); |
|
8958 CleanupStack::PopAndDestroy(&stringVal); |
|
8959 |
|
8960 TBuf8<256> expectedBuf; |
|
8961 expectedBuf.Append(0x02); // value-length |
|
8962 expectedBuf.Append(0x80); // Encoded token for 'Q' |
|
8963 expectedBuf.Append(0x0B); // encoded token for '0.1' |
|
8964 iUTContext->SetExpectedL(expectedBuf); |
|
8965 |
|
8966 // Add the Transitions in the order they are to run |
|
8967 // C'tor first, D'tor last... |
|
8968 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
8969 using constructor and destuctor validators */ |
|
8970 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
8971 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
8972 iPragmaParameterValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
8973 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iPragmaParameterValidator)); |
|
8974 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
8975 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
8976 } |
|
8977 |
|
8978 // ______________________________________________________________________________ |
|
8979 // |
|
8980 _LIT(KWspHeaderWriterUpgradeTextUnitTest,"CWspHeaderWriter_UpgradeText_UnitTest"); |
|
8981 |
|
8982 CWspHeaderWriter_UpgradeText_UnitTest* CWspHeaderWriter_UpgradeText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
8983 MUnitTestObserver& aObserver) |
|
8984 { |
|
8985 CWspHeaderWriter_UpgradeText_UnitTest* self = |
|
8986 new(ELeave) CWspHeaderWriter_UpgradeText_UnitTest(aDataLogger, |
|
8987 aObserver); |
|
8988 CleanupStack::PushL(self); |
|
8989 self->ConstructL(); |
|
8990 CleanupStack::Pop(self); |
|
8991 return self; |
|
8992 } |
|
8993 |
|
8994 inline TInt CWspHeaderWriter_UpgradeText_UnitTest::RunError(TInt aError) |
|
8995 { |
|
8996 // The RunL left so chain to the base first and then cleanup |
|
8997 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
8998 delete iUTContext; |
|
8999 iUTContext = NULL; |
|
9000 delete iStateAccessor; |
|
9001 iStateAccessor = NULL; |
|
9002 /* delete any validators used */ |
|
9003 delete iCtorValidator; |
|
9004 iCtorValidator = NULL; |
|
9005 delete iUpgradeTextValidator; |
|
9006 iUpgradeTextValidator = NULL; |
|
9007 delete iDtorValidator; |
|
9008 iDtorValidator = NULL; |
|
9009 return error; |
|
9010 } |
|
9011 |
|
9012 inline CWspHeaderWriter_UpgradeText_UnitTest::~CWspHeaderWriter_UpgradeText_UnitTest() |
|
9013 { |
|
9014 // Simply delete our test class instance |
|
9015 delete iUTContext; |
|
9016 delete iStateAccessor; |
|
9017 /* delete any validators used */ |
|
9018 delete iCtorValidator; |
|
9019 delete iUpgradeTextValidator; |
|
9020 delete iDtorValidator; |
|
9021 } |
|
9022 |
|
9023 inline CWspHeaderWriter_UpgradeText_UnitTest::CWspHeaderWriter_UpgradeText_UnitTest(CDataLogger& aDataLogger, |
|
9024 MUnitTestObserver& aObserver) |
|
9025 : CUnitTest(KWspHeaderWriterUpgradeTextUnitTest, aDataLogger, aObserver) |
|
9026 { |
|
9027 //Do nothing |
|
9028 } |
|
9029 |
|
9030 // Now the Individual transitions need to be added. |
|
9031 inline void CWspHeaderWriter_UpgradeText_UnitTest::ConstructL() |
|
9032 { |
|
9033 // Perform the base class initialization |
|
9034 UnitTestConstructL(); |
|
9035 |
|
9036 // Create the Unit test state accessor |
|
9037 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
9038 // Construct the Unit test context. |
|
9039 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
9040 iUTContext->ConstructL(WSP::EUpgrade); |
|
9041 |
|
9042 // Part1 |
|
9043 _LIT8(KTxtUnknownLen, "upgrade-text"); |
|
9044 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtUnknownLen); |
|
9045 CleanupClosePushL(stringVal); |
|
9046 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
9047 CleanupStack::PushL(part1); |
|
9048 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
9049 CleanupStack::Pop(part1); |
|
9050 CleanupStack::PopAndDestroy(&stringVal); |
|
9051 |
|
9052 TBuf8<256> expectedBuf; |
|
9053 expectedBuf.Append(KTxtUnknownLen); |
|
9054 expectedBuf.Append(0x00); |
|
9055 iUTContext->SetExpectedL(expectedBuf); |
|
9056 |
|
9057 // Add the Transitions in the order they are to run |
|
9058 // C'tor first, D'tor last... |
|
9059 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
9060 using constructor and destuctor validators */ |
|
9061 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
9062 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
9063 iUpgradeTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
9064 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iUpgradeTextValidator)); |
|
9065 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
9066 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
9067 } |
|
9068 |
|
9069 // ______________________________________________________________________________ |
|
9070 // |
|
9071 _LIT(KWspHeaderWriterUpgradeNullTextUnitTest,"CWspHeaderWriter_UpgradeNullText_UnitTest"); |
|
9072 |
|
9073 CWspHeaderWriter_UpgradeNullText_UnitTest* CWspHeaderWriter_UpgradeNullText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
9074 MUnitTestObserver& aObserver) |
|
9075 { |
|
9076 CWspHeaderWriter_UpgradeNullText_UnitTest* self = |
|
9077 new(ELeave) CWspHeaderWriter_UpgradeNullText_UnitTest(aDataLogger, |
|
9078 aObserver); |
|
9079 CleanupStack::PushL(self); |
|
9080 self->ConstructL(); |
|
9081 CleanupStack::Pop(self); |
|
9082 return self; |
|
9083 } |
|
9084 |
|
9085 inline TInt CWspHeaderWriter_UpgradeNullText_UnitTest::RunError(TInt aError) |
|
9086 { |
|
9087 // The RunL left so chain to the base first and then cleanup |
|
9088 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
9089 delete iUTContext; |
|
9090 iUTContext = NULL; |
|
9091 delete iStateAccessor; |
|
9092 iStateAccessor = NULL; |
|
9093 /* delete any validators used */ |
|
9094 delete iCtorValidator; |
|
9095 iCtorValidator = NULL; |
|
9096 delete iUpgradeNullTextValidator; |
|
9097 iUpgradeNullTextValidator = NULL; |
|
9098 delete iDtorValidator; |
|
9099 iDtorValidator = NULL; |
|
9100 return error; |
|
9101 } |
|
9102 |
|
9103 inline CWspHeaderWriter_UpgradeNullText_UnitTest::~CWspHeaderWriter_UpgradeNullText_UnitTest() |
|
9104 { |
|
9105 // Simply delete our test class instance |
|
9106 delete iUTContext; |
|
9107 delete iStateAccessor; |
|
9108 /* delete any validators used */ |
|
9109 delete iCtorValidator; |
|
9110 delete iUpgradeNullTextValidator; |
|
9111 delete iDtorValidator; |
|
9112 } |
|
9113 |
|
9114 inline CWspHeaderWriter_UpgradeNullText_UnitTest::CWspHeaderWriter_UpgradeNullText_UnitTest(CDataLogger& aDataLogger, |
|
9115 MUnitTestObserver& aObserver) |
|
9116 : CUnitTest(KWspHeaderWriterUpgradeNullTextUnitTest, aDataLogger, aObserver) |
|
9117 { |
|
9118 //Do nothing |
|
9119 } |
|
9120 |
|
9121 // Now the Individual transitions need to be added. |
|
9122 inline void CWspHeaderWriter_UpgradeNullText_UnitTest::ConstructL() |
|
9123 { |
|
9124 // Perform the base class initialization |
|
9125 UnitTestConstructL(); |
|
9126 |
|
9127 // Create the Unit test state accessor |
|
9128 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
9129 // Construct the Unit test context. |
|
9130 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
9131 iUTContext->ConstructL(WSP::EUpgrade); |
|
9132 |
|
9133 // Part1 |
|
9134 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KNullDesC8); |
|
9135 CleanupClosePushL(stringVal); |
|
9136 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
9137 CleanupStack::PushL(part1); |
|
9138 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
9139 CleanupStack::Pop(part1); |
|
9140 CleanupStack::PopAndDestroy(&stringVal); |
|
9141 |
|
9142 TBuf8<256> expectedBuf; |
|
9143 expectedBuf.Append(0x00); |
|
9144 iUTContext->SetExpectedL(expectedBuf); |
|
9145 |
|
9146 // Add the Transitions in the order they are to run |
|
9147 // C'tor first, D'tor last... |
|
9148 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
9149 using constructor and destuctor validators */ |
|
9150 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
9151 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
9152 iUpgradeNullTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
9153 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iUpgradeNullTextValidator)); |
|
9154 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
9155 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
9156 } |
|
9157 |
|
9158 // ______________________________________________________________________________ |
|
9159 // |
|
9160 _LIT(KWspHeaderWriterWarning110UnitTest,"CWspHeaderWriter_Warning110_UnitTest"); |
|
9161 |
|
9162 CWspHeaderWriter_Warning110_UnitTest* CWspHeaderWriter_Warning110_UnitTest::NewL(CDataLogger& aDataLogger, |
|
9163 MUnitTestObserver& aObserver) |
|
9164 { |
|
9165 CWspHeaderWriter_Warning110_UnitTest* self = |
|
9166 new(ELeave) CWspHeaderWriter_Warning110_UnitTest(aDataLogger, |
|
9167 aObserver); |
|
9168 CleanupStack::PushL(self); |
|
9169 self->ConstructL(); |
|
9170 CleanupStack::Pop(self); |
|
9171 return self; |
|
9172 } |
|
9173 |
|
9174 inline TInt CWspHeaderWriter_Warning110_UnitTest::RunError(TInt aError) |
|
9175 { |
|
9176 // The RunL left so chain to the base first and then cleanup |
|
9177 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
9178 delete iUTContext; |
|
9179 iUTContext = NULL; |
|
9180 delete iStateAccessor; |
|
9181 iStateAccessor = NULL; |
|
9182 /* delete any validators used */ |
|
9183 delete iCtorValidator; |
|
9184 iCtorValidator = NULL; |
|
9185 delete iWarning110Validator; |
|
9186 iWarning110Validator = NULL; |
|
9187 delete iDtorValidator; |
|
9188 iDtorValidator = NULL; |
|
9189 return error; |
|
9190 } |
|
9191 |
|
9192 inline CWspHeaderWriter_Warning110_UnitTest::~CWspHeaderWriter_Warning110_UnitTest() |
|
9193 { |
|
9194 // Simply delete our test class instance |
|
9195 delete iUTContext; |
|
9196 delete iStateAccessor; |
|
9197 /* delete any validators used */ |
|
9198 delete iCtorValidator; |
|
9199 delete iWarning110Validator; |
|
9200 delete iDtorValidator; |
|
9201 } |
|
9202 |
|
9203 inline CWspHeaderWriter_Warning110_UnitTest::CWspHeaderWriter_Warning110_UnitTest(CDataLogger& aDataLogger, |
|
9204 MUnitTestObserver& aObserver) |
|
9205 : CUnitTest(KWspHeaderWriterWarning110UnitTest, aDataLogger, aObserver) |
|
9206 { |
|
9207 //Do nothing |
|
9208 } |
|
9209 |
|
9210 // Now the Individual transitions need to be added. |
|
9211 inline void CWspHeaderWriter_Warning110_UnitTest::ConstructL() |
|
9212 { |
|
9213 // Perform the base class initialization |
|
9214 UnitTestConstructL(); |
|
9215 |
|
9216 // Create the Unit test state accessor |
|
9217 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
9218 // Construct the Unit test context. |
|
9219 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
9220 iUTContext->ConstructL(WSP::EWarning); |
|
9221 |
|
9222 // Part1 |
|
9223 TInt warningVal = 110; |
|
9224 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(warningVal); |
|
9225 CleanupStack::PushL(part1); |
|
9226 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
9227 CleanupStack::Pop(part1); |
|
9228 |
|
9229 TBuf8<256> expectedBuf; |
|
9230 expectedBuf.Append(0x8A); // encoded token for '214' |
|
9231 iUTContext->SetExpectedL(expectedBuf); |
|
9232 |
|
9233 // Add the Transitions in the order they are to run |
|
9234 // C'tor first, D'tor last... |
|
9235 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
9236 using constructor and destuctor validators */ |
|
9237 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
9238 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
9239 iWarning110Validator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
9240 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iWarning110Validator)); |
|
9241 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
9242 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
9243 } |
|
9244 |
|
9245 // ______________________________________________________________________________ |
|
9246 // |
|
9247 _LIT(KWspHeaderWriterWarning214UnitTest,"CWspHeaderWriter_Warning214_UnitTest"); |
|
9248 |
|
9249 CWspHeaderWriter_Warning214_UnitTest* CWspHeaderWriter_Warning214_UnitTest::NewL(CDataLogger& aDataLogger, |
|
9250 MUnitTestObserver& aObserver) |
|
9251 { |
|
9252 CWspHeaderWriter_Warning214_UnitTest* self = |
|
9253 new(ELeave) CWspHeaderWriter_Warning214_UnitTest(aDataLogger, |
|
9254 aObserver); |
|
9255 CleanupStack::PushL(self); |
|
9256 self->ConstructL(); |
|
9257 CleanupStack::Pop(self); |
|
9258 return self; |
|
9259 } |
|
9260 |
|
9261 inline TInt CWspHeaderWriter_Warning214_UnitTest::RunError(TInt aError) |
|
9262 { |
|
9263 // The RunL left so chain to the base first and then cleanup |
|
9264 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
9265 delete iUTContext; |
|
9266 iUTContext = NULL; |
|
9267 delete iStateAccessor; |
|
9268 iStateAccessor = NULL; |
|
9269 /* delete any validators used */ |
|
9270 delete iCtorValidator; |
|
9271 iCtorValidator = NULL; |
|
9272 delete iWarning214Validator; |
|
9273 iWarning214Validator = NULL; |
|
9274 delete iDtorValidator; |
|
9275 iDtorValidator = NULL; |
|
9276 return error; |
|
9277 } |
|
9278 |
|
9279 inline CWspHeaderWriter_Warning214_UnitTest::~CWspHeaderWriter_Warning214_UnitTest() |
|
9280 { |
|
9281 // Simply delete our test class instance |
|
9282 delete iUTContext; |
|
9283 delete iStateAccessor; |
|
9284 /* delete any validators used */ |
|
9285 delete iCtorValidator; |
|
9286 delete iWarning214Validator; |
|
9287 delete iDtorValidator; |
|
9288 } |
|
9289 |
|
9290 inline CWspHeaderWriter_Warning214_UnitTest::CWspHeaderWriter_Warning214_UnitTest(CDataLogger& aDataLogger, |
|
9291 MUnitTestObserver& aObserver) |
|
9292 : CUnitTest(KWspHeaderWriterWarning214UnitTest, aDataLogger, aObserver) |
|
9293 { |
|
9294 //Do nothing |
|
9295 } |
|
9296 |
|
9297 // Now the Individual transitions need to be added. |
|
9298 inline void CWspHeaderWriter_Warning214_UnitTest::ConstructL() |
|
9299 { |
|
9300 // Perform the base class initialization |
|
9301 UnitTestConstructL(); |
|
9302 |
|
9303 // Create the Unit test state accessor |
|
9304 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
9305 // Construct the Unit test context. |
|
9306 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
9307 iUTContext->ConstructL(WSP::EWarning); |
|
9308 |
|
9309 // Part1 |
|
9310 TInt warningVal = 214; |
|
9311 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(warningVal); |
|
9312 CleanupStack::PushL(part1); |
|
9313 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
9314 CleanupStack::Pop(part1); |
|
9315 |
|
9316 TBuf8<256> expectedBuf; |
|
9317 expectedBuf.Append(0x8E); // encoded token for '214' |
|
9318 iUTContext->SetExpectedL(expectedBuf); |
|
9319 |
|
9320 // Add the Transitions in the order they are to run |
|
9321 // C'tor first, D'tor last... |
|
9322 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
9323 using constructor and destuctor validators */ |
|
9324 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
9325 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
9326 iWarning214Validator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
9327 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iWarning214Validator)); |
|
9328 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
9329 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
9330 } |
|
9331 |
|
9332 // ______________________________________________________________________________ |
|
9333 // |
|
9334 _LIT(KWspHeaderWriterWarningWarnValue100UnitTest,"CWspHeaderWriter_WarningWarnValue100_UnitTest"); |
|
9335 |
|
9336 CWspHeaderWriter_WarningWarnValue100_UnitTest* CWspHeaderWriter_WarningWarnValue100_UnitTest::NewL(CDataLogger& aDataLogger, |
|
9337 MUnitTestObserver& aObserver) |
|
9338 { |
|
9339 CWspHeaderWriter_WarningWarnValue100_UnitTest* self = |
|
9340 new(ELeave) CWspHeaderWriter_WarningWarnValue100_UnitTest(aDataLogger, |
|
9341 aObserver); |
|
9342 CleanupStack::PushL(self); |
|
9343 self->ConstructL(); |
|
9344 CleanupStack::Pop(self); |
|
9345 return self; |
|
9346 } |
|
9347 |
|
9348 inline TInt CWspHeaderWriter_WarningWarnValue100_UnitTest::RunError(TInt aError) |
|
9349 { |
|
9350 // The RunL left so chain to the base first and then cleanup |
|
9351 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
9352 delete iUTContext; |
|
9353 iUTContext = NULL; |
|
9354 delete iStateAccessor; |
|
9355 iStateAccessor = NULL; |
|
9356 /* delete any validators used */ |
|
9357 delete iCtorValidator; |
|
9358 iCtorValidator = NULL; |
|
9359 delete iWarningWarnValue100Validator; |
|
9360 iWarningWarnValue100Validator = NULL; |
|
9361 delete iDtorValidator; |
|
9362 iDtorValidator = NULL; |
|
9363 return error; |
|
9364 } |
|
9365 |
|
9366 inline CWspHeaderWriter_WarningWarnValue100_UnitTest::~CWspHeaderWriter_WarningWarnValue100_UnitTest() |
|
9367 { |
|
9368 // Simply delete our test class instance |
|
9369 delete iUTContext; |
|
9370 delete iStateAccessor; |
|
9371 /* delete any validators used */ |
|
9372 delete iCtorValidator; |
|
9373 delete iWarningWarnValue100Validator; |
|
9374 delete iDtorValidator; |
|
9375 } |
|
9376 |
|
9377 inline CWspHeaderWriter_WarningWarnValue100_UnitTest::CWspHeaderWriter_WarningWarnValue100_UnitTest(CDataLogger& aDataLogger, |
|
9378 MUnitTestObserver& aObserver) |
|
9379 : CUnitTest(KWspHeaderWriterWarningWarnValue100UnitTest, aDataLogger, aObserver) |
|
9380 { |
|
9381 //Do nothing |
|
9382 } |
|
9383 |
|
9384 // Now the Individual transitions need to be added. |
|
9385 inline void CWspHeaderWriter_WarningWarnValue100_UnitTest::ConstructL() |
|
9386 { |
|
9387 // Perform the base class initialization |
|
9388 UnitTestConstructL(); |
|
9389 |
|
9390 // Create the Unit test state accessor |
|
9391 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
9392 // Construct the Unit test context. |
|
9393 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
9394 iUTContext->ConstructL(WSP::EWarning); |
|
9395 |
|
9396 // Part1 |
|
9397 TInt warningVal = 110; |
|
9398 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(warningVal); |
|
9399 CleanupStack::PushL(part1); |
|
9400 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
9401 CleanupStack::Pop(part1); |
|
9402 |
|
9403 // Part2 |
|
9404 _LIT8(KTxtWarnAgent, "warn-agent"); |
|
9405 RStringF warnAgent = iUTContext->iStrPool.OpenFStringL(KTxtWarnAgent); |
|
9406 CleanupClosePushL(warnAgent); |
|
9407 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(warnAgent); |
|
9408 CleanupStack::PushL(part2); |
|
9409 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
9410 CleanupStack::Pop(part2); |
|
9411 |
|
9412 // Part3 |
|
9413 _LIT8(KTxtWarnText, "warn-text"); |
|
9414 RStringF warnText = iUTContext->iStrPool.OpenFStringL(KTxtWarnText); |
|
9415 CleanupClosePushL(warnText); |
|
9416 CHeaderFieldPart* part3 = CHeaderFieldPart::NewL(warnText); |
|
9417 CleanupStack::PushL(part3); |
|
9418 iUTContext->iTestHeader->SetPartL(part3, 2); |
|
9419 CleanupStack::Pop(part3); |
|
9420 |
|
9421 CleanupStack::PopAndDestroy(2, &warnAgent); |
|
9422 |
|
9423 TBuf8<256> expectedBuf; |
|
9424 expectedBuf.Append(0x16); // value-length |
|
9425 expectedBuf.Append(0x8A); // encoded token for '110' |
|
9426 expectedBuf.Append(KTxtWarnAgent); |
|
9427 expectedBuf.Append(0x00); |
|
9428 expectedBuf.Append(KTxtWarnText); |
|
9429 expectedBuf.Append(0x00); |
|
9430 iUTContext->SetExpectedL(expectedBuf); |
|
9431 |
|
9432 // Add the Transitions in the order they are to run |
|
9433 // C'tor first, D'tor last... |
|
9434 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
9435 using constructor and destuctor validators */ |
|
9436 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
9437 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
9438 iWarningWarnValue100Validator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
9439 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iWarningWarnValue100Validator)); |
|
9440 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
9441 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
9442 } |
|
9443 |
|
9444 // ______________________________________________________________________________ |
|
9445 // |
|
9446 _LIT(KWspHeaderWriterWarningWarnValue110NullAgentUnitTest,"CWspHeaderWriter_WarningWarnValue110NullAgent_UnitTest"); |
|
9447 |
|
9448 CWspHeaderWriter_WarningWarnValue110NullAgent_UnitTest* CWspHeaderWriter_WarningWarnValue110NullAgent_UnitTest::NewL(CDataLogger& aDataLogger, |
|
9449 MUnitTestObserver& aObserver) |
|
9450 { |
|
9451 CWspHeaderWriter_WarningWarnValue110NullAgent_UnitTest* self = |
|
9452 new(ELeave) CWspHeaderWriter_WarningWarnValue110NullAgent_UnitTest(aDataLogger, |
|
9453 aObserver); |
|
9454 CleanupStack::PushL(self); |
|
9455 self->ConstructL(); |
|
9456 CleanupStack::Pop(self); |
|
9457 return self; |
|
9458 } |
|
9459 |
|
9460 inline TInt CWspHeaderWriter_WarningWarnValue110NullAgent_UnitTest::RunError(TInt aError) |
|
9461 { |
|
9462 // The RunL left so chain to the base first and then cleanup |
|
9463 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
9464 delete iUTContext; |
|
9465 iUTContext = NULL; |
|
9466 delete iStateAccessor; |
|
9467 iStateAccessor = NULL; |
|
9468 /* delete any validators used */ |
|
9469 delete iCtorValidator; |
|
9470 iCtorValidator = NULL; |
|
9471 delete iWarningWarnValue110NullAgentValidator; |
|
9472 iWarningWarnValue110NullAgentValidator = NULL; |
|
9473 delete iDtorValidator; |
|
9474 iDtorValidator = NULL; |
|
9475 return error; |
|
9476 } |
|
9477 |
|
9478 inline CWspHeaderWriter_WarningWarnValue110NullAgent_UnitTest::~CWspHeaderWriter_WarningWarnValue110NullAgent_UnitTest() |
|
9479 { |
|
9480 // Simply delete our test class instance |
|
9481 delete iUTContext; |
|
9482 delete iStateAccessor; |
|
9483 /* delete any validators used */ |
|
9484 delete iCtorValidator; |
|
9485 delete iWarningWarnValue110NullAgentValidator; |
|
9486 delete iDtorValidator; |
|
9487 } |
|
9488 |
|
9489 inline CWspHeaderWriter_WarningWarnValue110NullAgent_UnitTest::CWspHeaderWriter_WarningWarnValue110NullAgent_UnitTest(CDataLogger& aDataLogger, |
|
9490 MUnitTestObserver& aObserver) |
|
9491 : CUnitTest(KWspHeaderWriterWarningWarnValue110NullAgentUnitTest, aDataLogger, aObserver) |
|
9492 { |
|
9493 //Do nothing |
|
9494 } |
|
9495 |
|
9496 // Now the Individual transitions need to be added. |
|
9497 inline void CWspHeaderWriter_WarningWarnValue110NullAgent_UnitTest::ConstructL() |
|
9498 { |
|
9499 // Perform the base class initialization |
|
9500 UnitTestConstructL(); |
|
9501 |
|
9502 // Create the Unit test state accessor |
|
9503 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
9504 // Construct the Unit test context. |
|
9505 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
9506 iUTContext->ConstructL(WSP::EWarning); |
|
9507 |
|
9508 // Part1 |
|
9509 TInt warningVal = 110; |
|
9510 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(warningVal); |
|
9511 CleanupStack::PushL(part1); |
|
9512 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
9513 CleanupStack::Pop(part1); |
|
9514 |
|
9515 // Part2 |
|
9516 RStringF warnAgent = iUTContext->iStrPool.OpenFStringL(KNullDesC8); |
|
9517 CleanupClosePushL(warnAgent); |
|
9518 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(warnAgent); |
|
9519 CleanupStack::PushL(part2); |
|
9520 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
9521 CleanupStack::Pop(part2); |
|
9522 |
|
9523 // Part3 |
|
9524 _LIT8(KTxtWarnText, "warn-text"); |
|
9525 RStringF warnText = iUTContext->iStrPool.OpenFStringL(KTxtWarnText); |
|
9526 CleanupClosePushL(warnText); |
|
9527 CHeaderFieldPart* part3 = CHeaderFieldPart::NewL(warnText); |
|
9528 CleanupStack::PushL(part3); |
|
9529 iUTContext->iTestHeader->SetPartL(part3, 2); |
|
9530 CleanupStack::Pop(part3); |
|
9531 |
|
9532 CleanupStack::PopAndDestroy(2, &warnAgent); |
|
9533 |
|
9534 TBuf8<256> expectedBuf; |
|
9535 expectedBuf.Append(0x0C); // value-length |
|
9536 expectedBuf.Append(0x8A); // encoded token for '110' |
|
9537 expectedBuf.Append(0x00); |
|
9538 expectedBuf.Append(KTxtWarnText); |
|
9539 expectedBuf.Append(0x00); |
|
9540 iUTContext->SetExpectedL(expectedBuf); |
|
9541 |
|
9542 // Add the Transitions in the order they are to run |
|
9543 // C'tor first, D'tor last... |
|
9544 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
9545 using constructor and destuctor validators */ |
|
9546 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
9547 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
9548 iWarningWarnValue110NullAgentValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
9549 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iWarningWarnValue110NullAgentValidator)); |
|
9550 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
9551 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
9552 } |
|
9553 |
|
9554 // ______________________________________________________________________________ |
|
9555 // |
|
9556 _LIT(KWspHeaderWriterAcceptConstrainedTokenUnitTest,"CWspHeaderWriter_AcceptConstrainedToken_UnitTest"); |
|
9557 |
|
9558 CWspHeaderWriter_AcceptConstrainedToken_UnitTest* CWspHeaderWriter_AcceptConstrainedToken_UnitTest::NewL(CDataLogger& aDataLogger, |
|
9559 MUnitTestObserver& aObserver) |
|
9560 { |
|
9561 CWspHeaderWriter_AcceptConstrainedToken_UnitTest* self = |
|
9562 new(ELeave) CWspHeaderWriter_AcceptConstrainedToken_UnitTest(aDataLogger, |
|
9563 aObserver); |
|
9564 CleanupStack::PushL(self); |
|
9565 self->ConstructL(); |
|
9566 CleanupStack::Pop(self); |
|
9567 return self; |
|
9568 } |
|
9569 |
|
9570 inline TInt CWspHeaderWriter_AcceptConstrainedToken_UnitTest::RunError(TInt aError) |
|
9571 { |
|
9572 // The RunL left so chain to the base first and then cleanup |
|
9573 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
9574 delete iUTContext; |
|
9575 iUTContext = NULL; |
|
9576 delete iStateAccessor; |
|
9577 iStateAccessor = NULL; |
|
9578 /* delete any validators used */ |
|
9579 delete iCtorValidator; |
|
9580 iCtorValidator = NULL; |
|
9581 delete iAcceptConstrainedTokenValidator; |
|
9582 iAcceptConstrainedTokenValidator = NULL; |
|
9583 delete iDtorValidator; |
|
9584 iDtorValidator = NULL; |
|
9585 return error; |
|
9586 } |
|
9587 |
|
9588 inline CWspHeaderWriter_AcceptConstrainedToken_UnitTest::~CWspHeaderWriter_AcceptConstrainedToken_UnitTest() |
|
9589 { |
|
9590 // Simply delete our test class instance |
|
9591 delete iUTContext; |
|
9592 delete iStateAccessor; |
|
9593 /* delete any validators used */ |
|
9594 delete iCtorValidator; |
|
9595 delete iAcceptConstrainedTokenValidator; |
|
9596 delete iDtorValidator; |
|
9597 } |
|
9598 |
|
9599 inline CWspHeaderWriter_AcceptConstrainedToken_UnitTest::CWspHeaderWriter_AcceptConstrainedToken_UnitTest(CDataLogger& aDataLogger, |
|
9600 MUnitTestObserver& aObserver) |
|
9601 : CUnitTest(KWspHeaderWriterAcceptConstrainedTokenUnitTest, aDataLogger, aObserver) |
|
9602 { |
|
9603 //Do nothing |
|
9604 } |
|
9605 |
|
9606 // Now the Individual transitions need to be added. |
|
9607 inline void CWspHeaderWriter_AcceptConstrainedToken_UnitTest::ConstructL() |
|
9608 { |
|
9609 // Perform the base class initialization |
|
9610 UnitTestConstructL(); |
|
9611 |
|
9612 // Create the Unit test state accessor |
|
9613 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
9614 // Construct the Unit test context. |
|
9615 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
9616 iUTContext->ConstructL(WSP::EAccept); |
|
9617 |
|
9618 // Part1 |
|
9619 _LIT8(KTxtAccept, "*/*"); |
|
9620 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtAccept); |
|
9621 CleanupClosePushL(stringVal); |
|
9622 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
9623 CleanupStack::PushL(part1); |
|
9624 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
9625 CleanupStack::Pop(part1); |
|
9626 CleanupStack::PopAndDestroy(&stringVal); |
|
9627 |
|
9628 TBuf8<256> expectedBuf; |
|
9629 expectedBuf.Append(0x80); |
|
9630 iUTContext->SetExpectedL(expectedBuf); |
|
9631 |
|
9632 // Add the Transitions in the order they are to run |
|
9633 // C'tor first, D'tor last... |
|
9634 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
9635 using constructor and destuctor validators */ |
|
9636 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
9637 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
9638 iAcceptConstrainedTokenValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
9639 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptConstrainedTokenValidator)); |
|
9640 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
9641 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
9642 } |
|
9643 |
|
9644 // ______________________________________________________________________________ |
|
9645 // |
|
9646 _LIT(KWspHeaderWriterAcceptConstrainedTextUnitTest,"CWspHeaderWriter_AcceptConstrainedText_UnitTest"); |
|
9647 |
|
9648 CWspHeaderWriter_AcceptConstrainedText_UnitTest* CWspHeaderWriter_AcceptConstrainedText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
9649 MUnitTestObserver& aObserver) |
|
9650 { |
|
9651 CWspHeaderWriter_AcceptConstrainedText_UnitTest* self = |
|
9652 new(ELeave) CWspHeaderWriter_AcceptConstrainedText_UnitTest(aDataLogger, |
|
9653 aObserver); |
|
9654 CleanupStack::PushL(self); |
|
9655 self->ConstructL(); |
|
9656 CleanupStack::Pop(self); |
|
9657 return self; |
|
9658 } |
|
9659 |
|
9660 inline TInt CWspHeaderWriter_AcceptConstrainedText_UnitTest::RunError(TInt aError) |
|
9661 { |
|
9662 // The RunL left so chain to the base first and then cleanup |
|
9663 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
9664 delete iUTContext; |
|
9665 iUTContext = NULL; |
|
9666 delete iStateAccessor; |
|
9667 iStateAccessor = NULL; |
|
9668 /* delete any validators used */ |
|
9669 delete iCtorValidator; |
|
9670 iCtorValidator = NULL; |
|
9671 delete iAcceptConstrainedTextValidator; |
|
9672 iAcceptConstrainedTextValidator = NULL; |
|
9673 delete iDtorValidator; |
|
9674 iDtorValidator = NULL; |
|
9675 return error; |
|
9676 } |
|
9677 |
|
9678 inline CWspHeaderWriter_AcceptConstrainedText_UnitTest::~CWspHeaderWriter_AcceptConstrainedText_UnitTest() |
|
9679 { |
|
9680 // Simply delete our test class instance |
|
9681 delete iUTContext; |
|
9682 delete iStateAccessor; |
|
9683 /* delete any validators used */ |
|
9684 delete iCtorValidator; |
|
9685 delete iAcceptConstrainedTextValidator; |
|
9686 delete iDtorValidator; |
|
9687 } |
|
9688 |
|
9689 inline CWspHeaderWriter_AcceptConstrainedText_UnitTest::CWspHeaderWriter_AcceptConstrainedText_UnitTest(CDataLogger& aDataLogger, |
|
9690 MUnitTestObserver& aObserver) |
|
9691 : CUnitTest(KWspHeaderWriterAcceptConstrainedTextUnitTest, aDataLogger, aObserver) |
|
9692 { |
|
9693 //Do nothing |
|
9694 } |
|
9695 |
|
9696 // Now the Individual transitions need to be added. |
|
9697 inline void CWspHeaderWriter_AcceptConstrainedText_UnitTest::ConstructL() |
|
9698 { |
|
9699 // Perform the base class initialization |
|
9700 UnitTestConstructL(); |
|
9701 |
|
9702 // Create the Unit test state accessor |
|
9703 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
9704 // Construct the Unit test context. |
|
9705 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
9706 iUTContext->ConstructL(WSP::EAccept); |
|
9707 |
|
9708 // Part1 |
|
9709 _LIT8(KTxtAccept, "my-content-type"); |
|
9710 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtAccept); |
|
9711 CleanupClosePushL(stringVal); |
|
9712 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
9713 CleanupStack::PushL(part1); |
|
9714 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
9715 CleanupStack::Pop(part1); |
|
9716 CleanupStack::PopAndDestroy(&stringVal); |
|
9717 |
|
9718 TBuf8<256> expectedBuf; |
|
9719 expectedBuf.Append(KTxtAccept); |
|
9720 expectedBuf.Append(0x00); |
|
9721 iUTContext->SetExpectedL(expectedBuf); |
|
9722 |
|
9723 // Add the Transitions in the order they are to run |
|
9724 // C'tor first, D'tor last... |
|
9725 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
9726 using constructor and destuctor validators */ |
|
9727 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
9728 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
9729 iAcceptConstrainedTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
9730 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptConstrainedTextValidator)); |
|
9731 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
9732 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
9733 } |
|
9734 |
|
9735 // ______________________________________________________________________________ |
|
9736 // |
|
9737 _LIT(KWspHeaderWriterAcceptGeneralTokenQValUnitTest,"CWspHeaderWriter_AcceptGeneralTokenQVal_UnitTest"); |
|
9738 |
|
9739 CWspHeaderWriter_AcceptGeneralTokenQVal_UnitTest* CWspHeaderWriter_AcceptGeneralTokenQVal_UnitTest::NewL(CDataLogger& aDataLogger, |
|
9740 MUnitTestObserver& aObserver) |
|
9741 { |
|
9742 CWspHeaderWriter_AcceptGeneralTokenQVal_UnitTest* self = |
|
9743 new(ELeave) CWspHeaderWriter_AcceptGeneralTokenQVal_UnitTest(aDataLogger, |
|
9744 aObserver); |
|
9745 CleanupStack::PushL(self); |
|
9746 self->ConstructL(); |
|
9747 CleanupStack::Pop(self); |
|
9748 return self; |
|
9749 } |
|
9750 |
|
9751 inline TInt CWspHeaderWriter_AcceptGeneralTokenQVal_UnitTest::RunError(TInt aError) |
|
9752 { |
|
9753 // The RunL left so chain to the base first and then cleanup |
|
9754 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
9755 delete iUTContext; |
|
9756 iUTContext = NULL; |
|
9757 delete iStateAccessor; |
|
9758 iStateAccessor = NULL; |
|
9759 /* delete any validators used */ |
|
9760 delete iCtorValidator; |
|
9761 iCtorValidator = NULL; |
|
9762 delete iAcceptGeneralTokenQValValidator; |
|
9763 iAcceptGeneralTokenQValValidator = NULL; |
|
9764 delete iDtorValidator; |
|
9765 iDtorValidator = NULL; |
|
9766 return error; |
|
9767 } |
|
9768 |
|
9769 inline CWspHeaderWriter_AcceptGeneralTokenQVal_UnitTest::~CWspHeaderWriter_AcceptGeneralTokenQVal_UnitTest() |
|
9770 { |
|
9771 // Simply delete our test class instance |
|
9772 delete iUTContext; |
|
9773 delete iStateAccessor; |
|
9774 /* delete any validators used */ |
|
9775 delete iCtorValidator; |
|
9776 delete iAcceptGeneralTokenQValValidator; |
|
9777 delete iDtorValidator; |
|
9778 } |
|
9779 |
|
9780 inline CWspHeaderWriter_AcceptGeneralTokenQVal_UnitTest::CWspHeaderWriter_AcceptGeneralTokenQVal_UnitTest(CDataLogger& aDataLogger, |
|
9781 MUnitTestObserver& aObserver) |
|
9782 : CUnitTest(KWspHeaderWriterAcceptGeneralTokenQValUnitTest, aDataLogger, aObserver) |
|
9783 { |
|
9784 //Do nothing |
|
9785 } |
|
9786 |
|
9787 // Now the Individual transitions need to be added. |
|
9788 inline void CWspHeaderWriter_AcceptGeneralTokenQVal_UnitTest::ConstructL() |
|
9789 { |
|
9790 // Perform the base class initialization |
|
9791 UnitTestConstructL(); |
|
9792 |
|
9793 // Create the Unit test state accessor |
|
9794 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
9795 // Construct the Unit test context. |
|
9796 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
9797 iUTContext->ConstructL(WSP::EAccept); |
|
9798 |
|
9799 // Part1 |
|
9800 _LIT8(KTxtAccept, "multipart/*"); |
|
9801 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtAccept); |
|
9802 CleanupClosePushL(stringVal); |
|
9803 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
9804 CleanupStack::PushL(part1); |
|
9805 |
|
9806 // Param1 |
|
9807 _LIT8(KTxtQName, "Q"); |
|
9808 _LIT8(KTxtQVal, "0.333"); |
|
9809 RStringF stringVal1 = iUTContext->iStrPool.OpenFStringL(KTxtQName); |
|
9810 CleanupClosePushL(stringVal1); |
|
9811 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtQVal); |
|
9812 CleanupClosePushL(stringVal2); |
|
9813 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(stringVal1, stringVal2); |
|
9814 CleanupStack::PushL(param1); |
|
9815 part1->AddParamL(param1); |
|
9816 CleanupStack::Pop(param1); |
|
9817 |
|
9818 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
9819 CleanupStack::PopAndDestroy(2, &stringVal1); |
|
9820 CleanupStack::Pop(part1); |
|
9821 CleanupStack::PopAndDestroy(&stringVal); |
|
9822 |
|
9823 TBuf8<256> expectedBuf; |
|
9824 expectedBuf.Append(0x04); // value-length |
|
9825 expectedBuf.Append(0x8B); |
|
9826 expectedBuf.Append(0x80); |
|
9827 expectedBuf.Append(0x83); |
|
9828 expectedBuf.Append(0x31); |
|
9829 iUTContext->SetExpectedL(expectedBuf); |
|
9830 |
|
9831 // Add the Transitions in the order they are to run |
|
9832 // C'tor first, D'tor last... |
|
9833 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
9834 using constructor and destuctor validators */ |
|
9835 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
9836 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
9837 iAcceptGeneralTokenQValValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
9838 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptGeneralTokenQValValidator)); |
|
9839 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
9840 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
9841 } |
|
9842 |
|
9843 // ______________________________________________________________________________ |
|
9844 // |
|
9845 _LIT(KWspHeaderWriterAcceptGeneralLongInt2ParamsUnitTest,"CWspHeaderWriter_AcceptGeneralLongInt2Params_UnitTest"); |
|
9846 |
|
9847 CWspHeaderWriter_AcceptGeneralLongInt2Params_UnitTest* CWspHeaderWriter_AcceptGeneralLongInt2Params_UnitTest::NewL(CDataLogger& aDataLogger, |
|
9848 MUnitTestObserver& aObserver) |
|
9849 { |
|
9850 CWspHeaderWriter_AcceptGeneralLongInt2Params_UnitTest* self = |
|
9851 new(ELeave) CWspHeaderWriter_AcceptGeneralLongInt2Params_UnitTest(aDataLogger, |
|
9852 aObserver); |
|
9853 CleanupStack::PushL(self); |
|
9854 self->ConstructL(); |
|
9855 CleanupStack::Pop(self); |
|
9856 return self; |
|
9857 } |
|
9858 |
|
9859 inline TInt CWspHeaderWriter_AcceptGeneralLongInt2Params_UnitTest::RunError(TInt aError) |
|
9860 { |
|
9861 // The RunL left so chain to the base first and then cleanup |
|
9862 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
9863 delete iUTContext; |
|
9864 iUTContext = NULL; |
|
9865 delete iStateAccessor; |
|
9866 iStateAccessor = NULL; |
|
9867 /* delete any validators used */ |
|
9868 delete iCtorValidator; |
|
9869 iCtorValidator = NULL; |
|
9870 delete iAcceptGeneralLongInt2ParamsValidator; |
|
9871 iAcceptGeneralLongInt2ParamsValidator = NULL; |
|
9872 delete iDtorValidator; |
|
9873 iDtorValidator = NULL; |
|
9874 return error; |
|
9875 } |
|
9876 |
|
9877 inline CWspHeaderWriter_AcceptGeneralLongInt2Params_UnitTest::~CWspHeaderWriter_AcceptGeneralLongInt2Params_UnitTest() |
|
9878 { |
|
9879 // Simply delete our test class instance |
|
9880 delete iUTContext; |
|
9881 delete iStateAccessor; |
|
9882 /* delete any validators used */ |
|
9883 delete iCtorValidator; |
|
9884 delete iAcceptGeneralLongInt2ParamsValidator; |
|
9885 delete iDtorValidator; |
|
9886 } |
|
9887 |
|
9888 inline CWspHeaderWriter_AcceptGeneralLongInt2Params_UnitTest::CWspHeaderWriter_AcceptGeneralLongInt2Params_UnitTest(CDataLogger& aDataLogger, |
|
9889 MUnitTestObserver& aObserver) |
|
9890 : CUnitTest(KWspHeaderWriterAcceptGeneralLongInt2ParamsUnitTest, aDataLogger, aObserver) |
|
9891 { |
|
9892 //Do nothing |
|
9893 } |
|
9894 |
|
9895 // Now the Individual transitions need to be added. |
|
9896 inline void CWspHeaderWriter_AcceptGeneralLongInt2Params_UnitTest::ConstructL() |
|
9897 { |
|
9898 // Perform the base class initialization |
|
9899 UnitTestConstructL(); |
|
9900 |
|
9901 // Create the Unit test state accessor |
|
9902 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
9903 // Construct the Unit test context. |
|
9904 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
9905 iUTContext->ConstructL(WSP::EAccept); |
|
9906 |
|
9907 // Part1 |
|
9908 _LIT8(KTxtAccept, "application/vnd.uplanet.signal"); |
|
9909 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtAccept); |
|
9910 CleanupClosePushL(stringVal); |
|
9911 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
9912 CleanupStack::PushL(part1); |
|
9913 |
|
9914 // Param1 |
|
9915 _LIT8(KTxtParamName, "my-param"); |
|
9916 _LIT8(KTxtParamVal, "param-value"); |
|
9917 RStringF stringVal1 = iUTContext->iStrPool.OpenFStringL(KTxtParamName); |
|
9918 CleanupClosePushL(stringVal1); |
|
9919 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtParamVal); |
|
9920 CleanupClosePushL(stringVal2); |
|
9921 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(stringVal1, stringVal2); |
|
9922 CleanupStack::PushL(param1); |
|
9923 part1->AddParamL(param1); |
|
9924 CleanupStack::Pop(param1); |
|
9925 |
|
9926 // Param2 |
|
9927 _LIT8(KTxtQName, "Q"); |
|
9928 _LIT8(KTxtQVal, "0.333"); |
|
9929 RStringF stringVal3 = iUTContext->iStrPool.OpenFStringL(KTxtQName); |
|
9930 CleanupClosePushL(stringVal3); |
|
9931 RStringF stringVal4 = iUTContext->iStrPool.OpenFStringL(KTxtQVal); |
|
9932 CleanupClosePushL(stringVal4); |
|
9933 CHeaderFieldParam* param2 = CHeaderFieldParam::NewL(stringVal3, stringVal4); |
|
9934 CleanupStack::PushL(param2); |
|
9935 part1->AddParamL(param2); |
|
9936 CleanupStack::Pop(param2); |
|
9937 |
|
9938 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
9939 CleanupStack::PopAndDestroy(4, &stringVal1); |
|
9940 CleanupStack::Pop(part1); |
|
9941 CleanupStack::PopAndDestroy(&stringVal); |
|
9942 |
|
9943 TBuf8<256> expectedBuf; |
|
9944 expectedBuf.Append(0x1B); // value-length |
|
9945 expectedBuf.Append(0x02); // long int encoding for type ... |
|
9946 expectedBuf.Append(0x02); // ... |
|
9947 expectedBuf.Append(0x02); // ... |
|
9948 expectedBuf.Append(KTxtParamName); |
|
9949 expectedBuf.Append(0x00); |
|
9950 expectedBuf.Append(KTxtParamVal); |
|
9951 expectedBuf.Append(0x00); |
|
9952 expectedBuf.Append(0x80); // encoding for q value ... |
|
9953 expectedBuf.Append(0x83); // ... |
|
9954 expectedBuf.Append(0x31); // ... |
|
9955 iUTContext->SetExpectedL(expectedBuf); |
|
9956 |
|
9957 // Add the Transitions in the order they are to run |
|
9958 // C'tor first, D'tor last... |
|
9959 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
9960 using constructor and destuctor validators */ |
|
9961 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
9962 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
9963 iAcceptGeneralLongInt2ParamsValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
9964 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptGeneralLongInt2ParamsValidator)); |
|
9965 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
9966 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
9967 } |
|
9968 |
|
9969 // ______________________________________________________________________________ |
|
9970 // |
|
9971 _LIT(KWspHeaderWriterAcceptGeneralNullToken3ParamsUnitTest,"CWspHeaderWriter_AcceptGeneralNullToken3Params_UnitTest"); |
|
9972 |
|
9973 CWspHeaderWriter_AcceptGeneralNullToken3Params_UnitTest* CWspHeaderWriter_AcceptGeneralNullToken3Params_UnitTest::NewL(CDataLogger& aDataLogger, |
|
9974 MUnitTestObserver& aObserver) |
|
9975 { |
|
9976 CWspHeaderWriter_AcceptGeneralNullToken3Params_UnitTest* self = |
|
9977 new(ELeave) CWspHeaderWriter_AcceptGeneralNullToken3Params_UnitTest(aDataLogger, |
|
9978 aObserver); |
|
9979 CleanupStack::PushL(self); |
|
9980 self->ConstructL(); |
|
9981 CleanupStack::Pop(self); |
|
9982 return self; |
|
9983 } |
|
9984 |
|
9985 inline TInt CWspHeaderWriter_AcceptGeneralNullToken3Params_UnitTest::RunError(TInt aError) |
|
9986 { |
|
9987 // The RunL left so chain to the base first and then cleanup |
|
9988 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
9989 delete iUTContext; |
|
9990 iUTContext = NULL; |
|
9991 delete iStateAccessor; |
|
9992 iStateAccessor = NULL; |
|
9993 /* delete any validators used */ |
|
9994 delete iCtorValidator; |
|
9995 iCtorValidator = NULL; |
|
9996 delete iAcceptGeneralNullToken3ParamsValidator; |
|
9997 iAcceptGeneralNullToken3ParamsValidator = NULL; |
|
9998 delete iDtorValidator; |
|
9999 iDtorValidator = NULL; |
|
10000 return error; |
|
10001 } |
|
10002 |
|
10003 inline CWspHeaderWriter_AcceptGeneralNullToken3Params_UnitTest::~CWspHeaderWriter_AcceptGeneralNullToken3Params_UnitTest() |
|
10004 { |
|
10005 // Simply delete our test class instance |
|
10006 delete iUTContext; |
|
10007 delete iStateAccessor; |
|
10008 /* delete any validators used */ |
|
10009 delete iCtorValidator; |
|
10010 delete iAcceptGeneralNullToken3ParamsValidator; |
|
10011 delete iDtorValidator; |
|
10012 } |
|
10013 |
|
10014 inline CWspHeaderWriter_AcceptGeneralNullToken3Params_UnitTest::CWspHeaderWriter_AcceptGeneralNullToken3Params_UnitTest(CDataLogger& aDataLogger, |
|
10015 MUnitTestObserver& aObserver) |
|
10016 : CUnitTest(KWspHeaderWriterAcceptGeneralNullToken3ParamsUnitTest, aDataLogger, aObserver) |
|
10017 { |
|
10018 //Do nothing |
|
10019 } |
|
10020 |
|
10021 // Now the Individual transitions need to be added. |
|
10022 inline void CWspHeaderWriter_AcceptGeneralNullToken3Params_UnitTest::ConstructL() |
|
10023 { |
|
10024 // Perform the base class initialization |
|
10025 UnitTestConstructL(); |
|
10026 |
|
10027 // Create the Unit test state accessor |
|
10028 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
10029 // Construct the Unit test context. |
|
10030 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
10031 iUTContext->ConstructL(WSP::EAccept); |
|
10032 |
|
10033 // Part1 |
|
10034 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KNullDesC8); |
|
10035 CleanupClosePushL(stringVal); |
|
10036 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
10037 CleanupStack::PushL(part1); |
|
10038 |
|
10039 // Param1 |
|
10040 _LIT8(KTxtParamName, "my-param"); |
|
10041 _LIT8(KTxtParamVal, "param-value"); |
|
10042 RStringF stringVal1 = iUTContext->iStrPool.OpenFStringL(KTxtParamName); |
|
10043 CleanupClosePushL(stringVal1); |
|
10044 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtParamVal); |
|
10045 CleanupClosePushL(stringVal2); |
|
10046 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(stringVal1, stringVal2); |
|
10047 CleanupStack::PushL(param1); |
|
10048 part1->AddParamL(param1); |
|
10049 CleanupStack::Pop(param1); |
|
10050 |
|
10051 // Param2 |
|
10052 _LIT8(KTxtQName, "Q"); |
|
10053 _LIT8(KTxtQVal, "0.333"); |
|
10054 RStringF stringVal3 = iUTContext->iStrPool.OpenFStringL(KTxtQName); |
|
10055 CleanupClosePushL(stringVal3); |
|
10056 RStringF stringVal4 = iUTContext->iStrPool.OpenFStringL(KTxtQVal); |
|
10057 CleanupClosePushL(stringVal4); |
|
10058 CHeaderFieldParam* param2 = CHeaderFieldParam::NewL(stringVal3, stringVal4); |
|
10059 CleanupStack::PushL(param2); |
|
10060 part1->AddParamL(param2); |
|
10061 CleanupStack::Pop(param2); |
|
10062 |
|
10063 // Param3 |
|
10064 _LIT8(KTxtParam2Name, "Charset"); |
|
10065 _LIT8(KTxtParam2Val, "utf-8"); |
|
10066 RStringF stringVal5 = iUTContext->iStrPool.OpenFStringL(KTxtParam2Name); |
|
10067 CleanupClosePushL(stringVal5); |
|
10068 RStringF stringVal6 = iUTContext->iStrPool.OpenFStringL(KTxtParam2Val); |
|
10069 CleanupClosePushL(stringVal6); |
|
10070 CHeaderFieldParam* param3 = CHeaderFieldParam::NewL(stringVal5, stringVal6); |
|
10071 CleanupStack::PushL(param3); |
|
10072 part1->AddParamL(param3); |
|
10073 CleanupStack::Pop(param3); |
|
10074 |
|
10075 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
10076 CleanupStack::PopAndDestroy(6, &stringVal1); |
|
10077 CleanupStack::Pop(part1); |
|
10078 CleanupStack::PopAndDestroy(&stringVal); |
|
10079 |
|
10080 TBuf8<256> expectedBuf; |
|
10081 expectedBuf.Append(0x1B); // value-length |
|
10082 expectedBuf.Append(0x00); |
|
10083 expectedBuf.Append(KTxtParamName); |
|
10084 expectedBuf.Append(0x00); |
|
10085 expectedBuf.Append(KTxtParamVal); |
|
10086 expectedBuf.Append(0x00); |
|
10087 expectedBuf.Append(0x80); // encoding for q value ... |
|
10088 expectedBuf.Append(0x83); // ... |
|
10089 expectedBuf.Append(0x31); // ... |
|
10090 expectedBuf.Append(0x81); // encoding for charset param ... |
|
10091 expectedBuf.Append(0xEA); // ... utf-8 |
|
10092 iUTContext->SetExpectedL(expectedBuf); |
|
10093 |
|
10094 // Add the Transitions in the order they are to run |
|
10095 // C'tor first, D'tor last... |
|
10096 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
10097 using constructor and destuctor validators */ |
|
10098 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
10099 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
10100 iAcceptGeneralNullToken3ParamsValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
10101 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptGeneralNullToken3ParamsValidator)); |
|
10102 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
10103 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
10104 } |
|
10105 |
|
10106 // ______________________________________________________________________________ |
|
10107 // |
|
10108 _LIT(KWspHeaderWriterCookieVersionUnitTest,"CWspHeaderWriter_CookieVersion_UnitTest"); |
|
10109 |
|
10110 CWspHeaderWriter_CookieVersion_UnitTest* CWspHeaderWriter_CookieVersion_UnitTest::NewL(CDataLogger& aDataLogger, |
|
10111 MUnitTestObserver& aObserver) |
|
10112 { |
|
10113 CWspHeaderWriter_CookieVersion_UnitTest* self = |
|
10114 new(ELeave) CWspHeaderWriter_CookieVersion_UnitTest(aDataLogger, |
|
10115 aObserver); |
|
10116 CleanupStack::PushL(self); |
|
10117 self->ConstructL(); |
|
10118 CleanupStack::Pop(self); |
|
10119 return self; |
|
10120 } |
|
10121 |
|
10122 inline TInt CWspHeaderWriter_CookieVersion_UnitTest::RunError(TInt aError) |
|
10123 { |
|
10124 // The RunL left so chain to the base first and then cleanup |
|
10125 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
10126 delete iUTContext; |
|
10127 iUTContext = NULL; |
|
10128 delete iStateAccessor; |
|
10129 iStateAccessor = NULL; |
|
10130 /* delete any validators used */ |
|
10131 delete iCtorValidator; |
|
10132 iCtorValidator = NULL; |
|
10133 delete iCookieVersionValidator; |
|
10134 iCookieVersionValidator = NULL; |
|
10135 delete iDtorValidator; |
|
10136 iDtorValidator = NULL; |
|
10137 return error; |
|
10138 } |
|
10139 |
|
10140 inline CWspHeaderWriter_CookieVersion_UnitTest::~CWspHeaderWriter_CookieVersion_UnitTest() |
|
10141 { |
|
10142 // Simply delete our test class instance |
|
10143 delete iUTContext; |
|
10144 delete iStateAccessor; |
|
10145 /* delete any validators used */ |
|
10146 delete iCtorValidator; |
|
10147 delete iCookieVersionValidator; |
|
10148 delete iDtorValidator; |
|
10149 } |
|
10150 |
|
10151 inline CWspHeaderWriter_CookieVersion_UnitTest::CWspHeaderWriter_CookieVersion_UnitTest(CDataLogger& aDataLogger, |
|
10152 MUnitTestObserver& aObserver) |
|
10153 : CUnitTest(KWspHeaderWriterCookieVersionUnitTest, aDataLogger, aObserver) |
|
10154 { |
|
10155 //Do nothing |
|
10156 } |
|
10157 |
|
10158 // Now the Individual transitions need to be added. |
|
10159 inline void CWspHeaderWriter_CookieVersion_UnitTest::ConstructL() |
|
10160 { |
|
10161 // Perform the base class initialization |
|
10162 UnitTestConstructL(); |
|
10163 |
|
10164 // Create the Unit test state accessor |
|
10165 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
10166 // Construct the Unit test context. |
|
10167 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
10168 iUTContext->ConstructL(WSP::ECookie); |
|
10169 |
|
10170 // Part1 |
|
10171 _LIT8(KTxtCookie, "1.1"); |
|
10172 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtCookie); |
|
10173 CleanupClosePushL(stringVal); |
|
10174 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
10175 CleanupStack::PushL(part1); |
|
10176 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
10177 CleanupStack::Pop(part1); |
|
10178 CleanupStack::PopAndDestroy(&stringVal); |
|
10179 |
|
10180 TBuf8<256> expectedBuf; |
|
10181 expectedBuf.Append(0x01); |
|
10182 expectedBuf.Append(0x91); // encoded version 1.1 |
|
10183 iUTContext->SetExpectedL(expectedBuf); |
|
10184 |
|
10185 // Add the Transitions in the order they are to run |
|
10186 // C'tor first, D'tor last... |
|
10187 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
10188 using constructor and destuctor validators */ |
|
10189 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
10190 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
10191 iCookieVersionValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
10192 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iCookieVersionValidator)); |
|
10193 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
10194 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
10195 } |
|
10196 |
|
10197 // ______________________________________________________________________________ |
|
10198 // |
|
10199 _LIT(KWspHeaderWriterCookieVersionNameValUnitTest,"CWspHeaderWriter_CookieVersionNameVal_UnitTest"); |
|
10200 |
|
10201 CWspHeaderWriter_CookieVersionNameVal_UnitTest* CWspHeaderWriter_CookieVersionNameVal_UnitTest::NewL(CDataLogger& aDataLogger, |
|
10202 MUnitTestObserver& aObserver) |
|
10203 { |
|
10204 CWspHeaderWriter_CookieVersionNameVal_UnitTest* self = |
|
10205 new(ELeave) CWspHeaderWriter_CookieVersionNameVal_UnitTest(aDataLogger, |
|
10206 aObserver); |
|
10207 CleanupStack::PushL(self); |
|
10208 self->ConstructL(); |
|
10209 CleanupStack::Pop(self); |
|
10210 return self; |
|
10211 } |
|
10212 |
|
10213 inline TInt CWspHeaderWriter_CookieVersionNameVal_UnitTest::RunError(TInt aError) |
|
10214 { |
|
10215 // The RunL left so chain to the base first and then cleanup |
|
10216 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
10217 delete iUTContext; |
|
10218 iUTContext = NULL; |
|
10219 delete iStateAccessor; |
|
10220 iStateAccessor = NULL; |
|
10221 /* delete any validators used */ |
|
10222 delete iCtorValidator; |
|
10223 iCtorValidator = NULL; |
|
10224 delete iCookieVersionNameValValidator; |
|
10225 iCookieVersionNameValValidator = NULL; |
|
10226 delete iDtorValidator; |
|
10227 iDtorValidator = NULL; |
|
10228 return error; |
|
10229 } |
|
10230 |
|
10231 inline CWspHeaderWriter_CookieVersionNameVal_UnitTest::~CWspHeaderWriter_CookieVersionNameVal_UnitTest() |
|
10232 { |
|
10233 // Simply delete our test class instance |
|
10234 delete iUTContext; |
|
10235 delete iStateAccessor; |
|
10236 /* delete any validators used */ |
|
10237 delete iCtorValidator; |
|
10238 delete iCookieVersionNameValValidator; |
|
10239 delete iDtorValidator; |
|
10240 } |
|
10241 |
|
10242 inline CWspHeaderWriter_CookieVersionNameVal_UnitTest::CWspHeaderWriter_CookieVersionNameVal_UnitTest(CDataLogger& aDataLogger, |
|
10243 MUnitTestObserver& aObserver) |
|
10244 : CUnitTest(KWspHeaderWriterCookieVersionNameValUnitTest, aDataLogger, aObserver) |
|
10245 { |
|
10246 //Do nothing |
|
10247 } |
|
10248 |
|
10249 // Now the Individual transitions need to be added. |
|
10250 inline void CWspHeaderWriter_CookieVersionNameVal_UnitTest::ConstructL() |
|
10251 { |
|
10252 // Perform the base class initialization |
|
10253 UnitTestConstructL(); |
|
10254 |
|
10255 // Create the Unit test state accessor |
|
10256 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
10257 // Construct the Unit test context. |
|
10258 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
10259 iUTContext->ConstructL(WSP::ECookie); |
|
10260 |
|
10261 // Part1 |
|
10262 _LIT8(KTxtCookie, "1.1"); |
|
10263 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtCookie); |
|
10264 CleanupClosePushL(stringVal); |
|
10265 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
10266 CleanupStack::PushL(part1); |
|
10267 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
10268 CleanupStack::Pop(part1); |
|
10269 CleanupStack::PopAndDestroy(&stringVal); |
|
10270 |
|
10271 // Part2 |
|
10272 _LIT8(KTxtCookieName, "cookie-name"); // 11 bytes |
|
10273 RStringF nameStr = iUTContext->iStrPool.OpenFStringL(KTxtCookieName); |
|
10274 CleanupClosePushL(nameStr); |
|
10275 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(nameStr); |
|
10276 CleanupStack::PushL(part2); |
|
10277 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
10278 CleanupStack::Pop(part2); |
|
10279 CleanupStack::PopAndDestroy(&nameStr); |
|
10280 |
|
10281 // Part3 |
|
10282 _LIT8(KTxtCookieVal, "cookie-value"); // 12 bytes |
|
10283 RStringF valueStr = iUTContext->iStrPool.OpenFStringL(KTxtCookieVal); |
|
10284 CleanupClosePushL(valueStr); |
|
10285 CHeaderFieldPart* part3 = CHeaderFieldPart::NewL(valueStr); |
|
10286 CleanupStack::PushL(part3); |
|
10287 iUTContext->iTestHeader->SetPartL(part3, 2); |
|
10288 CleanupStack::Pop(part3); |
|
10289 CleanupStack::PopAndDestroy(&valueStr); |
|
10290 |
|
10291 TBuf8<256> expectedBuf; |
|
10292 expectedBuf.Append(0x1B); // value-length |
|
10293 expectedBuf.Append(0x91); // encoded version 1.1 |
|
10294 expectedBuf.Append(0x19); // cookie-length |
|
10295 expectedBuf.Append(KTxtCookieName); |
|
10296 expectedBuf.Append(0x00); |
|
10297 expectedBuf.Append(KTxtCookieVal); |
|
10298 expectedBuf.Append(0x00); |
|
10299 iUTContext->SetExpectedL(expectedBuf); |
|
10300 |
|
10301 // Add the Transitions in the order they are to run |
|
10302 // C'tor first, D'tor last... |
|
10303 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
10304 using constructor and destuctor validators */ |
|
10305 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
10306 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
10307 iCookieVersionNameValValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
10308 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iCookieVersionNameValValidator)); |
|
10309 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
10310 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
10311 } |
|
10312 |
|
10313 // ______________________________________________________________________________ |
|
10314 // |
|
10315 _LIT(KWspHeaderWriterCookieVersionNameNullValPathUnitTest,"CWspHeaderWriter_CookieVersionNameNullValPath_UnitTest"); |
|
10316 |
|
10317 CWspHeaderWriter_CookieVersionNameNullValPath_UnitTest* CWspHeaderWriter_CookieVersionNameNullValPath_UnitTest::NewL(CDataLogger& aDataLogger, |
|
10318 MUnitTestObserver& aObserver) |
|
10319 { |
|
10320 CWspHeaderWriter_CookieVersionNameNullValPath_UnitTest* self = |
|
10321 new(ELeave) CWspHeaderWriter_CookieVersionNameNullValPath_UnitTest(aDataLogger, |
|
10322 aObserver); |
|
10323 CleanupStack::PushL(self); |
|
10324 self->ConstructL(); |
|
10325 CleanupStack::Pop(self); |
|
10326 return self; |
|
10327 } |
|
10328 |
|
10329 inline TInt CWspHeaderWriter_CookieVersionNameNullValPath_UnitTest::RunError(TInt aError) |
|
10330 { |
|
10331 // The RunL left so chain to the base first and then cleanup |
|
10332 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
10333 delete iUTContext; |
|
10334 iUTContext = NULL; |
|
10335 delete iStateAccessor; |
|
10336 iStateAccessor = NULL; |
|
10337 /* delete any validators used */ |
|
10338 delete iCtorValidator; |
|
10339 iCtorValidator = NULL; |
|
10340 delete iCookieVersionNameNullValPathValidator; |
|
10341 iCookieVersionNameNullValPathValidator = NULL; |
|
10342 delete iDtorValidator; |
|
10343 iDtorValidator = NULL; |
|
10344 return error; |
|
10345 } |
|
10346 |
|
10347 inline CWspHeaderWriter_CookieVersionNameNullValPath_UnitTest::~CWspHeaderWriter_CookieVersionNameNullValPath_UnitTest() |
|
10348 { |
|
10349 // Simply delete our test class instance |
|
10350 delete iUTContext; |
|
10351 delete iStateAccessor; |
|
10352 /* delete any validators used */ |
|
10353 delete iCtorValidator; |
|
10354 delete iCookieVersionNameNullValPathValidator; |
|
10355 delete iDtorValidator; |
|
10356 } |
|
10357 |
|
10358 inline CWspHeaderWriter_CookieVersionNameNullValPath_UnitTest::CWspHeaderWriter_CookieVersionNameNullValPath_UnitTest(CDataLogger& aDataLogger, |
|
10359 MUnitTestObserver& aObserver) |
|
10360 : CUnitTest(KWspHeaderWriterCookieVersionNameNullValPathUnitTest, aDataLogger, aObserver) |
|
10361 { |
|
10362 //Do nothing |
|
10363 } |
|
10364 |
|
10365 // Now the Individual transitions need to be added. |
|
10366 inline void CWspHeaderWriter_CookieVersionNameNullValPath_UnitTest::ConstructL() |
|
10367 { |
|
10368 // Perform the base class initialization |
|
10369 UnitTestConstructL(); |
|
10370 |
|
10371 // Create the Unit test state accessor |
|
10372 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
10373 // Construct the Unit test context. |
|
10374 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
10375 iUTContext->ConstructL(WSP::ECookie); |
|
10376 |
|
10377 // Part1 |
|
10378 _LIT8(KTxtCookie, "1.1"); |
|
10379 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtCookie); |
|
10380 CleanupClosePushL(stringVal); |
|
10381 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
10382 CleanupStack::PushL(part1); |
|
10383 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
10384 CleanupStack::Pop(part1); |
|
10385 CleanupStack::PopAndDestroy(&stringVal); |
|
10386 |
|
10387 // Part2 |
|
10388 _LIT8(KTxtCookieName, "cookie-name"); // 11 bytes |
|
10389 RStringF nameStr = iUTContext->iStrPool.OpenFStringL(KTxtCookieName); |
|
10390 CleanupClosePushL(nameStr); |
|
10391 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(nameStr); |
|
10392 CleanupStack::PushL(part2); |
|
10393 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
10394 CleanupStack::Pop(part2); |
|
10395 CleanupStack::PopAndDestroy(&nameStr); |
|
10396 |
|
10397 // Part3 |
|
10398 RStringF valueStr = iUTContext->iStrPool.OpenFStringL(KNullDesC8); |
|
10399 CleanupClosePushL(valueStr); |
|
10400 CHeaderFieldPart* part3 = CHeaderFieldPart::NewL(valueStr); |
|
10401 CleanupStack::PushL(part3); |
|
10402 |
|
10403 // Param1 |
|
10404 _LIT8(KTxtPath, "Path"); |
|
10405 _LIT8(KTxtPathVal, "my-path"); // 7 bytes |
|
10406 RStringF pathStr = iUTContext->iStrPool.OpenFStringL(KTxtPath); |
|
10407 CleanupClosePushL(pathStr); |
|
10408 RStringF pathValStr = iUTContext->iStrPool.OpenFStringL(KTxtPathVal); |
|
10409 CleanupClosePushL(pathValStr); |
|
10410 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(pathStr, pathValStr); |
|
10411 CleanupStack::PushL(param1); |
|
10412 part3->AddParamL(param1); |
|
10413 CleanupStack::Pop(param1); |
|
10414 |
|
10415 iUTContext->iTestHeader->SetPartL(part3, 2); |
|
10416 CleanupStack::PopAndDestroy(2, &pathStr); |
|
10417 CleanupStack::Pop(part3); |
|
10418 CleanupStack::PopAndDestroy(&valueStr); |
|
10419 |
|
10420 TBuf8<256> expectedBuf; |
|
10421 expectedBuf.Append(0x18); // value-length |
|
10422 expectedBuf.Append(0x91); // encoded version 1.1 |
|
10423 expectedBuf.Append(0x16); // cookie-length |
|
10424 expectedBuf.Append(KTxtCookieName); |
|
10425 expectedBuf.Append(0x00); |
|
10426 expectedBuf.Append(0x00); |
|
10427 expectedBuf.Append(0x9D); // encoded 'path' |
|
10428 expectedBuf.Append(KTxtPathVal); |
|
10429 expectedBuf.Append(0x00); |
|
10430 iUTContext->SetExpectedL(expectedBuf); |
|
10431 |
|
10432 // Add the Transitions in the order they are to run |
|
10433 // C'tor first, D'tor last... |
|
10434 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
10435 using constructor and destuctor validators */ |
|
10436 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
10437 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
10438 iCookieVersionNameNullValPathValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
10439 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iCookieVersionNameNullValPathValidator)); |
|
10440 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
10441 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
10442 } |
|
10443 |
|
10444 // ______________________________________________________________________________ |
|
10445 // |
|
10446 _LIT(KWspHeaderWriterCookieVaerionNameValNullPathDomainUnitTest,"CWspHeaderWriter_CookieVaerionNameValNullPathDomain_UnitTest"); |
|
10447 |
|
10448 CWspHeaderWriter_CookieVaerionNameValNullPathDomain_UnitTest* CWspHeaderWriter_CookieVaerionNameValNullPathDomain_UnitTest::NewL(CDataLogger& aDataLogger, |
|
10449 MUnitTestObserver& aObserver) |
|
10450 { |
|
10451 CWspHeaderWriter_CookieVaerionNameValNullPathDomain_UnitTest* self = |
|
10452 new(ELeave) CWspHeaderWriter_CookieVaerionNameValNullPathDomain_UnitTest(aDataLogger, |
|
10453 aObserver); |
|
10454 CleanupStack::PushL(self); |
|
10455 self->ConstructL(); |
|
10456 CleanupStack::Pop(self); |
|
10457 return self; |
|
10458 } |
|
10459 |
|
10460 inline TInt CWspHeaderWriter_CookieVaerionNameValNullPathDomain_UnitTest::RunError(TInt aError) |
|
10461 { |
|
10462 // The RunL left so chain to the base first and then cleanup |
|
10463 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
10464 delete iUTContext; |
|
10465 iUTContext = NULL; |
|
10466 delete iStateAccessor; |
|
10467 iStateAccessor = NULL; |
|
10468 /* delete any validators used */ |
|
10469 delete iCtorValidator; |
|
10470 iCtorValidator = NULL; |
|
10471 delete iCookieVaerionNameValNullPathDomainValidator; |
|
10472 iCookieVaerionNameValNullPathDomainValidator = NULL; |
|
10473 delete iDtorValidator; |
|
10474 iDtorValidator = NULL; |
|
10475 return error; |
|
10476 } |
|
10477 |
|
10478 inline CWspHeaderWriter_CookieVaerionNameValNullPathDomain_UnitTest::~CWspHeaderWriter_CookieVaerionNameValNullPathDomain_UnitTest() |
|
10479 { |
|
10480 // Simply delete our test class instance |
|
10481 delete iUTContext; |
|
10482 delete iStateAccessor; |
|
10483 /* delete any validators used */ |
|
10484 delete iCtorValidator; |
|
10485 delete iCookieVaerionNameValNullPathDomainValidator; |
|
10486 delete iDtorValidator; |
|
10487 } |
|
10488 |
|
10489 inline CWspHeaderWriter_CookieVaerionNameValNullPathDomain_UnitTest::CWspHeaderWriter_CookieVaerionNameValNullPathDomain_UnitTest(CDataLogger& aDataLogger, |
|
10490 MUnitTestObserver& aObserver) |
|
10491 : CUnitTest(KWspHeaderWriterCookieVaerionNameValNullPathDomainUnitTest, aDataLogger, aObserver) |
|
10492 { |
|
10493 //Do nothing |
|
10494 } |
|
10495 |
|
10496 // Now the Individual transitions need to be added. |
|
10497 inline void CWspHeaderWriter_CookieVaerionNameValNullPathDomain_UnitTest::ConstructL() |
|
10498 { |
|
10499 // Perform the base class initialization |
|
10500 UnitTestConstructL(); |
|
10501 |
|
10502 // Create the Unit test state accessor |
|
10503 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
10504 // Construct the Unit test context. |
|
10505 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
10506 iUTContext->ConstructL(WSP::ECookie); |
|
10507 |
|
10508 // Part1 |
|
10509 _LIT8(KTxtCookie, "1.1"); |
|
10510 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtCookie); |
|
10511 CleanupClosePushL(stringVal); |
|
10512 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
10513 CleanupStack::PushL(part1); |
|
10514 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
10515 CleanupStack::Pop(part1); |
|
10516 CleanupStack::PopAndDestroy(&stringVal); |
|
10517 |
|
10518 // Part2 |
|
10519 _LIT8(KTxtCookieName, "cookie-name"); // 11 bytes |
|
10520 RStringF nameStr = iUTContext->iStrPool.OpenFStringL(KTxtCookieName); |
|
10521 CleanupClosePushL(nameStr); |
|
10522 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(nameStr); |
|
10523 CleanupStack::PushL(part2); |
|
10524 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
10525 CleanupStack::Pop(part2); |
|
10526 CleanupStack::PopAndDestroy(&nameStr); |
|
10527 |
|
10528 // Part3 |
|
10529 _LIT8(KTxtCookieValue, "cookie-value"); // 12 bytes |
|
10530 RStringF valueStr = iUTContext->iStrPool.OpenFStringL(KTxtCookieValue); |
|
10531 CleanupClosePushL(valueStr); |
|
10532 CHeaderFieldPart* part3 = CHeaderFieldPart::NewL(valueStr); |
|
10533 CleanupStack::PushL(part3); |
|
10534 |
|
10535 // Param1 |
|
10536 _LIT8(KTxtPath, "Path"); |
|
10537 RStringF pathStr = iUTContext->iStrPool.OpenFStringL(KTxtPath); |
|
10538 CleanupClosePushL(pathStr); |
|
10539 RStringF pathValStr = iUTContext->iStrPool.OpenFStringL(KNullDesC8); |
|
10540 CleanupClosePushL(pathValStr); |
|
10541 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(pathStr, pathValStr); |
|
10542 CleanupStack::PushL(param1); |
|
10543 part3->AddParamL(param1); |
|
10544 CleanupStack::Pop(param1); |
|
10545 |
|
10546 // Param2 |
|
10547 _LIT8(KTxtDomain, "Domain"); |
|
10548 _LIT8(KTxtDomainVal, "my-domain"); // 9 bytes |
|
10549 RStringF domainStr = iUTContext->iStrPool.OpenFStringL(KTxtDomain); |
|
10550 CleanupClosePushL(domainStr); |
|
10551 RStringF domainValStr = iUTContext->iStrPool.OpenFStringL(KTxtDomainVal); |
|
10552 CleanupClosePushL(domainValStr); |
|
10553 CHeaderFieldParam* param2 = CHeaderFieldParam::NewL(domainStr, domainValStr); |
|
10554 CleanupStack::PushL(param2); |
|
10555 part3->AddParamL(param2); |
|
10556 CleanupStack::Pop(param2); |
|
10557 |
|
10558 iUTContext->iTestHeader->SetPartL(part3, 2); |
|
10559 CleanupStack::PopAndDestroy(4, &pathStr); |
|
10560 CleanupStack::Pop(part3); |
|
10561 CleanupStack::PopAndDestroy(&valueStr); |
|
10562 |
|
10563 TBuf8<256> expectedBuf; |
|
10564 expectedBuf.Append(0x1F); // value-length ... |
|
10565 expectedBuf.Append(0x28); // ... |
|
10566 expectedBuf.Append(0x91); // encoded version 1.1 |
|
10567 expectedBuf.Append(0x26); // cookie-length |
|
10568 expectedBuf.Append(KTxtCookieName); |
|
10569 expectedBuf.Append(0x00); |
|
10570 expectedBuf.Append(KTxtCookieValue); |
|
10571 expectedBuf.Append(0x00); |
|
10572 expectedBuf.Append(0x9D); // encoded 'path' |
|
10573 expectedBuf.Append(0x00); |
|
10574 expectedBuf.Append(0x9C); // encoded 'domain' |
|
10575 expectedBuf.Append(KTxtDomainVal); |
|
10576 expectedBuf.Append(0x00); |
|
10577 iUTContext->SetExpectedL(expectedBuf); |
|
10578 |
|
10579 // Add the Transitions in the order they are to run |
|
10580 // C'tor first, D'tor last... |
|
10581 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
10582 using constructor and destuctor validators */ |
|
10583 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
10584 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
10585 iCookieVaerionNameValNullPathDomainValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
10586 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iCookieVaerionNameValNullPathDomainValidator)); |
|
10587 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
10588 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
10589 } |
|
10590 |
|
10591 // ______________________________________________________________________________ |
|
10592 // |
|
10593 _LIT(KWspHeaderWriterAcceptMultiHeaderUnitTest,"CWspHeaderWriter_AcceptMultiHeader_UnitTest"); |
|
10594 |
|
10595 CWspHeaderWriter_AcceptMultiHeader_UnitTest* CWspHeaderWriter_AcceptMultiHeader_UnitTest::NewL(CDataLogger& aDataLogger, |
|
10596 MUnitTestObserver& aObserver) |
|
10597 { |
|
10598 CWspHeaderWriter_AcceptMultiHeader_UnitTest* self = |
|
10599 new(ELeave) CWspHeaderWriter_AcceptMultiHeader_UnitTest(aDataLogger, |
|
10600 aObserver); |
|
10601 CleanupStack::PushL(self); |
|
10602 self->ConstructL(); |
|
10603 CleanupStack::Pop(self); |
|
10604 return self; |
|
10605 } |
|
10606 |
|
10607 inline TInt CWspHeaderWriter_AcceptMultiHeader_UnitTest::RunError(TInt aError) |
|
10608 { |
|
10609 // The RunL left so chain to the base first and then cleanup |
|
10610 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
10611 delete iUTContext; |
|
10612 iUTContext = NULL; |
|
10613 delete iStateAccessor; |
|
10614 iStateAccessor = NULL; |
|
10615 /* delete any validators used */ |
|
10616 delete iCtorValidator; |
|
10617 iCtorValidator = NULL; |
|
10618 delete iAcceptMultiHeaderValidator; |
|
10619 iAcceptMultiHeaderValidator = NULL; |
|
10620 delete iDtorValidator; |
|
10621 iDtorValidator = NULL; |
|
10622 return error; |
|
10623 } |
|
10624 |
|
10625 inline CWspHeaderWriter_AcceptMultiHeader_UnitTest::~CWspHeaderWriter_AcceptMultiHeader_UnitTest() |
|
10626 { |
|
10627 // Simply delete our test class instance |
|
10628 delete iUTContext; |
|
10629 delete iStateAccessor; |
|
10630 /* delete any validators used */ |
|
10631 delete iCtorValidator; |
|
10632 delete iAcceptMultiHeaderValidator; |
|
10633 delete iDtorValidator; |
|
10634 } |
|
10635 |
|
10636 inline CWspHeaderWriter_AcceptMultiHeader_UnitTest::CWspHeaderWriter_AcceptMultiHeader_UnitTest(CDataLogger& aDataLogger, |
|
10637 MUnitTestObserver& aObserver) |
|
10638 : CUnitTest(KWspHeaderWriterAcceptMultiHeaderUnitTest, aDataLogger, aObserver) |
|
10639 { |
|
10640 //Do nothing |
|
10641 } |
|
10642 |
|
10643 // Now the Individual transitions need to be added. |
|
10644 inline void CWspHeaderWriter_AcceptMultiHeader_UnitTest::ConstructL() |
|
10645 { |
|
10646 // Perform the base class initialization |
|
10647 UnitTestConstructL(); |
|
10648 |
|
10649 // Create the Unit test state accessor |
|
10650 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
10651 // Construct the Unit test context. |
|
10652 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
10653 iUTContext->ConstructL(WSP::EAccept); |
|
10654 |
|
10655 // Part1 |
|
10656 _LIT8(KTxtAccept, "multipart/*"); |
|
10657 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtAccept); |
|
10658 CleanupClosePushL(stringVal); |
|
10659 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
10660 CleanupStack::PushL(part1); |
|
10661 |
|
10662 // Param1 |
|
10663 _LIT8(KTxtQName, "Q"); |
|
10664 _LIT8(KTxtQVal, "0.333"); |
|
10665 RStringF stringVal1 = iUTContext->iStrPool.OpenFStringL(KTxtQName); |
|
10666 CleanupClosePushL(stringVal1); |
|
10667 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtQVal); |
|
10668 CleanupClosePushL(stringVal2); |
|
10669 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(stringVal1, stringVal2); |
|
10670 CleanupStack::PushL(param1); |
|
10671 part1->AddParamL(param1); |
|
10672 CleanupStack::Pop(param1); |
|
10673 |
|
10674 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
10675 CleanupStack::PopAndDestroy(2, &stringVal1); |
|
10676 CleanupStack::Pop(part1); |
|
10677 CleanupStack::PopAndDestroy(&stringVal); |
|
10678 |
|
10679 // Part2 |
|
10680 _LIT8(KTxtAccept2, "*/*"); |
|
10681 RStringF stringValPt2 = iUTContext->iStrPool.OpenFStringL(KTxtAccept2); |
|
10682 CleanupClosePushL(stringValPt2); |
|
10683 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringValPt2); |
|
10684 CleanupStack::PushL(part2); |
|
10685 |
|
10686 // Param2 |
|
10687 RStringF stringVal3 = iUTContext->iStrPool.OpenFStringL(KTxtQName); |
|
10688 CleanupClosePushL(stringVal3); |
|
10689 RStringF stringVal4 = iUTContext->iStrPool.OpenFStringL(KTxtQVal); |
|
10690 CleanupClosePushL(stringVal4); |
|
10691 CHeaderFieldParam* param2 = CHeaderFieldParam::NewL(stringVal3, stringVal4); |
|
10692 CleanupStack::PushL(param2); |
|
10693 part2->AddParamL(param2); |
|
10694 CleanupStack::Pop(param2); |
|
10695 |
|
10696 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
10697 CleanupStack::PopAndDestroy(2, &stringVal3); |
|
10698 CleanupStack::Pop(part2); |
|
10699 CleanupStack::PopAndDestroy(&stringValPt2); |
|
10700 |
|
10701 TBuf8<256> expectedBuf; |
|
10702 //Part1 |
|
10703 expectedBuf.Append(0x04); // value-length |
|
10704 expectedBuf.Append(0x8B); // token for 'multipart/*' |
|
10705 expectedBuf.Append(0x80); // token for QVal token |
|
10706 expectedBuf.Append(0x83); // token for '0.333' ... |
|
10707 expectedBuf.Append(0x31); // ... |
|
10708 //Part2 |
|
10709 expectedBuf.Append(0x80); // token for 'Accept' |
|
10710 expectedBuf.Append(0x04); // value-length |
|
10711 expectedBuf.Append(0x80); // token for '*/*' |
|
10712 expectedBuf.Append(0x80); // token for QVal token |
|
10713 expectedBuf.Append(0x83); // token for '0.333' ... |
|
10714 expectedBuf.Append(0x31); // ... |
|
10715 iUTContext->SetExpectedL(expectedBuf); |
|
10716 |
|
10717 // Add the Transitions in the order they are to run |
|
10718 // C'tor first, D'tor last... |
|
10719 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
10720 using constructor and destuctor validators */ |
|
10721 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
10722 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
10723 iAcceptMultiHeaderValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
10724 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptMultiHeaderValidator)); |
|
10725 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
10726 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
10727 } |
|
10728 |
|
10729 // ______________________________________________________________________________ |
|
10730 // |
|
10731 _LIT(KWspHeaderWriterAcceptCharsetMultiHeaderUnitTest,"CWspHeaderWriter_AcceptCharsetMultiHeader_UnitTest"); |
|
10732 |
|
10733 CWspHeaderWriter_AcceptCharsetMultiHeader_UnitTest* CWspHeaderWriter_AcceptCharsetMultiHeader_UnitTest::NewL(CDataLogger& aDataLogger, |
|
10734 MUnitTestObserver& aObserver) |
|
10735 { |
|
10736 CWspHeaderWriter_AcceptCharsetMultiHeader_UnitTest* self = |
|
10737 new(ELeave) CWspHeaderWriter_AcceptCharsetMultiHeader_UnitTest(aDataLogger, |
|
10738 aObserver); |
|
10739 CleanupStack::PushL(self); |
|
10740 self->ConstructL(); |
|
10741 CleanupStack::Pop(self); |
|
10742 return self; |
|
10743 } |
|
10744 |
|
10745 inline TInt CWspHeaderWriter_AcceptCharsetMultiHeader_UnitTest::RunError(TInt aError) |
|
10746 { |
|
10747 // The RunL left so chain to the base first and then cleanup |
|
10748 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
10749 delete iUTContext; |
|
10750 iUTContext = NULL; |
|
10751 delete iStateAccessor; |
|
10752 iStateAccessor = NULL; |
|
10753 /* delete any validators used */ |
|
10754 delete iCtorValidator; |
|
10755 iCtorValidator = NULL; |
|
10756 delete iAcceptCharsetMultiHeaderValidator; |
|
10757 iAcceptCharsetMultiHeaderValidator = NULL; |
|
10758 delete iDtorValidator; |
|
10759 iDtorValidator = NULL; |
|
10760 return error; |
|
10761 } |
|
10762 |
|
10763 inline CWspHeaderWriter_AcceptCharsetMultiHeader_UnitTest::~CWspHeaderWriter_AcceptCharsetMultiHeader_UnitTest() |
|
10764 { |
|
10765 // Simply delete our test class instance |
|
10766 delete iUTContext; |
|
10767 delete iStateAccessor; |
|
10768 /* delete any validators used */ |
|
10769 delete iCtorValidator; |
|
10770 delete iAcceptCharsetMultiHeaderValidator; |
|
10771 delete iDtorValidator; |
|
10772 } |
|
10773 |
|
10774 inline CWspHeaderWriter_AcceptCharsetMultiHeader_UnitTest::CWspHeaderWriter_AcceptCharsetMultiHeader_UnitTest(CDataLogger& aDataLogger, |
|
10775 MUnitTestObserver& aObserver) |
|
10776 : CUnitTest(KWspHeaderWriterAcceptCharsetMultiHeaderUnitTest, aDataLogger, aObserver) |
|
10777 { |
|
10778 //Do nothing |
|
10779 } |
|
10780 |
|
10781 // Now the Individual transitions need to be added. |
|
10782 inline void CWspHeaderWriter_AcceptCharsetMultiHeader_UnitTest::ConstructL() |
|
10783 { |
|
10784 // Perform the base class initialization |
|
10785 UnitTestConstructL(); |
|
10786 |
|
10787 // Create the Unit test state accessor |
|
10788 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
10789 // Construct the Unit test context. |
|
10790 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
10791 iUTContext->ConstructL(WSP::EAcceptCharset); |
|
10792 |
|
10793 // Part1 |
|
10794 _LIT8(KTxtAcceptCharset, "utf-8"); |
|
10795 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtAcceptCharset); |
|
10796 CleanupClosePushL(stringVal); |
|
10797 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
10798 CleanupStack::PushL(part1); |
|
10799 |
|
10800 // Param1 |
|
10801 _LIT8(KTxtQName, "Q"); |
|
10802 _LIT8(KTxtQVal, "0.333"); |
|
10803 RStringF stringVal1 = iUTContext->iStrPool.OpenFStringL(KTxtQName); |
|
10804 CleanupClosePushL(stringVal1); |
|
10805 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtQVal); |
|
10806 CleanupClosePushL(stringVal2); |
|
10807 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(stringVal1, stringVal2); |
|
10808 CleanupStack::PushL(param1); |
|
10809 part1->AddParamL(param1); |
|
10810 CleanupStack::Pop(param1); |
|
10811 |
|
10812 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
10813 CleanupStack::PopAndDestroy(2, &stringVal1); |
|
10814 CleanupStack::Pop(part1); |
|
10815 CleanupStack::PopAndDestroy(&stringVal); |
|
10816 |
|
10817 // Part2 |
|
10818 _LIT8(KTxtAcceptCharset2, "us-ascii"); |
|
10819 RStringF stringValPt2 = iUTContext->iStrPool.OpenFStringL(KTxtAcceptCharset2); |
|
10820 CleanupClosePushL(stringValPt2); |
|
10821 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringValPt2); |
|
10822 CleanupStack::PushL(part2); |
|
10823 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
10824 CleanupStack::Pop(part2); |
|
10825 CleanupStack::PopAndDestroy(&stringValPt2); |
|
10826 |
|
10827 TBuf8<256> expectedBuf; |
|
10828 //Part1 |
|
10829 expectedBuf.Append(0x03); // value-length |
|
10830 expectedBuf.Append(0xEA); // token for 'utf-8' |
|
10831 expectedBuf.Append(0x83); // token for '0.333' ... |
|
10832 expectedBuf.Append(0x31); // ... |
|
10833 //Part2 |
|
10834 expectedBuf.Append(0xBB); // token for 'Accept-charset' |
|
10835 expectedBuf.Append(0x83); // token for 'us-ascii' ... |
|
10836 iUTContext->SetExpectedL(expectedBuf); |
|
10837 |
|
10838 // Add the Transitions in the order they are to run |
|
10839 // C'tor first, D'tor last... |
|
10840 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
10841 using constructor and destuctor validators */ |
|
10842 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
10843 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
10844 iAcceptCharsetMultiHeaderValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
10845 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAcceptCharsetMultiHeaderValidator)); |
|
10846 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
10847 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
10848 } |
|
10849 |
|
10850 // ______________________________________________________________________________ |
|
10851 // |
|
10852 _LIT(KWspHeaderWriterRangeMultiHeaderUnitTest,"CWspHeaderWriter_RangeMultiHeader_UnitTest"); |
|
10853 |
|
10854 CWspHeaderWriter_RangeMultiHeader_UnitTest* CWspHeaderWriter_RangeMultiHeader_UnitTest::NewL(CDataLogger& aDataLogger, |
|
10855 MUnitTestObserver& aObserver) |
|
10856 { |
|
10857 CWspHeaderWriter_RangeMultiHeader_UnitTest* self = |
|
10858 new(ELeave) CWspHeaderWriter_RangeMultiHeader_UnitTest(aDataLogger, |
|
10859 aObserver); |
|
10860 CleanupStack::PushL(self); |
|
10861 self->ConstructL(); |
|
10862 CleanupStack::Pop(self); |
|
10863 return self; |
|
10864 } |
|
10865 |
|
10866 inline TInt CWspHeaderWriter_RangeMultiHeader_UnitTest::RunError(TInt aError) |
|
10867 { |
|
10868 // The RunL left so chain to the base first and then cleanup |
|
10869 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
10870 delete iUTContext; |
|
10871 iUTContext = NULL; |
|
10872 delete iStateAccessor; |
|
10873 iStateAccessor = NULL; |
|
10874 /* delete any validators used */ |
|
10875 delete iCtorValidator; |
|
10876 iCtorValidator = NULL; |
|
10877 delete iRangeMultiHeaderValidator; |
|
10878 iRangeMultiHeaderValidator = NULL; |
|
10879 delete iDtorValidator; |
|
10880 iDtorValidator = NULL; |
|
10881 return error; |
|
10882 } |
|
10883 |
|
10884 inline CWspHeaderWriter_RangeMultiHeader_UnitTest::~CWspHeaderWriter_RangeMultiHeader_UnitTest() |
|
10885 { |
|
10886 // Simply delete our test class instance |
|
10887 delete iUTContext; |
|
10888 delete iStateAccessor; |
|
10889 /* delete any validators used */ |
|
10890 delete iCtorValidator; |
|
10891 delete iRangeMultiHeaderValidator; |
|
10892 delete iDtorValidator; |
|
10893 } |
|
10894 |
|
10895 inline CWspHeaderWriter_RangeMultiHeader_UnitTest::CWspHeaderWriter_RangeMultiHeader_UnitTest(CDataLogger& aDataLogger, |
|
10896 MUnitTestObserver& aObserver) |
|
10897 : CUnitTest(KWspHeaderWriterRangeMultiHeaderUnitTest, aDataLogger, aObserver) |
|
10898 { |
|
10899 //Do nothing |
|
10900 } |
|
10901 |
|
10902 // Now the Individual transitions need to be added. |
|
10903 inline void CWspHeaderWriter_RangeMultiHeader_UnitTest::ConstructL() |
|
10904 { |
|
10905 // Perform the base class initialization |
|
10906 UnitTestConstructL(); |
|
10907 |
|
10908 // Create the Unit test state accessor |
|
10909 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
10910 // Construct the Unit test context. |
|
10911 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
10912 iUTContext->ConstructL(WSP::ERange); |
|
10913 |
|
10914 // Part1 |
|
10915 _LIT8(KTxtRange, "Byte-range"); |
|
10916 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtRange); |
|
10917 CleanupClosePushL(stringVal); |
|
10918 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
10919 CleanupStack::PushL(part1); |
|
10920 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
10921 CleanupStack::Pop(part1); |
|
10922 CleanupStack::PopAndDestroy(&stringVal); |
|
10923 |
|
10924 // Part2 |
|
10925 TInt firstBytePos = 145; |
|
10926 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(firstBytePos); |
|
10927 CleanupStack::PushL(part2); |
|
10928 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
10929 CleanupStack::Pop(part2); |
|
10930 |
|
10931 // Part3 |
|
10932 TInt lastBytePos = 300; |
|
10933 CHeaderFieldPart* part3 = CHeaderFieldPart::NewL(lastBytePos); |
|
10934 CleanupStack::PushL(part3); |
|
10935 iUTContext->iTestHeader->SetPartL(part3, 2); |
|
10936 CleanupStack::Pop(part3); |
|
10937 |
|
10938 // Part4 - new header |
|
10939 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtRange); |
|
10940 CleanupClosePushL(stringVal2); |
|
10941 CHeaderFieldPart* part4 = CHeaderFieldPart::NewL(stringVal2); |
|
10942 CleanupStack::PushL(part4); |
|
10943 iUTContext->iTestHeader->SetPartL(part4, 3); |
|
10944 CleanupStack::Pop(part4); |
|
10945 CleanupStack::PopAndDestroy(&stringVal2); |
|
10946 |
|
10947 // Part5 |
|
10948 TInt firstBytePos2 = 145; |
|
10949 CHeaderFieldPart* part5 = CHeaderFieldPart::NewL(firstBytePos2); |
|
10950 CleanupStack::PushL(part5); |
|
10951 iUTContext->iTestHeader->SetPartL(part5, 4); |
|
10952 CleanupStack::Pop(part5); |
|
10953 |
|
10954 TBuf8<256> expectedBuf; |
|
10955 expectedBuf.Append(0x05); // value length |
|
10956 expectedBuf.Append(0x80); // encoded token for 'byte-range' |
|
10957 expectedBuf.Append(0x81); // value-length for 145 ... |
|
10958 expectedBuf.Append(0x11); // ... |
|
10959 expectedBuf.Append(0x82); // value-length for 300 ... |
|
10960 expectedBuf.Append(0x2C); // ... |
|
10961 |
|
10962 expectedBuf.Append(0xA3); // token for 'range' |
|
10963 expectedBuf.Append(0x03); // value length |
|
10964 expectedBuf.Append(0x80); // encoded token for 'byte-range' |
|
10965 expectedBuf.Append(0x81); // value-length for 145 ... |
|
10966 expectedBuf.Append(0x11); // ... |
|
10967 iUTContext->SetExpectedL(expectedBuf); |
|
10968 |
|
10969 // Add the Transitions in the order they are to run |
|
10970 // C'tor first, D'tor last... |
|
10971 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
10972 using constructor and destuctor validators */ |
|
10973 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
10974 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
10975 iRangeMultiHeaderValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
10976 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iRangeMultiHeaderValidator)); |
|
10977 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
10978 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
10979 } |
|
10980 |
|
10981 // ______________________________________________________________________________ |
|
10982 // |
|
10983 _LIT(KWspHeaderWriterTEMultiHeaderUnitTest,"CWspHeaderWriter_TEMultiHeader_UnitTest"); |
|
10984 |
|
10985 CWspHeaderWriter_TEMultiHeader_UnitTest* CWspHeaderWriter_TEMultiHeader_UnitTest::NewL(CDataLogger& aDataLogger, |
|
10986 MUnitTestObserver& aObserver) |
|
10987 { |
|
10988 CWspHeaderWriter_TEMultiHeader_UnitTest* self = |
|
10989 new(ELeave) CWspHeaderWriter_TEMultiHeader_UnitTest(aDataLogger, |
|
10990 aObserver); |
|
10991 CleanupStack::PushL(self); |
|
10992 self->ConstructL(); |
|
10993 CleanupStack::Pop(self); |
|
10994 return self; |
|
10995 } |
|
10996 |
|
10997 inline TInt CWspHeaderWriter_TEMultiHeader_UnitTest::RunError(TInt aError) |
|
10998 { |
|
10999 // The RunL left so chain to the base first and then cleanup |
|
11000 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
11001 delete iUTContext; |
|
11002 iUTContext = NULL; |
|
11003 delete iStateAccessor; |
|
11004 iStateAccessor = NULL; |
|
11005 /* delete any validators used */ |
|
11006 delete iCtorValidator; |
|
11007 iCtorValidator = NULL; |
|
11008 delete iTEMultiHeaderValidator; |
|
11009 iTEMultiHeaderValidator = NULL; |
|
11010 delete iDtorValidator; |
|
11011 iDtorValidator = NULL; |
|
11012 return error; |
|
11013 } |
|
11014 |
|
11015 inline CWspHeaderWriter_TEMultiHeader_UnitTest::~CWspHeaderWriter_TEMultiHeader_UnitTest() |
|
11016 { |
|
11017 // Simply delete our test class instance |
|
11018 delete iUTContext; |
|
11019 delete iStateAccessor; |
|
11020 /* delete any validators used */ |
|
11021 delete iCtorValidator; |
|
11022 delete iTEMultiHeaderValidator; |
|
11023 delete iDtorValidator; |
|
11024 } |
|
11025 |
|
11026 inline CWspHeaderWriter_TEMultiHeader_UnitTest::CWspHeaderWriter_TEMultiHeader_UnitTest(CDataLogger& aDataLogger, |
|
11027 MUnitTestObserver& aObserver) |
|
11028 : CUnitTest(KWspHeaderWriterTEMultiHeaderUnitTest, aDataLogger, aObserver) |
|
11029 { |
|
11030 //Do nothing |
|
11031 } |
|
11032 |
|
11033 // Now the Individual transitions need to be added. |
|
11034 inline void CWspHeaderWriter_TEMultiHeader_UnitTest::ConstructL() |
|
11035 { |
|
11036 // Perform the base class initialization |
|
11037 UnitTestConstructL(); |
|
11038 |
|
11039 // Create the Unit test state accessor |
|
11040 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
11041 // Construct the Unit test context. |
|
11042 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
11043 iUTContext->ConstructL(WSP::ETE); |
|
11044 |
|
11045 // Part1 |
|
11046 _LIT8(KTxtTE, "Trailers"); |
|
11047 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTE); |
|
11048 CleanupClosePushL(stringVal); |
|
11049 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
11050 CleanupStack::PushL(part1); |
|
11051 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
11052 CleanupStack::Pop(part1); |
|
11053 CleanupStack::PopAndDestroy(&stringVal); |
|
11054 |
|
11055 // Part2 |
|
11056 _LIT8(KTxtTE2, "Chunked"); |
|
11057 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtTE2); |
|
11058 CleanupClosePushL(stringVal2); |
|
11059 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringVal2); |
|
11060 CleanupStack::PushL(part2); |
|
11061 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
11062 CleanupStack::Pop(part2); |
|
11063 CleanupStack::PopAndDestroy(&stringVal2); |
|
11064 |
|
11065 TBuf8<256> expectedBuf; |
|
11066 expectedBuf.Append(0x81); // encoded token for trailers |
|
11067 expectedBuf.Append(0xB9); // encoded token for TE |
|
11068 expectedBuf.Append(0x01); // value length |
|
11069 expectedBuf.Append(0x82); // encoded token for chunked |
|
11070 iUTContext->SetExpectedL(expectedBuf); |
|
11071 |
|
11072 // Add the Transitions in the order they are to run |
|
11073 // C'tor first, D'tor last... |
|
11074 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
11075 using constructor and destuctor validators */ |
|
11076 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
11077 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
11078 iTEMultiHeaderValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
11079 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iTEMultiHeaderValidator)); |
|
11080 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
11081 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
11082 } |
|
11083 |
|
11084 // ______________________________________________________________________________ |
|
11085 // |
|
11086 _LIT(KWspHeaderWriterTrailerMultiHeaderUnitTest,"CWspHeaderWriter_TrailerMultiHeader_UnitTest"); |
|
11087 |
|
11088 CWspHeaderWriter_TrailerMultiHeader_UnitTest* CWspHeaderWriter_TrailerMultiHeader_UnitTest::NewL(CDataLogger& aDataLogger, |
|
11089 MUnitTestObserver& aObserver) |
|
11090 { |
|
11091 CWspHeaderWriter_TrailerMultiHeader_UnitTest* self = |
|
11092 new(ELeave) CWspHeaderWriter_TrailerMultiHeader_UnitTest(aDataLogger, |
|
11093 aObserver); |
|
11094 CleanupStack::PushL(self); |
|
11095 self->ConstructL(); |
|
11096 CleanupStack::Pop(self); |
|
11097 return self; |
|
11098 } |
|
11099 |
|
11100 inline TInt CWspHeaderWriter_TrailerMultiHeader_UnitTest::RunError(TInt aError) |
|
11101 { |
|
11102 // The RunL left so chain to the base first and then cleanup |
|
11103 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
11104 delete iUTContext; |
|
11105 iUTContext = NULL; |
|
11106 delete iStateAccessor; |
|
11107 iStateAccessor = NULL; |
|
11108 /* delete any validators used */ |
|
11109 delete iCtorValidator; |
|
11110 iCtorValidator = NULL; |
|
11111 delete iTrailerMultiHeaderValidator; |
|
11112 iTrailerMultiHeaderValidator = NULL; |
|
11113 delete iDtorValidator; |
|
11114 iDtorValidator = NULL; |
|
11115 return error; |
|
11116 } |
|
11117 |
|
11118 inline CWspHeaderWriter_TrailerMultiHeader_UnitTest::~CWspHeaderWriter_TrailerMultiHeader_UnitTest() |
|
11119 { |
|
11120 // Simply delete our test class instance |
|
11121 delete iUTContext; |
|
11122 delete iStateAccessor; |
|
11123 /* delete any validators used */ |
|
11124 delete iCtorValidator; |
|
11125 delete iTrailerMultiHeaderValidator; |
|
11126 delete iDtorValidator; |
|
11127 } |
|
11128 |
|
11129 inline CWspHeaderWriter_TrailerMultiHeader_UnitTest::CWspHeaderWriter_TrailerMultiHeader_UnitTest(CDataLogger& aDataLogger, |
|
11130 MUnitTestObserver& aObserver) |
|
11131 : CUnitTest(KWspHeaderWriterTrailerMultiHeaderUnitTest, aDataLogger, aObserver) |
|
11132 { |
|
11133 //Do nothing |
|
11134 } |
|
11135 |
|
11136 // Now the Individual transitions need to be added. |
|
11137 inline void CWspHeaderWriter_TrailerMultiHeader_UnitTest::ConstructL() |
|
11138 { |
|
11139 // Perform the base class initialization |
|
11140 UnitTestConstructL(); |
|
11141 |
|
11142 // Create the Unit test state accessor |
|
11143 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
11144 // Construct the Unit test context. |
|
11145 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
11146 iUTContext->ConstructL(WSP::ETrailer); |
|
11147 |
|
11148 // Part1 |
|
11149 _LIT8(KTxtTrailer, "Accept"); |
|
11150 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTrailer); |
|
11151 CleanupClosePushL(stringVal); |
|
11152 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
11153 CleanupStack::PushL(part1); |
|
11154 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
11155 CleanupStack::Pop(part1); |
|
11156 CleanupStack::PopAndDestroy(&stringVal); |
|
11157 |
|
11158 // Part2 |
|
11159 _LIT8(KTxtTrailer2, "my-new-field"); |
|
11160 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtTrailer2); |
|
11161 CleanupClosePushL(stringVal2); |
|
11162 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringVal2); |
|
11163 CleanupStack::PushL(part2); |
|
11164 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
11165 CleanupStack::Pop(part2); |
|
11166 CleanupStack::PopAndDestroy(&stringVal2); |
|
11167 |
|
11168 TBuf8<256> expectedBuf; |
|
11169 expectedBuf.Append(0x80); // encoding for 'accept' |
|
11170 expectedBuf.Append(0xBA); // encoding for 'Trailer' |
|
11171 expectedBuf.Append(KTxtTrailer2); |
|
11172 expectedBuf.Append(0x00); |
|
11173 iUTContext->SetExpectedL(expectedBuf); |
|
11174 |
|
11175 // Add the Transitions in the order they are to run |
|
11176 // C'tor first, D'tor last... |
|
11177 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
11178 using constructor and destuctor validators */ |
|
11179 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
11180 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
11181 iTrailerMultiHeaderValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
11182 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iTrailerMultiHeaderValidator)); |
|
11183 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
11184 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
11185 } |
|
11186 |
|
11187 // ______________________________________________________________________________ |
|
11188 // |
|
11189 _LIT(KWspHeaderWriterViaMultiHeaderUnitTest,"CWspHeaderWriter_ViaMultiHeader_UnitTest"); |
|
11190 |
|
11191 CWspHeaderWriter_ViaMultiHeader_UnitTest* CWspHeaderWriter_ViaMultiHeader_UnitTest::NewL(CDataLogger& aDataLogger, |
|
11192 MUnitTestObserver& aObserver) |
|
11193 { |
|
11194 CWspHeaderWriter_ViaMultiHeader_UnitTest* self = |
|
11195 new(ELeave) CWspHeaderWriter_ViaMultiHeader_UnitTest(aDataLogger, |
|
11196 aObserver); |
|
11197 CleanupStack::PushL(self); |
|
11198 self->ConstructL(); |
|
11199 CleanupStack::Pop(self); |
|
11200 return self; |
|
11201 } |
|
11202 |
|
11203 inline TInt CWspHeaderWriter_ViaMultiHeader_UnitTest::RunError(TInt aError) |
|
11204 { |
|
11205 // The RunL left so chain to the base first and then cleanup |
|
11206 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
11207 delete iUTContext; |
|
11208 iUTContext = NULL; |
|
11209 delete iStateAccessor; |
|
11210 iStateAccessor = NULL; |
|
11211 /* delete any validators used */ |
|
11212 delete iCtorValidator; |
|
11213 iCtorValidator = NULL; |
|
11214 delete iViaMultiHeaderValidator; |
|
11215 iViaMultiHeaderValidator = NULL; |
|
11216 delete iDtorValidator; |
|
11217 iDtorValidator = NULL; |
|
11218 return error; |
|
11219 } |
|
11220 |
|
11221 inline CWspHeaderWriter_ViaMultiHeader_UnitTest::~CWspHeaderWriter_ViaMultiHeader_UnitTest() |
|
11222 { |
|
11223 // Simply delete our test class instance |
|
11224 delete iUTContext; |
|
11225 delete iStateAccessor; |
|
11226 /* delete any validators used */ |
|
11227 delete iCtorValidator; |
|
11228 delete iViaMultiHeaderValidator; |
|
11229 delete iDtorValidator; |
|
11230 } |
|
11231 |
|
11232 inline CWspHeaderWriter_ViaMultiHeader_UnitTest::CWspHeaderWriter_ViaMultiHeader_UnitTest(CDataLogger& aDataLogger, |
|
11233 MUnitTestObserver& aObserver) |
|
11234 : CUnitTest(KWspHeaderWriterViaMultiHeaderUnitTest, aDataLogger, aObserver) |
|
11235 { |
|
11236 //Do nothing |
|
11237 } |
|
11238 |
|
11239 // Now the Individual transitions need to be added. |
|
11240 inline void CWspHeaderWriter_ViaMultiHeader_UnitTest::ConstructL() |
|
11241 { |
|
11242 // Perform the base class initialization |
|
11243 UnitTestConstructL(); |
|
11244 |
|
11245 // Create the Unit test state accessor |
|
11246 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
11247 // Construct the Unit test context. |
|
11248 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
11249 iUTContext->ConstructL(WSP::EVia); |
|
11250 |
|
11251 // Part1 |
|
11252 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KNullDesC8); |
|
11253 CleanupClosePushL(stringVal); |
|
11254 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
11255 CleanupStack::PushL(part1); |
|
11256 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
11257 CleanupStack::Pop(part1); |
|
11258 CleanupStack::PopAndDestroy(&stringVal); |
|
11259 |
|
11260 // Part2 |
|
11261 _LIT8(KTxtVia, "go-via-me"); |
|
11262 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtVia); |
|
11263 CleanupClosePushL(stringVal2); |
|
11264 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringVal2); |
|
11265 CleanupStack::PushL(part2); |
|
11266 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
11267 CleanupStack::Pop(part2); |
|
11268 CleanupStack::PopAndDestroy(&stringVal2); |
|
11269 |
|
11270 TBuf8<256> expectedBuf; |
|
11271 expectedBuf.Append(0x00); // null terminator |
|
11272 expectedBuf.Append(0xAB); // encoding for 'Via' |
|
11273 expectedBuf.Append(KTxtVia); |
|
11274 expectedBuf.Append(0x00); |
|
11275 iUTContext->SetExpectedL(expectedBuf); |
|
11276 |
|
11277 // Add the Transitions in the order they are to run |
|
11278 // C'tor first, D'tor last... |
|
11279 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
11280 using constructor and destuctor validators */ |
|
11281 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
11282 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
11283 iViaMultiHeaderValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
11284 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iViaMultiHeaderValidator)); |
|
11285 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
11286 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
11287 } |
|
11288 |
|
11289 // ______________________________________________________________________________ |
|
11290 // |
|
11291 _LIT(KWspHeaderWriterAllowMultiHeaderUnitTest,"CWspHeaderWriter_AllowMultiHeader_UnitTest"); |
|
11292 |
|
11293 CWspHeaderWriter_AllowMultiHeader_UnitTest* CWspHeaderWriter_AllowMultiHeader_UnitTest::NewL(CDataLogger& aDataLogger, |
|
11294 MUnitTestObserver& aObserver) |
|
11295 { |
|
11296 CWspHeaderWriter_AllowMultiHeader_UnitTest* self = |
|
11297 new(ELeave) CWspHeaderWriter_AllowMultiHeader_UnitTest(aDataLogger, |
|
11298 aObserver); |
|
11299 CleanupStack::PushL(self); |
|
11300 self->ConstructL(); |
|
11301 CleanupStack::Pop(self); |
|
11302 return self; |
|
11303 } |
|
11304 |
|
11305 inline TInt CWspHeaderWriter_AllowMultiHeader_UnitTest::RunError(TInt aError) |
|
11306 { |
|
11307 // The RunL left so chain to the base first and then cleanup |
|
11308 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
11309 delete iUTContext; |
|
11310 iUTContext = NULL; |
|
11311 delete iStateAccessor; |
|
11312 iStateAccessor = NULL; |
|
11313 /* delete any validators used */ |
|
11314 delete iCtorValidator; |
|
11315 iCtorValidator = NULL; |
|
11316 delete iAllowMultiHeaderValidator; |
|
11317 iAllowMultiHeaderValidator = NULL; |
|
11318 delete iDtorValidator; |
|
11319 iDtorValidator = NULL; |
|
11320 return error; |
|
11321 } |
|
11322 |
|
11323 inline CWspHeaderWriter_AllowMultiHeader_UnitTest::~CWspHeaderWriter_AllowMultiHeader_UnitTest() |
|
11324 { |
|
11325 // Simply delete our test class instance |
|
11326 delete iUTContext; |
|
11327 delete iStateAccessor; |
|
11328 /* delete any validators used */ |
|
11329 delete iCtorValidator; |
|
11330 delete iAllowMultiHeaderValidator; |
|
11331 delete iDtorValidator; |
|
11332 } |
|
11333 |
|
11334 inline CWspHeaderWriter_AllowMultiHeader_UnitTest::CWspHeaderWriter_AllowMultiHeader_UnitTest(CDataLogger& aDataLogger, |
|
11335 MUnitTestObserver& aObserver) |
|
11336 : CUnitTest(KWspHeaderWriterAllowMultiHeaderUnitTest, aDataLogger, aObserver) |
|
11337 { |
|
11338 //Do nothing |
|
11339 } |
|
11340 |
|
11341 // Now the Individual transitions need to be added. |
|
11342 inline void CWspHeaderWriter_AllowMultiHeader_UnitTest::ConstructL() |
|
11343 { |
|
11344 // Perform the base class initialization |
|
11345 UnitTestConstructL(); |
|
11346 |
|
11347 // Create the Unit test state accessor |
|
11348 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
11349 // Construct the Unit test context. |
|
11350 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
11351 iUTContext->ConstructL(WSP::EAllow); |
|
11352 |
|
11353 // Part1 |
|
11354 _LIT8(KTxtAllow, "Get"); |
|
11355 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtAllow); |
|
11356 CleanupClosePushL(stringVal); |
|
11357 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
11358 CleanupStack::PushL(part1); |
|
11359 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
11360 CleanupStack::Pop(part1); |
|
11361 CleanupStack::PopAndDestroy(&stringVal); |
|
11362 |
|
11363 // Part2 |
|
11364 _LIT8(KTxtAllow2, "Post"); |
|
11365 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtAllow2); |
|
11366 CleanupClosePushL(stringVal2); |
|
11367 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringVal2); |
|
11368 CleanupStack::PushL(part2); |
|
11369 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
11370 CleanupStack::Pop(part2); |
|
11371 CleanupStack::PopAndDestroy(&stringVal2); |
|
11372 |
|
11373 TBuf8<256> expectedBuf; |
|
11374 expectedBuf.Append(0xC0); // token for 'Get' |
|
11375 expectedBuf.Append(0x86); // encoding for 'Allow' |
|
11376 expectedBuf.Append(0xE0); // token for 'Post' |
|
11377 iUTContext->SetExpectedL(expectedBuf); |
|
11378 |
|
11379 // Add the Transitions in the order they are to run |
|
11380 // C'tor first, D'tor last... |
|
11381 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
11382 using constructor and destuctor validators */ |
|
11383 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
11384 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
11385 iAllowMultiHeaderValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
11386 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iAllowMultiHeaderValidator)); |
|
11387 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
11388 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
11389 } |
|
11390 |
|
11391 // ______________________________________________________________________________ |
|
11392 // |
|
11393 _LIT(KWspHeaderWriterContentEncodingMultiHeaderUnitTest,"CWspHeaderWriter_ContentEncodingMultiHeader_UnitTest"); |
|
11394 |
|
11395 CWspHeaderWriter_ContentEncodingMultiHeader_UnitTest* CWspHeaderWriter_ContentEncodingMultiHeader_UnitTest::NewL(CDataLogger& aDataLogger, |
|
11396 MUnitTestObserver& aObserver) |
|
11397 { |
|
11398 CWspHeaderWriter_ContentEncodingMultiHeader_UnitTest* self = |
|
11399 new(ELeave) CWspHeaderWriter_ContentEncodingMultiHeader_UnitTest(aDataLogger, |
|
11400 aObserver); |
|
11401 CleanupStack::PushL(self); |
|
11402 self->ConstructL(); |
|
11403 CleanupStack::Pop(self); |
|
11404 return self; |
|
11405 } |
|
11406 |
|
11407 inline TInt CWspHeaderWriter_ContentEncodingMultiHeader_UnitTest::RunError(TInt aError) |
|
11408 { |
|
11409 // The RunL left so chain to the base first and then cleanup |
|
11410 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
11411 delete iUTContext; |
|
11412 iUTContext = NULL; |
|
11413 delete iStateAccessor; |
|
11414 iStateAccessor = NULL; |
|
11415 /* delete any validators used */ |
|
11416 delete iCtorValidator; |
|
11417 iCtorValidator = NULL; |
|
11418 delete iContentEncodingMultiHeaderValidator; |
|
11419 iContentEncodingMultiHeaderValidator = NULL; |
|
11420 delete iDtorValidator; |
|
11421 iDtorValidator = NULL; |
|
11422 return error; |
|
11423 } |
|
11424 |
|
11425 inline CWspHeaderWriter_ContentEncodingMultiHeader_UnitTest::~CWspHeaderWriter_ContentEncodingMultiHeader_UnitTest() |
|
11426 { |
|
11427 // Simply delete our test class instance |
|
11428 delete iUTContext; |
|
11429 delete iStateAccessor; |
|
11430 /* delete any validators used */ |
|
11431 delete iCtorValidator; |
|
11432 delete iContentEncodingMultiHeaderValidator; |
|
11433 delete iDtorValidator; |
|
11434 } |
|
11435 |
|
11436 inline CWspHeaderWriter_ContentEncodingMultiHeader_UnitTest::CWspHeaderWriter_ContentEncodingMultiHeader_UnitTest(CDataLogger& aDataLogger, |
|
11437 MUnitTestObserver& aObserver) |
|
11438 : CUnitTest(KWspHeaderWriterContentEncodingMultiHeaderUnitTest, aDataLogger, aObserver) |
|
11439 { |
|
11440 //Do nothing |
|
11441 } |
|
11442 |
|
11443 // Now the Individual transitions need to be added. |
|
11444 inline void CWspHeaderWriter_ContentEncodingMultiHeader_UnitTest::ConstructL() |
|
11445 { |
|
11446 // Perform the base class initialization |
|
11447 UnitTestConstructL(); |
|
11448 |
|
11449 // Create the Unit test state accessor |
|
11450 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
11451 // Construct the Unit test context. |
|
11452 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
11453 iUTContext->ConstructL(WSP::EContentEncoding); |
|
11454 |
|
11455 // Part1 |
|
11456 _LIT8(KTxtContentEnc, "Gzip"); |
|
11457 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtContentEnc); |
|
11458 CleanupClosePushL(stringVal); |
|
11459 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
11460 CleanupStack::PushL(part1); |
|
11461 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
11462 CleanupStack::Pop(part1); |
|
11463 CleanupStack::PopAndDestroy(&stringVal); |
|
11464 |
|
11465 // Part2 |
|
11466 _LIT8(KTxtContentEnc2, "Deflate"); |
|
11467 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtContentEnc2); |
|
11468 CleanupClosePushL(stringVal2); |
|
11469 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringVal2); |
|
11470 CleanupStack::PushL(part2); |
|
11471 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
11472 CleanupStack::Pop(part2); |
|
11473 CleanupStack::PopAndDestroy(&stringVal2); |
|
11474 |
|
11475 TBuf8<256> expectedBuf; |
|
11476 expectedBuf.Append(0x80); // token for 'gzip' |
|
11477 expectedBuf.Append(0x8B); // encoding for 'content-encoding' |
|
11478 expectedBuf.Append(0x82); // token for 'deflate' |
|
11479 iUTContext->SetExpectedL(expectedBuf); |
|
11480 |
|
11481 // Add the Transitions in the order they are to run |
|
11482 // C'tor first, D'tor last... |
|
11483 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
11484 using constructor and destuctor validators */ |
|
11485 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
11486 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
11487 iContentEncodingMultiHeaderValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
11488 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iContentEncodingMultiHeaderValidator)); |
|
11489 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
11490 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
11491 } |
|
11492 |
|
11493 // ______________________________________________________________________________ |
|
11494 // |
|
11495 _LIT(KWspHeaderWriterUnknownHeaderUnitTest,"CWspHeaderWriter_UnknownHeader_UnitTest"); |
|
11496 |
|
11497 CWspHeaderWriter_UnknownHeader_UnitTest* CWspHeaderWriter_UnknownHeader_UnitTest::NewL(CDataLogger& aDataLogger, |
|
11498 MUnitTestObserver& aObserver) |
|
11499 { |
|
11500 CWspHeaderWriter_UnknownHeader_UnitTest* self = |
|
11501 new(ELeave) CWspHeaderWriter_UnknownHeader_UnitTest(aDataLogger, |
|
11502 aObserver); |
|
11503 CleanupStack::PushL(self); |
|
11504 self->ConstructL(); |
|
11505 CleanupStack::Pop(self); |
|
11506 return self; |
|
11507 } |
|
11508 |
|
11509 inline TInt CWspHeaderWriter_UnknownHeader_UnitTest::RunError(TInt aError) |
|
11510 { |
|
11511 // The RunL left so chain to the base first and then cleanup |
|
11512 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
11513 delete iUTContext; |
|
11514 iUTContext = NULL; |
|
11515 delete iStateAccessor; |
|
11516 iStateAccessor = NULL; |
|
11517 /* delete any validators used */ |
|
11518 delete iCtorValidator; |
|
11519 iCtorValidator = NULL; |
|
11520 delete iUnknownHeaderValidator; |
|
11521 iUnknownHeaderValidator = NULL; |
|
11522 delete iDtorValidator; |
|
11523 iDtorValidator = NULL; |
|
11524 return error; |
|
11525 } |
|
11526 |
|
11527 inline CWspHeaderWriter_UnknownHeader_UnitTest::~CWspHeaderWriter_UnknownHeader_UnitTest() |
|
11528 { |
|
11529 // Simply delete our test class instance |
|
11530 delete iUTContext; |
|
11531 delete iStateAccessor; |
|
11532 /* delete any validators used */ |
|
11533 delete iCtorValidator; |
|
11534 delete iUnknownHeaderValidator; |
|
11535 delete iDtorValidator; |
|
11536 } |
|
11537 |
|
11538 inline CWspHeaderWriter_UnknownHeader_UnitTest::CWspHeaderWriter_UnknownHeader_UnitTest(CDataLogger& aDataLogger, |
|
11539 MUnitTestObserver& aObserver) |
|
11540 : CUnitTest(KWspHeaderWriterUnknownHeaderUnitTest, aDataLogger, aObserver) |
|
11541 { |
|
11542 //Do nothing |
|
11543 } |
|
11544 |
|
11545 // Now the Individual transitions need to be added. |
|
11546 inline void CWspHeaderWriter_UnknownHeader_UnitTest::ConstructL() |
|
11547 { |
|
11548 // Perform the base class initialization |
|
11549 UnitTestConstructL(); |
|
11550 |
|
11551 // Create the Unit test state accessor |
|
11552 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
11553 // Construct the Unit test context. |
|
11554 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
11555 iUTContext->ConstructL(KErrNotFound); |
|
11556 |
|
11557 // Part1 |
|
11558 _LIT8(KTxtTestData, "This is test data"); |
|
11559 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTestData); |
|
11560 CleanupClosePushL(stringVal); |
|
11561 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
11562 CleanupStack::PushL(part1); |
|
11563 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
11564 CleanupStack::Pop(part1); |
|
11565 CleanupStack::PopAndDestroy(&stringVal); |
|
11566 |
|
11567 TBuf8<256> expectedBuf; |
|
11568 expectedBuf.Append(KTxtTestData); |
|
11569 expectedBuf.Append(0x00); |
|
11570 iUTContext->SetExpectedL(expectedBuf); |
|
11571 |
|
11572 // Add the Transitions in the order they are to run |
|
11573 // C'tor first, D'tor last... |
|
11574 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
11575 using constructor and destuctor validators */ |
|
11576 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
11577 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
11578 iUnknownHeaderValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
11579 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iUnknownHeaderValidator)); |
|
11580 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
11581 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
11582 } |
|
11583 |
|
11584 // ______________________________________________________________________________ |
|
11585 // |
|
11586 _LIT(KWspHeaderWriterUnknownNullHeaderUnitTest,"CWspHeaderWriter_UnknownNullHeader_UnitTest"); |
|
11587 |
|
11588 CWspHeaderWriter_UnknownNullHeader_UnitTest* CWspHeaderWriter_UnknownNullHeader_UnitTest::NewL(CDataLogger& aDataLogger, |
|
11589 MUnitTestObserver& aObserver) |
|
11590 { |
|
11591 CWspHeaderWriter_UnknownNullHeader_UnitTest* self = |
|
11592 new(ELeave) CWspHeaderWriter_UnknownNullHeader_UnitTest(aDataLogger, |
|
11593 aObserver); |
|
11594 CleanupStack::PushL(self); |
|
11595 self->ConstructL(); |
|
11596 CleanupStack::Pop(self); |
|
11597 return self; |
|
11598 } |
|
11599 |
|
11600 inline TInt CWspHeaderWriter_UnknownNullHeader_UnitTest::RunError(TInt aError) |
|
11601 { |
|
11602 // The RunL left so chain to the base first and then cleanup |
|
11603 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
11604 delete iUTContext; |
|
11605 iUTContext = NULL; |
|
11606 delete iStateAccessor; |
|
11607 iStateAccessor = NULL; |
|
11608 /* delete any validators used */ |
|
11609 delete iCtorValidator; |
|
11610 iCtorValidator = NULL; |
|
11611 delete iUnknownNullHeaderValidator; |
|
11612 iUnknownNullHeaderValidator = NULL; |
|
11613 delete iDtorValidator; |
|
11614 iDtorValidator = NULL; |
|
11615 return error; |
|
11616 } |
|
11617 |
|
11618 inline CWspHeaderWriter_UnknownNullHeader_UnitTest::~CWspHeaderWriter_UnknownNullHeader_UnitTest() |
|
11619 { |
|
11620 // Simply delete our test class instance |
|
11621 delete iUTContext; |
|
11622 delete iStateAccessor; |
|
11623 /* delete any validators used */ |
|
11624 delete iCtorValidator; |
|
11625 delete iUnknownNullHeaderValidator; |
|
11626 delete iDtorValidator; |
|
11627 } |
|
11628 |
|
11629 inline CWspHeaderWriter_UnknownNullHeader_UnitTest::CWspHeaderWriter_UnknownNullHeader_UnitTest(CDataLogger& aDataLogger, |
|
11630 MUnitTestObserver& aObserver) |
|
11631 : CUnitTest(KWspHeaderWriterUnknownNullHeaderUnitTest, aDataLogger, aObserver) |
|
11632 { |
|
11633 //Do nothing |
|
11634 } |
|
11635 |
|
11636 // Now the Individual transitions need to be added. |
|
11637 inline void CWspHeaderWriter_UnknownNullHeader_UnitTest::ConstructL() |
|
11638 { |
|
11639 // Perform the base class initialization |
|
11640 UnitTestConstructL(); |
|
11641 |
|
11642 // Create the Unit test state accessor |
|
11643 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
11644 // Construct the Unit test context. |
|
11645 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
11646 iUTContext->ConstructL(KErrNotFound); |
|
11647 |
|
11648 // Part1 |
|
11649 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KNullDesC8()); |
|
11650 CleanupClosePushL(stringVal); |
|
11651 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
11652 CleanupStack::PushL(part1); |
|
11653 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
11654 CleanupStack::Pop(part1); |
|
11655 CleanupStack::PopAndDestroy(&stringVal); |
|
11656 |
|
11657 TBuf8<256> expectedBuf; |
|
11658 expectedBuf.Append(0x00); |
|
11659 iUTContext->SetExpectedL(expectedBuf); |
|
11660 |
|
11661 // Add the Transitions in the order they are to run |
|
11662 // C'tor first, D'tor last... |
|
11663 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
11664 using constructor and destuctor validators */ |
|
11665 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
11666 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
11667 iUnknownNullHeaderValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
11668 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iUnknownNullHeaderValidator)); |
|
11669 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
11670 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
11671 } |
|
11672 |
|
11673 // ______________________________________________________________________________ |
|
11674 // |
|
11675 _LIT(KWspHeaderWriterMultiUnknownHeaderUnitTest,"CWspHeaderWriter_MultiUnknownHeader_UnitTest"); |
|
11676 |
|
11677 CWspHeaderWriter_MultiUnknownHeader_UnitTest* CWspHeaderWriter_MultiUnknownHeader_UnitTest::NewL(CDataLogger& aDataLogger, |
|
11678 MUnitTestObserver& aObserver) |
|
11679 { |
|
11680 CWspHeaderWriter_MultiUnknownHeader_UnitTest* self = |
|
11681 new(ELeave) CWspHeaderWriter_MultiUnknownHeader_UnitTest(aDataLogger, |
|
11682 aObserver); |
|
11683 CleanupStack::PushL(self); |
|
11684 self->ConstructL(); |
|
11685 CleanupStack::Pop(self); |
|
11686 return self; |
|
11687 } |
|
11688 |
|
11689 inline TInt CWspHeaderWriter_MultiUnknownHeader_UnitTest::RunError(TInt aError) |
|
11690 { |
|
11691 // The RunL left so chain to the base first and then cleanup |
|
11692 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
11693 delete iUTContext; |
|
11694 iUTContext = NULL; |
|
11695 delete iStateAccessor; |
|
11696 iStateAccessor = NULL; |
|
11697 /* delete any validators used */ |
|
11698 delete iCtorValidator; |
|
11699 iCtorValidator = NULL; |
|
11700 delete iMultiUnknownHeaderValidator; |
|
11701 iMultiUnknownHeaderValidator = NULL; |
|
11702 delete iDtorValidator; |
|
11703 iDtorValidator = NULL; |
|
11704 return error; |
|
11705 } |
|
11706 |
|
11707 inline CWspHeaderWriter_MultiUnknownHeader_UnitTest::~CWspHeaderWriter_MultiUnknownHeader_UnitTest() |
|
11708 { |
|
11709 // Simply delete our test class instance |
|
11710 delete iUTContext; |
|
11711 delete iStateAccessor; |
|
11712 /* delete any validators used */ |
|
11713 delete iCtorValidator; |
|
11714 delete iMultiUnknownHeaderValidator; |
|
11715 delete iDtorValidator; |
|
11716 } |
|
11717 |
|
11718 inline CWspHeaderWriter_MultiUnknownHeader_UnitTest::CWspHeaderWriter_MultiUnknownHeader_UnitTest(CDataLogger& aDataLogger, |
|
11719 MUnitTestObserver& aObserver) |
|
11720 : CUnitTest(KWspHeaderWriterMultiUnknownHeaderUnitTest, aDataLogger, aObserver) |
|
11721 { |
|
11722 //Do nothing |
|
11723 } |
|
11724 |
|
11725 // Now the Individual transitions need to be added. |
|
11726 inline void CWspHeaderWriter_MultiUnknownHeader_UnitTest::ConstructL() |
|
11727 { |
|
11728 // Perform the base class initialization |
|
11729 UnitTestConstructL(); |
|
11730 |
|
11731 // Create the Unit test state accessor |
|
11732 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
11733 // Construct the Unit test context. |
|
11734 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
11735 iUTContext->ConstructL(KErrNotFound); |
|
11736 |
|
11737 // Part1 |
|
11738 _LIT8(KTxtTestData1, "First test data"); |
|
11739 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTestData1()); |
|
11740 CleanupClosePushL(stringVal); |
|
11741 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
11742 CleanupStack::PushL(part1); |
|
11743 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
11744 CleanupStack::Pop(part1); |
|
11745 CleanupStack::PopAndDestroy(&stringVal); |
|
11746 |
|
11747 // Part2 |
|
11748 _LIT8(KTxtTestData2, "Second test data"); |
|
11749 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtTestData2()); |
|
11750 CleanupClosePushL(stringVal2); |
|
11751 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringVal2); |
|
11752 CleanupStack::PushL(part2); |
|
11753 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
11754 CleanupStack::Pop(part2); |
|
11755 CleanupStack::PopAndDestroy(&stringVal2); |
|
11756 |
|
11757 _LIT8(KTxtTestHdrSeperator, "TestHeader\0"); |
|
11758 TBuf8<256> expectedBuf; |
|
11759 expectedBuf.Append(KTxtTestData1()); |
|
11760 expectedBuf.Append(0x00); |
|
11761 expectedBuf.Append(KTxtTestHdrSeperator()); |
|
11762 expectedBuf.Append(KTxtTestData2()); |
|
11763 expectedBuf.Append(0x00); |
|
11764 iUTContext->SetExpectedL(expectedBuf); |
|
11765 |
|
11766 // Add the Transitions in the order they are to run |
|
11767 // C'tor first, D'tor last... |
|
11768 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
11769 using constructor and destuctor validators */ |
|
11770 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
11771 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
11772 iMultiUnknownHeaderValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
11773 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iMultiUnknownHeaderValidator)); |
|
11774 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
11775 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
11776 } |
|
11777 |
|
11778 // ______________________________________________________________________________ |
|
11779 // |
|
11780 _LIT(KWspHeaderWriterProfileUnitTest,"CWspHeaderWriter_Profile_UnitTest"); |
|
11781 |
|
11782 CWspHeaderWriter_Profile_UnitTest* CWspHeaderWriter_Profile_UnitTest::NewL(CDataLogger& aDataLogger, |
|
11783 MUnitTestObserver& aObserver) |
|
11784 { |
|
11785 CWspHeaderWriter_Profile_UnitTest* self = |
|
11786 new(ELeave) CWspHeaderWriter_Profile_UnitTest(aDataLogger, |
|
11787 aObserver); |
|
11788 CleanupStack::PushL(self); |
|
11789 self->ConstructL(); |
|
11790 CleanupStack::Pop(self); |
|
11791 return self; |
|
11792 } |
|
11793 |
|
11794 inline TInt CWspHeaderWriter_Profile_UnitTest::RunError(TInt aError) |
|
11795 { |
|
11796 // The RunL left so chain to the base first and then cleanup |
|
11797 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
11798 delete iUTContext; |
|
11799 iUTContext = NULL; |
|
11800 delete iStateAccessor; |
|
11801 iStateAccessor = NULL; |
|
11802 /* delete any validators used */ |
|
11803 delete iCtorValidator; |
|
11804 iCtorValidator = NULL; |
|
11805 delete iProfileValidator; |
|
11806 iProfileValidator = NULL; |
|
11807 delete iDtorValidator; |
|
11808 iDtorValidator = NULL; |
|
11809 return error; |
|
11810 } |
|
11811 |
|
11812 inline CWspHeaderWriter_Profile_UnitTest::~CWspHeaderWriter_Profile_UnitTest() |
|
11813 { |
|
11814 // Simply delete our test class instance |
|
11815 delete iUTContext; |
|
11816 delete iStateAccessor; |
|
11817 /* delete any validators used */ |
|
11818 delete iCtorValidator; |
|
11819 delete iProfileValidator; |
|
11820 delete iDtorValidator; |
|
11821 } |
|
11822 |
|
11823 inline CWspHeaderWriter_Profile_UnitTest::CWspHeaderWriter_Profile_UnitTest(CDataLogger& aDataLogger, |
|
11824 MUnitTestObserver& aObserver) |
|
11825 : CUnitTest(KWspHeaderWriterProfileUnitTest, aDataLogger, aObserver) |
|
11826 { |
|
11827 //Do nothing |
|
11828 } |
|
11829 |
|
11830 // Now the Individual transitions need to be added. |
|
11831 inline void CWspHeaderWriter_Profile_UnitTest::ConstructL() |
|
11832 { |
|
11833 // Perform the base class initialization |
|
11834 UnitTestConstructL(); |
|
11835 |
|
11836 // Create the Unit test state accessor |
|
11837 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
11838 // Construct the Unit test context. |
|
11839 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
11840 iUTContext->ConstructL(WSP::EProfile); |
|
11841 |
|
11842 _LIT8(KTxtProfileUri, "http://www.symbian.com"); |
|
11843 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtProfileUri); |
|
11844 CleanupClosePushL(stringVal); |
|
11845 CHeaderFieldPart* part = CHeaderFieldPart::NewL(stringVal); |
|
11846 CleanupStack::PushL(part); |
|
11847 iUTContext->iTestHeader->SetPartL(part, 0); |
|
11848 CleanupStack::Pop(part); |
|
11849 CleanupStack::PopAndDestroy(&stringVal); |
|
11850 |
|
11851 TBuf8<256> expectedBuf; |
|
11852 expectedBuf.Append(KTxtProfileUri); |
|
11853 expectedBuf.Append(0x00); |
|
11854 iUTContext->SetExpectedL(expectedBuf); |
|
11855 |
|
11856 // Add the Transitions in the order they are to run |
|
11857 // C'tor first, D'tor last... |
|
11858 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
11859 using constructor and destuctor validators */ |
|
11860 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
11861 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
11862 iProfileValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
11863 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iProfileValidator)); |
|
11864 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
11865 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
11866 } |
|
11867 |
|
11868 // ______________________________________________________________________________ |
|
11869 // |
|
11870 _LIT(KWspHeaderWriterProfileNullTextUnitTest,"CWspHeaderWriter_ProfileNullText_UnitTest"); |
|
11871 |
|
11872 CWspHeaderWriter_ProfileNullText_UnitTest* CWspHeaderWriter_ProfileNullText_UnitTest::NewL(CDataLogger& aDataLogger, |
|
11873 MUnitTestObserver& aObserver) |
|
11874 { |
|
11875 CWspHeaderWriter_ProfileNullText_UnitTest* self = |
|
11876 new(ELeave) CWspHeaderWriter_ProfileNullText_UnitTest(aDataLogger, |
|
11877 aObserver); |
|
11878 CleanupStack::PushL(self); |
|
11879 self->ConstructL(); |
|
11880 CleanupStack::Pop(self); |
|
11881 return self; |
|
11882 } |
|
11883 |
|
11884 inline TInt CWspHeaderWriter_ProfileNullText_UnitTest::RunError(TInt aError) |
|
11885 { |
|
11886 // The RunL left so chain to the base first and then cleanup |
|
11887 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
11888 delete iUTContext; |
|
11889 iUTContext = NULL; |
|
11890 delete iStateAccessor; |
|
11891 iStateAccessor = NULL; |
|
11892 /* delete any validators used */ |
|
11893 delete iCtorValidator; |
|
11894 iCtorValidator = NULL; |
|
11895 delete iProfileNullTextValidator; |
|
11896 iProfileNullTextValidator = NULL; |
|
11897 delete iDtorValidator; |
|
11898 iDtorValidator = NULL; |
|
11899 return error; |
|
11900 } |
|
11901 |
|
11902 inline CWspHeaderWriter_ProfileNullText_UnitTest::~CWspHeaderWriter_ProfileNullText_UnitTest() |
|
11903 { |
|
11904 // Simply delete our test class instance |
|
11905 delete iUTContext; |
|
11906 delete iStateAccessor; |
|
11907 /* delete any validators used */ |
|
11908 delete iCtorValidator; |
|
11909 delete iProfileNullTextValidator; |
|
11910 delete iDtorValidator; |
|
11911 } |
|
11912 |
|
11913 inline CWspHeaderWriter_ProfileNullText_UnitTest::CWspHeaderWriter_ProfileNullText_UnitTest(CDataLogger& aDataLogger, |
|
11914 MUnitTestObserver& aObserver) |
|
11915 : CUnitTest(KWspHeaderWriterProfileNullTextUnitTest, aDataLogger, aObserver) |
|
11916 { |
|
11917 //Do nothing |
|
11918 } |
|
11919 |
|
11920 // Now the Individual transitions need to be added. |
|
11921 inline void CWspHeaderWriter_ProfileNullText_UnitTest::ConstructL() |
|
11922 { |
|
11923 // Perform the base class initialization |
|
11924 UnitTestConstructL(); |
|
11925 |
|
11926 // Create the Unit test state accessor |
|
11927 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
11928 // Construct the Unit test context. |
|
11929 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
11930 iUTContext->ConstructL(WSP::EProfile); |
|
11931 |
|
11932 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KNullDesC8); |
|
11933 CleanupClosePushL(stringVal); |
|
11934 CHeaderFieldPart* part = CHeaderFieldPart::NewL(stringVal); |
|
11935 CleanupStack::PushL(part); |
|
11936 iUTContext->iTestHeader->SetPartL(part, 0); |
|
11937 CleanupStack::Pop(part); |
|
11938 CleanupStack::PopAndDestroy(&stringVal); |
|
11939 |
|
11940 TBuf8<256> expectedBuf; |
|
11941 expectedBuf.Append(0x00); |
|
11942 iUTContext->SetExpectedL(expectedBuf); |
|
11943 |
|
11944 // Add the Transitions in the order they are to run |
|
11945 // C'tor first, D'tor last... |
|
11946 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
11947 using constructor and destuctor validators */ |
|
11948 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
11949 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
11950 iProfileNullTextValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
11951 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iProfileNullTextValidator)); |
|
11952 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
11953 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
11954 } |
|
11955 |
|
11956 // ______________________________________________________________________________ |
|
11957 // |
|
11958 _LIT(KWspHeaderWriterProfileMalformedUnitTest,"CWspHeaderWriter_ProfileMalformed_UnitTest"); |
|
11959 |
|
11960 CWspHeaderWriter_ProfileMalformed_UnitTest* CWspHeaderWriter_ProfileMalformed_UnitTest::NewL(CDataLogger& aDataLogger, |
|
11961 MUnitTestObserver& aObserver) |
|
11962 { |
|
11963 CWspHeaderWriter_ProfileMalformed_UnitTest* self = |
|
11964 new(ELeave) CWspHeaderWriter_ProfileMalformed_UnitTest(aDataLogger, |
|
11965 aObserver); |
|
11966 CleanupStack::PushL(self); |
|
11967 self->ConstructL(); |
|
11968 CleanupStack::Pop(self); |
|
11969 return self; |
|
11970 } |
|
11971 |
|
11972 inline TInt CWspHeaderWriter_ProfileMalformed_UnitTest::RunError(TInt aError) |
|
11973 { |
|
11974 // The RunL left so chain to the base first and then cleanup |
|
11975 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
11976 delete iUTContext; |
|
11977 iUTContext = NULL; |
|
11978 delete iStateAccessor; |
|
11979 iStateAccessor = NULL; |
|
11980 /* delete any validators used */ |
|
11981 delete iCtorValidator; |
|
11982 iCtorValidator = NULL; |
|
11983 delete iProfileMalformedValidator; |
|
11984 iProfileMalformedValidator = NULL; |
|
11985 delete iDtorValidator; |
|
11986 iDtorValidator = NULL; |
|
11987 return error; |
|
11988 } |
|
11989 |
|
11990 inline CWspHeaderWriter_ProfileMalformed_UnitTest::~CWspHeaderWriter_ProfileMalformed_UnitTest() |
|
11991 { |
|
11992 // Simply delete our test class instance |
|
11993 delete iUTContext; |
|
11994 delete iStateAccessor; |
|
11995 /* delete any validators used */ |
|
11996 delete iCtorValidator; |
|
11997 delete iProfileMalformedValidator; |
|
11998 delete iDtorValidator; |
|
11999 } |
|
12000 |
|
12001 inline CWspHeaderWriter_ProfileMalformed_UnitTest::CWspHeaderWriter_ProfileMalformed_UnitTest(CDataLogger& aDataLogger, |
|
12002 MUnitTestObserver& aObserver) |
|
12003 : CUnitTest(KWspHeaderWriterProfileMalformedUnitTest, aDataLogger, aObserver) |
|
12004 { |
|
12005 //Do nothing |
|
12006 } |
|
12007 |
|
12008 // Now the Individual transitions need to be added. |
|
12009 inline void CWspHeaderWriter_ProfileMalformed_UnitTest::ConstructL() |
|
12010 { |
|
12011 // Perform the base class initialization |
|
12012 UnitTestConstructL(); |
|
12013 |
|
12014 // Create the Unit test state accessor |
|
12015 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
12016 // Construct the Unit test context. |
|
12017 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
12018 iUTContext->ConstructL(WSP::EProfile); |
|
12019 |
|
12020 _LIT8(KTxtProfileUri, "http://www.@symbian!.com-profiles"); |
|
12021 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtProfileUri); |
|
12022 CleanupClosePushL(stringVal); |
|
12023 CHeaderFieldPart* part = CHeaderFieldPart::NewL(stringVal); |
|
12024 CleanupStack::PushL(part); |
|
12025 iUTContext->iTestHeader->SetPartL(part, 0); |
|
12026 CleanupStack::Pop(part); |
|
12027 CleanupStack::PopAndDestroy(&stringVal); |
|
12028 |
|
12029 TBuf8<256> expectedBuf; |
|
12030 expectedBuf.Append(KTxtProfileUri); |
|
12031 expectedBuf.Append(0x00); |
|
12032 iUTContext->SetExpectedL(expectedBuf); |
|
12033 |
|
12034 // Add the Transitions in the order they are to run |
|
12035 // C'tor first, D'tor last... |
|
12036 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
12037 using constructor and destuctor validators */ |
|
12038 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
12039 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
12040 iProfileMalformedValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
12041 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iProfileMalformedValidator)); |
|
12042 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
12043 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
12044 } |
|
12045 |
|
12046 // ______________________________________________________________________________ |
|
12047 // |
|
12048 _LIT(KWspHeaderWriterProfileDiffShortUnitTest,"CWspHeaderWriter_ProfileDiffShort_UnitTest"); |
|
12049 |
|
12050 CWspHeaderWriter_ProfileDiffShort_UnitTest* CWspHeaderWriter_ProfileDiffShort_UnitTest::NewL(CDataLogger& aDataLogger, |
|
12051 MUnitTestObserver& aObserver) |
|
12052 { |
|
12053 CWspHeaderWriter_ProfileDiffShort_UnitTest* self = |
|
12054 new(ELeave) CWspHeaderWriter_ProfileDiffShort_UnitTest(aDataLogger, |
|
12055 aObserver); |
|
12056 CleanupStack::PushL(self); |
|
12057 self->ConstructL(); |
|
12058 CleanupStack::Pop(self); |
|
12059 return self; |
|
12060 } |
|
12061 |
|
12062 inline TInt CWspHeaderWriter_ProfileDiffShort_UnitTest::RunError(TInt aError) |
|
12063 { |
|
12064 // The RunL left so chain to the base first and then cleanup |
|
12065 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
12066 delete iUTContext; |
|
12067 iUTContext = NULL; |
|
12068 delete iStateAccessor; |
|
12069 iStateAccessor = NULL; |
|
12070 /* delete any validators used */ |
|
12071 delete iCtorValidator; |
|
12072 iCtorValidator = NULL; |
|
12073 delete iProfileDiffShortValidator; |
|
12074 iProfileDiffShortValidator = NULL; |
|
12075 delete iDtorValidator; |
|
12076 iDtorValidator = NULL; |
|
12077 return error; |
|
12078 } |
|
12079 |
|
12080 inline CWspHeaderWriter_ProfileDiffShort_UnitTest::~CWspHeaderWriter_ProfileDiffShort_UnitTest() |
|
12081 { |
|
12082 // Simply delete our test class instance |
|
12083 delete iUTContext; |
|
12084 delete iStateAccessor; |
|
12085 /* delete any validators used */ |
|
12086 delete iCtorValidator; |
|
12087 delete iProfileDiffShortValidator; |
|
12088 delete iDtorValidator; |
|
12089 } |
|
12090 |
|
12091 inline CWspHeaderWriter_ProfileDiffShort_UnitTest::CWspHeaderWriter_ProfileDiffShort_UnitTest(CDataLogger& aDataLogger, |
|
12092 MUnitTestObserver& aObserver) |
|
12093 : CUnitTest(KWspHeaderWriterProfileDiffShortUnitTest, aDataLogger, aObserver) |
|
12094 { |
|
12095 //Do nothing |
|
12096 } |
|
12097 |
|
12098 // Now the Individual transitions need to be added. |
|
12099 inline void CWspHeaderWriter_ProfileDiffShort_UnitTest::ConstructL() |
|
12100 { |
|
12101 // Perform the base class initialization |
|
12102 UnitTestConstructL(); |
|
12103 |
|
12104 // Create the Unit test state accessor |
|
12105 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
12106 // Construct the Unit test context. |
|
12107 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
12108 iUTContext->ConstructL(WSP::EProfileDiff); |
|
12109 |
|
12110 _LIT8(KTxtShortCCPP, "short_profile_diff_info25"); |
|
12111 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtShortCCPP); |
|
12112 CleanupClosePushL(stringVal); |
|
12113 CHeaderFieldPart* part = CHeaderFieldPart::NewL(stringVal); |
|
12114 CleanupStack::PushL(part); |
|
12115 iUTContext->iTestHeader->SetPartL(part, 0); |
|
12116 CleanupStack::Pop(part); |
|
12117 CleanupStack::PopAndDestroy(&stringVal); |
|
12118 |
|
12119 TBuf8<256> expectedBuf; |
|
12120 expectedBuf.Append(0x19); // value-length |
|
12121 expectedBuf.Append(KTxtShortCCPP); |
|
12122 iUTContext->SetExpectedL(expectedBuf); |
|
12123 |
|
12124 // Add the Transitions in the order they are to run |
|
12125 // C'tor first, D'tor last... |
|
12126 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
12127 using constructor and destuctor validators */ |
|
12128 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
12129 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
12130 iProfileDiffShortValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
12131 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iProfileDiffShortValidator)); |
|
12132 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
12133 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
12134 } |
|
12135 |
|
12136 // ______________________________________________________________________________ |
|
12137 // |
|
12138 _LIT(KWspHeaderWriterProfileDiffLongUnitTest,"CWspHeaderWriter_ProfileDiffLong_UnitTest"); |
|
12139 |
|
12140 CWspHeaderWriter_ProfileDiffLong_UnitTest* CWspHeaderWriter_ProfileDiffLong_UnitTest::NewL(CDataLogger& aDataLogger, |
|
12141 MUnitTestObserver& aObserver) |
|
12142 { |
|
12143 CWspHeaderWriter_ProfileDiffLong_UnitTest* self = |
|
12144 new(ELeave) CWspHeaderWriter_ProfileDiffLong_UnitTest(aDataLogger, |
|
12145 aObserver); |
|
12146 CleanupStack::PushL(self); |
|
12147 self->ConstructL(); |
|
12148 CleanupStack::Pop(self); |
|
12149 return self; |
|
12150 } |
|
12151 |
|
12152 inline TInt CWspHeaderWriter_ProfileDiffLong_UnitTest::RunError(TInt aError) |
|
12153 { |
|
12154 // The RunL left so chain to the base first and then cleanup |
|
12155 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
12156 delete iUTContext; |
|
12157 iUTContext = NULL; |
|
12158 delete iStateAccessor; |
|
12159 iStateAccessor = NULL; |
|
12160 /* delete any validators used */ |
|
12161 delete iCtorValidator; |
|
12162 iCtorValidator = NULL; |
|
12163 delete iProfileDiffLongValidator; |
|
12164 iProfileDiffLongValidator = NULL; |
|
12165 delete iDtorValidator; |
|
12166 iDtorValidator = NULL; |
|
12167 return error; |
|
12168 } |
|
12169 |
|
12170 inline CWspHeaderWriter_ProfileDiffLong_UnitTest::~CWspHeaderWriter_ProfileDiffLong_UnitTest() |
|
12171 { |
|
12172 // Simply delete our test class instance |
|
12173 delete iUTContext; |
|
12174 delete iStateAccessor; |
|
12175 /* delete any validators used */ |
|
12176 delete iCtorValidator; |
|
12177 delete iProfileDiffLongValidator; |
|
12178 delete iDtorValidator; |
|
12179 } |
|
12180 |
|
12181 inline CWspHeaderWriter_ProfileDiffLong_UnitTest::CWspHeaderWriter_ProfileDiffLong_UnitTest(CDataLogger& aDataLogger, |
|
12182 MUnitTestObserver& aObserver) |
|
12183 : CUnitTest(KWspHeaderWriterProfileDiffLongUnitTest, aDataLogger, aObserver) |
|
12184 { |
|
12185 //Do nothing |
|
12186 } |
|
12187 |
|
12188 // Now the Individual transitions need to be added. |
|
12189 inline void CWspHeaderWriter_ProfileDiffLong_UnitTest::ConstructL() |
|
12190 { |
|
12191 // Perform the base class initialization |
|
12192 UnitTestConstructL(); |
|
12193 |
|
12194 // Create the Unit test state accessor |
|
12195 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
12196 // Construct the Unit test context. |
|
12197 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
12198 iUTContext->ConstructL(WSP::EProfileDiff); |
|
12199 |
|
12200 _LIT8(KTxtLongCCPP, "long_length_profile_diff_information38"); |
|
12201 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtLongCCPP); |
|
12202 CleanupClosePushL(stringVal); |
|
12203 CHeaderFieldPart* part = CHeaderFieldPart::NewL(stringVal); |
|
12204 CleanupStack::PushL(part); |
|
12205 iUTContext->iTestHeader->SetPartL(part, 0); |
|
12206 CleanupStack::Pop(part); |
|
12207 CleanupStack::PopAndDestroy(&stringVal); |
|
12208 |
|
12209 TBuf8<256> expectedBuf; |
|
12210 expectedBuf.Append(0x1F); // value-length <octet 31> |
|
12211 expectedBuf.Append(0x26); // value-length |
|
12212 expectedBuf.Append(KTxtLongCCPP); |
|
12213 iUTContext->SetExpectedL(expectedBuf); |
|
12214 |
|
12215 // Add the Transitions in the order they are to run |
|
12216 // C'tor first, D'tor last... |
|
12217 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
12218 using constructor and destuctor validators */ |
|
12219 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
12220 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
12221 iProfileDiffLongValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
12222 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iProfileDiffLongValidator)); |
|
12223 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
12224 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
12225 } |
|
12226 |
|
12227 // ______________________________________________________________________________ |
|
12228 // |
|
12229 _LIT(KWspHeaderWriterProfileDiffMultiHeaderUnitTest,"CWspHeaderWriter_ProfileDiffMultiHeader_UnitTest"); |
|
12230 |
|
12231 CWspHeaderWriter_ProfileDiffMultiHeader_UnitTest* CWspHeaderWriter_ProfileDiffMultiHeader_UnitTest::NewL(CDataLogger& aDataLogger, |
|
12232 MUnitTestObserver& aObserver) |
|
12233 { |
|
12234 CWspHeaderWriter_ProfileDiffMultiHeader_UnitTest* self = |
|
12235 new(ELeave) CWspHeaderWriter_ProfileDiffMultiHeader_UnitTest(aDataLogger, |
|
12236 aObserver); |
|
12237 CleanupStack::PushL(self); |
|
12238 self->ConstructL(); |
|
12239 CleanupStack::Pop(self); |
|
12240 return self; |
|
12241 } |
|
12242 |
|
12243 inline TInt CWspHeaderWriter_ProfileDiffMultiHeader_UnitTest::RunError(TInt aError) |
|
12244 { |
|
12245 // The RunL left so chain to the base first and then cleanup |
|
12246 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
12247 delete iUTContext; |
|
12248 iUTContext = NULL; |
|
12249 delete iStateAccessor; |
|
12250 iStateAccessor = NULL; |
|
12251 /* delete any validators used */ |
|
12252 delete iCtorValidator; |
|
12253 iCtorValidator = NULL; |
|
12254 delete iProfileDiffMultiHeaderValidator; |
|
12255 iProfileDiffMultiHeaderValidator = NULL; |
|
12256 delete iDtorValidator; |
|
12257 iDtorValidator = NULL; |
|
12258 return error; |
|
12259 } |
|
12260 |
|
12261 inline CWspHeaderWriter_ProfileDiffMultiHeader_UnitTest::~CWspHeaderWriter_ProfileDiffMultiHeader_UnitTest() |
|
12262 { |
|
12263 // Simply delete our test class instance |
|
12264 delete iUTContext; |
|
12265 delete iStateAccessor; |
|
12266 /* delete any validators used */ |
|
12267 delete iCtorValidator; |
|
12268 delete iProfileDiffMultiHeaderValidator; |
|
12269 delete iDtorValidator; |
|
12270 } |
|
12271 |
|
12272 inline CWspHeaderWriter_ProfileDiffMultiHeader_UnitTest::CWspHeaderWriter_ProfileDiffMultiHeader_UnitTest(CDataLogger& aDataLogger, |
|
12273 MUnitTestObserver& aObserver) |
|
12274 : CUnitTest(KWspHeaderWriterProfileDiffMultiHeaderUnitTest, aDataLogger, aObserver) |
|
12275 { |
|
12276 //Do nothing |
|
12277 } |
|
12278 |
|
12279 // Now the Individual transitions need to be added. |
|
12280 inline void CWspHeaderWriter_ProfileDiffMultiHeader_UnitTest::ConstructL() |
|
12281 { |
|
12282 // Perform the base class initialization |
|
12283 UnitTestConstructL(); |
|
12284 |
|
12285 // Create the Unit test state accessor |
|
12286 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
12287 // Construct the Unit test context. |
|
12288 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
12289 iUTContext->ConstructL(WSP::EProfileDiff); |
|
12290 |
|
12291 _LIT8(KTxtLongCCPP, "long_length_profile_diff_information38"); |
|
12292 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtLongCCPP); |
|
12293 CleanupClosePushL(stringVal); |
|
12294 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
12295 CleanupStack::PushL(part1); |
|
12296 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
12297 CleanupStack::Pop(part1); |
|
12298 CleanupStack::PopAndDestroy(&stringVal); |
|
12299 |
|
12300 _LIT8(KTxtShortCCPP, "short_profile_diff_info25"); |
|
12301 RStringF stringVal2 = iUTContext->iStrPool.OpenFStringL(KTxtShortCCPP); |
|
12302 CleanupClosePushL(stringVal2); |
|
12303 CHeaderFieldPart* part2 = CHeaderFieldPart::NewL(stringVal2); |
|
12304 CleanupStack::PushL(part2); |
|
12305 iUTContext->iTestHeader->SetPartL(part2, 1); |
|
12306 CleanupStack::Pop(part2); |
|
12307 CleanupStack::PopAndDestroy(&stringVal2); |
|
12308 |
|
12309 TBuf8<256> expectedBuf; |
|
12310 // Part 1 |
|
12311 expectedBuf.Append(0x1F); // value-length <octet 31> |
|
12312 expectedBuf.Append(0x26); // value-length |
|
12313 expectedBuf.Append(KTxtLongCCPP); |
|
12314 //Part 2 |
|
12315 expectedBuf.Append(0xB6); // encoded token for 'Profile-Diff' |
|
12316 expectedBuf.Append(0x19); // value-length |
|
12317 expectedBuf.Append(KTxtShortCCPP); |
|
12318 |
|
12319 iUTContext->SetExpectedL(expectedBuf); |
|
12320 |
|
12321 // Add the Transitions in the order they are to run |
|
12322 // C'tor first, D'tor last... |
|
12323 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
12324 using constructor and destuctor validators */ |
|
12325 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
12326 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
12327 iProfileDiffMultiHeaderValidator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
12328 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iProfileDiffMultiHeaderValidator)); |
|
12329 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
12330 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
12331 } |
|
12332 |
|
12333 |
|
12334 // ______________________________________________________________________________ |
|
12335 // |
|
12336 _LIT(KWspHeaderWriterDefectFix_HOL595DR6_1UnitTest,"CWspHeaderWriter_DefectFix_HOL595DR6_1_UnitTest"); |
|
12337 |
|
12338 CWspHeaderWriter_DefectFix_HOL595DR6_1_UnitTest* CWspHeaderWriter_DefectFix_HOL595DR6_1_UnitTest::NewL(CDataLogger& aDataLogger, |
|
12339 MUnitTestObserver& aObserver) |
|
12340 { |
|
12341 CWspHeaderWriter_DefectFix_HOL595DR6_1_UnitTest* self = |
|
12342 new(ELeave) CWspHeaderWriter_DefectFix_HOL595DR6_1_UnitTest(aDataLogger, |
|
12343 aObserver); |
|
12344 CleanupStack::PushL(self); |
|
12345 self->ConstructL(); |
|
12346 CleanupStack::Pop(self); |
|
12347 return self; |
|
12348 } |
|
12349 |
|
12350 inline TInt CWspHeaderWriter_DefectFix_HOL595DR6_1_UnitTest::RunError(TInt aError) |
|
12351 { |
|
12352 // The RunL left so chain to the base first and then cleanup |
|
12353 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
12354 delete iUTContext; |
|
12355 iUTContext = NULL; |
|
12356 delete iStateAccessor; |
|
12357 iStateAccessor = NULL; |
|
12358 /* delete any validators used */ |
|
12359 delete iCtorValidator; |
|
12360 iCtorValidator = NULL; |
|
12361 delete iDefectFix_HOL595DR6_1Validator; |
|
12362 iDefectFix_HOL595DR6_1Validator = NULL; |
|
12363 delete iDtorValidator; |
|
12364 iDtorValidator = NULL; |
|
12365 return error; |
|
12366 } |
|
12367 |
|
12368 inline CWspHeaderWriter_DefectFix_HOL595DR6_1_UnitTest::~CWspHeaderWriter_DefectFix_HOL595DR6_1_UnitTest() |
|
12369 { |
|
12370 // Simply delete our test class instance |
|
12371 delete iUTContext; |
|
12372 delete iStateAccessor; |
|
12373 /* delete any validators used */ |
|
12374 delete iCtorValidator; |
|
12375 delete iDefectFix_HOL595DR6_1Validator; |
|
12376 delete iDtorValidator; |
|
12377 } |
|
12378 |
|
12379 inline CWspHeaderWriter_DefectFix_HOL595DR6_1_UnitTest::CWspHeaderWriter_DefectFix_HOL595DR6_1_UnitTest(CDataLogger& aDataLogger, |
|
12380 MUnitTestObserver& aObserver) |
|
12381 : CUnitTest(KWspHeaderWriterDefectFix_HOL595DR6_1UnitTest, aDataLogger, aObserver) |
|
12382 { |
|
12383 //Do nothing |
|
12384 } |
|
12385 |
|
12386 // Now the Individual transitions need to be added. |
|
12387 inline void CWspHeaderWriter_DefectFix_HOL595DR6_1_UnitTest::ConstructL() |
|
12388 { |
|
12389 // Perform the base class initialization |
|
12390 UnitTestConstructL(); |
|
12391 |
|
12392 // Create the Unit test state accessor |
|
12393 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
12394 // Construct the Unit test context. |
|
12395 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
12396 iUTContext->ConstructL(WSP::ETrailer); |
|
12397 (REINTERPRET_CAST(CWspHeaderCodec*, iUTContext->iCodec))->SetWspVersion(CWspHeaderCodec::EVersion1_2); |
|
12398 |
|
12399 // Part1 |
|
12400 _LIT8(KTxtAccept, "Accept"); |
|
12401 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtAccept); |
|
12402 CleanupClosePushL(stringVal); |
|
12403 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
12404 CleanupStack::PushL(part1); |
|
12405 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
12406 CleanupStack::Pop(part1); |
|
12407 CleanupStack::PopAndDestroy(&stringVal); |
|
12408 |
|
12409 TBuf8<256> expectedBuf; |
|
12410 expectedBuf.Append(KTxtAccept()); |
|
12411 expectedBuf.Append(0x00); |
|
12412 iUTContext->SetExpectedL(expectedBuf); |
|
12413 |
|
12414 // Add the Transitions in the order they are to run |
|
12415 // C'tor first, D'tor last... |
|
12416 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
12417 using constructor and destuctor validators */ |
|
12418 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
12419 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
12420 iDefectFix_HOL595DR6_1Validator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
12421 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iDefectFix_HOL595DR6_1Validator)); |
|
12422 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
12423 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
12424 } |
|
12425 |
|
12426 // ______________________________________________________________________________ |
|
12427 // |
|
12428 _LIT(KWspHeaderWriterDefectFix_HOL595DR6_2UnitTest,"CWspHeaderWriter_DefectFix_HOL595DR6_2_UnitTest"); |
|
12429 |
|
12430 CWspHeaderWriter_DefectFix_HOL595DR6_2_UnitTest* CWspHeaderWriter_DefectFix_HOL595DR6_2_UnitTest::NewL(CDataLogger& aDataLogger, |
|
12431 MUnitTestObserver& aObserver) |
|
12432 { |
|
12433 CWspHeaderWriter_DefectFix_HOL595DR6_2_UnitTest* self = |
|
12434 new(ELeave) CWspHeaderWriter_DefectFix_HOL595DR6_2_UnitTest(aDataLogger, |
|
12435 aObserver); |
|
12436 CleanupStack::PushL(self); |
|
12437 self->ConstructL(); |
|
12438 CleanupStack::Pop(self); |
|
12439 return self; |
|
12440 } |
|
12441 |
|
12442 inline TInt CWspHeaderWriter_DefectFix_HOL595DR6_2_UnitTest::RunError(TInt aError) |
|
12443 { |
|
12444 // The RunL left so chain to the base first and then cleanup |
|
12445 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
12446 delete iUTContext; |
|
12447 iUTContext = NULL; |
|
12448 delete iStateAccessor; |
|
12449 iStateAccessor = NULL; |
|
12450 /* delete any validators used */ |
|
12451 delete iCtorValidator; |
|
12452 iCtorValidator = NULL; |
|
12453 delete iDefectFix_HOL595DR6_2Validator; |
|
12454 iDefectFix_HOL595DR6_2Validator = NULL; |
|
12455 delete iDtorValidator; |
|
12456 iDtorValidator = NULL; |
|
12457 return error; |
|
12458 } |
|
12459 |
|
12460 inline CWspHeaderWriter_DefectFix_HOL595DR6_2_UnitTest::~CWspHeaderWriter_DefectFix_HOL595DR6_2_UnitTest() |
|
12461 { |
|
12462 // Simply delete our test class instance |
|
12463 delete iUTContext; |
|
12464 delete iStateAccessor; |
|
12465 /* delete any validators used */ |
|
12466 delete iCtorValidator; |
|
12467 delete iDefectFix_HOL595DR6_2Validator; |
|
12468 delete iDtorValidator; |
|
12469 } |
|
12470 |
|
12471 inline CWspHeaderWriter_DefectFix_HOL595DR6_2_UnitTest::CWspHeaderWriter_DefectFix_HOL595DR6_2_UnitTest(CDataLogger& aDataLogger, |
|
12472 MUnitTestObserver& aObserver) |
|
12473 : CUnitTest(KWspHeaderWriterDefectFix_HOL595DR6_2UnitTest, aDataLogger, aObserver) |
|
12474 { |
|
12475 //Do nothing |
|
12476 } |
|
12477 |
|
12478 // Now the Individual transitions need to be added. |
|
12479 inline void CWspHeaderWriter_DefectFix_HOL595DR6_2_UnitTest::ConstructL() |
|
12480 { |
|
12481 // Perform the base class initialization |
|
12482 UnitTestConstructL(); |
|
12483 |
|
12484 // Create the Unit test state accessor |
|
12485 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
12486 // Construct the Unit test context. |
|
12487 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
12488 iUTContext->ConstructL(WSP::EContentType); |
|
12489 |
|
12490 // Part1 |
|
12491 _LIT8(KTxtTypeToken, "application/vnd.wap.mms-message"); |
|
12492 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTypeToken); |
|
12493 CleanupClosePushL(stringVal); |
|
12494 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
12495 CleanupStack::PushL(part1); |
|
12496 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
12497 CleanupStack::Pop(part1); |
|
12498 CleanupStack::PopAndDestroy(&stringVal); |
|
12499 |
|
12500 TBuf8<256> expectedBuf; |
|
12501 expectedBuf.Append(0xBE); // encoded token for type above with top bit set |
|
12502 iUTContext->SetExpectedL(expectedBuf); |
|
12503 |
|
12504 // Add the Transitions in the order they are to run |
|
12505 // C'tor first, D'tor last... |
|
12506 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
12507 using constructor and destuctor validators */ |
|
12508 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
12509 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
12510 iDefectFix_HOL595DR6_2Validator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
12511 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iDefectFix_HOL595DR6_2Validator)); |
|
12512 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
12513 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
12514 } |
|
12515 |
|
12516 // ______________________________________________________________________________ |
|
12517 // |
|
12518 _LIT(KWspHeaderWriterDefectFix_HOL595DR6_3UnitTest,"CWspHeaderWriter_DefectFix_HOL595DR6_3_UnitTest"); |
|
12519 |
|
12520 CWspHeaderWriter_DefectFix_HOL595DR6_3_UnitTest* CWspHeaderWriter_DefectFix_HOL595DR6_3_UnitTest::NewL(CDataLogger& aDataLogger, |
|
12521 MUnitTestObserver& aObserver) |
|
12522 { |
|
12523 CWspHeaderWriter_DefectFix_HOL595DR6_3_UnitTest* self = |
|
12524 new(ELeave) CWspHeaderWriter_DefectFix_HOL595DR6_3_UnitTest(aDataLogger, |
|
12525 aObserver); |
|
12526 CleanupStack::PushL(self); |
|
12527 self->ConstructL(); |
|
12528 CleanupStack::Pop(self); |
|
12529 return self; |
|
12530 } |
|
12531 |
|
12532 inline TInt CWspHeaderWriter_DefectFix_HOL595DR6_3_UnitTest::RunError(TInt aError) |
|
12533 { |
|
12534 // The RunL left so chain to the base first and then cleanup |
|
12535 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
12536 delete iUTContext; |
|
12537 iUTContext = NULL; |
|
12538 delete iStateAccessor; |
|
12539 iStateAccessor = NULL; |
|
12540 /* delete any validators used */ |
|
12541 delete iCtorValidator; |
|
12542 iCtorValidator = NULL; |
|
12543 delete iDefectFix_HOL595DR6_3Validator; |
|
12544 iDefectFix_HOL595DR6_3Validator = NULL; |
|
12545 delete iDtorValidator; |
|
12546 iDtorValidator = NULL; |
|
12547 return error; |
|
12548 } |
|
12549 |
|
12550 inline CWspHeaderWriter_DefectFix_HOL595DR6_3_UnitTest::~CWspHeaderWriter_DefectFix_HOL595DR6_3_UnitTest() |
|
12551 { |
|
12552 // Simply delete our test class instance |
|
12553 delete iUTContext; |
|
12554 delete iStateAccessor; |
|
12555 /* delete any validators used */ |
|
12556 delete iCtorValidator; |
|
12557 delete iDefectFix_HOL595DR6_3Validator; |
|
12558 delete iDtorValidator; |
|
12559 } |
|
12560 |
|
12561 inline CWspHeaderWriter_DefectFix_HOL595DR6_3_UnitTest::CWspHeaderWriter_DefectFix_HOL595DR6_3_UnitTest(CDataLogger& aDataLogger, |
|
12562 MUnitTestObserver& aObserver) |
|
12563 : CUnitTest(KWspHeaderWriterDefectFix_HOL595DR6_3UnitTest, aDataLogger, aObserver) |
|
12564 { |
|
12565 //Do nothing |
|
12566 } |
|
12567 |
|
12568 // Now the Individual transitions need to be added. |
|
12569 inline void CWspHeaderWriter_DefectFix_HOL595DR6_3_UnitTest::ConstructL() |
|
12570 { |
|
12571 // Perform the base class initialization |
|
12572 UnitTestConstructL(); |
|
12573 |
|
12574 // Create the Unit test state accessor |
|
12575 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
12576 // Construct the Unit test context. |
|
12577 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
12578 iUTContext->ConstructL(WSP::EContentType); |
|
12579 (REINTERPRET_CAST(CWspHeaderCodec*, iUTContext->iCodec))->SetWspVersion(CWspHeaderCodec::EVersion1_2); |
|
12580 |
|
12581 // Part1 |
|
12582 _LIT8(KTxtTypeToken, "application/vnd.wap.mms-message"); |
|
12583 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTypeToken); |
|
12584 CleanupClosePushL(stringVal); |
|
12585 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
12586 CleanupStack::PushL(part1); |
|
12587 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
12588 CleanupStack::Pop(part1); |
|
12589 CleanupStack::PopAndDestroy(&stringVal); |
|
12590 |
|
12591 TBuf8<256> expectedBuf; |
|
12592 expectedBuf.Append(KTxtTypeToken()); // not encoded, should be text as encoding not available in 1.2 |
|
12593 expectedBuf.Append(0x00); |
|
12594 iUTContext->SetExpectedL(expectedBuf); |
|
12595 |
|
12596 // Add the Transitions in the order they are to run |
|
12597 // C'tor first, D'tor last... |
|
12598 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
12599 using constructor and destuctor validators */ |
|
12600 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
12601 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
12602 iDefectFix_HOL595DR6_3Validator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
12603 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iDefectFix_HOL595DR6_3Validator)); |
|
12604 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
12605 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
12606 } |
|
12607 |
|
12608 // ______________________________________________________________________________ |
|
12609 // |
|
12610 _LIT(KWspHeaderWriterDefectFix_HOL595DR6_4UnitTest,"CWspHeaderWriter_DefectFix_HOL595DR6_4_UnitTest"); |
|
12611 |
|
12612 CWspHeaderWriter_DefectFix_HOL595DR6_4_UnitTest* CWspHeaderWriter_DefectFix_HOL595DR6_4_UnitTest::NewL(CDataLogger& aDataLogger, |
|
12613 MUnitTestObserver& aObserver) |
|
12614 { |
|
12615 CWspHeaderWriter_DefectFix_HOL595DR6_4_UnitTest* self = |
|
12616 new(ELeave) CWspHeaderWriter_DefectFix_HOL595DR6_4_UnitTest(aDataLogger, |
|
12617 aObserver); |
|
12618 CleanupStack::PushL(self); |
|
12619 self->ConstructL(); |
|
12620 CleanupStack::Pop(self); |
|
12621 return self; |
|
12622 } |
|
12623 |
|
12624 inline TInt CWspHeaderWriter_DefectFix_HOL595DR6_4_UnitTest::RunError(TInt aError) |
|
12625 { |
|
12626 // The RunL left so chain to the base first and then cleanup |
|
12627 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
12628 delete iUTContext; |
|
12629 iUTContext = NULL; |
|
12630 delete iStateAccessor; |
|
12631 iStateAccessor = NULL; |
|
12632 /* delete any validators used */ |
|
12633 delete iCtorValidator; |
|
12634 iCtorValidator = NULL; |
|
12635 delete iDefectFix_HOL595DR6_4Validator; |
|
12636 iDefectFix_HOL595DR6_4Validator = NULL; |
|
12637 delete iDtorValidator; |
|
12638 iDtorValidator = NULL; |
|
12639 return error; |
|
12640 } |
|
12641 |
|
12642 inline CWspHeaderWriter_DefectFix_HOL595DR6_4_UnitTest::~CWspHeaderWriter_DefectFix_HOL595DR6_4_UnitTest() |
|
12643 { |
|
12644 // Simply delete our test class instance |
|
12645 delete iUTContext; |
|
12646 delete iStateAccessor; |
|
12647 /* delete any validators used */ |
|
12648 delete iCtorValidator; |
|
12649 delete iDefectFix_HOL595DR6_4Validator; |
|
12650 delete iDtorValidator; |
|
12651 } |
|
12652 |
|
12653 inline CWspHeaderWriter_DefectFix_HOL595DR6_4_UnitTest::CWspHeaderWriter_DefectFix_HOL595DR6_4_UnitTest(CDataLogger& aDataLogger, |
|
12654 MUnitTestObserver& aObserver) |
|
12655 : CUnitTest(KWspHeaderWriterDefectFix_HOL595DR6_4UnitTest, aDataLogger, aObserver) |
|
12656 { |
|
12657 //Do nothing |
|
12658 } |
|
12659 |
|
12660 // Now the Individual transitions need to be added. |
|
12661 inline void CWspHeaderWriter_DefectFix_HOL595DR6_4_UnitTest::ConstructL() |
|
12662 { |
|
12663 // Perform the base class initialization |
|
12664 UnitTestConstructL(); |
|
12665 |
|
12666 // Create the Unit test state accessor |
|
12667 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
12668 // Construct the Unit test context. |
|
12669 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
12670 iUTContext->ConstructL(WSP::EContentType); |
|
12671 |
|
12672 // Part1 |
|
12673 _LIT8(KTxtTypeToken, "application/*"); |
|
12674 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTypeToken); |
|
12675 CleanupClosePushL(stringVal); |
|
12676 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
12677 CleanupStack::PushL(part1); |
|
12678 |
|
12679 // Param1 |
|
12680 _LIT8(KTxtParam1Name, "Name"); |
|
12681 _LIT8(KTxtParam1Value, "TestName"); |
|
12682 RStringF param1Name = iUTContext->iStrPool.OpenFStringL(KTxtParam1Name); |
|
12683 CleanupClosePushL(param1Name); |
|
12684 RStringF param1Value = iUTContext->iStrPool.OpenFStringL(KTxtParam1Value); |
|
12685 CleanupClosePushL(param1Value); |
|
12686 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(param1Name, param1Value); |
|
12687 CleanupStack::PushL(param1); |
|
12688 part1->AddParamL(param1); |
|
12689 CleanupStack::Pop(param1); |
|
12690 |
|
12691 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
12692 CleanupStack::PopAndDestroy(2, ¶m1Name); |
|
12693 CleanupStack::Pop(part1); |
|
12694 CleanupStack::PopAndDestroy(&stringVal); |
|
12695 |
|
12696 TBuf8<256> expectedBuf; |
|
12697 expectedBuf.Append(0x0B); // length value |
|
12698 expectedBuf.Append(0x90); // token for application |
|
12699 expectedBuf.Append(0x97); // token for name param |
|
12700 expectedBuf.Append(KTxtParam1Value); // param value |
|
12701 expectedBuf.Append(0x00); |
|
12702 iUTContext->SetExpectedL(expectedBuf); |
|
12703 |
|
12704 // Add the Transitions in the order they are to run |
|
12705 // C'tor first, D'tor last... |
|
12706 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
12707 using constructor and destuctor validators */ |
|
12708 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
12709 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
12710 iDefectFix_HOL595DR6_4Validator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
12711 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iDefectFix_HOL595DR6_4Validator)); |
|
12712 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
12713 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
12714 } |
|
12715 |
|
12716 // ______________________________________________________________________________ |
|
12717 // |
|
12718 _LIT(KWspHeaderWriterDefectFix_HOL595DR6_5UnitTest,"CWspHeaderWriter_DefectFix_HOL595DR6_5_UnitTest"); |
|
12719 |
|
12720 CWspHeaderWriter_DefectFix_HOL595DR6_5_UnitTest* CWspHeaderWriter_DefectFix_HOL595DR6_5_UnitTest::NewL(CDataLogger& aDataLogger, |
|
12721 MUnitTestObserver& aObserver) |
|
12722 { |
|
12723 CWspHeaderWriter_DefectFix_HOL595DR6_5_UnitTest* self = |
|
12724 new(ELeave) CWspHeaderWriter_DefectFix_HOL595DR6_5_UnitTest(aDataLogger, |
|
12725 aObserver); |
|
12726 CleanupStack::PushL(self); |
|
12727 self->ConstructL(); |
|
12728 CleanupStack::Pop(self); |
|
12729 return self; |
|
12730 } |
|
12731 |
|
12732 inline TInt CWspHeaderWriter_DefectFix_HOL595DR6_5_UnitTest::RunError(TInt aError) |
|
12733 { |
|
12734 // The RunL left so chain to the base first and then cleanup |
|
12735 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
12736 delete iUTContext; |
|
12737 iUTContext = NULL; |
|
12738 delete iStateAccessor; |
|
12739 iStateAccessor = NULL; |
|
12740 /* delete any validators used */ |
|
12741 delete iCtorValidator; |
|
12742 iCtorValidator = NULL; |
|
12743 delete iDefectFix_HOL595DR6_5Validator; |
|
12744 iDefectFix_HOL595DR6_5Validator = NULL; |
|
12745 delete iDtorValidator; |
|
12746 iDtorValidator = NULL; |
|
12747 return error; |
|
12748 } |
|
12749 |
|
12750 inline CWspHeaderWriter_DefectFix_HOL595DR6_5_UnitTest::~CWspHeaderWriter_DefectFix_HOL595DR6_5_UnitTest() |
|
12751 { |
|
12752 // Simply delete our test class instance |
|
12753 delete iUTContext; |
|
12754 delete iStateAccessor; |
|
12755 /* delete any validators used */ |
|
12756 delete iCtorValidator; |
|
12757 delete iDefectFix_HOL595DR6_5Validator; |
|
12758 delete iDtorValidator; |
|
12759 } |
|
12760 |
|
12761 inline CWspHeaderWriter_DefectFix_HOL595DR6_5_UnitTest::CWspHeaderWriter_DefectFix_HOL595DR6_5_UnitTest(CDataLogger& aDataLogger, |
|
12762 MUnitTestObserver& aObserver) |
|
12763 : CUnitTest(KWspHeaderWriterDefectFix_HOL595DR6_5UnitTest, aDataLogger, aObserver) |
|
12764 { |
|
12765 //Do nothing |
|
12766 } |
|
12767 |
|
12768 // Now the Individual transitions need to be added. |
|
12769 inline void CWspHeaderWriter_DefectFix_HOL595DR6_5_UnitTest::ConstructL() |
|
12770 { |
|
12771 // Perform the base class initialization |
|
12772 UnitTestConstructL(); |
|
12773 |
|
12774 // Create the Unit test state accessor |
|
12775 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
12776 // Construct the Unit test context. |
|
12777 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
12778 iUTContext->ConstructL(WSP::EContentType); |
|
12779 (REINTERPRET_CAST(CWspHeaderCodec*, iUTContext->iCodec))->SetWspVersion(CWspHeaderCodec::EVersion1_2); |
|
12780 |
|
12781 // Part1 |
|
12782 _LIT8(KTxtTypeToken, "application/*"); |
|
12783 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTypeToken); |
|
12784 CleanupClosePushL(stringVal); |
|
12785 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
12786 CleanupStack::PushL(part1); |
|
12787 |
|
12788 // Param1 |
|
12789 _LIT8(KTxtParam1Name, "Name"); |
|
12790 _LIT8(KTxtParam1Value, "TestName"); |
|
12791 RStringF param1Name = iUTContext->iStrPool.OpenFStringL(KTxtParam1Name); |
|
12792 CleanupClosePushL(param1Name); |
|
12793 RStringF param1Value = iUTContext->iStrPool.OpenFStringL(KTxtParam1Value); |
|
12794 CleanupClosePushL(param1Value); |
|
12795 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(param1Name, param1Value); |
|
12796 CleanupStack::PushL(param1); |
|
12797 part1->AddParamL(param1); |
|
12798 CleanupStack::Pop(param1); |
|
12799 |
|
12800 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
12801 CleanupStack::PopAndDestroy(2, ¶m1Name); |
|
12802 CleanupStack::Pop(part1); |
|
12803 CleanupStack::PopAndDestroy(&stringVal); |
|
12804 |
|
12805 TBuf8<256> expectedBuf; |
|
12806 expectedBuf.Append(0x0B); // length value |
|
12807 expectedBuf.Append(0x90); // token for application |
|
12808 expectedBuf.Append(0x85); // token for name param in v1.2 |
|
12809 expectedBuf.Append(KTxtParam1Value); // param value |
|
12810 expectedBuf.Append(0x00); |
|
12811 iUTContext->SetExpectedL(expectedBuf); |
|
12812 |
|
12813 // Add the Transitions in the order they are to run |
|
12814 // C'tor first, D'tor last... |
|
12815 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
12816 using constructor and destuctor validators */ |
|
12817 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
12818 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
12819 iDefectFix_HOL595DR6_5Validator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
12820 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iDefectFix_HOL595DR6_5Validator)); |
|
12821 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
12822 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
12823 } |
|
12824 |
|
12825 // ______________________________________________________________________________ |
|
12826 // |
|
12827 _LIT(KWspHeaderWriterDefectFix_HOL595DR6_6UnitTest,"CWspHeaderWriter_DefectFix_HOL595DR6_6_UnitTest"); |
|
12828 |
|
12829 CWspHeaderWriter_DefectFix_HOL595DR6_6_UnitTest* CWspHeaderWriter_DefectFix_HOL595DR6_6_UnitTest::NewL(CDataLogger& aDataLogger, |
|
12830 MUnitTestObserver& aObserver) |
|
12831 { |
|
12832 CWspHeaderWriter_DefectFix_HOL595DR6_6_UnitTest* self = |
|
12833 new(ELeave) CWspHeaderWriter_DefectFix_HOL595DR6_6_UnitTest(aDataLogger, |
|
12834 aObserver); |
|
12835 CleanupStack::PushL(self); |
|
12836 self->ConstructL(); |
|
12837 CleanupStack::Pop(self); |
|
12838 return self; |
|
12839 } |
|
12840 |
|
12841 inline TInt CWspHeaderWriter_DefectFix_HOL595DR6_6_UnitTest::RunError(TInt aError) |
|
12842 { |
|
12843 // The RunL left so chain to the base first and then cleanup |
|
12844 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
12845 delete iUTContext; |
|
12846 iUTContext = NULL; |
|
12847 delete iStateAccessor; |
|
12848 iStateAccessor = NULL; |
|
12849 /* delete any validators used */ |
|
12850 delete iCtorValidator; |
|
12851 iCtorValidator = NULL; |
|
12852 delete iDefectFix_HOL595DR6_6Validator; |
|
12853 iDefectFix_HOL595DR6_6Validator = NULL; |
|
12854 delete iDtorValidator; |
|
12855 iDtorValidator = NULL; |
|
12856 return error; |
|
12857 } |
|
12858 |
|
12859 inline CWspHeaderWriter_DefectFix_HOL595DR6_6_UnitTest::~CWspHeaderWriter_DefectFix_HOL595DR6_6_UnitTest() |
|
12860 { |
|
12861 // Simply delete our test class instance |
|
12862 delete iUTContext; |
|
12863 delete iStateAccessor; |
|
12864 /* delete any validators used */ |
|
12865 delete iCtorValidator; |
|
12866 delete iDefectFix_HOL595DR6_6Validator; |
|
12867 delete iDtorValidator; |
|
12868 } |
|
12869 |
|
12870 inline CWspHeaderWriter_DefectFix_HOL595DR6_6_UnitTest::CWspHeaderWriter_DefectFix_HOL595DR6_6_UnitTest(CDataLogger& aDataLogger, |
|
12871 MUnitTestObserver& aObserver) |
|
12872 : CUnitTest(KWspHeaderWriterDefectFix_HOL595DR6_6UnitTest, aDataLogger, aObserver) |
|
12873 { |
|
12874 //Do nothing |
|
12875 } |
|
12876 |
|
12877 // Now the Individual transitions need to be added. |
|
12878 inline void CWspHeaderWriter_DefectFix_HOL595DR6_6_UnitTest::ConstructL() |
|
12879 { |
|
12880 // Perform the base class initialization |
|
12881 UnitTestConstructL(); |
|
12882 |
|
12883 // Create the Unit test state accessor |
|
12884 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
12885 // Construct the Unit test context. |
|
12886 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
12887 iUTContext->ConstructL(WSP::EContentType); |
|
12888 |
|
12889 // Part1 |
|
12890 _LIT8(KTxtTypeToken, "application/*"); |
|
12891 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTypeToken); |
|
12892 CleanupClosePushL(stringVal); |
|
12893 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
12894 CleanupStack::PushL(part1); |
|
12895 |
|
12896 // Param1 |
|
12897 _LIT8(KTxtParam1Name, "Comment"); |
|
12898 _LIT8(KTxtParam1Value, "TestName"); |
|
12899 RStringF param1Name = iUTContext->iStrPool.OpenFStringL(KTxtParam1Name); |
|
12900 CleanupClosePushL(param1Name); |
|
12901 RStringF param1Value = iUTContext->iStrPool.OpenFStringL(KTxtParam1Value); |
|
12902 CleanupClosePushL(param1Value); |
|
12903 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(param1Name, param1Value); |
|
12904 CleanupStack::PushL(param1); |
|
12905 part1->AddParamL(param1); |
|
12906 CleanupStack::Pop(param1); |
|
12907 |
|
12908 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
12909 CleanupStack::PopAndDestroy(2, ¶m1Name); |
|
12910 CleanupStack::Pop(part1); |
|
12911 CleanupStack::PopAndDestroy(&stringVal); |
|
12912 |
|
12913 TBuf8<256> expectedBuf; |
|
12914 expectedBuf.Append(0x0B); // length value |
|
12915 expectedBuf.Append(0x90); // token for application |
|
12916 expectedBuf.Append(0x9B); // token for comment param in v1.4 |
|
12917 expectedBuf.Append(KTxtParam1Value); // param value |
|
12918 expectedBuf.Append(0x00); |
|
12919 iUTContext->SetExpectedL(expectedBuf); |
|
12920 |
|
12921 // Add the Transitions in the order they are to run |
|
12922 // C'tor first, D'tor last... |
|
12923 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
12924 using constructor and destuctor validators */ |
|
12925 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
12926 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
12927 iDefectFix_HOL595DR6_6Validator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
12928 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iDefectFix_HOL595DR6_6Validator)); |
|
12929 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
12930 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
12931 } |
|
12932 |
|
12933 // ______________________________________________________________________________ |
|
12934 // |
|
12935 _LIT(KWspHeaderWriterDefectFix_HOL595DR6_7UnitTest,"CWspHeaderWriter_DefectFix_HOL595DR6_7_UnitTest"); |
|
12936 |
|
12937 CWspHeaderWriter_DefectFix_HOL595DR6_7_UnitTest* CWspHeaderWriter_DefectFix_HOL595DR6_7_UnitTest::NewL(CDataLogger& aDataLogger, |
|
12938 MUnitTestObserver& aObserver) |
|
12939 { |
|
12940 CWspHeaderWriter_DefectFix_HOL595DR6_7_UnitTest* self = |
|
12941 new(ELeave) CWspHeaderWriter_DefectFix_HOL595DR6_7_UnitTest(aDataLogger, |
|
12942 aObserver); |
|
12943 CleanupStack::PushL(self); |
|
12944 self->ConstructL(); |
|
12945 CleanupStack::Pop(self); |
|
12946 return self; |
|
12947 } |
|
12948 |
|
12949 inline TInt CWspHeaderWriter_DefectFix_HOL595DR6_7_UnitTest::RunError(TInt aError) |
|
12950 { |
|
12951 // The RunL left so chain to the base first and then cleanup |
|
12952 TInt error = CUnitTest::RunError(aError); // Chain to base |
|
12953 delete iUTContext; |
|
12954 iUTContext = NULL; |
|
12955 delete iStateAccessor; |
|
12956 iStateAccessor = NULL; |
|
12957 /* delete any validators used */ |
|
12958 delete iCtorValidator; |
|
12959 iCtorValidator = NULL; |
|
12960 delete iDefectFix_HOL595DR6_7Validator; |
|
12961 iDefectFix_HOL595DR6_7Validator = NULL; |
|
12962 delete iDtorValidator; |
|
12963 iDtorValidator = NULL; |
|
12964 return error; |
|
12965 } |
|
12966 |
|
12967 inline CWspHeaderWriter_DefectFix_HOL595DR6_7_UnitTest::~CWspHeaderWriter_DefectFix_HOL595DR6_7_UnitTest() |
|
12968 { |
|
12969 // Simply delete our test class instance |
|
12970 delete iUTContext; |
|
12971 delete iStateAccessor; |
|
12972 /* delete any validators used */ |
|
12973 delete iCtorValidator; |
|
12974 delete iDefectFix_HOL595DR6_7Validator; |
|
12975 delete iDtorValidator; |
|
12976 } |
|
12977 |
|
12978 inline CWspHeaderWriter_DefectFix_HOL595DR6_7_UnitTest::CWspHeaderWriter_DefectFix_HOL595DR6_7_UnitTest(CDataLogger& aDataLogger, |
|
12979 MUnitTestObserver& aObserver) |
|
12980 : CUnitTest(KWspHeaderWriterDefectFix_HOL595DR6_7UnitTest, aDataLogger, aObserver) |
|
12981 { |
|
12982 //Do nothing |
|
12983 } |
|
12984 |
|
12985 // Now the Individual transitions need to be added. |
|
12986 inline void CWspHeaderWriter_DefectFix_HOL595DR6_7_UnitTest::ConstructL() |
|
12987 { |
|
12988 // Perform the base class initialization |
|
12989 UnitTestConstructL(); |
|
12990 |
|
12991 // Create the Unit test state accessor |
|
12992 iStateAccessor = new(ELeave) TWspHeaderWriter_StateAccessor; |
|
12993 // Construct the Unit test context. |
|
12994 iUTContext = new(ELeave) CWspHeaderWriter_UnitTestContext(iDataLogger, *iStateAccessor, *this, WSP::Table); |
|
12995 iUTContext->ConstructL(WSP::EContentType); |
|
12996 (REINTERPRET_CAST(CWspHeaderCodec*, iUTContext->iCodec))->SetWspVersion(CWspHeaderCodec::EVersion1_2); |
|
12997 |
|
12998 // Part1 |
|
12999 _LIT8(KTxtTypeToken, "application/*"); |
|
13000 RStringF stringVal = iUTContext->iStrPool.OpenFStringL(KTxtTypeToken); |
|
13001 CleanupClosePushL(stringVal); |
|
13002 CHeaderFieldPart* part1 = CHeaderFieldPart::NewL(stringVal); |
|
13003 CleanupStack::PushL(part1); |
|
13004 |
|
13005 // Param1 |
|
13006 _LIT8(KTxtParam1Name, "Comment"); |
|
13007 _LIT8(KTxtParam1Value, "TestName"); |
|
13008 RStringF param1Name = iUTContext->iStrPool.OpenFStringL(KTxtParam1Name); |
|
13009 CleanupClosePushL(param1Name); |
|
13010 RStringF param1Value = iUTContext->iStrPool.OpenFStringL(KTxtParam1Value); |
|
13011 CleanupClosePushL(param1Value); |
|
13012 CHeaderFieldParam* param1 = CHeaderFieldParam::NewL(param1Name, param1Value); |
|
13013 CleanupStack::PushL(param1); |
|
13014 part1->AddParamL(param1); |
|
13015 CleanupStack::Pop(param1); |
|
13016 |
|
13017 iUTContext->iTestHeader->SetPartL(part1, 0); |
|
13018 CleanupStack::PopAndDestroy(2, ¶m1Name); |
|
13019 CleanupStack::Pop(part1); |
|
13020 CleanupStack::PopAndDestroy(&stringVal); |
|
13021 |
|
13022 TBuf8<256> expectedBuf; |
|
13023 expectedBuf.Append(0x12); // length value |
|
13024 expectedBuf.Append(0x90); // token for application |
|
13025 expectedBuf.Append(KTxtParam1Name); // param name |
|
13026 expectedBuf.Append(0x00); |
|
13027 expectedBuf.Append(KTxtParam1Value); // param value |
|
13028 expectedBuf.Append(0x00); |
|
13029 iUTContext->SetExpectedL(expectedBuf); |
|
13030 |
|
13031 // Add the Transitions in the order they are to run |
|
13032 // C'tor first, D'tor last... |
|
13033 /* Examples of C'tor and D'tor transitions on CWspHeaderWriter class. |
|
13034 using constructor and destuctor validators */ |
|
13035 iCtorValidator = new(ELeave) TWspHeaderWriter_Ctor_TransitionValidator(*iUTContext); |
|
13036 AddTransitionL(new(ELeave)CWspHeaderWriter_NewL_Transition(*iUTContext,*iCtorValidator)); |
|
13037 iDefectFix_HOL595DR6_7Validator = new(ELeave) TWspHeaderWriter_EncodeHeaderL_TransitionValidator(*iUTContext); |
|
13038 AddTransitionL(new(ELeave)CWspHeaderWriter_EncodeHeaderL_Transition(*iUTContext,*iDefectFix_HOL595DR6_7Validator)); |
|
13039 iDtorValidator = new(ELeave) TWspHeaderWriter_Dtor_TransitionValidator(*iUTContext); |
|
13040 AddTransitionL(new(ELeave)CWspHeaderWriter_Dtor_Transition(*iUTContext,*iDtorValidator)); |
|
13041 } |