|
1 // |
|
2 // Copyright (c) 2009 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 // This contains CommDb Unit Test Cases 009.XX |
|
19 |
|
20 // EPOC includes |
|
21 #include <e32base.h> |
|
22 #include <commdb.h> |
|
23 |
|
24 |
|
25 // Test system includes |
|
26 #include "Teststepcommdb.h" |
|
27 #include "Step_009_xx.h" |
|
28 |
|
29 |
|
30 |
|
31 ///////////////////// |
|
32 // Test step 009.001 |
|
33 ///////////////////// |
|
34 |
|
35 // constructor |
|
36 CCommDbTest009_01::CCommDbTest009_01() |
|
37 { |
|
38 // store the name of this test case |
|
39 SetTestStepName(_L("step_009_01")); |
|
40 } |
|
41 |
|
42 // destructor |
|
43 CCommDbTest009_01::~CCommDbTest009_01() |
|
44 { |
|
45 } |
|
46 |
|
47 |
|
48 TVerdict CCommDbTest009_01::doTestStepPreambleL() |
|
49 { |
|
50 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
51 SetTestStepResult(EPass); return TestStepResult(); |
|
52 } |
|
53 |
|
54 #define ISP_INIT_STRING_TEST_VALUE _L8("Test Value") |
|
55 #define COMMDB_NAME_TEST_VALUE _L("Test record") |
|
56 //#define ISP_IF_NAME_TEST_VALUE _L("Test record") |
|
57 |
|
58 |
|
59 TInt CCommDbTest009_01::executeStepL() |
|
60 { |
|
61 TInt ret=KErrGeneral; |
|
62 TUint32 id; |
|
63 |
|
64 //NB. The table MUST be empty for this test to work! |
|
65 |
|
66 //Try to insert a record |
|
67 |
|
68 CDBLEAVE( iTheView->InsertRecord( id ), KErrNone ); |
|
69 |
|
70 //Insert some text |
|
71 iTheView->WriteTextL( TPtrC(ISP_INIT_STRING), ISP_INIT_STRING_TEST_VALUE ); |
|
72 |
|
73 //Must write to these columns as they cannot hold null values |
|
74 iTheView->WriteBoolL(TPtrC(ISP_DIAL_RESOLUTION),ETrue); |
|
75 iTheView->WriteBoolL(TPtrC(ISP_USE_LOGIN_SCRIPT),ETrue); |
|
76 iTheView->WriteBoolL(TPtrC(ISP_PROMPT_FOR_LOGIN),EFalse); |
|
77 // iTheView->WriteTextL(TPtrC(ISP_IF_NAME), ISP_IF_NAME_TEST_VALUE ); |
|
78 iTheView->WriteBoolL(TPtrC(ISP_IF_PROMPT_FOR_AUTH),EFalse); |
|
79 iTheView->WriteBoolL(TPtrC(ISP_IP_ADDR_FROM_SERVER),ETrue); |
|
80 iTheView->WriteBoolL(TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER),ETrue); |
|
81 iTheView->WriteBoolL(TPtrC(ISP_IP6_DNS_ADDR_FROM_SERVER),ETrue); |
|
82 iTheView->WriteTextL(TPtrC(COMMDB_NAME),COMMDB_NAME_TEST_VALUE); |
|
83 |
|
84 CDBLEAVE( iTheView->PutRecordChanges(), KErrNone ); |
|
85 |
|
86 |
|
87 //Read the value from the field and compare it to the value we've just written |
|
88 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ); |
|
89 |
|
90 TBuf8<KCommsDbSvrMaxFieldLength> value; |
|
91 iTheView->ReadTextL( TPtrC(ISP_INIT_STRING), value ); |
|
92 if( !value.Compare( ISP_INIT_STRING_TEST_VALUE ) ) |
|
93 { |
|
94 ret = KErrNone; |
|
95 } |
|
96 |
|
97 |
|
98 return ret; |
|
99 } |
|
100 |
|
101 |
|
102 TVerdict CCommDbTest009_01::doTestStepL( ) |
|
103 { |
|
104 INFO_PRINTF1(_L("Step 009.01 called ")); |
|
105 |
|
106 |
|
107 if ( executeStepL() == KErrNone ) |
|
108 SetTestStepResult(EPass); else |
|
109 SetTestStepResult(EFail); |
|
110 |
|
111 return TestStepResult(); |
|
112 } |
|
113 |
|
114 |
|
115 ///////////////////// |
|
116 // Test step 009.002 |
|
117 ///////////////////// |
|
118 |
|
119 // constructor |
|
120 CCommDbTest009_02::CCommDbTest009_02() |
|
121 { |
|
122 // store the name of this test case |
|
123 SetTestStepName(_L("step_009_02")); |
|
124 } |
|
125 |
|
126 // destructor |
|
127 CCommDbTest009_02::~CCommDbTest009_02() |
|
128 { |
|
129 } |
|
130 |
|
131 |
|
132 TVerdict CCommDbTest009_02::doTestStepPreambleL() |
|
133 { |
|
134 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
135 SetTestStepResult(EPass); return TestStepResult(); |
|
136 } |
|
137 |
|
138 |
|
139 #define ISP_DESCRIPTION_TEST_VALUE _L16("ISP description test value") |
|
140 |
|
141 TInt CCommDbTest009_02::executeStepL() |
|
142 { |
|
143 TInt ret=KErrGeneral; |
|
144 TUint32 id; |
|
145 |
|
146 //NB. The table MUST be empty for this test to work! |
|
147 |
|
148 //Try to insert a record |
|
149 CDBLEAVE( iTheView->InsertRecord( id ), KErrNone ); |
|
150 |
|
151 //Insert some text |
|
152 iTheView->WriteTextL( TPtrC(ISP_DESCRIPTION), ISP_DESCRIPTION_TEST_VALUE ); |
|
153 |
|
154 //Must write to these columns as they cannot hold null values |
|
155 iTheView->WriteBoolL(TPtrC(ISP_DIAL_RESOLUTION),ETrue); |
|
156 iTheView->WriteBoolL(TPtrC(ISP_USE_LOGIN_SCRIPT),ETrue); |
|
157 iTheView->WriteBoolL(TPtrC(ISP_PROMPT_FOR_LOGIN),EFalse); |
|
158 // iTheView->WriteTextL(TPtrC(ISP_IF_NAME), ISP_IF_NAME_TEST_VALUE ); |
|
159 iTheView->WriteBoolL(TPtrC(ISP_IF_PROMPT_FOR_AUTH),EFalse); |
|
160 iTheView->WriteBoolL(TPtrC(ISP_IP_ADDR_FROM_SERVER),ETrue); |
|
161 iTheView->WriteBoolL(TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER),ETrue); |
|
162 iTheView->WriteBoolL(TPtrC(ISP_IP6_DNS_ADDR_FROM_SERVER),ETrue); |
|
163 iTheView->WriteTextL(TPtrC(COMMDB_NAME),COMMDB_NAME_TEST_VALUE); |
|
164 |
|
165 CDBLEAVE( iTheView->PutRecordChanges(), KErrNone); |
|
166 |
|
167 //Read the value from the field and compare it to the value we've just written |
|
168 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ) ; |
|
169 |
|
170 TBuf<KCommsDbSvrMaxFieldLength> value; |
|
171 iTheView->ReadTextL( TPtrC(ISP_DESCRIPTION), value ); |
|
172 if( !value.Compare( ISP_DESCRIPTION_TEST_VALUE ) ) |
|
173 { |
|
174 ret = KErrNone; |
|
175 } |
|
176 |
|
177 return ret; |
|
178 } |
|
179 |
|
180 |
|
181 TVerdict CCommDbTest009_02::doTestStepL( ) |
|
182 { |
|
183 INFO_PRINTF1(_L("Step 009.02 called ")); |
|
184 |
|
185 if ( executeStepL() == KErrNone ) |
|
186 SetTestStepResult(EPass); else |
|
187 SetTestStepResult(EFail); |
|
188 return TestStepResult(); |
|
189 } |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 ///////////////////// |
|
195 // Test step 009.003 |
|
196 ///////////////////// |
|
197 |
|
198 // constructor |
|
199 CCommDbTest009_03::CCommDbTest009_03() |
|
200 { |
|
201 // store the name of this test case |
|
202 SetTestStepName(_L("step_009_03")); |
|
203 } |
|
204 |
|
205 // destructor |
|
206 CCommDbTest009_03::~CCommDbTest009_03() |
|
207 { |
|
208 } |
|
209 |
|
210 |
|
211 TVerdict CCommDbTest009_03::doTestStepPreambleL() |
|
212 { |
|
213 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
214 SetTestStepResult(EPass); return TestStepResult(); |
|
215 } |
|
216 |
|
217 #define ISP_BEARER_TYPE_TEST_VALUE 0x1 |
|
218 |
|
219 TInt CCommDbTest009_03::executeStepL() |
|
220 { |
|
221 TInt ret=KErrGeneral; |
|
222 TUint32 id; |
|
223 |
|
224 //NB. The table MUST be empty for this test to work! |
|
225 |
|
226 //Try to insert a record |
|
227 CDBLEAVE( iTheView->InsertRecord( id ), KErrNone ); |
|
228 |
|
229 //Insert a value |
|
230 iTheView->WriteUintL( TPtrC(ISP_BEARER_TYPE), ISP_BEARER_TYPE_TEST_VALUE ); |
|
231 |
|
232 //Must write to these columns as they cannot hold null values |
|
233 iTheView->WriteBoolL(TPtrC(ISP_DIAL_RESOLUTION),ETrue); |
|
234 iTheView->WriteBoolL(TPtrC(ISP_USE_LOGIN_SCRIPT),ETrue); |
|
235 iTheView->WriteBoolL(TPtrC(ISP_PROMPT_FOR_LOGIN),EFalse); |
|
236 // iTheView->WriteTextL(TPtrC(ISP_IF_NAME), ISP_IF_NAME_TEST_VALUE ); |
|
237 iTheView->WriteBoolL(TPtrC(ISP_IF_PROMPT_FOR_AUTH),EFalse); |
|
238 iTheView->WriteBoolL(TPtrC(ISP_IP_ADDR_FROM_SERVER),ETrue); |
|
239 iTheView->WriteBoolL(TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER),ETrue); |
|
240 iTheView->WriteBoolL(TPtrC(ISP_IP6_DNS_ADDR_FROM_SERVER),ETrue); |
|
241 iTheView->WriteTextL(TPtrC(COMMDB_NAME),COMMDB_NAME_TEST_VALUE); |
|
242 |
|
243 CDBLEAVE( iTheView->PutRecordChanges(), KErrNone ); |
|
244 |
|
245 //Read the value from the field and compare it to the value we've just written |
|
246 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ); |
|
247 |
|
248 TUint32 value; |
|
249 iTheView->ReadUintL( TPtrC(ISP_BEARER_TYPE), value ); |
|
250 if( value == ISP_BEARER_TYPE_TEST_VALUE ) |
|
251 { |
|
252 ret = KErrNone; |
|
253 } |
|
254 |
|
255 |
|
256 return ret; |
|
257 } |
|
258 |
|
259 |
|
260 TVerdict CCommDbTest009_03::doTestStepL( ) |
|
261 { |
|
262 INFO_PRINTF1(_L("Step 009.03 called ")); |
|
263 |
|
264 if ( executeStepL() == KErrNone ) |
|
265 SetTestStepResult(EPass); else |
|
266 SetTestStepResult(EFail); |
|
267 |
|
268 return TestStepResult(); |
|
269 } |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 ///////////////////// |
|
278 // Test step 009.004 |
|
279 ///////////////////// |
|
280 |
|
281 // constructor |
|
282 CCommDbTest009_04::CCommDbTest009_04() |
|
283 { |
|
284 // store the name of this test case |
|
285 SetTestStepName(_L("step_009_04")); |
|
286 } |
|
287 |
|
288 // destructor |
|
289 CCommDbTest009_04::~CCommDbTest009_04() |
|
290 { |
|
291 } |
|
292 |
|
293 |
|
294 TVerdict CCommDbTest009_04::doTestStepPreambleL() |
|
295 { |
|
296 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
297 SetTestStepResult(EPass); return TestStepResult(); |
|
298 } |
|
299 |
|
300 #define ISP_ENABLE_SW_COMP_TEST_VALUE ETrue |
|
301 |
|
302 TInt CCommDbTest009_04::executeStepL() |
|
303 { |
|
304 TInt ret=KErrGeneral; |
|
305 TUint32 id; |
|
306 |
|
307 //NB. The table MUST be empty for this test to work! |
|
308 |
|
309 //Try to insert a record |
|
310 CDBLEAVE( iTheView->InsertRecord( id ), KErrNone ); |
|
311 |
|
312 //Insert a value |
|
313 iTheView->WriteBoolL( TPtrC(ISP_ENABLE_SW_COMP), ISP_ENABLE_SW_COMP_TEST_VALUE ); |
|
314 |
|
315 //Must write to these columns as they cannot hold null values |
|
316 iTheView->WriteBoolL(TPtrC(ISP_DIAL_RESOLUTION),ETrue); |
|
317 iTheView->WriteBoolL(TPtrC(ISP_USE_LOGIN_SCRIPT),ETrue); |
|
318 iTheView->WriteBoolL(TPtrC(ISP_PROMPT_FOR_LOGIN),EFalse); |
|
319 // iTheView->WriteTextL(TPtrC(ISP_IF_NAME), ISP_IF_NAME_TEST_VALUE ); |
|
320 iTheView->WriteBoolL(TPtrC(ISP_IF_PROMPT_FOR_AUTH),EFalse); |
|
321 iTheView->WriteBoolL(TPtrC(ISP_IP_ADDR_FROM_SERVER),ETrue); |
|
322 iTheView->WriteBoolL(TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER),ETrue); |
|
323 iTheView->WriteBoolL(TPtrC(ISP_IP6_DNS_ADDR_FROM_SERVER),ETrue); |
|
324 iTheView->WriteTextL(TPtrC(COMMDB_NAME),COMMDB_NAME_TEST_VALUE); |
|
325 |
|
326 CDBLEAVE( iTheView->PutRecordChanges(), KErrNone ); |
|
327 |
|
328 //Read the value from the field and compare it to the value we've just written |
|
329 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ); |
|
330 |
|
331 TBool value; |
|
332 iTheView->ReadBoolL( TPtrC(ISP_ENABLE_SW_COMP), value ); |
|
333 if( value ) |
|
334 { |
|
335 ret = KErrNone; |
|
336 } |
|
337 |
|
338 |
|
339 return ret; |
|
340 } |
|
341 |
|
342 |
|
343 TVerdict CCommDbTest009_04::doTestStepL( ) |
|
344 { |
|
345 INFO_PRINTF1(_L("Step 009.04 called ")); |
|
346 |
|
347 |
|
348 if ( executeStepL() == KErrNone ) |
|
349 SetTestStepResult(EPass); else |
|
350 SetTestStepResult(EFail); |
|
351 |
|
352 return TestStepResult(); |
|
353 } |
|
354 |
|
355 |
|
356 |
|
357 |
|
358 |
|
359 ///////////////////// |
|
360 // Test step 009.005 |
|
361 ///////////////////// |
|
362 |
|
363 // constructor |
|
364 CCommDbTest009_05::CCommDbTest009_05() |
|
365 { |
|
366 // store the name of this test case |
|
367 SetTestStepName(_L("step_009_05")); |
|
368 } |
|
369 |
|
370 // destructor |
|
371 CCommDbTest009_05::~CCommDbTest009_05() |
|
372 { |
|
373 } |
|
374 |
|
375 TVerdict CCommDbTest009_05::doTestStepPreambleL() |
|
376 { |
|
377 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
378 SetTestStepResult(EPass); return TestStepResult(); |
|
379 } |
|
380 |
|
381 |
|
382 #define ISP_LOGIN_SCRIPT_TEST_VALUE _L("This is a test string that will be used in the test. It must be longer than 50 characters") |
|
383 |
|
384 TInt CCommDbTest009_05::executeStepL() |
|
385 { |
|
386 TInt ret=KErrGeneral; |
|
387 TUint32 id; |
|
388 |
|
389 //NB. The table MUST be empty for this test to work! |
|
390 |
|
391 //Try to insert a record |
|
392 CDBLEAVE( iTheView->InsertRecord( id ), KErrNone ); |
|
393 |
|
394 //Insert a value |
|
395 iTheView->WriteLongTextL( TPtrC(ISP_LOGIN_SCRIPT), TPtrC(ISP_LOGIN_SCRIPT_TEST_VALUE) ); |
|
396 |
|
397 //Must write to these columns as they cannot hold null values |
|
398 iTheView->WriteBoolL(TPtrC(ISP_DIAL_RESOLUTION),ETrue); |
|
399 iTheView->WriteBoolL(TPtrC(ISP_USE_LOGIN_SCRIPT),ETrue); |
|
400 iTheView->WriteBoolL(TPtrC(ISP_PROMPT_FOR_LOGIN),EFalse); |
|
401 // iTheView->WriteTextL(TPtrC(ISP_IF_NAME), ISP_IF_NAME_TEST_VALUE ); |
|
402 iTheView->WriteBoolL(TPtrC(ISP_IF_PROMPT_FOR_AUTH),EFalse); |
|
403 iTheView->WriteBoolL(TPtrC(ISP_IP_ADDR_FROM_SERVER),ETrue); |
|
404 iTheView->WriteBoolL(TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER),ETrue); |
|
405 iTheView->WriteBoolL(TPtrC(ISP_IP6_DNS_ADDR_FROM_SERVER),ETrue); |
|
406 iTheView->WriteTextL(TPtrC(COMMDB_NAME),COMMDB_NAME_TEST_VALUE); |
|
407 |
|
408 CDBLEAVE( iTheView->PutRecordChanges(), KErrNone ); |
|
409 |
|
410 |
|
411 //Read the value from the field and compare it to the value we've just written |
|
412 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ); |
|
413 |
|
414 HBufC* value = iTheView->ReadLongTextLC( TPtrC(ISP_LOGIN_SCRIPT) ); |
|
415 |
|
416 if ( value ) |
|
417 { |
|
418 if( !value->Compare( ISP_LOGIN_SCRIPT_TEST_VALUE) ) |
|
419 { |
|
420 ret = KErrNone; |
|
421 } |
|
422 CleanupStack::PopAndDestroy(); |
|
423 } |
|
424 |
|
425 return ret; |
|
426 } |
|
427 |
|
428 |
|
429 TVerdict CCommDbTest009_05::doTestStepL( ) |
|
430 { |
|
431 INFO_PRINTF1(_L("Step 009.05 called ")); |
|
432 |
|
433 if ( executeStepL() == KErrNone ) |
|
434 SetTestStepResult(EPass); else |
|
435 SetTestStepResult(EFail); |
|
436 return TestStepResult(); |
|
437 } |
|
438 |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 ///////////////////// |
|
444 // Test step 009.06 |
|
445 ///////////////////// |
|
446 |
|
447 // constructor |
|
448 CCommDbTest009_06::CCommDbTest009_06() |
|
449 { |
|
450 // store the name of this test case |
|
451 SetTestStepName(_L("step_009_06")); |
|
452 } |
|
453 |
|
454 // destructor |
|
455 CCommDbTest009_06::~CCommDbTest009_06() |
|
456 { |
|
457 } |
|
458 |
|
459 |
|
460 TVerdict CCommDbTest009_06::doTestStepPreambleL() |
|
461 { |
|
462 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
463 SetTestStepResult(EPass); return TestStepResult(); |
|
464 } |
|
465 |
|
466 |
|
467 #define TEST_DATA _L("Test data") |
|
468 |
|
469 |
|
470 TInt CCommDbTest009_06::executeStepL() |
|
471 { |
|
472 TInt ret=KErrNone; |
|
473 TUint32 id; |
|
474 |
|
475 //NB. The table MUST be empty for this test to work! |
|
476 |
|
477 //NB. This test will cause a PANIC |
|
478 |
|
479 //Try to insert a record |
|
480 CDBLEAVE( iTheView->InsertRecord( id ), KErrNone ); |
|
481 |
|
482 //Insert a value in an invalid column |
|
483 iTheView->WriteTextL( KInvalidColumnName, TPtrC(TEST_DATA) ); |
|
484 |
|
485 // We should never get here because we should have hit a panic |
|
486 // If the Panic doesnt happen, we'll cause a leave |
|
487 |
|
488 User::Leave( KErrGeneral ); |
|
489 |
|
490 return ret; |
|
491 } |
|
492 |
|
493 |
|
494 TVerdict CCommDbTest009_06::doTestStepL( ) |
|
495 { |
|
496 |
|
497 //This test step needs to trap a Panic |
|
498 |
|
499 TRAPD( r, executeStepL() ); |
|
500 |
|
501 if ( r == KErrNotFound ) |
|
502 SetTestStepResult(EPass); else |
|
503 SetTestStepResult(EFail); |
|
504 |
|
505 return TestStepResult(); |
|
506 } |
|
507 |
|
508 |
|
509 |
|
510 ///////////////////// |
|
511 // Test step 009.07 |
|
512 ///////////////////// |
|
513 |
|
514 // constructor |
|
515 CCommDbTest009_07::CCommDbTest009_07() |
|
516 { |
|
517 // store the name of this test case |
|
518 SetTestStepName(_L("step_009_07")); |
|
519 } |
|
520 |
|
521 // destructor |
|
522 CCommDbTest009_07::~CCommDbTest009_07() |
|
523 { |
|
524 } |
|
525 |
|
526 |
|
527 TVerdict CCommDbTest009_07::doTestStepPreambleL() |
|
528 { |
|
529 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
530 SetTestStepResult(EPass); return TestStepResult(); |
|
531 } |
|
532 |
|
533 |
|
534 TInt CCommDbTest009_07::executeStepL() |
|
535 { |
|
536 TInt ret=KErrNone; |
|
537 |
|
538 //NB. This test will cause a PANIC |
|
539 |
|
540 //Try to insert a record without a call to InsertRecord() |
|
541 |
|
542 //Insert a value in column |
|
543 iTheView->WriteBoolL( TPtrC(ISP_ENABLE_SW_COMP), ETrue ); |
|
544 |
|
545 // We should never get here because we should have hit a panic |
|
546 // If the Panic doesnt happen, we'll cause a leave |
|
547 |
|
548 User::Leave( KErrGeneral ); |
|
549 |
|
550 return ret; |
|
551 } |
|
552 |
|
553 |
|
554 TVerdict CCommDbTest009_07::doTestStepL( ) |
|
555 { |
|
556 //This test step needs to trap a Panic |
|
557 |
|
558 TRAPD( r, executeStepL() ); |
|
559 |
|
560 if ( r == KErrNone ) |
|
561 SetTestStepResult(EFail); else |
|
562 SetTestStepResult(EFail); |
|
563 |
|
564 return TestStepResult(); |
|
565 } |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 |
|
573 ///////////////////// |
|
574 // Test step 009.08 |
|
575 ///////////////////// |
|
576 |
|
577 // constructor |
|
578 CCommDbTest009_08::CCommDbTest009_08() |
|
579 { |
|
580 // store the name of this test case |
|
581 SetTestStepName(_L("step_009_08")); |
|
582 |
|
583 } |
|
584 |
|
585 // destructor |
|
586 CCommDbTest009_08::~CCommDbTest009_08() |
|
587 { |
|
588 } |
|
589 |
|
590 |
|
591 TVerdict CCommDbTest009_08::doTestStepPreambleL() |
|
592 { |
|
593 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
594 SetTestStepResult(EPass); return TestStepResult(); |
|
595 } |
|
596 |
|
597 |
|
598 TInt CCommDbTest009_08::executeStepL() |
|
599 { |
|
600 TInt ret=KErrNone; |
|
601 |
|
602 //NB. This test will cause a PANIC |
|
603 //Try to PutRecordChanges() without a call to InsertRecord() |
|
604 |
|
605 //Insert a value |
|
606 iTheView->WriteUintL( TPtrC(ISP_ENABLE_SW_COMP), ISP_ENABLE_SW_COMP_TEST_VALUE ); |
|
607 |
|
608 //Must write to these columns as they cannot hold null values |
|
609 iTheView->WriteBoolL(TPtrC(ISP_DIAL_RESOLUTION),ETrue); |
|
610 iTheView->WriteBoolL(TPtrC(ISP_USE_LOGIN_SCRIPT),ETrue); |
|
611 iTheView->WriteBoolL(TPtrC(ISP_PROMPT_FOR_LOGIN),EFalse); |
|
612 // iTheView->WriteTextL(TPtrC(ISP_IF_NAME), ISP_IF_NAME_TEST_VALUE ); |
|
613 iTheView->WriteBoolL(TPtrC(ISP_IF_PROMPT_FOR_AUTH),EFalse); |
|
614 iTheView->WriteBoolL(TPtrC(ISP_IP_ADDR_FROM_SERVER),ETrue); |
|
615 iTheView->WriteBoolL(TPtrC(ISP_IP_DNS_ADDR_FROM_SERVER),ETrue); |
|
616 iTheView->WriteBoolL(TPtrC(ISP_IP6_DNS_ADDR_FROM_SERVER),ETrue); |
|
617 iTheView->WriteTextL(TPtrC(COMMDB_NAME),COMMDB_NAME_TEST_VALUE); |
|
618 |
|
619 iTheView->PutRecordChanges(); |
|
620 |
|
621 // We should never get here because we should have hit a panic |
|
622 // If the Panic doesnt happen, we'll cause a leave |
|
623 |
|
624 User::Leave( KErrGeneral ); |
|
625 |
|
626 return ret; |
|
627 } |
|
628 |
|
629 |
|
630 TVerdict CCommDbTest009_08::doTestStepL( ) |
|
631 { |
|
632 //This test step needs to trap a Panic |
|
633 |
|
634 if ( executeStepL() == KErrNone ) |
|
635 SetTestStepResult(EFail); else |
|
636 SetTestStepResult(EFail); |
|
637 return TestStepResult(); |
|
638 } |
|
639 |
|
640 ///////////////////// |
|
641 // Test step 009.09 |
|
642 ///////////////////// |
|
643 |
|
644 // constructor |
|
645 CCommDbTest009_09::CCommDbTest009_09() |
|
646 { |
|
647 // store the name of this test case |
|
648 SetTestStepName(_L("step_009_09")); |
|
649 } |
|
650 |
|
651 // destructor |
|
652 CCommDbTest009_09::~CCommDbTest009_09() |
|
653 { |
|
654 } |
|
655 |
|
656 |
|
657 TVerdict CCommDbTest009_09::doTestStepPreambleL() |
|
658 { |
|
659 SetTestStepResult(EPass); return TestStepResult(); |
|
660 } |
|
661 |
|
662 |
|
663 |
|
664 TInt CCommDbTest009_09::executeStepL() |
|
665 { |
|
666 return KErrInUse; |
|
667 } |
|
668 |
|
669 |
|
670 TVerdict CCommDbTest009_09::doTestStepL( ) |
|
671 { |
|
672 INFO_PRINTF1(_L("Step 009.09 called")); |
|
673 |
|
674 //This test step needs to trap a Panic |
|
675 |
|
676 if ( executeStepL() == KErrInUse ) |
|
677 SetTestStepResult(EPass); else |
|
678 SetTestStepResult(EFail); return TestStepResult(); |
|
679 } |
|
680 |
|
681 ///////////////////// |
|
682 // Test step 009.10 |
|
683 ///////////////////// |
|
684 |
|
685 // constructor |
|
686 CCommDbTest009_10::CCommDbTest009_10() |
|
687 { |
|
688 // store the name of this test case |
|
689 SetTestStepName(_L("step_009_10")); |
|
690 } |
|
691 |
|
692 // destructor |
|
693 CCommDbTest009_10::~CCommDbTest009_10() |
|
694 { |
|
695 } |
|
696 |
|
697 |
|
698 TVerdict CCommDbTest009_10::doTestStepPreambleL() |
|
699 { |
|
700 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
701 SetTestStepResult(EPass); return TestStepResult(); |
|
702 } |
|
703 |
|
704 |
|
705 #define ISP_INIT_STRING_LONG_VALUE _L8("aVeryVeryLongColumnValueThatIsLongerThanFiftyCharacters") |
|
706 |
|
707 |
|
708 TInt CCommDbTest009_10::executeStepL() |
|
709 { |
|
710 TInt ret=KErrGeneral; |
|
711 TUint32 id; |
|
712 |
|
713 //Try to insert a record |
|
714 CDBLEAVE( iTheView->InsertRecord( id ), KErrNone ); |
|
715 |
|
716 //Write a long string |
|
717 TRAP(ret, iTheView->WriteTextL( TPtrC(ISP_INIT_STRING), ISP_INIT_STRING_LONG_VALUE ) ); |
|
718 |
|
719 return ret; |
|
720 } |
|
721 |
|
722 |
|
723 TVerdict CCommDbTest009_10::doTestStepL( ) |
|
724 { |
|
725 INFO_PRINTF1(_L("Step 009.10 called")); |
|
726 |
|
727 if ( executeStepL() == KErrOverflow ) |
|
728 SetTestStepResult(EPass); else |
|
729 SetTestStepResult(EFail); |
|
730 return TestStepResult(); |
|
731 } |
|
732 |
|
733 |
|
734 |
|
735 |
|
736 ///////////////////// |
|
737 // Test step 009.11 |
|
738 ///////////////////// |
|
739 |
|
740 // constructor |
|
741 CCommDbTest009_11::CCommDbTest009_11() |
|
742 { |
|
743 // store the name of this test case |
|
744 SetTestStepName(_L("step_009_11")); |
|
745 } |
|
746 |
|
747 // destructor |
|
748 CCommDbTest009_11::~CCommDbTest009_11() |
|
749 { |
|
750 } |
|
751 |
|
752 TVerdict CCommDbTest009_11::doTestStepL( ) |
|
753 { |
|
754 INFO_PRINTF1(_L("Step 009.11 called ")); |
|
755 |
|
756 SetTestStepResult(EPass); |
|
757 // Have backup of Database in c:\default7.dat |
|
758 // Heap test for 009.01 |
|
759 |
|
760 CCommDbTest009_01* step009_01 = new(ELeave) CCommDbTest009_01; |
|
761 CleanupStack::PushL(step009_01); |
|
762 doTestStepWithHeapFailureL( *step009_01, KErrNone); |
|
763 if ( step009_01->TestStepResult() == EFail ) |
|
764 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step009_01); |
|
765 |
|
766 |
|
767 return TestStepResult(); |
|
768 |
|
769 } |
|
770 |
|
771 |
|
772 // constructor |
|
773 CCommDbTest009_12::CCommDbTest009_12() |
|
774 { |
|
775 // store the name of this test case |
|
776 SetTestStepName(_L("step_009_12")); |
|
777 } |
|
778 |
|
779 // destructor |
|
780 CCommDbTest009_12::~CCommDbTest009_12() |
|
781 { |
|
782 } |
|
783 |
|
784 TVerdict CCommDbTest009_12::doTestStepL( ) |
|
785 { |
|
786 // store the name of this test case |
|
787 SetTestStepName(_L("step_009_12")); |
|
788 SetTestStepResult(EPass); |
|
789 CCommDbTest009_02* step009_02 = new(ELeave) CCommDbTest009_02; |
|
790 CleanupStack::PushL(step009_02); |
|
791 doTestStepWithHeapFailureL( *step009_02, KErrNone); |
|
792 if ( step009_02->TestStepResult() == EFail ) |
|
793 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step009_02); |
|
794 |
|
795 return TestStepResult(); |
|
796 } |
|
797 |
|
798 // constructor |
|
799 CCommDbTest009_13::CCommDbTest009_13() |
|
800 { |
|
801 // store the name of this test case |
|
802 SetTestStepName(_L("step_009_13")); |
|
803 } |
|
804 |
|
805 // destructor |
|
806 CCommDbTest009_13::~CCommDbTest009_13() |
|
807 { |
|
808 } |
|
809 |
|
810 TVerdict CCommDbTest009_13::doTestStepL( ) |
|
811 { |
|
812 // store the name of this test case |
|
813 SetTestStepName(_L("step_009_13")); |
|
814 SetTestStepResult(EPass); |
|
815 // Heap test for 009.03 |
|
816 CCommDbTest009_03* step009_03 = new(ELeave) CCommDbTest009_03; |
|
817 CleanupStack::PushL(step009_03); |
|
818 doTestStepWithHeapFailureL( *step009_03, KErrNone); |
|
819 if ( step009_03->TestStepResult() == EFail ) |
|
820 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step009_03); |
|
821 |
|
822 return TestStepResult(); |
|
823 } |
|
824 |
|
825 // constructor |
|
826 CCommDbTest009_14::CCommDbTest009_14() |
|
827 { |
|
828 // store the name of this test case |
|
829 SetTestStepName(_L("step_009_14")); |
|
830 } |
|
831 |
|
832 // destructor |
|
833 CCommDbTest009_14::~CCommDbTest009_14() |
|
834 { |
|
835 } |
|
836 |
|
837 TVerdict CCommDbTest009_14::doTestStepL( ) |
|
838 { |
|
839 // store the name of this test case |
|
840 SetTestStepName(_L("step_009_14")); |
|
841 SetTestStepResult(EPass); |
|
842 // Heap test for 009.04 |
|
843 CCommDbTest009_04* step009_04 = new(ELeave) CCommDbTest009_04; |
|
844 CleanupStack::PushL(step009_04); |
|
845 doTestStepWithHeapFailureL( *step009_04, KErrNone); |
|
846 if ( step009_04->TestStepResult() == EFail ) |
|
847 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step009_04); |
|
848 |
|
849 return TestStepResult(); |
|
850 } |
|
851 |
|
852 // constructor |
|
853 CCommDbTest009_15::CCommDbTest009_15() |
|
854 { |
|
855 // store the name of this test case |
|
856 SetTestStepName(_L("step_009_15")); |
|
857 } |
|
858 |
|
859 // destructor |
|
860 CCommDbTest009_15::~CCommDbTest009_15() |
|
861 { |
|
862 } |
|
863 |
|
864 TVerdict CCommDbTest009_15::doTestStepL( ) |
|
865 { |
|
866 // store the name of this test case |
|
867 SetTestStepName(_L("step_009_15")); |
|
868 SetTestStepResult(EPass); |
|
869 // Heap test for 009.05 |
|
870 CCommDbTest009_05* step009_05 = new(ELeave) CCommDbTest009_05; |
|
871 CleanupStack::PushL(step009_05); |
|
872 doTestStepWithHeapFailureL( *step009_05, KErrNone); |
|
873 if ( step009_05->TestStepResult() == EFail ) |
|
874 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step009_05); |
|
875 |
|
876 // Heap test for 009.06 |
|
877 CCommDbTest009_06* step009_06 = new(ELeave) CCommDbTest009_06; |
|
878 CleanupStack::PushL(step009_06); |
|
879 doTestStepWithHeapFailureL( *step009_06, KErrNotFound); |
|
880 if ( step009_06->TestStepResult() == EFail ) |
|
881 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step009_06); |
|
882 |
|
883 return TestStepResult(); |
|
884 } |
|
885 |
|
886 // constructor |
|
887 CCommDbTest009_16::CCommDbTest009_16() |
|
888 { |
|
889 // store the name of this test case |
|
890 SetTestStepName(_L("step_009_16")); |
|
891 } |
|
892 |
|
893 // destructor |
|
894 CCommDbTest009_16::~CCommDbTest009_16() |
|
895 { |
|
896 } |
|
897 |
|
898 TVerdict CCommDbTest009_16::doTestStepL( ) |
|
899 { |
|
900 // store the name of this test case |
|
901 SetTestStepName(_L("step_009_16")); |
|
902 SetTestStepResult(EPass); |
|
903 // Heap test for 009.09 |
|
904 CCommDbTest009_09* step009_09 = new(ELeave) CCommDbTest009_09; |
|
905 CleanupStack::PushL(step009_09); |
|
906 doTestStepWithHeapFailureL( *step009_09, KErrInUse); |
|
907 if ( step009_09->TestStepResult() == EFail ) |
|
908 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step009_09); |
|
909 |
|
910 // Heap test for 009.10 |
|
911 CCommDbTest009_10* step009_10 = new(ELeave) CCommDbTest009_10; |
|
912 CleanupStack::PushL(step009_10); |
|
913 doTestStepWithHeapFailureL( *step009_10, KErrOverflow); |
|
914 if ( step009_10->TestStepResult() == EFail ) |
|
915 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step009_10); |
|
916 |
|
917 return TestStepResult(); |
|
918 } |
|
919 |
|
920 |
|
921 // constructor |
|
922 CCommDbTest009_17::CCommDbTest009_17() |
|
923 { |
|
924 // store the name of this test case |
|
925 SetTestStepName(_L("step_009_17")); |
|
926 } |
|
927 |
|
928 // destructor |
|
929 CCommDbTest009_17::~CCommDbTest009_17() |
|
930 { |
|
931 } |
|
932 |
|
933 TVerdict CCommDbTest009_17::doTestStepPreambleL() |
|
934 { |
|
935 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
936 SetTestStepResult(EPass); return TestStepResult(); |
|
937 } |
|
938 |
|
939 TInt CCommDbTest009_17::executeStepL() |
|
940 { |
|
941 TBuf<50> buff; |
|
942 |
|
943 TInt ret(0); |
|
944 |
|
945 CDBLEAVE( ret = iTheView->GotoFirstRecord(), KErrNone ); |
|
946 |
|
947 iTheView->UpdateRecord(); |
|
948 |
|
949 iTheView->SetNullL( TPtrC(ISP_IF_CALLBACK_INFO )); |
|
950 |
|
951 User::LeaveIfError(iTheView->PutRecordChanges()); |
|
952 |
|
953 iTheView->ReadTextL(TPtrC(ISP_IF_CALLBACK_INFO ), buff); |
|
954 |
|
955 if(buff.Length() == 0) |
|
956 { |
|
957 ret = KErrNone; |
|
958 } |
|
959 else |
|
960 { |
|
961 ret = KErrGeneral; |
|
962 } |
|
963 |
|
964 return ret; |
|
965 } |
|
966 |
|
967 // do Test step 009.17 |
|
968 TVerdict CCommDbTest009_17::doTestStepL( ) |
|
969 { |
|
970 |
|
971 INFO_PRINTF1(_L("Step 009.17 called ")); |
|
972 if (executeStepL() == KErrNone) |
|
973 SetTestStepResult(EPass); else |
|
974 SetTestStepResult(EFail); |
|
975 |
|
976 return TestStepResult(); |
|
977 } |
|
978 |
|
979 ///////////////////// |
|
980 // Test step 009.18 |
|
981 ///////////////////// |
|
982 |
|
983 // constructor |
|
984 CCommDbTest009_18::CCommDbTest009_18() |
|
985 { |
|
986 // store the name of this test case |
|
987 SetTestStepName(_L("step_009_18")); |
|
988 } |
|
989 |
|
990 // destructor |
|
991 CCommDbTest009_18::~CCommDbTest009_18() |
|
992 { |
|
993 } |
|
994 |
|
995 TVerdict CCommDbTest009_18::doTestStepPreambleL() |
|
996 { |
|
997 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
998 SetTestStepResult(EPass); return TestStepResult(); |
|
999 } |
|
1000 |
|
1001 TInt CCommDbTest009_18::executeStepL() |
|
1002 { |
|
1003 TBuf<KCommsDbSvrMaxColumnNameLength> tableName; |
|
1004 SetTestStepResult(EFail); iTheView->GetTableName( tableName ); |
|
1005 if ( tableName.Compare( TPtrC(DIAL_OUT_ISP)) != KErrNone ) |
|
1006 { |
|
1007 SetTestStepResult(EFail); } |
|
1008 else |
|
1009 { |
|
1010 SetTestStepResult(EPass); } |
|
1011 return TestStepResult(); |
|
1012 } |
|
1013 |
|
1014 // do Test step 009.18 |
|
1015 TVerdict CCommDbTest009_18::doTestStepL( ) |
|
1016 { |
|
1017 SetTestStepResult(EFail); INFO_PRINTF1(_L("Step 009.18 called ")); |
|
1018 if (executeStepL() != KErrNone) |
|
1019 { |
|
1020 SetTestStepResult(EFail); } |
|
1021 else |
|
1022 { |
|
1023 SetTestStepResult(EPass); } |
|
1024 return TestStepResult(); |
|
1025 } |
|
1026 |
|
1027 ///////////////////// |
|
1028 // Test step 009.19 |
|
1029 ///////////////////// |
|
1030 |
|
1031 // constructor |
|
1032 CCommDbTest009_19::CCommDbTest009_19() |
|
1033 { |
|
1034 // store the name of this test case |
|
1035 SetTestStepName(_L("step_009_19")); |
|
1036 } |
|
1037 |
|
1038 // destructor |
|
1039 CCommDbTest009_19::~CCommDbTest009_19() |
|
1040 { |
|
1041 } |
|
1042 |
|
1043 TVerdict CCommDbTest009_19::doTestStepL( ) |
|
1044 { |
|
1045 INFO_PRINTF1(_L("Step 009.19 called ")); |
|
1046 |
|
1047 SetTestStepResult(EPass); |
|
1048 // Heap test for 009.17 |
|
1049 |
|
1050 CCommDbTest009_17* step009_17 = new(ELeave) CCommDbTest009_17; |
|
1051 CleanupStack::PushL(step009_17); |
|
1052 if ( doTestStepWithHeapFailureL( *step009_17, KErrNone) == EFail ) |
|
1053 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step009_17); |
|
1054 |
|
1055 return TestStepResult(); |
|
1056 |
|
1057 } |
|
1058 |
|
1059 ///////////////////// |
|
1060 // Test step 009.20 |
|
1061 ///////////////////// |
|
1062 |
|
1063 // constructor |
|
1064 CCommDbTest009_20::CCommDbTest009_20() |
|
1065 { |
|
1066 // store the name of this test case |
|
1067 SetTestStepName(_L("step_009_20")); |
|
1068 } |
|
1069 |
|
1070 // destructor |
|
1071 CCommDbTest009_20::~CCommDbTest009_20() |
|
1072 { |
|
1073 } |
|
1074 |
|
1075 TVerdict CCommDbTest009_20::doTestStepL( ) |
|
1076 { |
|
1077 |
|
1078 SetTestStepResult(EPass); |
|
1079 // Heap test for 009.07 |
|
1080 |
|
1081 CCommDbTest009_07* step009_07 = new(ELeave) CCommDbTest009_07; |
|
1082 CleanupStack::PushL(step009_07); |
|
1083 if ( doTestStepWithHeapFailureL( *step009_07, KErrNone) == EFail ) |
|
1084 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step009_07); |
|
1085 |
|
1086 return TestStepResult(); |
|
1087 |
|
1088 } |
|
1089 |
|
1090 ///////////////////// |
|
1091 // Test step 009.21 |
|
1092 ///////////////////// |
|
1093 |
|
1094 // constructor |
|
1095 CCommDbTest009_21::CCommDbTest009_21() |
|
1096 { |
|
1097 // store the name of this test case |
|
1098 SetTestStepName(_L("step_009_21")); |
|
1099 } |
|
1100 |
|
1101 // destructor |
|
1102 CCommDbTest009_21::~CCommDbTest009_21() |
|
1103 { |
|
1104 } |
|
1105 |
|
1106 TVerdict CCommDbTest009_21::doTestStepL( ) |
|
1107 { |
|
1108 |
|
1109 SetTestStepResult(EPass); |
|
1110 // Heap test for 009.08 |
|
1111 |
|
1112 CCommDbTest009_08* step009_08 = new(ELeave) CCommDbTest009_08; |
|
1113 CleanupStack::PushL(step009_08); |
|
1114 if ( doTestStepWithHeapFailureL( *step009_08, KErrNone) == EFail ) |
|
1115 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step009_08); |
|
1116 |
|
1117 return TestStepResult(); |
|
1118 |
|
1119 } |
|
1120 |
|
1121 //EOF |