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