1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This contains CommDb Unit Test Cases 007.XX |
|
15 // |
|
16 // |
|
17 |
|
18 // EPOC includes |
|
19 #include <e32base.h> |
|
20 #include <commdb.h> |
|
21 |
|
22 |
|
23 // Test system includes |
|
24 #include <networking/log.h> |
|
25 #include <networking/teststep.h> |
|
26 #include "Teststepcommdb.h" |
|
27 #include "TestSuiteCommdb.h" |
|
28 #include "Step_007_xx.h" |
|
29 |
|
30 //#ifndef SYMBIAN_COMMS_REPOSITORY |
|
31 // _LIT(KTempDb3, "c:\\system\\data\\default3.dat"); |
|
32 //#endif |
|
33 |
|
34 // |
|
35 // Test step 007.001 |
|
36 // |
|
37 |
|
38 // constructor |
|
39 CCommDbTest007_01::CCommDbTest007_01() |
|
40 { |
|
41 // store the name of this test case |
|
42 iTestStepName = _L("step_007_01"); |
|
43 } |
|
44 |
|
45 // destructor |
|
46 CCommDbTest007_01::~CCommDbTest007_01() |
|
47 { |
|
48 } |
|
49 |
|
50 |
|
51 TVerdict CCommDbTest007_01::doTestStepPreambleL() |
|
52 { |
|
53 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
54 return EPass; |
|
55 } |
|
56 |
|
57 #define EXPECTED_FIELD_VALUE _L8("Call me back") |
|
58 |
|
59 TInt CCommDbTest007_01::executeStepL() |
|
60 { |
|
61 TInt ret = EFail; |
|
62 |
|
63 |
|
64 CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone ); |
|
65 //Read the value from the field and compare it to the expected value |
|
66 TBuf8<KCommsDbSvrMaxFieldLength> value; |
|
67 |
|
68 iTheView->ReadTextL( TPtrC(ISP_IF_CALLBACK_INFO), value ); |
|
69 |
|
70 if( !value.Compare( TPtrC8(EXPECTED_FIELD_VALUE) ) ) |
|
71 { |
|
72 ret = EPass; |
|
73 } |
|
74 |
|
75 return ret; |
|
76 } |
|
77 |
|
78 TVerdict CCommDbTest007_01::doTestStepL( ) |
|
79 { |
|
80 Log(_L("Step 007.01 called ")); |
|
81 |
|
82 iTestStepResult = EFail; |
|
83 |
|
84 |
|
85 if ( executeStepL() == EPass ) |
|
86 iTestStepResult = EPass; |
|
87 else |
|
88 iTestStepResult = EFail; |
|
89 |
|
90 return iTestStepResult; |
|
91 } |
|
92 |
|
93 |
|
94 // |
|
95 // Test step 007.002 |
|
96 // |
|
97 |
|
98 // constructor |
|
99 CCommDbTest007_02::CCommDbTest007_02() |
|
100 { |
|
101 // store the name of this test case |
|
102 iTestStepName = _L("step_007_02"); |
|
103 } |
|
104 |
|
105 // destructor |
|
106 CCommDbTest007_02::~CCommDbTest007_02() |
|
107 { |
|
108 } |
|
109 |
|
110 |
|
111 TVerdict CCommDbTest007_02::doTestStepPreambleL() |
|
112 { |
|
113 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
114 return EPass; |
|
115 } |
|
116 |
|
117 #define EXPECTED_ISP_DESCRIPTION _S("Description") |
|
118 |
|
119 TInt CCommDbTest007_02::executeStepL() |
|
120 { |
|
121 TInt32 ret = EFail; |
|
122 |
|
123 |
|
124 CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone ); |
|
125 //Read the value from the field and compare it to the expected value |
|
126 TBuf<KCommsDbSvrMaxFieldLength> value; |
|
127 iTheView->ReadTextL( TPtrC(ISP_DESCRIPTION), value ); |
|
128 |
|
129 if( !value.Compare( TPtrC(EXPECTED_ISP_DESCRIPTION) ) ) |
|
130 { |
|
131 ret = EPass; |
|
132 } |
|
133 |
|
134 return ret; |
|
135 } |
|
136 |
|
137 TVerdict CCommDbTest007_02::doTestStepL( ) |
|
138 { |
|
139 Log(_L("Step 007.02 called ")); |
|
140 iTestStepResult = EFail; |
|
141 |
|
142 if ( executeStepL() == EPass ) |
|
143 iTestStepResult = EPass; |
|
144 else |
|
145 iTestStepResult = EFail; |
|
146 |
|
147 return iTestStepResult; |
|
148 } |
|
149 |
|
150 |
|
151 // |
|
152 // Test step 007.003 |
|
153 // |
|
154 |
|
155 // constructor |
|
156 CCommDbTest007_03::CCommDbTest007_03() |
|
157 { |
|
158 // store the name of this test case |
|
159 iTestStepName = _L("step_007_03"); |
|
160 } |
|
161 |
|
162 // destructor |
|
163 CCommDbTest007_03::~CCommDbTest007_03() |
|
164 { |
|
165 } |
|
166 |
|
167 TVerdict CCommDbTest007_03::doTestStepPreambleL() |
|
168 { |
|
169 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
170 return EPass; |
|
171 } |
|
172 |
|
173 #define EXPECTED_ISP_LOGIN_SCRIPT _S("wobble") |
|
174 |
|
175 TInt CCommDbTest007_03::executeStepL() |
|
176 { |
|
177 TInt32 ret = EFail; |
|
178 |
|
179 CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone ); |
|
180 |
|
181 //Read the value from the LongText field and compare it to the expected value |
|
182 HBufC* value = iTheView->ReadLongTextLC( TPtrC(ISP_LOGIN_SCRIPT) ); |
|
183 |
|
184 if ( value ) |
|
185 { |
|
186 if( !value->Compare( TPtrC(EXPECTED_ISP_LOGIN_SCRIPT) ) ) |
|
187 { |
|
188 ret = EPass; |
|
189 } |
|
190 CleanupStack::PopAndDestroy(); |
|
191 } |
|
192 |
|
193 |
|
194 return ret; |
|
195 } |
|
196 |
|
197 TVerdict CCommDbTest007_03::doTestStepL( ) |
|
198 { |
|
199 Log(_L("Step 007.03 called ")); |
|
200 |
|
201 if ( executeStepL() == EPass ) |
|
202 iTestStepResult = EPass; |
|
203 else |
|
204 iTestStepResult = EFail; |
|
205 |
|
206 return iTestStepResult; |
|
207 } |
|
208 |
|
209 |
|
210 |
|
211 // |
|
212 // Test step 007.004 |
|
213 // |
|
214 |
|
215 // constructor |
|
216 CCommDbTest007_04::CCommDbTest007_04() |
|
217 { |
|
218 // store the name of this test case |
|
219 iTestStepName = _L("step_007_04"); |
|
220 } |
|
221 |
|
222 // destructor |
|
223 CCommDbTest007_04::~CCommDbTest007_04() |
|
224 { |
|
225 } |
|
226 |
|
227 TVerdict CCommDbTest007_04::doTestStepPreambleL() |
|
228 { |
|
229 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
230 return EPass; |
|
231 } |
|
232 |
|
233 #define EXPECTED_ISP_TYPE 2 |
|
234 |
|
235 TInt CCommDbTest007_04::executeStepL() |
|
236 { |
|
237 TBool ret = EFail; |
|
238 |
|
239 |
|
240 CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone); |
|
241 //Read the value from the Uint field and compare it to the expected value |
|
242 TUint32 value; |
|
243 iTheView->ReadUintL( TPtrC(ISP_TYPE), value ); |
|
244 |
|
245 if( value == EXPECTED_ISP_TYPE ) |
|
246 { |
|
247 ret = EPass; |
|
248 } |
|
249 |
|
250 return ret; |
|
251 } |
|
252 |
|
253 TVerdict CCommDbTest007_04::doTestStepL( ) |
|
254 { |
|
255 Log(_L("Step 007.04 called ")); |
|
256 |
|
257 |
|
258 if ( executeStepL() == EPass ) |
|
259 iTestStepResult = EPass; |
|
260 else |
|
261 iTestStepResult = EFail; |
|
262 |
|
263 |
|
264 return iTestStepResult; |
|
265 } |
|
266 |
|
267 |
|
268 // |
|
269 // Test step 007.005 |
|
270 // |
|
271 |
|
272 // constructor |
|
273 CCommDbTest007_05::CCommDbTest007_05() |
|
274 { |
|
275 // store the name of this test case |
|
276 iTestStepName = _L("step_007_05"); |
|
277 // default to no local objects allocated |
|
278 iLocalObjects = EFalse; |
|
279 } |
|
280 |
|
281 // destructor |
|
282 CCommDbTest007_05::~CCommDbTest007_05() |
|
283 { |
|
284 } |
|
285 |
|
286 TVerdict CCommDbTest007_05::doTestStepPreambleL() |
|
287 { |
|
288 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
289 return EPass; |
|
290 } |
|
291 |
|
292 TInt CCommDbTest007_05::executeStepL() |
|
293 { |
|
294 TBool ret = EFail; |
|
295 |
|
296 CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone); |
|
297 //Read the value from the Uint field and compare it to the expected value |
|
298 TBool expectedValue; |
|
299 iTheView->ReadBoolL( TPtrC(ISP_DISPLAY_PCT), expectedValue ); |
|
300 |
|
301 if( expectedValue ) |
|
302 { |
|
303 iTestStepResult = EPass; |
|
304 } |
|
305 |
|
306 return ret; |
|
307 } |
|
308 |
|
309 TVerdict CCommDbTest007_05::doTestStepL( ) |
|
310 { |
|
311 Log(_L("Step 007.05 called ")); |
|
312 |
|
313 if ( executeStepL() == EPass ) |
|
314 iTestStepResult = EPass; |
|
315 else |
|
316 iTestStepResult = EFail; |
|
317 |
|
318 return iTestStepResult; |
|
319 } |
|
320 |
|
321 |
|
322 |
|
323 // |
|
324 // Test step 007.006 |
|
325 // |
|
326 |
|
327 // constructor |
|
328 CCommDbTest007_06::CCommDbTest007_06() |
|
329 { |
|
330 // store the name of this test case |
|
331 iTestStepName = _L("step_007_06"); |
|
332 } |
|
333 |
|
334 // destructor |
|
335 CCommDbTest007_06::~CCommDbTest007_06() |
|
336 { |
|
337 } |
|
338 |
|
339 TVerdict CCommDbTest007_06::doTestStepPreambleL() |
|
340 { |
|
341 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
342 return EPass; |
|
343 } |
|
344 |
|
345 #define EXPECTED_COLUMN_LENGTH 10 //Expected length of ISP_IP_ADDR column |
|
346 |
|
347 TInt CCommDbTest007_06::executeStepL() |
|
348 { |
|
349 TBool ret = EFail; |
|
350 |
|
351 CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone ); |
|
352 |
|
353 //Read the length of a column |
|
354 TInt value; |
|
355 iTheView->ReadColumnLengthL( TPtrC(ISP_IP_ADDR), value ); |
|
356 |
|
357 if( value == EXPECTED_COLUMN_LENGTH ) |
|
358 iTestStepResult = EPass; |
|
359 |
|
360 return ret; |
|
361 } |
|
362 |
|
363 TVerdict CCommDbTest007_06::doTestStepL( ) |
|
364 { |
|
365 Log(_L("Step 007.06 called ")); |
|
366 |
|
367 if ( executeStepL() == EPass ) |
|
368 iTestStepResult = EPass; |
|
369 else |
|
370 iTestStepResult = EFail; |
|
371 |
|
372 return iTestStepResult; |
|
373 } |
|
374 |
|
375 |
|
376 // |
|
377 // Test step 007.007 |
|
378 // |
|
379 |
|
380 // constructor |
|
381 CCommDbTest007_07::CCommDbTest007_07() |
|
382 { |
|
383 // store the name of this test case |
|
384 iTestStepName = _L("step_007_07"); |
|
385 } |
|
386 |
|
387 // destructor |
|
388 CCommDbTest007_07::~CCommDbTest007_07() |
|
389 { |
|
390 } |
|
391 |
|
392 |
|
393 |
|
394 TVerdict CCommDbTest007_07::doTestStepPreambleL() |
|
395 { |
|
396 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
397 return EPass; |
|
398 } |
|
399 |
|
400 TInt CCommDbTest007_07::executeStepL() |
|
401 { |
|
402 TInt ret = KErrGeneral; |
|
403 |
|
404 ret = iTheView->GotoFirstRecord(); |
|
405 if ( ret == KErrNotFound ) |
|
406 return ret; |
|
407 |
|
408 //Try to read a column value from the empty view |
|
409 TBuf<KCommsDbSvrMaxFieldLength> value; |
|
410 iTheView->ReadTextL( TPtrC(ISP_DESCRIPTION), value ); |
|
411 return ret; |
|
412 } |
|
413 |
|
414 TVerdict CCommDbTest007_07::doTestStepL( ) |
|
415 { |
|
416 Log(_L("Step 007.07 called ")); |
|
417 |
|
418 //NB. create a view on an empty table |
|
419 if ( executeStepL() == KErrNotFound ) |
|
420 iTestStepResult = EPass; |
|
421 else |
|
422 iTestStepResult = EFail; |
|
423 |
|
424 |
|
425 return iTestStepResult; |
|
426 } |
|
427 |
|
428 // |
|
429 // Test step 007.08 |
|
430 // |
|
431 |
|
432 // constructor |
|
433 CCommDbTest007_08::CCommDbTest007_08() |
|
434 { |
|
435 // store the name of this test case |
|
436 iTestStepName = _L("step_007_08"); |
|
437 // default to no local objects allocated |
|
438 iLocalObjects = EFalse; |
|
439 } |
|
440 |
|
441 // destructor |
|
442 CCommDbTest007_08::~CCommDbTest007_08() |
|
443 { |
|
444 } |
|
445 |
|
446 |
|
447 |
|
448 TVerdict CCommDbTest007_08::doTestStepPreambleL() |
|
449 { |
|
450 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
451 return EPass; |
|
452 } |
|
453 |
|
454 TInt CCommDbTest007_08::executeStepL() |
|
455 { |
|
456 TBool ret = EFail; |
|
457 |
|
458 ret = iTheView->GotoFirstRecord(); |
|
459 if ( ret == KErrNotFound ) |
|
460 return EPass; |
|
461 |
|
462 //Read the length of a column |
|
463 TInt value; |
|
464 iTheView->ReadColumnLengthL( TPtrC(ISP_IF_PARAMS), value ); |
|
465 if ( value == 0 ) |
|
466 ret = EPass; |
|
467 |
|
468 return ret; |
|
469 } |
|
470 |
|
471 TVerdict CCommDbTest007_08::doTestStepL( ) |
|
472 { |
|
473 Log(_L("Step 007.08 called ")); |
|
474 |
|
475 //NB. create a view on an empty table |
|
476 |
|
477 if ( executeStepL() == EPass ) |
|
478 iTestStepResult = EPass; |
|
479 else |
|
480 iTestStepResult = EFail; |
|
481 |
|
482 return iTestStepResult; |
|
483 } |
|
484 |
|
485 // |
|
486 // Test step 007.09 |
|
487 // |
|
488 |
|
489 // constructor |
|
490 CCommDbTest007_09::CCommDbTest007_09() |
|
491 { |
|
492 // store the name of this test case |
|
493 iTestStepName = _L("step_007_09"); |
|
494 } |
|
495 |
|
496 // destructor |
|
497 CCommDbTest007_09::~CCommDbTest007_09() |
|
498 { |
|
499 } |
|
500 |
|
501 |
|
502 TVerdict CCommDbTest007_09::doTestStepPreambleL() |
|
503 { |
|
504 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
505 return EPass; |
|
506 } |
|
507 |
|
508 TInt CCommDbTest007_09::executeStepL() |
|
509 { |
|
510 TInt ret = KErrGeneral; |
|
511 |
|
512 CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone ) |
|
513 |
|
514 //Try to read from an invalid column |
|
515 TBuf<KCommsDbSvrMaxFieldLength> value; |
|
516 TRAPD(r, iTheView->ReadTextL( KInvalidColumnName, value ) ); |
|
517 |
|
518 ret = r; |
|
519 |
|
520 return ret; |
|
521 } |
|
522 |
|
523 TVerdict CCommDbTest007_09::doTestStepL( ) |
|
524 { |
|
525 Log(_L("Step 007.09 called ")); |
|
526 |
|
527 //NB. create a view on an empty table |
|
528 |
|
529 if ( executeStepL() == KErrNotFound ) |
|
530 iTestStepResult = EPass; |
|
531 else |
|
532 iTestStepResult = EFail; |
|
533 |
|
534 |
|
535 return iTestStepResult; |
|
536 } |
|
537 |
|
538 |
|
539 // |
|
540 // Test step 007.10 |
|
541 // |
|
542 |
|
543 // constructor |
|
544 CCommDbTest007_10::CCommDbTest007_10() |
|
545 { |
|
546 // store the name of this test case |
|
547 iTestStepName = _L("step_007_10"); |
|
548 } |
|
549 |
|
550 // destructor |
|
551 CCommDbTest007_10::~CCommDbTest007_10() |
|
552 { |
|
553 } |
|
554 |
|
555 |
|
556 TVerdict CCommDbTest007_10::doTestStepPreambleL() |
|
557 { |
|
558 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
559 return EPass; |
|
560 } |
|
561 |
|
562 |
|
563 TInt CCommDbTest007_10::executeStepL() |
|
564 { |
|
565 TInt ret = KErrGeneral; |
|
566 |
|
567 CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone ); |
|
568 |
|
569 //Try to read length of an invalid column |
|
570 TInt value; |
|
571 TRAPD(r,iTheView->ReadColumnLengthL( KInvalidColumnName, value )); |
|
572 ret = r; |
|
573 |
|
574 return ret; |
|
575 } |
|
576 |
|
577 TVerdict CCommDbTest007_10::doTestStepL( ) |
|
578 { |
|
579 Log(_L("Step 007.10 called ")); |
|
580 |
|
581 //NB. create a view on an empty table |
|
582 |
|
583 if ( executeStepL() == KErrNotFound ) |
|
584 iTestStepResult = EPass; |
|
585 else |
|
586 iTestStepResult = EFail; |
|
587 |
|
588 return iTestStepResult; |
|
589 } |
|
590 |
|
591 |
|
592 // |
|
593 // Test step 007.11 |
|
594 // |
|
595 |
|
596 // constructor |
|
597 CCommDbTest007_11::CCommDbTest007_11() |
|
598 { |
|
599 // store the name of this test case |
|
600 iTestStepName = _L("step_007_11"); |
|
601 } |
|
602 |
|
603 // destructor |
|
604 CCommDbTest007_11::~CCommDbTest007_11() |
|
605 { |
|
606 } |
|
607 |
|
608 |
|
609 TVerdict CCommDbTest007_11::doTestStepPreambleL() |
|
610 { |
|
611 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
612 return EPass; |
|
613 } |
|
614 |
|
615 TInt CCommDbTest007_11::executeStepL() |
|
616 { |
|
617 TInt ret = KErrGeneral; |
|
618 |
|
619 CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone); |
|
620 |
|
621 //Read a column that will have a NULL value |
|
622 TBuf<KCommsDbSvrMaxFieldLength> value; |
|
623 TRAPD( r, iTheView->ReadTextL( TPtrC( ISP_DESCRIPTION ), value ) ); |
|
624 if ( r==KErrNone && value.Size() == 0 ) |
|
625 { |
|
626 //test passed |
|
627 ret = KErrNone; |
|
628 } |
|
629 else if ( r != KErrNone ) |
|
630 { |
|
631 //return the leave reason |
|
632 ret = r; |
|
633 } |
|
634 |
|
635 |
|
636 return ret; |
|
637 } |
|
638 |
|
639 TVerdict CCommDbTest007_11::doTestStepL( ) |
|
640 { |
|
641 Log(_L("Step 007.11 called ")); |
|
642 |
|
643 if ( executeStepL() == KErrNone ) |
|
644 iTestStepResult = EPass; |
|
645 else |
|
646 iTestStepResult = EFail; |
|
647 |
|
648 |
|
649 return iTestStepResult; |
|
650 } |
|
651 |
|
652 |
|
653 |
|
654 // |
|
655 // Test step 007.12 |
|
656 // |
|
657 |
|
658 // constructor |
|
659 CCommDbTest007_12::CCommDbTest007_12() |
|
660 { |
|
661 // store the name of this test case |
|
662 iTestStepName = _L("step_007_12"); |
|
663 } |
|
664 |
|
665 // destructor |
|
666 CCommDbTest007_12::~CCommDbTest007_12() |
|
667 { |
|
668 } |
|
669 |
|
670 |
|
671 TVerdict CCommDbTest007_12::doTestStepPreambleL() |
|
672 { |
|
673 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
674 return EPass; |
|
675 } |
|
676 |
|
677 |
|
678 TInt CCommDbTest007_12::executeStepL() |
|
679 { |
|
680 TInt ret = KErrGeneral; |
|
681 |
|
682 CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone ) |
|
683 |
|
684 //Try to read length of column containing a NULL value |
|
685 TInt value = -1; |
|
686 TRAPD(r, iTheView->ReadColumnLengthL( TPtrC(ISP_DESCRIPTION), value ) ); |
|
687 if ( r==KErrNone && value == 0 ) |
|
688 { |
|
689 //test passed |
|
690 ret = KErrNone; |
|
691 } |
|
692 else if ( r != KErrNone ) |
|
693 { |
|
694 //return the leave reason |
|
695 ret = r; |
|
696 } |
|
697 |
|
698 return ret; |
|
699 } |
|
700 |
|
701 TVerdict CCommDbTest007_12::doTestStepL( ) |
|
702 { |
|
703 Log(_L("Step 007.12 called ")); |
|
704 |
|
705 //NB. create a view on an empty table |
|
706 if ( executeStepL() == KErrNone ) |
|
707 iTestStepResult = EPass; |
|
708 else |
|
709 iTestStepResult = EFail; |
|
710 |
|
711 |
|
712 return iTestStepResult; |
|
713 } |
|
714 |
|
715 |
|
716 |
|
717 |
|
718 // |
|
719 // Test step 007.13 |
|
720 // |
|
721 /* |
|
722 //Removed since this test will not compile on Code warrior due to having an array of zero length |
|
723 // constructor |
|
724 CCommDbTest007_13::CCommDbTest007_13() |
|
725 { |
|
726 // store the name of this test case |
|
727 iTestStepName = _L("step_007_13"); |
|
728 } |
|
729 |
|
730 // destructor |
|
731 CCommDbTest007_13::~CCommDbTest007_13() |
|
732 { |
|
733 } |
|
734 |
|
735 |
|
736 TVerdict CCommDbTest007_13::doTestStepPreambleL() |
|
737 { |
|
738 copyTestDatabase( EDatabase_1 ); |
|
739 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
740 return EPass; |
|
741 } |
|
742 |
|
743 TInt CCommDbTest007_13::executeStepL() |
|
744 { |
|
745 TInt ret = KErrGeneral; |
|
746 |
|
747 |
|
748 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ); |
|
749 |
|
750 //Read a column and pass a zero length buffer |
|
751 |
|
752 //This next line causes a warning |
|
753 TBuf<0> value; |
|
754 |
|
755 |
|
756 TRAPD( r, iTheView->ReadTextL( TPtrC( ISP_DESCRIPTION ), value ) ); |
|
757 if ( r==KErrNone ) |
|
758 { |
|
759 //test passed |
|
760 ret = KErrNone; |
|
761 } |
|
762 else if ( r != KErrNone ) |
|
763 { |
|
764 //return the leave reason |
|
765 ret = r; |
|
766 } |
|
767 |
|
768 return ret; |
|
769 } |
|
770 |
|
771 TVerdict CCommDbTest007_13::doTestStepL( ) |
|
772 { |
|
773 Log(_L("Step 007.13 called.")); |
|
774 |
|
775 //NB. create a view on an empty table |
|
776 |
|
777 if ( executeStepL() == KErrNone ) |
|
778 iTestStepResult = EPass; |
|
779 else |
|
780 iTestStepResult = EFail; |
|
781 |
|
782 |
|
783 return iTestStepResult; |
|
784 } |
|
785 |
|
786 |
|
787 */ |
|
788 |
|
789 |
|
790 // |
|
791 // Test step 007.14 |
|
792 // |
|
793 |
|
794 // constructor |
|
795 CCommDbTest007_14::CCommDbTest007_14() |
|
796 { |
|
797 // store the name of this test case |
|
798 iTestStepName = _L("step_007_14"); |
|
799 } |
|
800 |
|
801 // destructor |
|
802 CCommDbTest007_14::~CCommDbTest007_14() |
|
803 { |
|
804 } |
|
805 |
|
806 |
|
807 TVerdict CCommDbTest007_14::doTestStepPreambleL() |
|
808 { |
|
809 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
810 return EPass; |
|
811 } |
|
812 |
|
813 TInt CCommDbTest007_14::executeStepL() |
|
814 { |
|
815 TInt ret = KErrGeneral; |
|
816 |
|
817 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ); |
|
818 |
|
819 //Read a column and pass a small length buffer |
|
820 |
|
821 TBuf<5> value; |
|
822 |
|
823 TRAPD( r, iTheView->ReadTextL( TPtrC( ISP_DESCRIPTION ), value ) ); |
|
824 if ( r==KErrNone ) |
|
825 { |
|
826 //test passed |
|
827 ret = KErrNone; |
|
828 } |
|
829 else if ( r != KErrNone ) |
|
830 { |
|
831 //return the leave reason |
|
832 ret = r; |
|
833 } |
|
834 |
|
835 return ret; |
|
836 } |
|
837 |
|
838 TVerdict CCommDbTest007_14::doTestStepL( ) |
|
839 { |
|
840 //NB. create a view on an empty table |
|
841 |
|
842 if ( executeStepL() == KErrNone ) |
|
843 iTestStepResult = EPass; |
|
844 else |
|
845 iTestStepResult = EFail; |
|
846 |
|
847 |
|
848 return iTestStepResult; |
|
849 } |
|
850 |
|
851 |
|
852 |
|
853 // |
|
854 // Test step 007.15 |
|
855 // |
|
856 |
|
857 // constructor |
|
858 CCommDbTest007_15::CCommDbTest007_15() |
|
859 { |
|
860 // store the name of this test case |
|
861 iTestStepName = _L("step_007_15"); |
|
862 } |
|
863 |
|
864 // destructor |
|
865 CCommDbTest007_15::~CCommDbTest007_15() |
|
866 { |
|
867 } |
|
868 |
|
869 |
|
870 TVerdict CCommDbTest007_15::doTestStepPreambleL() |
|
871 { |
|
872 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
873 return EPass; |
|
874 } |
|
875 |
|
876 |
|
877 #define ISP_DESCRIPTION_VALUE _S("Isp #1") |
|
878 |
|
879 TInt CCommDbTest007_15::executeStepL() |
|
880 { |
|
881 TInt ret = KErrGeneral; |
|
882 |
|
883 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ); |
|
884 |
|
885 //Read a read only column |
|
886 TBuf<KCommsDbSvrMaxFieldLength> value; |
|
887 TRAPD( r, iTheView->ReadTextL( TPtrC( ISP_DESCRIPTION ), value ) ); |
|
888 if ( r==KErrNone && value.Compare(TPtrC(ISP_DESCRIPTION_VALUE) ) == 0 ) |
|
889 { |
|
890 //test passed |
|
891 ret = KErrNone; |
|
892 } |
|
893 else if ( r != KErrNone ) |
|
894 { |
|
895 //return the leave reason |
|
896 ret = r; |
|
897 } |
|
898 |
|
899 return ret; |
|
900 } |
|
901 |
|
902 TVerdict CCommDbTest007_15::doTestStepL( ) |
|
903 { |
|
904 Log(_L("Step 007.15 called")); |
|
905 |
|
906 //NB. create a view on an empty table |
|
907 |
|
908 if ( executeStepL() == KErrNone ) |
|
909 iTestStepResult = EPass; |
|
910 else |
|
911 iTestStepResult = EFail; |
|
912 |
|
913 |
|
914 return iTestStepResult; |
|
915 } |
|
916 |
|
917 |
|
918 // |
|
919 // Test step 007.16 |
|
920 // Check different paths in ReadTextL |
|
921 // |
|
922 |
|
923 // constructor |
|
924 CCommDbTest007_16::CCommDbTest007_16() |
|
925 { |
|
926 // store the name of this test case |
|
927 iTestStepName = _L("step_007_16"); |
|
928 } |
|
929 |
|
930 // destructor |
|
931 CCommDbTest007_16::~CCommDbTest007_16() |
|
932 { |
|
933 } |
|
934 |
|
935 |
|
936 TVerdict CCommDbTest007_16::doTestStepPreambleL() |
|
937 { |
|
938 openDbAndViewL(TPtrC(OUTGOING_GPRS)); |
|
939 return EPass; |
|
940 } |
|
941 |
|
942 |
|
943 #define SHORT_APN_VALUE _S("Test") |
|
944 |
|
945 // this is KCommsDbSvrRealMaxFieldLength chars long (=255) |
|
946 #define LONG_APN_VALUE _S("TheQuickBrownFoxJumpedOverTheLazyDogTheQuickBrownFoxJumpedOverTheLazyDogTheQuickBrownFoxJumpedOverTheLazyDogTheQuickBrownFoxJumpedOverTheLazyDogTheQuickBrownFoxJumpedOverTheLazyDogTheQuickBrownFoxJumpedOverTheLazyDogTheQuickBrownFoxJumpedOverTheLazyDog123") |
|
947 |
|
948 TInt CCommDbTest007_16::executeStepL() |
|
949 { |
|
950 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ); |
|
951 |
|
952 // Read a short APN value |
|
953 TBuf<KCommsDbSvrRealMaxFieldLength> value; |
|
954 iTheView->ReadTextL( TPtrC( GPRS_APN ), value ); |
|
955 |
|
956 if (value.Compare(TPtrC(SHORT_APN_VALUE) ) != 0 ) |
|
957 { |
|
958 User::Leave(KErrGeneral); |
|
959 } |
|
960 |
|
961 // check that the long desc test is valid - ie KCommsDbSvrRealMaxFieldLength |
|
962 // hasn't changed since we wrote this |
|
963 TPtrC longDesc(LONG_APN_VALUE); |
|
964 if (longDesc.Length() != KCommsDbSvrRealMaxFieldLength) |
|
965 { |
|
966 User::Leave(KErrGeneral); |
|
967 } |
|
968 |
|
969 CDBLEAVE( iTheView->GotoNextRecord(), KErrNone ); |
|
970 iTheView->ReadTextL( TPtrC( GPRS_APN ), value ); |
|
971 |
|
972 if (value.Compare(TPtrC(LONG_APN_VALUE) ) != 0 ) |
|
973 { |
|
974 User::Leave(KErrGeneral); |
|
975 } |
|
976 |
|
977 return KErrNone; |
|
978 } |
|
979 |
|
980 TVerdict CCommDbTest007_16::doTestStepL( ) |
|
981 { |
|
982 Log(_L("Step 007.16 called")); |
|
983 |
|
984 //NB. create a view on an empty table |
|
985 |
|
986 if ( executeStepL() == KErrNone ) |
|
987 iTestStepResult = EPass; |
|
988 else |
|
989 iTestStepResult = EFail; |
|
990 |
|
991 |
|
992 return iTestStepResult; |
|
993 } |
|
994 |
|
995 |
|
996 // |
|
997 // Test step 007.17 |
|
998 // Check different paths in ReadTextL |
|
999 // |
|
1000 |
|
1001 // constructor |
|
1002 CCommDbTest007_17::CCommDbTest007_17() |
|
1003 { |
|
1004 // store the name of this test case |
|
1005 iTestStepName = _L("step_007_17"); |
|
1006 } |
|
1007 |
|
1008 // destructor |
|
1009 CCommDbTest007_17::~CCommDbTest007_17() |
|
1010 { |
|
1011 } |
|
1012 |
|
1013 TVerdict CCommDbTest007_17::doTestStepL() |
|
1014 { |
|
1015 Log(_L("Step 007.17 called")); |
|
1016 |
|
1017 iTestStepResult = EPass; |
|
1018 |
|
1019 //Heap test for 007.01 - uses default1.xml |
|
1020 CCommDbTest007_01* step007_01 = new CCommDbTest007_01; |
|
1021 CleanupStack::PushL(step007_01); |
|
1022 step007_01->iSuite = iSuite; |
|
1023 doTestStepWithHeapFailureL( *step007_01, KErrNone ); |
|
1024 if ( step007_01->iTestStepResult == EFail ) |
|
1025 iTestStepResult = EFail; |
|
1026 CleanupStack::PopAndDestroy(step007_01); |
|
1027 |
|
1028 //Heap test for 007.02 - uses default1.xml |
|
1029 CCommDbTest007_02* step007_02 = new CCommDbTest007_02; |
|
1030 CleanupStack::PushL(step007_02); |
|
1031 step007_02->iSuite = iSuite; |
|
1032 doTestStepWithHeapFailureL( *step007_02, KErrNone ); |
|
1033 if ( step007_02->iTestStepResult == EFail ) |
|
1034 iTestStepResult = EFail; |
|
1035 CleanupStack::PopAndDestroy(step007_02); |
|
1036 |
|
1037 //Heap test for 007.03 - uses default1.xml |
|
1038 CCommDbTest007_03* step007_03 = new CCommDbTest007_03; |
|
1039 CleanupStack::PushL(step007_03); |
|
1040 step007_03->iSuite = iSuite; |
|
1041 doTestStepWithHeapFailureL( *step007_03, KErrNone ); |
|
1042 if ( step007_03->iTestStepResult == EFail ) |
|
1043 iTestStepResult = EFail; |
|
1044 CleanupStack::PopAndDestroy(step007_03); |
|
1045 |
|
1046 //Heap test for 007.04 - uses default1.xml |
|
1047 CCommDbTest007_04* step007_04 = new CCommDbTest007_04; |
|
1048 CleanupStack::PushL(step007_04); |
|
1049 step007_04->iSuite = iSuite; |
|
1050 doTestStepWithHeapFailureL( *step007_04, KErrNone ); |
|
1051 if ( step007_04->iTestStepResult == EFail ) |
|
1052 iTestStepResult = EFail; |
|
1053 CleanupStack::PopAndDestroy(step007_04); |
|
1054 |
|
1055 //Heap test for 007.05 - uses default1.xml |
|
1056 CCommDbTest007_05* step007_05 = new CCommDbTest007_05; |
|
1057 CleanupStack::PushL(step007_05); |
|
1058 step007_05->iSuite = iSuite; |
|
1059 doTestStepWithHeapFailureL( *step007_05, KErrNone ); |
|
1060 if ( step007_05->iTestStepResult == EFail ) |
|
1061 iTestStepResult = EFail; |
|
1062 CleanupStack::PopAndDestroy(step007_05); |
|
1063 |
|
1064 //Heap test for 007.06 - uses default1.xml |
|
1065 CCommDbTest007_06* step007_06 = new CCommDbTest007_06; |
|
1066 CleanupStack::PushL(step007_06); |
|
1067 step007_06->iSuite = iSuite; |
|
1068 doTestStepWithHeapFailureL( *step007_06, KErrNone ); |
|
1069 if ( step007_06->iTestStepResult == EFail ) |
|
1070 iTestStepResult = EFail; |
|
1071 CleanupStack::PopAndDestroy(step007_06); |
|
1072 |
|
1073 //Heap test for 007.07 - uses default7.xml |
|
1074 //Heap test for 007.08 - uses default7.xml |
|
1075 |
|
1076 //Heap test for 007.09 - uses default1.xml |
|
1077 CCommDbTest007_09* step007_09 = new CCommDbTest007_09; |
|
1078 CleanupStack::PushL(step007_09); |
|
1079 step007_09->iSuite = iSuite; |
|
1080 doTestStepWithHeapFailureL( *step007_09, KErrNotFound ); |
|
1081 if ( step007_09->iTestStepResult == EFail ) |
|
1082 iTestStepResult = EFail; |
|
1083 CleanupStack::PopAndDestroy(step007_09); |
|
1084 |
|
1085 //Heap test for 007.10 - uses default1.xml |
|
1086 CCommDbTest007_10* step007_10 = new CCommDbTest007_10; |
|
1087 CleanupStack::PushL(step007_10); |
|
1088 step007_10->iSuite = iSuite; |
|
1089 doTestStepWithHeapFailureL( *step007_10, KErrNotFound ); |
|
1090 if ( step007_10->iTestStepResult == EFail ) |
|
1091 iTestStepResult = EFail; |
|
1092 CleanupStack::PopAndDestroy(step007_10); |
|
1093 |
|
1094 //Heap test for 007.11 - uses default1.xml |
|
1095 CCommDbTest007_11* step007_11 = new CCommDbTest007_11; |
|
1096 CleanupStack::PushL(step007_11); |
|
1097 step007_11->iSuite = iSuite; |
|
1098 doTestStepWithHeapFailureL( *step007_11, KErrNone ); |
|
1099 if ( step007_11->iTestStepResult == EFail ) |
|
1100 iTestStepResult = EFail; |
|
1101 CleanupStack::PopAndDestroy(step007_11); |
|
1102 |
|
1103 //Heap test for 007.12 - uses default1.xml |
|
1104 CCommDbTest007_12* step007_12 = new CCommDbTest007_12; |
|
1105 CleanupStack::PushL(step007_12); |
|
1106 step007_12->iSuite = iSuite; |
|
1107 doTestStepWithHeapFailureL( *step007_12, KErrNone ); |
|
1108 if ( step007_12->iTestStepResult == EFail ) |
|
1109 iTestStepResult = EFail; |
|
1110 CleanupStack::PopAndDestroy(step007_12); |
|
1111 |
|
1112 //Heap test for 007.14 - uses default1.xml - panic test see 7.20 |
|
1113 |
|
1114 //Heap test for 007.15 - uses default1.xml |
|
1115 CCommDbTest007_15* step007_15 = new CCommDbTest007_15; |
|
1116 CleanupStack::PushL(step007_15); |
|
1117 step007_15->iSuite = iSuite; |
|
1118 doTestStepWithHeapFailureL( *step007_15, KErrNone ); |
|
1119 if ( step007_15->iTestStepResult == EFail ) |
|
1120 iTestStepResult = EFail; |
|
1121 CleanupStack::PopAndDestroy(step007_15); |
|
1122 |
|
1123 return iTestStepResult; |
|
1124 } |
|
1125 |
|
1126 // |
|
1127 // Test step 007.18 |
|
1128 // Check different paths in ReadTextL |
|
1129 // |
|
1130 |
|
1131 // constructor |
|
1132 CCommDbTest007_18::CCommDbTest007_18() |
|
1133 { |
|
1134 // store the name of this test case |
|
1135 iTestStepName = _L("step_007_18"); |
|
1136 } |
|
1137 |
|
1138 // destructor |
|
1139 CCommDbTest007_18::~CCommDbTest007_18() |
|
1140 { |
|
1141 } |
|
1142 |
|
1143 TVerdict CCommDbTest007_18::doTestStepL() |
|
1144 { |
|
1145 Log(_L("Step 007.18 called")); |
|
1146 |
|
1147 iTestStepResult = EPass; |
|
1148 |
|
1149 //Heap test for 007.07 - uses default7.xml |
|
1150 copyTestDatabase( EDatabase_7 ); |
|
1151 CCommDbTest007_07* step007_07 = new CCommDbTest007_07; |
|
1152 CleanupStack::PushL(step007_07); |
|
1153 step007_07->iSuite = iSuite; |
|
1154 doTestStepWithHeapFailureL( *step007_07, KErrNotFound ); |
|
1155 if ( step007_07->iTestStepResult == EFail ) |
|
1156 iTestStepResult = EFail; |
|
1157 CleanupStack::PopAndDestroy(step007_07); |
|
1158 |
|
1159 |
|
1160 //Heap test for 007.08 - uses default7.xml |
|
1161 CCommDbTest007_08* step007_08 = new CCommDbTest007_08; |
|
1162 CleanupStack::PushL(step007_08); |
|
1163 step007_08->iSuite = iSuite; |
|
1164 doTestStepWithHeapFailureL( *step007_08, KErrNone ); |
|
1165 if ( step007_08->iTestStepResult == EFail ) |
|
1166 iTestStepResult = EFail; |
|
1167 CleanupStack::PopAndDestroy(step007_08); |
|
1168 |
|
1169 return iTestStepResult; |
|
1170 } |
|
1171 |
|
1172 // |
|
1173 // Test step 007.19 |
|
1174 // Check different paths in ReadTextL |
|
1175 // |
|
1176 |
|
1177 // constructor |
|
1178 CCommDbTest007_19::CCommDbTest007_19() |
|
1179 { |
|
1180 // store the name of this test case |
|
1181 iTestStepName = _L("step_007_19"); |
|
1182 } |
|
1183 |
|
1184 // destructor |
|
1185 CCommDbTest007_19::~CCommDbTest007_19() |
|
1186 { |
|
1187 } |
|
1188 |
|
1189 TVerdict CCommDbTest007_19::doTestStepL() |
|
1190 { |
|
1191 Log(_L("Step 007.19 called")); |
|
1192 |
|
1193 iTestStepResult = EPass; |
|
1194 |
|
1195 //Heap test for 007.16 - uses default3.xml |
|
1196 CCommDbTest007_16* step007_16 = new CCommDbTest007_16; |
|
1197 CleanupStack::PushL(step007_16); |
|
1198 step007_16->iSuite = iSuite; |
|
1199 doTestStepWithHeapFailureL( *step007_16, KErrNone ); |
|
1200 if ( step007_16->iTestStepResult == EFail ) |
|
1201 iTestStepResult = EFail; |
|
1202 CleanupStack::PopAndDestroy(step007_16); |
|
1203 |
|
1204 return iTestStepResult; |
|
1205 } |
|
1206 |
|
1207 // |
|
1208 // Test step 007.20 |
|
1209 // Check different paths in ReadTextL |
|
1210 // |
|
1211 |
|
1212 // constructor |
|
1213 CCommDbTest007_20::CCommDbTest007_20() |
|
1214 { |
|
1215 // store the name of this test case |
|
1216 iTestStepName = _L("step_007_20"); |
|
1217 } |
|
1218 |
|
1219 // destructor |
|
1220 CCommDbTest007_20::~CCommDbTest007_20() |
|
1221 { |
|
1222 } |
|
1223 |
|
1224 TVerdict CCommDbTest007_20::doTestStepL() |
|
1225 { |
|
1226 |
|
1227 iTestStepResult = EPass; |
|
1228 |
|
1229 //Heap test for 007.14 - uses default1.xml |
|
1230 CCommDbTest007_14* step007_14 = new CCommDbTest007_14; |
|
1231 CleanupStack::PushL(step007_14); |
|
1232 step007_14->iSuite = iSuite; |
|
1233 doTestStepWithHeapFailureL( *step007_14, KErrNone ); |
|
1234 if ( step007_14->iTestStepResult == EFail ) |
|
1235 iTestStepResult = EFail; |
|
1236 CleanupStack::PopAndDestroy(step007_14); |
|
1237 |
|
1238 return iTestStepResult; |
|
1239 } |
|