|
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 035.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_035_xx.h" |
|
29 |
|
30 |
|
31 CCommDbTest035_01::CCommDbTest035_01() |
|
32 { |
|
33 // store the name of this test case |
|
34 SetTestStepName(_L("step_035_01")); |
|
35 } |
|
36 |
|
37 CCommDbTest035_01::~CCommDbTest035_01() |
|
38 {} |
|
39 |
|
40 TVerdict CCommDbTest035_01::doTestStepL( void ) |
|
41 { |
|
42 executeStepL(); |
|
43 SetTestStepResult(EPass); return TestStepResult(); //If we've got this far we've passed |
|
44 } |
|
45 |
|
46 TVerdict CCommDbTest035_01::doTestStepPreambleL() |
|
47 { |
|
48 iTheDb=CCommsDatabase::NewL(); |
|
49 |
|
50 SetTestStepResult(EPass); return TestStepResult(); |
|
51 } |
|
52 |
|
53 TInt CCommDbTest035_01::executeStepL() |
|
54 { |
|
55 CCommsDbTemplateRecord* templateRecord = CCommsDbTemplateRecord::NewL(iTheDb, TPtrC(DIAL_IN_ISP)); |
|
56 delete templateRecord; |
|
57 return KErrNone; |
|
58 } |
|
59 |
|
60 TVerdict CCommDbTest035_01::doTestStepPostambleL() |
|
61 { |
|
62 delete iTheDb; |
|
63 iTheDb=NULL; |
|
64 SetTestStepResult(EPass); return TestStepResult(); |
|
65 } |
|
66 |
|
67 ///////////////////////////////////////////////////////////////////////////////// |
|
68 |
|
69 CCommDbTest035_02::CCommDbTest035_02() |
|
70 { |
|
71 // store the name of this test case |
|
72 SetTestStepName(_L("step_035_02")); |
|
73 } |
|
74 |
|
75 CCommDbTest035_02::~CCommDbTest035_02() |
|
76 {} |
|
77 |
|
78 TVerdict CCommDbTest035_02::doTestStepL( void ) |
|
79 { |
|
80 if(executeStepL()!=KErrNotSupported) |
|
81 SetTestStepResult(EFail); SetTestStepResult(EPass); return TestStepResult(); |
|
82 } |
|
83 |
|
84 TVerdict CCommDbTest035_02::doTestStepPreambleL() |
|
85 { |
|
86 iTheDb=CCommsDatabase::NewL(); |
|
87 |
|
88 SetTestStepResult(EPass); return TestStepResult(); |
|
89 } |
|
90 |
|
91 TInt CCommDbTest035_02::executeStepL() |
|
92 { |
|
93 CCommsDbTemplateRecord* templateRecord=NULL; |
|
94 //CCommsDbTemplateRecord::NewL should leave with KErrNotSupported, since IAP table doesn't support templates |
|
95 TRAPD(err, templateRecord = CCommsDbTemplateRecord::NewL(iTheDb, TPtrC(IAP))); |
|
96 delete templateRecord; |
|
97 return err; |
|
98 } |
|
99 |
|
100 TVerdict CCommDbTest035_02::doTestStepPostambleL() |
|
101 { |
|
102 delete iTheDb; |
|
103 iTheDb=NULL; |
|
104 SetTestStepResult(EPass); return TestStepResult(); |
|
105 } |
|
106 |
|
107 ///////////////////////////////////////////////////////////////////////////////// |
|
108 |
|
109 CCommDbTest035_03::CCommDbTest035_03() |
|
110 { |
|
111 // store the name of this test case |
|
112 SetTestStepName(_L("step_035_03")); |
|
113 } |
|
114 |
|
115 CCommDbTest035_03::~CCommDbTest035_03() |
|
116 {} |
|
117 |
|
118 TVerdict CCommDbTest035_03::doTestStepL( void ) |
|
119 { |
|
120 if(executeStepL()!=KErrArgument) |
|
121 SetTestStepResult(EFail); SetTestStepResult(EPass); return TestStepResult(); |
|
122 } |
|
123 |
|
124 TVerdict CCommDbTest035_03::doTestStepPreambleL() |
|
125 { |
|
126 iTheDb=CCommsDatabase::NewL(); |
|
127 |
|
128 SetTestStepResult(EPass); return TestStepResult(); |
|
129 } |
|
130 |
|
131 TInt CCommDbTest035_03::executeStepL() |
|
132 { |
|
133 CCommsDbTemplateRecord* templateRecord=NULL; |
|
134 //CCommsDbTemplateRecord::NewL should leave with KErrArgument for invalid name |
|
135 TRAPD(err, templateRecord = CCommsDbTemplateRecord::NewL(iTheDb, _L("Hi there"))); |
|
136 delete templateRecord; |
|
137 return err; |
|
138 } |
|
139 |
|
140 TVerdict CCommDbTest035_03::doTestStepPostambleL() |
|
141 { |
|
142 delete iTheDb; |
|
143 iTheDb=NULL; |
|
144 SetTestStepResult(EPass); return TestStepResult(); |
|
145 } |
|
146 |
|
147 ////////////////////////////////////////////////////////////////////////// |
|
148 |
|
149 CCommDbTest035_04::CCommDbTest035_04() |
|
150 { |
|
151 // store the name of this test case |
|
152 SetTestStepName(_L("step_035_04")); |
|
153 } |
|
154 |
|
155 CCommDbTest035_04::~CCommDbTest035_04() |
|
156 {} |
|
157 |
|
158 TVerdict CCommDbTest035_04::doTestStepL( void ) |
|
159 { |
|
160 INFO_PRINTF1(_L("Step 035.04 called ")); |
|
161 |
|
162 SetTestStepResult(EPass); |
|
163 CCommDbTest035_01* step035_01 = new(ELeave) CCommDbTest035_01; |
|
164 CleanupStack::PushL(step035_01); |
|
165 doTestStepWithHeapFailureL( *step035_01, KErrNone); |
|
166 CleanupStack::PopAndDestroy(step035_01); |
|
167 |
|
168 CCommDbTest035_02* step035_02 = new(ELeave) CCommDbTest035_02; |
|
169 CleanupStack::PushL(step035_02); |
|
170 doTestStepWithHeapFailureL( *step035_02, KErrNotSupported); |
|
171 CleanupStack::PopAndDestroy(step035_02); |
|
172 |
|
173 CCommDbTest035_03* step035_03 = new(ELeave) CCommDbTest035_03; |
|
174 CleanupStack::PushL(step035_03); |
|
175 doTestStepWithHeapFailureL( *step035_03, KErrArgument); |
|
176 CleanupStack::PopAndDestroy(step035_03); |
|
177 |
|
178 return TestStepResult(); |
|
179 } |