|
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 039.XX |
|
19 |
|
20 // EPOC includes |
|
21 #include <e32base.h> |
|
22 #include <commdb.h> |
|
23 #include <d32comm.h> |
|
24 #include <cdbtemp.h> |
|
25 |
|
26 // Test system includes |
|
27 #include "Teststepcommdb.h" |
|
28 #include "Step_039_xx.h" |
|
29 |
|
30 |
|
31 CCommDbTest039_01::CCommDbTest039_01() |
|
32 { |
|
33 // store the name of this test case |
|
34 SetTestStepName(_L("step_039_01")); |
|
35 } |
|
36 |
|
37 CCommDbTest039_01::~CCommDbTest039_01() |
|
38 {} |
|
39 |
|
40 TVerdict CCommDbTest039_01::doTestStepL( void ) |
|
41 { |
|
42 if(executeStepL()!=KErrNone) |
|
43 SetTestStepResult(EFail); SetTestStepResult(EPass); return TestStepResult(); |
|
44 } |
|
45 |
|
46 TVerdict CCommDbTest039_01::doTestStepPreambleL() |
|
47 { |
|
48 iTheDb=CCommsDatabase::NewL(); |
|
49 |
|
50 SetTestStepResult(EPass); return TestStepResult(); |
|
51 } |
|
52 |
|
53 TInt CCommDbTest039_01::executeStepL() |
|
54 { |
|
55 CCommsDbTemplateRecord* templateRecord = CCommsDbTemplateRecord::NewL(iTheDb, TPtrC(MODEM_BEARER)); |
|
56 CleanupStack::PushL(templateRecord); |
|
57 |
|
58 TInt ret(KErrNone); |
|
59 User::LeaveIfError(templateRecord->Modify()); |
|
60 templateRecord->WriteTextL(TPtrC(COMMDB_NAME), _L("DummyName")); |
|
61 User::LeaveIfError(templateRecord->StoreModifications()); |
|
62 |
|
63 if(!templateRecord->TemplateRecordExists()) |
|
64 ret = KErrGeneral; |
|
65 |
|
66 //delete the template |
|
67 User::LeaveIfError(templateRecord->Delete()); |
|
68 |
|
69 if(templateRecord->TemplateRecordExists()) |
|
70 ret = KErrGeneral; |
|
71 |
|
72 CleanupStack::PopAndDestroy(templateRecord); |
|
73 |
|
74 return ret; |
|
75 } |
|
76 |
|
77 TVerdict CCommDbTest039_01::doTestStepPostambleL() |
|
78 { |
|
79 delete iTheDb; |
|
80 iTheDb=NULL; |
|
81 SetTestStepResult(EPass); return TestStepResult(); |
|
82 } |
|
83 |
|
84 ////////////////////////////////////////////////////////////////////////// |
|
85 |
|
86 CCommDbTest039_02::CCommDbTest039_02() |
|
87 { |
|
88 // store the name of this test case |
|
89 SetTestStepName(_L("step_039_02")); |
|
90 } |
|
91 |
|
92 CCommDbTest039_02::~CCommDbTest039_02() |
|
93 {} |
|
94 |
|
95 TVerdict CCommDbTest039_02::doTestStepL( void ) |
|
96 { |
|
97 INFO_PRINTF1(_L("Step 039.02 called ")); |
|
98 |
|
99 SetTestStepResult(EPass); |
|
100 CCommDbTest039_01* step039_01 = new(ELeave) CCommDbTest039_01; |
|
101 CleanupStack::PushL(step039_01); |
|
102 doTestStepWithHeapFailureL( *step039_01, KErrNone); |
|
103 CleanupStack::PopAndDestroy(step039_01); |
|
104 |
|
105 return TestStepResult(); |
|
106 } |