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 015.XX |
|
15 // |
|
16 // |
|
17 |
|
18 // EPOC includes |
|
19 #include <e32base.h> |
|
20 #include <commdb.h> |
|
21 #include <d32comm.h> |
|
22 |
|
23 |
|
24 // Test system includes |
|
25 #include <networking/log.h> |
|
26 #include <networking/teststep.h> |
|
27 #include "Teststepcommdb.h" |
|
28 #include "TestSuiteCommdb.h" |
|
29 #include "Step_015_xx.h" |
|
30 |
|
31 |
|
32 |
|
33 // |
|
34 // Test step 015.01 |
|
35 // |
|
36 |
|
37 // constructor |
|
38 CCommDbTest015_01::CCommDbTest015_01() |
|
39 { |
|
40 // store the name of this test case |
|
41 iTestStepName = _L("step_015_01"); |
|
42 } |
|
43 |
|
44 // destructor |
|
45 CCommDbTest015_01::~CCommDbTest015_01() |
|
46 { |
|
47 } |
|
48 |
|
49 |
|
50 TVerdict CCommDbTest015_01::doTestStepPreambleL() |
|
51 { |
|
52 openDbL(); |
|
53 return EPass; |
|
54 } |
|
55 |
|
56 |
|
57 TInt CCommDbTest015_01::executeStepL() |
|
58 { |
|
59 TInt ret=KErrGeneral; |
|
60 |
|
61 //Check the inTransaction flag |
|
62 |
|
63 TRAPD(r, iTheDb->BeginTransaction() ); |
|
64 |
|
65 ret = !(iTheDb->InTransaction() ); |
|
66 |
|
67 if ( r != KErrNone ) |
|
68 { |
|
69 ret = r; |
|
70 } |
|
71 |
|
72 |
|
73 return ret; |
|
74 } |
|
75 |
|
76 |
|
77 |
|
78 TVerdict CCommDbTest015_01::doTestStepL( ) |
|
79 { |
|
80 Log(_L("Step 015.01 called ")); |
|
81 |
|
82 if ( executeStepL() == KErrNone ) |
|
83 iTestStepResult = EPass; |
|
84 else |
|
85 iTestStepResult = EFail; |
|
86 |
|
87 return iTestStepResult; |
|
88 } |
|
89 |
|
90 // |
|
91 // Test step 015.02 |
|
92 // |
|
93 |
|
94 // constructor |
|
95 CCommDbTest015_02::CCommDbTest015_02() |
|
96 { |
|
97 // store the name of this test case |
|
98 iTestStepName = _L("step_015_02"); |
|
99 } |
|
100 |
|
101 // destructor |
|
102 CCommDbTest015_02::~CCommDbTest015_02() |
|
103 { |
|
104 } |
|
105 |
|
106 TVerdict CCommDbTest015_02::doTestStepPreambleL() |
|
107 { |
|
108 openDbAndViewL(TPtrC(MODEM_BEARER)); |
|
109 return EPass; |
|
110 } |
|
111 |
|
112 |
|
113 |
|
114 TInt CCommDbTest015_02::executeStepL() |
|
115 { |
|
116 TInt ret=KErrGeneral; |
|
117 |
|
118 TUint32 id; |
|
119 TBool beforeValue=EFalse, afterValue=EFalse; |
|
120 |
|
121 |
|
122 //Check that the write lock flag is set when the |
|
123 //database is written to. |
|
124 //Take a copy of the flag before we insert a record |
|
125 TRAPD(r, beforeValue = iTheDb->IsDatabaseWriteLockedL() ); |
|
126 |
|
127 CDBLEAVE( iTheDb->BeginTransaction(), KErrNone ); |
|
128 |
|
129 CDBLEAVE( iTheView->InsertRecord( id ), KErrNone ); |
|
130 |
|
131 //Take a copy after the insert |
|
132 afterValue = iTheDb->IsDatabaseWriteLockedL(); |
|
133 |
|
134 iTheView->CancelRecordChanges(); |
|
135 |
|
136 //Now get the flag value after the record has been written |
|
137 |
|
138 if ( r == KErrNone ) |
|
139 { |
|
140 if ( !beforeValue && afterValue ) |
|
141 ret = KErrNone; |
|
142 } |
|
143 else |
|
144 { |
|
145 //return the trap value |
|
146 ret = r; |
|
147 } |
|
148 |
|
149 return ret; |
|
150 } |
|
151 |
|
152 |
|
153 |
|
154 TVerdict CCommDbTest015_02::doTestStepL( ) |
|
155 { |
|
156 Log(_L("Step 015.02 called ")); |
|
157 |
|
158 if ( executeStepL() == KErrNone ) |
|
159 iTestStepResult = EPass; |
|
160 else |
|
161 iTestStepResult = EFail; |
|
162 |
|
163 return iTestStepResult; |
|
164 } |
|
165 |
|
166 |
|
167 |
|
168 // |
|
169 // Test step 015.03 |
|
170 // |
|
171 |
|
172 // constructor |
|
173 CCommDbTest015_03::CCommDbTest015_03() |
|
174 { |
|
175 // store the name of this test case |
|
176 iTestStepName = _L("step_015_03"); |
|
177 // default to no local objects allocated |
|
178 } |
|
179 |
|
180 // destructor |
|
181 CCommDbTest015_03::~CCommDbTest015_03() |
|
182 { |
|
183 } |
|
184 |
|
185 TVerdict CCommDbTest015_03::doTestStepPreambleL() |
|
186 { |
|
187 openDbAndViewL(TPtrC(MODEM_BEARER)); |
|
188 return EPass; |
|
189 } |
|
190 |
|
191 |
|
192 TInt CCommDbTest015_03::executeStepL() |
|
193 { |
|
194 TUint32 id; |
|
195 |
|
196 //Commit a record and check for correct state of flags |
|
197 |
|
198 CDBLEAVE( iTheDb->BeginTransaction(), KErrNone ); |
|
199 |
|
200 CDBLEAVE( iTheView->InsertRecord( id ), KErrNone ); |
|
201 |
|
202 _LIT(KName,"CCommDbTest015_03"); |
|
203 _LIT(KTsy,"HAYES"); |
|
204 _LIT8(KModemInitString,"AT&F1"); |
|
205 _LIT8(KModemFaxInitString,"AT&d2"); |
|
206 //Write some sample data into the table |
|
207 iTheView->WriteTextL(TPtrC(COMMDB_NAME),KName); |
|
208 iTheView->WriteTextL(TPtrC(MODEM_TSY_NAME),KTsy); |
|
209 iTheView->WriteUintL(TPtrC(MODEM_RATE),(TUint32)EBps57600); |
|
210 iTheView->WriteUintL(TPtrC(MODEM_DATA_BITS),(TUint32)EData8); |
|
211 iTheView->WriteUintL(TPtrC(MODEM_STOP_BITS),(TUint32)EStop1); |
|
212 iTheView->WriteUintL(TPtrC(MODEM_PARITY),(TUint32)EParityNone); |
|
213 iTheView->WriteUintL(TPtrC(MODEM_HANDSHAKING),(TUint32)(KConfigObeyCTS|KConfigObeyDSR|KConfigFailDSR|KConfigObeyDCD|KConfigFailDCD)); //KConfigObeyCTS; |
|
214 iTheView->WriteUintL(TPtrC(MODEM_SPECIAL_RATE),(TUint32)0); |
|
215 iTheView->WriteUintL(TPtrC(MODEM_XON_CHAR),(TUint32)0); |
|
216 iTheView->WriteUintL(TPtrC(MODEM_XOFF_CHAR),(TUint32)0); |
|
217 iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING),KModemInitString); |
|
218 iTheView->WriteTextL(TPtrC(MODEM_DATA_INIT_STRING),KNullDesC8); |
|
219 iTheView->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING),KModemFaxInitString); |
|
220 iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_PREF),(TUint32)EModemSpeakerSettingAfterDialUntilAnswer); |
|
221 iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_VOL_PREF),(TUint32)EModemSpeakerVolumeQuiet); |
|
222 |
|
223 CDBLEAVE ( iTheView->PutRecordChanges(), KErrNone ); |
|
224 User::LeaveIfError(iTheDb->CommitTransaction()); |
|
225 |
|
226 delete iTheView; |
|
227 iTheView=NULL; |
|
228 |
|
229 //Create a new view that should have the record in it |
|
230 iTheView = iTheDb->OpenViewMatchingTextLC( TPtrC(MODEM_BEARER), TPtrC(COMMDB_NAME), KName); |
|
231 CleanupStack::Pop(); |
|
232 |
|
233 User::LeaveIfError(iTheView->GotoFirstRecord()); //Will leave if first record isn't there |
|
234 |
|
235 if (! iTheDb->IsDatabaseWriteLockedL() && ! iTheDb->InTransaction() ) |
|
236 return KErrNone; |
|
237 |
|
238 return KErrGeneral; |
|
239 } |
|
240 |
|
241 |
|
242 |
|
243 TVerdict CCommDbTest015_03::doTestStepL( ) |
|
244 { |
|
245 Log(_L("Step 015.03 called ")); |
|
246 |
|
247 if ( executeStepL() == KErrNone ) |
|
248 iTestStepResult = EPass; |
|
249 else |
|
250 iTestStepResult = EFail; |
|
251 |
|
252 return iTestStepResult; |
|
253 } |
|
254 |
|
255 |
|
256 |
|
257 |
|
258 |
|
259 // |
|
260 // Test step 015.04 |
|
261 // |
|
262 |
|
263 // constructor |
|
264 CCommDbTest015_04::CCommDbTest015_04() |
|
265 { |
|
266 // store the name of this test case |
|
267 iTestStepName = _L("step_015_04"); |
|
268 // default to no local objects allocated |
|
269 } |
|
270 |
|
271 // destructor |
|
272 CCommDbTest015_04::~CCommDbTest015_04() |
|
273 { |
|
274 } |
|
275 |
|
276 TVerdict CCommDbTest015_04::doTestStepPreambleL() |
|
277 { |
|
278 openDbAndViewL(TPtrC(MODEM_BEARER)); |
|
279 return EPass; |
|
280 } |
|
281 |
|
282 |
|
283 TInt CCommDbTest015_04::executeStepL() |
|
284 { |
|
285 TInt ret=KErrGeneral; |
|
286 TUint32 id; |
|
287 |
|
288 |
|
289 //Check that we can rollback a transaction |
|
290 //NB Test assumes that the table is empty |
|
291 |
|
292 |
|
293 CDBLEAVE( iTheDb->BeginTransaction(), KErrNone ); |
|
294 CDBLEAVE( iTheView->InsertRecord( id ), KErrNone ); |
|
295 |
|
296 _LIT(KName,"CCommDbTest015_04"); |
|
297 _LIT(KTsy,"HAYES"); |
|
298 _LIT8(KModemInitString,"AT&F1"); |
|
299 _LIT8(KModemFaxInitString,"AT&d2"); |
|
300 //Write some sample data into the table |
|
301 iTheView->WriteTextL(TPtrC(COMMDB_NAME),KName); |
|
302 iTheView->WriteTextL(TPtrC(MODEM_TSY_NAME),KTsy); |
|
303 iTheView->WriteUintL(TPtrC(MODEM_RATE),(TUint32)EBps57600); |
|
304 iTheView->WriteUintL(TPtrC(MODEM_DATA_BITS),(TUint32)EData8); |
|
305 iTheView->WriteUintL(TPtrC(MODEM_STOP_BITS),(TUint32)EStop1); |
|
306 iTheView->WriteUintL(TPtrC(MODEM_PARITY),(TUint32)EParityNone); |
|
307 iTheView->WriteUintL(TPtrC(MODEM_HANDSHAKING),(TUint32)(KConfigObeyCTS|KConfigObeyDSR|KConfigFailDSR|KConfigObeyDCD|KConfigFailDCD)); //KConfigObeyCTS; |
|
308 iTheView->WriteUintL(TPtrC(MODEM_SPECIAL_RATE),(TUint32)0); |
|
309 iTheView->WriteUintL(TPtrC(MODEM_XON_CHAR),(TUint32)0); |
|
310 iTheView->WriteUintL(TPtrC(MODEM_XOFF_CHAR),(TUint32)0); |
|
311 iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING),KModemInitString); |
|
312 iTheView->WriteTextL(TPtrC(MODEM_DATA_INIT_STRING),KNullDesC8); |
|
313 iTheView->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING),KModemFaxInitString); |
|
314 iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_PREF),(TUint32)EModemSpeakerSettingAfterDialUntilAnswer); |
|
315 iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_VOL_PREF),(TUint32)EModemSpeakerVolumeQuiet); |
|
316 CDBLEAVE( iTheView->PutRecordChanges(), KErrNone ); |
|
317 |
|
318 //Rollback the record we've just written |
|
319 TRAPD(r, iTheDb->RollbackTransaction() ); |
|
320 |
|
321 //Get rid of our view |
|
322 delete iTheView; |
|
323 iTheView=0; |
|
324 |
|
325 //Create a new view that should have the record in it |
|
326 iTheView = iTheDb->OpenViewMatchingTextLC( TPtrC(MODEM_BEARER), TPtrC(COMMDB_NAME), KName); |
|
327 |
|
328 CleanupStack::Pop(); |
|
329 |
|
330 ret = iTheView->GotoFirstRecord(); |
|
331 |
|
332 if ( r == KErrNone ) |
|
333 { |
|
334 if ( ret == KErrNotFound ) |
|
335 ret = KErrNone; |
|
336 else |
|
337 ret = KErrGeneral; |
|
338 } |
|
339 else |
|
340 { |
|
341 //Trap occoured, so return that value instead |
|
342 ret = r; |
|
343 } |
|
344 |
|
345 |
|
346 return ret; |
|
347 } |
|
348 |
|
349 TVerdict CCommDbTest015_04::doTestStepPostambleL() |
|
350 { |
|
351 |
|
352 //Get rid of our view |
|
353 if(iTheView) |
|
354 { |
|
355 delete iTheView; |
|
356 } |
|
357 iTheView=0; |
|
358 |
|
359 _LIT(KName,"CCommDbTest015_04"); |
|
360 //Create a new view that should have the record that was added in executeStepL and |
|
361 // may have been left in by a leave condition |
|
362 iTheView = iTheDb->OpenViewMatchingTextLC( TPtrC(MODEM_BEARER), TPtrC(COMMDB_NAME), KName); |
|
363 CleanupStack::Pop(); |
|
364 |
|
365 if(iTheView->GotoFirstRecord() == KErrNone) |
|
366 { |
|
367 iTheView->DeleteRecord(); |
|
368 } |
|
369 |
|
370 // Cleanup after test run |
|
371 CTestStepCommDb::doTestStepPostambleL(); |
|
372 return EPass; |
|
373 } |
|
374 |
|
375 TVerdict CCommDbTest015_04::doTestStepL( ) |
|
376 { |
|
377 Log(_L("Step 015.04 called ")); |
|
378 |
|
379 if ( executeStepL() == KErrNone ) |
|
380 iTestStepResult = EPass; |
|
381 else |
|
382 iTestStepResult = EFail; |
|
383 |
|
384 return iTestStepResult; |
|
385 } |
|
386 |
|
387 |
|
388 |
|
389 // |
|
390 // Test step 015.05 |
|
391 // |
|
392 |
|
393 // constructor |
|
394 CCommDbTest015_05::CCommDbTest015_05() |
|
395 { |
|
396 // store the name of this test case |
|
397 iTestStepName = _L("step_015_05"); |
|
398 } |
|
399 |
|
400 // destructor |
|
401 CCommDbTest015_05::~CCommDbTest015_05() |
|
402 { |
|
403 } |
|
404 |
|
405 |
|
406 TVerdict CCommDbTest015_05::doTestStepPreambleL() |
|
407 { |
|
408 openDbAndViewL(TPtrC(MODEM_BEARER)); |
|
409 return EPass; |
|
410 } |
|
411 |
|
412 |
|
413 TInt CCommDbTest015_05::executeStepL() |
|
414 { |
|
415 TInt ret=KErrGeneral; |
|
416 TUint32 id; |
|
417 |
|
418 //Try to rollback without a prior call to BeginTransaction() |
|
419 |
|
420 // |
|
421 // NB. This test will cause the DBMS server to Panic! |
|
422 // |
|
423 |
|
424 |
|
425 CDBLEAVE( iTheView->InsertRecord( id ), KErrNone ); |
|
426 |
|
427 _LIT(KName,"CCommDbTest015_05"); |
|
428 _LIT(KTsy,"HAYES"); |
|
429 _LIT8(KModemInitString,"AT&F1"); |
|
430 _LIT8(KModemFaxInitString,"AT&d2"); |
|
431 //Write some sample data into the table |
|
432 iTheView->WriteTextL(TPtrC(COMMDB_NAME),KName); |
|
433 iTheView->WriteTextL(TPtrC(MODEM_TSY_NAME),KTsy); |
|
434 iTheView->WriteUintL(TPtrC(MODEM_RATE),(TUint32)EBps57600); |
|
435 iTheView->WriteUintL(TPtrC(MODEM_DATA_BITS),(TUint32)EData8); |
|
436 iTheView->WriteUintL(TPtrC(MODEM_STOP_BITS),(TUint32)EStop1); |
|
437 iTheView->WriteUintL(TPtrC(MODEM_PARITY),(TUint32)EParityNone); |
|
438 iTheView->WriteUintL(TPtrC(MODEM_HANDSHAKING),(TUint32)(KConfigObeyCTS|KConfigObeyDSR|KConfigFailDSR|KConfigObeyDCD|KConfigFailDCD)); //KConfigObeyCTS; |
|
439 iTheView->WriteUintL(TPtrC(MODEM_SPECIAL_RATE),(TUint32)0); |
|
440 iTheView->WriteUintL(TPtrC(MODEM_XON_CHAR),(TUint32)0); |
|
441 iTheView->WriteUintL(TPtrC(MODEM_XOFF_CHAR),(TUint32)0); |
|
442 iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING),KModemInitString); |
|
443 iTheView->WriteTextL(TPtrC(MODEM_DATA_INIT_STRING),KNullDesC8); |
|
444 iTheView->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING),KModemFaxInitString); |
|
445 iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_PREF),(TUint32)EModemSpeakerSettingAfterDialUntilAnswer); |
|
446 iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_VOL_PREF),(TUint32)EModemSpeakerVolumeQuiet); |
|
447 |
|
448 CDBLEAVE( iTheView->PutRecordChanges(), KErrNone ); |
|
449 |
|
450 TRAPD(r, iTheDb->RollbackTransaction() ); |
|
451 |
|
452 delete iTheView ; |
|
453 iTheView=0; |
|
454 |
|
455 //Create a new view that would have the record in it |
|
456 iTheView = iTheDb->OpenViewLC(TPtrC(MODEM_BEARER), _L("Select * from Modem where Name='CCommDbTest015_05'") ); |
|
457 CleanupStack::Pop(); |
|
458 |
|
459 |
|
460 ret = iTheView->GotoFirstRecord(); |
|
461 |
|
462 if ( r == KErrNone ) |
|
463 { |
|
464 if ( ret == KErrNotFound ) |
|
465 ret = KErrNone; |
|
466 else |
|
467 ret = KErrGeneral; |
|
468 } |
|
469 else |
|
470 { |
|
471 //Trap occoured, so return that value instead |
|
472 ret = r; |
|
473 } |
|
474 |
|
475 |
|
476 return ret; |
|
477 } |
|
478 |
|
479 |
|
480 |
|
481 TVerdict CCommDbTest015_05::doTestStepPostambleL() |
|
482 { |
|
483 //Get rid of our view |
|
484 if(iTheView) |
|
485 { |
|
486 delete iTheView; |
|
487 } |
|
488 iTheView=0; |
|
489 |
|
490 _LIT(KName,"CCommDbTest015_05"); |
|
491 //Create a new view that should have the record that was added in executeStepL and |
|
492 // may have been left in by a leave condition |
|
493 iTheView = iTheDb->OpenViewMatchingTextLC( TPtrC(MODEM_BEARER), TPtrC(COMMDB_NAME), KName); |
|
494 CleanupStack::Pop(); |
|
495 |
|
496 if(iTheView->GotoFirstRecord() == KErrNone) |
|
497 { |
|
498 iTheView->DeleteRecord(); |
|
499 } |
|
500 |
|
501 // Cleanup after test run |
|
502 CTestStepCommDb::doTestStepPostambleL(); |
|
503 return EPass; |
|
504 } |
|
505 |
|
506 |
|
507 TVerdict CCommDbTest015_05::doTestStepL( ) |
|
508 { |
|
509 //Log(_L("Step 015.05 called ")); |
|
510 |
|
511 TRAPD(leaveCode, executeStepL()); |
|
512 if (leaveCode != KErrNotSupported) // SQL views no longer supported |
|
513 { |
|
514 iTestStepResult = EFail; |
|
515 } |
|
516 |
|
517 return iTestStepResult; |
|
518 } |
|
519 |
|
520 |
|
521 // |
|
522 // Test step 015.06 |
|
523 // |
|
524 |
|
525 // constructor |
|
526 CCommDbTest015_06::CCommDbTest015_06() |
|
527 { |
|
528 // store the name of this test case |
|
529 iTestStepName = _L("step_015_06"); |
|
530 } |
|
531 |
|
532 // destructor |
|
533 CCommDbTest015_06::~CCommDbTest015_06() |
|
534 { |
|
535 } |
|
536 |
|
537 TVerdict CCommDbTest015_06::doTestStepPreambleL() |
|
538 { |
|
539 openDbAndViewL(TPtrC(MODEM_BEARER)); |
|
540 return EPass; |
|
541 } |
|
542 |
|
543 |
|
544 TInt CCommDbTest015_06::executeStepL() |
|
545 { |
|
546 TInt ret=KErrGeneral; |
|
547 TUint32 id; |
|
548 |
|
549 //Try to commit without a prior call to BeginTransaction() |
|
550 |
|
551 // |
|
552 // NB. This test will cause the DBMS server to Panic! |
|
553 // |
|
554 |
|
555 |
|
556 CDBLEAVE( iTheView->InsertRecord( id ), KErrNone ); |
|
557 |
|
558 _LIT(KName,"CCommDbTest015_06"); |
|
559 _LIT(KTsy,"HAYES"); |
|
560 _LIT8(KModemInitString,"AT&F1"); |
|
561 _LIT8(KModemFaxInitString,"AT&d2"); |
|
562 //Write some sample data into the table |
|
563 iTheView->WriteTextL(TPtrC(COMMDB_NAME),KName); |
|
564 iTheView->WriteTextL(TPtrC(MODEM_TSY_NAME),KTsy); |
|
565 iTheView->WriteUintL(TPtrC(MODEM_RATE),(TUint32)EBps57600); |
|
566 iTheView->WriteUintL(TPtrC(MODEM_DATA_BITS),(TUint32)EData8); |
|
567 iTheView->WriteUintL(TPtrC(MODEM_STOP_BITS),(TUint32)EStop1); |
|
568 iTheView->WriteUintL(TPtrC(MODEM_PARITY),(TUint32)EParityNone); |
|
569 iTheView->WriteUintL(TPtrC(MODEM_HANDSHAKING),(TUint32)(KConfigObeyCTS|KConfigObeyDSR|KConfigFailDSR|KConfigObeyDCD|KConfigFailDCD)); //KConfigObeyCTS; |
|
570 iTheView->WriteUintL(TPtrC(MODEM_SPECIAL_RATE),(TUint32)0); |
|
571 iTheView->WriteUintL(TPtrC(MODEM_XON_CHAR),(TUint32)0); |
|
572 iTheView->WriteUintL(TPtrC(MODEM_XOFF_CHAR),(TUint32)0); |
|
573 iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING),KModemInitString); |
|
574 iTheView->WriteTextL(TPtrC(MODEM_DATA_INIT_STRING),KNullDesC8); |
|
575 iTheView->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING),KModemFaxInitString); |
|
576 iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_PREF),(TUint32)EModemSpeakerSettingAfterDialUntilAnswer); |
|
577 iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_VOL_PREF),(TUint32)EModemSpeakerVolumeQuiet); |
|
578 |
|
579 CDBLEAVE( iTheView->PutRecordChanges(), KErrNone ); |
|
580 //This will cause a panic |
|
581 TRAPD(r, iTheDb->CommitTransaction() ); |
|
582 |
|
583 delete iTheView ; |
|
584 iTheView=0; |
|
585 |
|
586 //Create a new view that would have the record in it |
|
587 iTheView = iTheDb->OpenViewLC(TPtrC(MODEM_BEARER), _L("Select * from Modem where Name='CCommDbTest015_06'") ); |
|
588 CleanupStack::Pop(); |
|
589 |
|
590 ret = iTheView->GotoFirstRecord(); |
|
591 |
|
592 if ( r == KErrNone ) |
|
593 { |
|
594 if ( ret == KErrNotFound ) |
|
595 ret = KErrNone; |
|
596 else |
|
597 ret = KErrGeneral; |
|
598 } |
|
599 else |
|
600 { |
|
601 //Trap occoured, so return that value instead |
|
602 ret = r; |
|
603 } |
|
604 |
|
605 |
|
606 return ret; |
|
607 } |
|
608 |
|
609 |
|
610 |
|
611 TVerdict CCommDbTest015_06::doTestStepPostambleL() |
|
612 { |
|
613 //Get rid of our view |
|
614 if(iTheView) |
|
615 { |
|
616 delete iTheView; |
|
617 } |
|
618 iTheView=0; |
|
619 |
|
620 _LIT(KName,"CCommDbTest015_06"); |
|
621 //Create a new view that should have the record that was added in executeStepL and |
|
622 // may have been left in by a leave condition |
|
623 iTheView = iTheDb->OpenViewMatchingTextLC( TPtrC(MODEM_BEARER), TPtrC(COMMDB_NAME), KName); |
|
624 CleanupStack::Pop(); |
|
625 |
|
626 if(iTheView->GotoFirstRecord() == KErrNone) |
|
627 { |
|
628 iTheView->DeleteRecord(); |
|
629 } |
|
630 |
|
631 // Cleanup after test run |
|
632 CTestStepCommDb::doTestStepPostambleL(); |
|
633 return EPass; |
|
634 } |
|
635 |
|
636 |
|
637 TVerdict CCommDbTest015_06::doTestStepL( ) |
|
638 { |
|
639 //Log(_L("Step 015.06 called ")); |
|
640 |
|
641 TRAPD(leaveCode, executeStepL()); |
|
642 if (leaveCode != KErrNotSupported) // SQL views no longer supported |
|
643 { |
|
644 iTestStepResult = EFail; |
|
645 } |
|
646 |
|
647 return iTestStepResult; |
|
648 } |
|
649 |
|
650 |
|
651 |
|
652 // |
|
653 // Test step 015.07 |
|
654 // |
|
655 |
|
656 // constructor |
|
657 CCommDbTest015_07::CCommDbTest015_07() |
|
658 { |
|
659 // store the name of this test case |
|
660 iTestStepName = _L("step_015_07"); |
|
661 } |
|
662 |
|
663 // destructor |
|
664 CCommDbTest015_07::~CCommDbTest015_07() |
|
665 { |
|
666 } |
|
667 |
|
668 |
|
669 TVerdict CCommDbTest015_07::doTestStepPreambleL() |
|
670 { |
|
671 openDbAndViewL(TPtrC(MODEM_BEARER)); |
|
672 return EPass; |
|
673 } |
|
674 |
|
675 |
|
676 TInt CCommDbTest015_07::executeStepL() |
|
677 { |
|
678 TInt ret=KErrGeneral; |
|
679 TUint32 id; |
|
680 |
|
681 |
|
682 //Close the database while inside a transaction |
|
683 CDBLEAVE( iTheDb->BeginTransaction(), KErrNone ); |
|
684 |
|
685 CDBLEAVE( iTheView->InsertRecord( id ), KErrNone ); |
|
686 |
|
687 _LIT(KName,"CCommDbTest015_07"); |
|
688 _LIT(KTsy,"HAYES"); |
|
689 _LIT8(KModemInitString,"AT&F1"); |
|
690 _LIT8(KModemFaxInitString,"AT&d2"); |
|
691 //Write some sample data into the table |
|
692 iTheView->WriteTextL(TPtrC(COMMDB_NAME),KName); |
|
693 iTheView->WriteTextL(TPtrC(MODEM_TSY_NAME),KTsy); |
|
694 iTheView->WriteUintL(TPtrC(MODEM_RATE),(TUint32)EBps57600); |
|
695 iTheView->WriteUintL(TPtrC(MODEM_DATA_BITS),(TUint32)EData8); |
|
696 iTheView->WriteUintL(TPtrC(MODEM_STOP_BITS),(TUint32)EStop1); |
|
697 iTheView->WriteUintL(TPtrC(MODEM_PARITY),(TUint32)EParityNone); |
|
698 iTheView->WriteUintL(TPtrC(MODEM_HANDSHAKING),(TUint32)(KConfigObeyCTS|KConfigObeyDSR|KConfigFailDSR|KConfigObeyDCD|KConfigFailDCD)); //KConfigObeyCTS; |
|
699 iTheView->WriteUintL(TPtrC(MODEM_SPECIAL_RATE),(TUint32)0); |
|
700 iTheView->WriteUintL(TPtrC(MODEM_XON_CHAR),(TUint32)0); |
|
701 iTheView->WriteUintL(TPtrC(MODEM_XOFF_CHAR),(TUint32)0); |
|
702 iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING),KModemInitString); |
|
703 iTheView->WriteTextL(TPtrC(MODEM_DATA_INIT_STRING),KNullDesC8); |
|
704 iTheView->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING),KModemFaxInitString); |
|
705 iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_PREF),(TUint32)EModemSpeakerSettingAfterDialUntilAnswer); |
|
706 iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_VOL_PREF),(TUint32)EModemSpeakerVolumeQuiet); |
|
707 |
|
708 CDBLEAVE( iTheView->PutRecordChanges(), KErrNone ); |
|
709 |
|
710 delete iTheView ; |
|
711 iTheView=0; |
|
712 |
|
713 //Close the DB |
|
714 delete iTheDb; |
|
715 iTheDb = 0; |
|
716 |
|
717 //NB Only get here if we didnt trap, so it must have passed |
|
718 ret = KErrNone; |
|
719 |
|
720 |
|
721 return ret; |
|
722 } |
|
723 |
|
724 |
|
725 |
|
726 TVerdict CCommDbTest015_07::doTestStepL( ) |
|
727 { |
|
728 Log(_L("Step 015.07 called ")); |
|
729 |
|
730 if ( executeStepL() == KErrNone ) |
|
731 iTestStepResult = EPass; |
|
732 else |
|
733 iTestStepResult = EFail; |
|
734 |
|
735 return iTestStepResult; |
|
736 } |
|
737 |
|
738 |
|
739 // |
|
740 // Test step 015.08 |
|
741 // |
|
742 |
|
743 // constructor |
|
744 CCommDbTest015_08::CCommDbTest015_08() |
|
745 { |
|
746 // store the name of this test case |
|
747 iTestStepName = _L("step_015_08"); |
|
748 } |
|
749 |
|
750 // destructor |
|
751 CCommDbTest015_08::~CCommDbTest015_08() |
|
752 { |
|
753 } |
|
754 |
|
755 |
|
756 TVerdict CCommDbTest015_08::doTestStepPreambleL() |
|
757 { |
|
758 openDbAndViewL(TPtrC(DIAL_OUT_ISP)); |
|
759 return EPass; |
|
760 } |
|
761 |
|
762 |
|
763 TInt CCommDbTest015_08::tryDatabaseWriteL(void) |
|
764 { |
|
765 TInt ret; |
|
766 |
|
767 //Open the database |
|
768 CCommsDatabase* theDb; |
|
769 theDb=CCommsDatabase::NewL(EDatabaseTypeIAP); |
|
770 CleanupStack::PushL(theDb); |
|
771 |
|
772 //Open a view |
|
773 CCommsDbTableView* theView; |
|
774 theView = theDb->OpenTableLC( TPtrC(DIAL_OUT_ISP) ); |
|
775 |
|
776 //Try to write |
|
777 TUint32 id; |
|
778 ret = theView->InsertRecord( id ); |
|
779 |
|
780 CleanupStack::PopAndDestroy(2); |
|
781 |
|
782 return ret; |
|
783 } |
|
784 |
|
785 // |
|
786 // This function is executed as a separate thread from Step 015_08. |
|
787 // It will try to write to the database, and should fail, as the database |
|
788 // will be write locked by CCommDbTest015_08::executeStepL() |
|
789 // |
|
790 TInt CCommDbTest015_08::step015_08Thread ( void * /*ptr*/ ) |
|
791 { |
|
792 TInt ret=KErrGeneral; |
|
793 |
|
794 // get clean-up stack |
|
795 CTrapCleanup* cleanup=CTrapCleanup::New(); |
|
796 |
|
797 if(!cleanup) |
|
798 return KErrNoMemory; |
|
799 //try to write to the database |
|
800 TRAPD(r, ret = tryDatabaseWriteL() ); |
|
801 |
|
802 if ( r!=KErrNone ) |
|
803 ret = r; |
|
804 |
|
805 // done with the clean up stack |
|
806 delete cleanup; |
|
807 |
|
808 |
|
809 return ret; |
|
810 } |
|
811 |
|
812 TInt CCommDbTest015_08::executeStepL() |
|
813 { |
|
814 TInt ret=KErrGeneral; |
|
815 |
|
816 |
|
817 //Lock the database, then request another thread to attempt a write |
|
818 |
|
819 //Start an insert to lock the database |
|
820 TUint32 id; |
|
821 |
|
822 CDBLEAVE( iTheDb->BeginTransaction(), KErrNone ); |
|
823 CDBLEAVE( iTheView->InsertRecord( id ), KErrNone ); |
|
824 |
|
825 TEST( iTheDb->IsDatabaseWriteLockedL() ); |
|
826 |
|
827 //Set up a new thread |
|
828 RThread t; |
|
829 |
|
830 TInt res=t.Create(_L("Step015_08Thread"),step015_08Thread, KDefaultStackSize,&User::Heap(),0 ); |
|
831 |
|
832 if ( res != KErrNone ) |
|
833 User::Leave( res ); |
|
834 |
|
835 // start the thread and request the status |
|
836 TRequestStatus stat; |
|
837 t.Logon(stat); |
|
838 t.Resume(); |
|
839 User::WaitForRequest(stat); |
|
840 |
|
841 // get the test result |
|
842 ret = stat.Int(); |
|
843 |
|
844 TExitType exitVal = t.ExitType(); |
|
845 TEST( exitVal == EExitKill ); |
|
846 |
|
847 // done with the test thread |
|
848 t.Close(); |
|
849 |
|
850 return ret; |
|
851 } |
|
852 |
|
853 |
|
854 |
|
855 TVerdict CCommDbTest015_08::doTestStepL( ) |
|
856 { |
|
857 Log(_L("Step 015.08 called ")); |
|
858 |
|
859 if ( executeStepL() == KErrLocked ) |
|
860 iTestStepResult = EPass; |
|
861 else |
|
862 iTestStepResult = EFail; |
|
863 |
|
864 return iTestStepResult; |
|
865 } |
|
866 |
|
867 |
|
868 // |
|
869 // Test step 015.09 |
|
870 // |
|
871 |
|
872 // constructor |
|
873 CCommDbTest015_09::CCommDbTest015_09() |
|
874 { |
|
875 // store the name of this test case |
|
876 iTestStepName = _L("step_015_09"); |
|
877 } |
|
878 |
|
879 // destructor |
|
880 CCommDbTest015_09::~CCommDbTest015_09() |
|
881 { |
|
882 } |
|
883 |
|
884 TInt CCommDbTest015_09::executeStepL() |
|
885 { |
|
886 TInt ret=KErrGeneral; |
|
887 |
|
888 |
|
889 TPtrC tableName(MODEM_BEARER); |
|
890 |
|
891 iTheDb=CCommsDatabase::NewL(); |
|
892 |
|
893 |
|
894 TUint32 recordToInsert; |
|
895 TUint32 recordToUpdate; |
|
896 TUint32 recordToDelete; |
|
897 TBuf8<128> fieldValue1, fieldValue2; |
|
898 _LIT8(KModemInitString, "ABCDE"); |
|
899 |
|
900 // |
|
901 // rollback transaction test |
|
902 |
|
903 // open view, insert record, delete view |
|
904 CDBLEAVE( iTheDb->BeginTransaction(), KErrNone ); |
|
905 { |
|
906 iTheView=iTheDb->OpenTableLC(tableName); |
|
907 CleanupStack::Pop(iTheView); |
|
908 |
|
909 CDBLEAVE( iTheView->InsertRecord(recordToInsert), KErrNone ); |
|
910 CDBLEAVE( iTheView->PutRecordChanges(), KErrNone ); |
|
911 |
|
912 delete iTheView ; |
|
913 iTheView=0; |
|
914 } |
|
915 iTheDb->RollbackTransaction(); |
|
916 |
|
917 // the inserted record must be rolled back |
|
918 CDBLEAVE( iTheDb->BeginTransaction(), KErrNone ); |
|
919 { |
|
920 iTheView=iTheDb->OpenViewMatchingUintLC(tableName, TPtrC(COMMDB_ID), recordToInsert); |
|
921 CleanupStack::Pop(iTheView); |
|
922 |
|
923 // there must be no records found |
|
924 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNotFound ); |
|
925 |
|
926 delete iTheView ; |
|
927 iTheView=0; |
|
928 } |
|
929 iTheDb->RollbackTransaction(); |
|
930 |
|
931 // open view, update record, delete view |
|
932 CDBLEAVE( iTheDb->BeginTransaction(), KErrNone ); |
|
933 { |
|
934 iTheView=iTheDb->OpenTableLC(tableName); |
|
935 CleanupStack::Pop(iTheView); |
|
936 |
|
937 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ); |
|
938 iTheView->ReadUintL(TPtrC(COMMDB_ID), recordToUpdate); |
|
939 iTheView->ReadTextL(TPtrC(MODEM_MODEM_INIT_STRING), fieldValue1); |
|
940 CDBLEAVE( iTheView->UpdateRecord(), KErrNone ); |
|
941 iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING), KModemInitString); |
|
942 CDBLEAVE( iTheView->PutRecordChanges(), KErrNone ); |
|
943 |
|
944 delete iTheView ; |
|
945 iTheView=0; |
|
946 } |
|
947 iTheDb->RollbackTransaction(); |
|
948 |
|
949 // the updated record must be rolled back |
|
950 CDBLEAVE( iTheDb->BeginTransaction(), KErrNone ); |
|
951 { |
|
952 iTheView=iTheDb->OpenViewMatchingUintLC(tableName, TPtrC(COMMDB_ID), recordToUpdate); |
|
953 CleanupStack::Pop(iTheView); |
|
954 |
|
955 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ); |
|
956 iTheView->ReadTextL(TPtrC(MODEM_MODEM_INIT_STRING), fieldValue2); |
|
957 |
|
958 if (fieldValue1 != fieldValue2) |
|
959 { |
|
960 User::Leave(KErrGeneral); |
|
961 } |
|
962 |
|
963 delete iTheView ; |
|
964 iTheView=0; |
|
965 } |
|
966 iTheDb->RollbackTransaction(); |
|
967 |
|
968 // open view, delete record, delete view |
|
969 CDBLEAVE( iTheDb->BeginTransaction(), KErrNone ); |
|
970 { |
|
971 iTheView=iTheDb->OpenTableLC(tableName); |
|
972 CleanupStack::Pop(iTheView); |
|
973 |
|
974 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ); |
|
975 iTheView->ReadUintL(TPtrC(COMMDB_ID), recordToDelete); |
|
976 CDBLEAVE( iTheView->DeleteRecord(), KErrNone ); |
|
977 |
|
978 delete iTheView ; |
|
979 iTheView=0; |
|
980 } |
|
981 iTheDb->RollbackTransaction(); |
|
982 |
|
983 // the deleted record must be rolled back |
|
984 CDBLEAVE( iTheDb->BeginTransaction(), KErrNone ); |
|
985 { |
|
986 iTheView=iTheDb->OpenViewMatchingUintLC(tableName, TPtrC(COMMDB_ID), recordToDelete); |
|
987 CleanupStack::Pop(iTheView); |
|
988 |
|
989 // the record must still be there |
|
990 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ); |
|
991 CDBLEAVE( iTheView->GotoNextRecord(), KErrNotFound ); |
|
992 |
|
993 delete iTheView ; |
|
994 iTheView=0; |
|
995 } |
|
996 iTheDb->RollbackTransaction(); |
|
997 |
|
998 |
|
999 |
|
1000 // |
|
1001 // commit transaction test |
|
1002 |
|
1003 // open view, insert record, delete view |
|
1004 CDBLEAVE( iTheDb->BeginTransaction(), KErrNone ); |
|
1005 { |
|
1006 iTheView=iTheDb->OpenTableLC(tableName); |
|
1007 CleanupStack::Pop(iTheView); |
|
1008 |
|
1009 CDBLEAVE( iTheView->InsertRecord(recordToInsert), KErrNone ); |
|
1010 CDBLEAVE( iTheView->PutRecordChanges(), KErrNone ); |
|
1011 |
|
1012 delete iTheView ; |
|
1013 iTheView=0; |
|
1014 } |
|
1015 iTheDb->CommitTransaction(); |
|
1016 |
|
1017 // the inserted records must be commited |
|
1018 CDBLEAVE( iTheDb->BeginTransaction(), KErrNone ); |
|
1019 { |
|
1020 iTheView=iTheDb->OpenViewMatchingUintLC(tableName, TPtrC(COMMDB_ID), recordToInsert); |
|
1021 CleanupStack::Pop(iTheView); |
|
1022 |
|
1023 // the record must have been inserted |
|
1024 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ); |
|
1025 CDBLEAVE( iTheView->GotoNextRecord(), KErrNotFound ); |
|
1026 |
|
1027 delete iTheView ; |
|
1028 iTheView=0; |
|
1029 } |
|
1030 iTheDb->RollbackTransaction(); |
|
1031 |
|
1032 |
|
1033 // open view, update record, delete view |
|
1034 CDBLEAVE( iTheDb->BeginTransaction(), KErrNone ); |
|
1035 { |
|
1036 iTheView=iTheDb->OpenTableLC(tableName); |
|
1037 CleanupStack::Pop(iTheView); |
|
1038 |
|
1039 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ); |
|
1040 iTheView->ReadUintL(TPtrC(COMMDB_ID), recordToUpdate); |
|
1041 iTheView->ReadTextL(TPtrC(MODEM_MODEM_INIT_STRING), fieldValue1); |
|
1042 CDBLEAVE( iTheView->UpdateRecord(), KErrNone ); |
|
1043 iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING), KModemInitString); |
|
1044 CDBLEAVE( iTheView->PutRecordChanges(), KErrNone ); |
|
1045 |
|
1046 delete iTheView ; |
|
1047 iTheView=0; |
|
1048 } |
|
1049 iTheDb->CommitTransaction(); |
|
1050 |
|
1051 // the updated record must be rolled back |
|
1052 CDBLEAVE( iTheDb->BeginTransaction(), KErrNone ); |
|
1053 { |
|
1054 iTheView=iTheDb->OpenViewMatchingUintLC(tableName, TPtrC(COMMDB_ID), recordToUpdate); |
|
1055 CleanupStack::Pop(iTheView); |
|
1056 |
|
1057 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ); |
|
1058 iTheView->ReadTextL(TPtrC(MODEM_MODEM_INIT_STRING), fieldValue2); |
|
1059 |
|
1060 if (fieldValue2 != KModemInitString) |
|
1061 { |
|
1062 User::Leave(KErrGeneral); |
|
1063 } |
|
1064 |
|
1065 delete iTheView ; |
|
1066 iTheView=0; |
|
1067 } |
|
1068 iTheDb->RollbackTransaction(); |
|
1069 |
|
1070 |
|
1071 // open view, delete record, delete view |
|
1072 // unfortunately we cannot do heap marking here because of commsdtat notifications |
|
1073 CDBLEAVE( iTheDb->BeginTransaction(), KErrNone ); |
|
1074 { |
|
1075 iTheView=iTheDb->OpenTableLC(tableName); |
|
1076 CleanupStack::Pop(iTheView); |
|
1077 |
|
1078 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ); |
|
1079 iTheView->ReadUintL(TPtrC(COMMDB_ID), recordToDelete); |
|
1080 CDBLEAVE( iTheView->DeleteRecord(), KErrNone ); |
|
1081 |
|
1082 delete iTheView ; |
|
1083 iTheView=0; |
|
1084 } |
|
1085 iTheDb->CommitTransaction(); |
|
1086 |
|
1087 // the deleted records must be commited |
|
1088 CDBLEAVE( iTheDb->BeginTransaction(), KErrNone ); |
|
1089 { |
|
1090 iTheView=iTheDb->OpenViewMatchingUintLC(tableName, TPtrC(COMMDB_ID), recordToDelete); |
|
1091 CleanupStack::Pop(iTheView); |
|
1092 |
|
1093 // the record must have been deleted |
|
1094 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNotFound ); |
|
1095 |
|
1096 delete iTheView ; |
|
1097 iTheView=0; |
|
1098 } |
|
1099 iTheDb->RollbackTransaction(); |
|
1100 |
|
1101 //Close the DB |
|
1102 delete iTheDb; |
|
1103 iTheDb = 0; |
|
1104 |
|
1105 //NB Only get here if we didnt trap, so it must have passed |
|
1106 ret = KErrNone; |
|
1107 return ret; |
|
1108 } |
|
1109 |
|
1110 |
|
1111 |
|
1112 TVerdict CCommDbTest015_09::doTestStepL( ) |
|
1113 { |
|
1114 Log(_L("Step 015.09 called ")); |
|
1115 |
|
1116 if ( executeStepL() == KErrNone ) |
|
1117 iTestStepResult = EPass; |
|
1118 else |
|
1119 iTestStepResult = EFail; |
|
1120 |
|
1121 return iTestStepResult; |
|
1122 } |
|
1123 |
|
1124 |
|
1125 |
|
1126 |
|
1127 |
|
1128 // |
|
1129 // Test step 015.10 |
|
1130 // |
|
1131 |
|
1132 // constructor |
|
1133 CCommDbTest015_10::CCommDbTest015_10() |
|
1134 { |
|
1135 // store the name of this test case |
|
1136 iTestStepName = _L("step_015_10"); |
|
1137 } |
|
1138 |
|
1139 // destructor |
|
1140 CCommDbTest015_10::~CCommDbTest015_10() |
|
1141 { |
|
1142 } |
|
1143 |
|
1144 TVerdict CCommDbTest015_10::doTestStepL( ) |
|
1145 { |
|
1146 Log(_L("Step 015.10 called ")); |
|
1147 |
|
1148 iTestStepResult = EPass; |
|
1149 |
|
1150 // Have backup of Database in c:\default1.dat |
|
1151 |
|
1152 // Heap test for 015.01 |
|
1153 |
|
1154 CCommDbTest015_01* step015_01 = new(ELeave) CCommDbTest015_01; |
|
1155 CleanupStack::PushL(step015_01); |
|
1156 step015_01->iSuite = iSuite; |
|
1157 doTestStepWithHeapFailureL( *step015_01, KErrNone); |
|
1158 if ( step015_01->iTestStepResult == EFail ) |
|
1159 iTestStepResult = EFail; |
|
1160 CleanupStack::PopAndDestroy(step015_01); |
|
1161 |
|
1162 |
|
1163 |
|
1164 return iTestStepResult; |
|
1165 |
|
1166 } |
|
1167 |
|
1168 // |
|
1169 // Test step 015.11 |
|
1170 // |
|
1171 |
|
1172 // constructor |
|
1173 CCommDbTest015_11::CCommDbTest015_11() |
|
1174 { |
|
1175 // store the name of this test case |
|
1176 iTestStepName = _L("step_015_11"); |
|
1177 } |
|
1178 |
|
1179 // destructor |
|
1180 CCommDbTest015_11::~CCommDbTest015_11() |
|
1181 { |
|
1182 } |
|
1183 |
|
1184 TVerdict CCommDbTest015_11::doTestStepL( ) |
|
1185 { |
|
1186 Log(_L("Step 015.11 called ")); |
|
1187 |
|
1188 iTestStepResult = EPass; |
|
1189 |
|
1190 // Heap test for 015.02 |
|
1191 CCommDbTest015_02* step015_02 = new CCommDbTest015_02; |
|
1192 CleanupStack::PushL(step015_02); |
|
1193 step015_02->iSuite = iSuite; |
|
1194 doTestStepWithHeapFailureL( *step015_02, KErrNone); |
|
1195 if ( step015_02->iTestStepResult == EFail ) |
|
1196 iTestStepResult = EFail; |
|
1197 CleanupStack::PopAndDestroy(step015_02); |
|
1198 |
|
1199 return iTestStepResult; |
|
1200 } |
|
1201 |
|
1202 // |
|
1203 // Test step 015.12 |
|
1204 // |
|
1205 |
|
1206 // constructor |
|
1207 CCommDbTest015_12::CCommDbTest015_12() |
|
1208 { |
|
1209 // store the name of this test case |
|
1210 iTestStepName = _L("step_015_12"); |
|
1211 } |
|
1212 |
|
1213 // destructor |
|
1214 CCommDbTest015_12::~CCommDbTest015_12() |
|
1215 { |
|
1216 } |
|
1217 |
|
1218 TVerdict CCommDbTest015_12::doTestStepL( ) |
|
1219 { |
|
1220 Log(_L("Step 015.12 called ")); |
|
1221 |
|
1222 iTestStepResult = EPass; |
|
1223 |
|
1224 // Heap test for 015.03 |
|
1225 |
|
1226 CCommDbTest015_03* step015_03 = new CCommDbTest015_03; |
|
1227 CleanupStack::PushL(step015_03); |
|
1228 doTestStepWithHeapFailureL( *step015_03, KErrNone); |
|
1229 if ( step015_03->iTestStepResult == EFail ) |
|
1230 iTestStepResult = EFail; |
|
1231 CleanupStack::PopAndDestroy(step015_03); |
|
1232 |
|
1233 return iTestStepResult; |
|
1234 } |
|
1235 |
|
1236 // |
|
1237 // Test step 015.13 |
|
1238 // |
|
1239 |
|
1240 // constructor |
|
1241 CCommDbTest015_13::CCommDbTest015_13() |
|
1242 { |
|
1243 // store the name of this test case |
|
1244 iTestStepName = _L("step_015_13"); |
|
1245 } |
|
1246 |
|
1247 // destructor |
|
1248 CCommDbTest015_13::~CCommDbTest015_13() |
|
1249 { |
|
1250 } |
|
1251 |
|
1252 TVerdict CCommDbTest015_13::doTestStepL( ) |
|
1253 { |
|
1254 Log(_L("Step 015.13 called ")); |
|
1255 |
|
1256 iTestStepResult = EPass; |
|
1257 |
|
1258 // Heap test for 015.04 |
|
1259 copyTestDatabase( EDatabase_1 ); |
|
1260 CCommDbTest015_04* step015_04 = new CCommDbTest015_04; |
|
1261 CleanupStack::PushL(step015_04); |
|
1262 step015_04->iSuite = iSuite; |
|
1263 doTestStepWithHeapFailureL( *step015_04, KErrNone); |
|
1264 if ( step015_04->iTestStepResult == EFail ) |
|
1265 iTestStepResult = EFail; |
|
1266 CleanupStack::PopAndDestroy(step015_04); |
|
1267 |
|
1268 return iTestStepResult; |
|
1269 } |
|
1270 |
|
1271 // |
|
1272 // Test step 015.14 |
|
1273 // |
|
1274 |
|
1275 // constructor |
|
1276 CCommDbTest015_14::CCommDbTest015_14() |
|
1277 { |
|
1278 // store the name of this test case |
|
1279 iTestStepName = _L("step_015_14"); |
|
1280 } |
|
1281 |
|
1282 // destructor |
|
1283 CCommDbTest015_14::~CCommDbTest015_14() |
|
1284 { |
|
1285 } |
|
1286 |
|
1287 TVerdict CCommDbTest015_14::doTestStepL( ) |
|
1288 { |
|
1289 Log(_L("Step 015.14 called ")); |
|
1290 |
|
1291 iTestStepResult = EPass; |
|
1292 |
|
1293 // Heap test for 015.07 |
|
1294 |
|
1295 CCommDbTest015_07* step015_07 = new CCommDbTest015_07; |
|
1296 CleanupStack::PushL(step015_07); |
|
1297 step015_07->iSuite = iSuite; |
|
1298 doTestStepWithHeapFailureL( *step015_07, KErrNone); |
|
1299 if ( step015_07->iTestStepResult == EFail ) |
|
1300 iTestStepResult = EFail; |
|
1301 CleanupStack::PopAndDestroy(step015_07); |
|
1302 |
|
1303 return iTestStepResult; |
|
1304 } |
|
1305 |
|
1306 // |
|
1307 // Test step 015.15 |
|
1308 // |
|
1309 |
|
1310 // constructor |
|
1311 CCommDbTest015_15::CCommDbTest015_15() |
|
1312 { |
|
1313 // store the name of this test case |
|
1314 iTestStepName = _L("step_015_15"); |
|
1315 } |
|
1316 |
|
1317 // destructor |
|
1318 CCommDbTest015_15::~CCommDbTest015_15() |
|
1319 { |
|
1320 } |
|
1321 |
|
1322 TVerdict CCommDbTest015_15::doTestStepL( ) |
|
1323 { |
|
1324 Log(_L("Step 015.15 called ")); |
|
1325 |
|
1326 iTestStepResult = EPass; |
|
1327 |
|
1328 // Heap test for 015.08 |
|
1329 |
|
1330 CCommDbTest015_08* step015_08 = new CCommDbTest015_08; |
|
1331 CleanupStack::PushL(step015_08); |
|
1332 step015_08->iSuite = iSuite; |
|
1333 doTestStepWithHeapFailureL( *step015_08, KErrLocked); |
|
1334 if ( step015_08->iTestStepResult == EFail ) |
|
1335 iTestStepResult = EFail; |
|
1336 CleanupStack::PopAndDestroy(step015_08); |
|
1337 |
|
1338 return iTestStepResult; |
|
1339 } |
|
1340 |
|
1341 |
|
1342 |
|
1343 // |
|
1344 // Test step 015.16 |
|
1345 // |
|
1346 |
|
1347 // constructor |
|
1348 CCommDbTest015_16::CCommDbTest015_16() |
|
1349 { |
|
1350 // store the name of this test case |
|
1351 iTestStepName = _L("step_015_16"); |
|
1352 } |
|
1353 |
|
1354 // destructor |
|
1355 CCommDbTest015_16::~CCommDbTest015_16() |
|
1356 { |
|
1357 } |
|
1358 |
|
1359 TVerdict CCommDbTest015_16::doTestStepL( ) |
|
1360 { |
|
1361 Log(_L("Step 015.16 called ")); |
|
1362 |
|
1363 iTestStepResult = EPass; |
|
1364 |
|
1365 // Heap test for 015.09 |
|
1366 |
|
1367 CCommDbTest015_09* step015_09 = new CCommDbTest015_09; |
|
1368 CleanupStack::PushL(step015_09); |
|
1369 step015_09->iSuite = iSuite; |
|
1370 doTestStepWithHeapFailureL( *step015_09, KErrNone); |
|
1371 if ( step015_09->iTestStepResult == EFail ) |
|
1372 iTestStepResult = EFail; |
|
1373 CleanupStack::PopAndDestroy(step015_09); |
|
1374 |
|
1375 return iTestStepResult; |
|
1376 } |
|