|
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 023.XX |
|
15 // |
|
16 // |
|
17 |
|
18 // EPOC includes |
|
19 #include <e32base.h> |
|
20 #include <commdb.h> |
|
21 #include <d32comm.h> |
|
22 |
|
23 // Test system includes |
|
24 #include <networking/log.h> |
|
25 #include <networking/teststep.h> |
|
26 #include "Teststepcommdb.h" |
|
27 #include "TestSuiteCommdb.h" |
|
28 #include "Step_023_xx.h" |
|
29 |
|
30 |
|
31 // |
|
32 // Test step 023.01 |
|
33 // |
|
34 |
|
35 // constructor |
|
36 CCommDbTest023_01::CCommDbTest023_01() |
|
37 { |
|
38 // store the name of this test case |
|
39 iTestStepName = _L("step_023_01"); |
|
40 } |
|
41 |
|
42 // destructor |
|
43 CCommDbTest023_01::~CCommDbTest023_01() |
|
44 { |
|
45 } |
|
46 |
|
47 |
|
48 TVerdict CCommDbTest023_01::doTestStepPreambleL() |
|
49 { |
|
50 // Have a temp copy of database |
|
51 openDbL(); |
|
52 return EPass; |
|
53 } |
|
54 |
|
55 TInt CCommDbTest023_01::executeStepL() |
|
56 { |
|
57 TInt ret=KErrGeneral; |
|
58 |
|
59 iTheView = iTheDb->OpenViewOnProxyRecordLC(1, TPtrC(DIAL_OUT_ISP) ); |
|
60 CleanupStack::Pop(); |
|
61 TUint32 value; |
|
62 |
|
63 //Check the view contains the expected records |
|
64 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone); |
|
65 iTheView->ReadUintL(TPtrC(PROXY_ISP), value); |
|
66 |
|
67 CDBLEAVE( iTheView->GotoNextRecord(), KErrNotFound ); |
|
68 |
|
69 ret = KErrNone; |
|
70 |
|
71 return ret; |
|
72 } |
|
73 |
|
74 |
|
75 TVerdict CCommDbTest023_01::doTestStepL( ) |
|
76 { |
|
77 Log(_L("Step 023.01 called ")); |
|
78 |
|
79 |
|
80 if ( executeStepL() == KErrNone ) |
|
81 iTestStepResult = EPass; |
|
82 else |
|
83 iTestStepResult = EFail; |
|
84 |
|
85 return iTestStepResult; |
|
86 } |
|
87 |
|
88 |
|
89 |
|
90 // |
|
91 // Test step 023.02 |
|
92 // |
|
93 |
|
94 // constructor |
|
95 CCommDbTest023_02::CCommDbTest023_02() |
|
96 { |
|
97 // store the name of this test case |
|
98 iTestStepName = _L("step_023_02"); |
|
99 } |
|
100 |
|
101 // destructor |
|
102 CCommDbTest023_02::~CCommDbTest023_02() |
|
103 { |
|
104 } |
|
105 |
|
106 |
|
107 TVerdict CCommDbTest023_02::doTestStepPreambleL() |
|
108 { |
|
109 openDbL(); |
|
110 return EPass; |
|
111 } |
|
112 |
|
113 TInt CCommDbTest023_02::executeStepL() |
|
114 { |
|
115 TInt ret=KErrGeneral; |
|
116 |
|
117 iTheView = iTheDb->OpenViewOnProxyRecordLC(99, TPtrC(DIAL_OUT_ISP) ); |
|
118 CleanupStack::Pop(); |
|
119 |
|
120 //The view should be empty |
|
121 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNotFound); |
|
122 |
|
123 ret = KErrNone; |
|
124 |
|
125 return ret; |
|
126 } |
|
127 |
|
128 |
|
129 TVerdict CCommDbTest023_02::doTestStepL( ) |
|
130 { |
|
131 Log(_L("Step 023.02 called ")); |
|
132 |
|
133 |
|
134 if ( executeStepL() == KErrNone ) |
|
135 iTestStepResult = EPass; |
|
136 else |
|
137 iTestStepResult = EFail; |
|
138 |
|
139 return iTestStepResult; |
|
140 } |
|
141 |
|
142 |
|
143 // |
|
144 // Test step 023.03 |
|
145 // |
|
146 |
|
147 // constructor |
|
148 CCommDbTest023_03::CCommDbTest023_03() |
|
149 { |
|
150 // store the name of this test case |
|
151 iTestStepName = _L("step_023_03"); |
|
152 } |
|
153 |
|
154 // destructor |
|
155 CCommDbTest023_03::~CCommDbTest023_03() |
|
156 { |
|
157 } |
|
158 |
|
159 |
|
160 TVerdict CCommDbTest023_03::doTestStepPreambleL() |
|
161 { |
|
162 openDbL(); |
|
163 return EPass; |
|
164 } |
|
165 |
|
166 |
|
167 #define INVALID_TABLE _L("Invalid") |
|
168 |
|
169 TInt CCommDbTest023_03::executeStepL() |
|
170 { |
|
171 TInt ret=KErrGeneral; |
|
172 |
|
173 |
|
174 iTheView = iTheDb->OpenViewOnProxyRecordLC(1, TPtrC(INVALID_TABLE) ); |
|
175 CleanupStack::Pop(); |
|
176 |
|
177 //It should be an empty view |
|
178 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNotFound ); |
|
179 |
|
180 ret = KErrNone; |
|
181 |
|
182 return ret; |
|
183 } |
|
184 |
|
185 |
|
186 TVerdict CCommDbTest023_03::doTestStepL( ) |
|
187 { |
|
188 Log(_L("Step 023.03 called ")); |
|
189 |
|
190 |
|
191 if ( executeStepL() == KErrNone ) |
|
192 iTestStepResult = EPass; |
|
193 else |
|
194 iTestStepResult = EFail; |
|
195 |
|
196 return iTestStepResult; |
|
197 } |
|
198 |
|
199 |
|
200 |
|
201 // |
|
202 // Test step 023.04 |
|
203 // |
|
204 |
|
205 // constructor |
|
206 CCommDbTest023_04::CCommDbTest023_04() |
|
207 { |
|
208 // store the name of this test case |
|
209 iTestStepName = _L("step_023_04"); |
|
210 } |
|
211 |
|
212 // destructor |
|
213 CCommDbTest023_04::~CCommDbTest023_04() |
|
214 { |
|
215 } |
|
216 |
|
217 TVerdict CCommDbTest023_04::doTestStepL( ) |
|
218 { |
|
219 Log(_L("Step 023.04 called ")); |
|
220 |
|
221 iTestStepResult = EPass; |
|
222 |
|
223 // Heap test for 023.01 |
|
224 |
|
225 CCommDbTest023_01* step023_01 = new(ELeave) CCommDbTest023_01; |
|
226 CleanupStack::PushL(step023_01); |
|
227 step023_01->iSuite = iSuite; |
|
228 if ( doTestStepWithHeapFailureL( *step023_01, KErrNone) == EFail ) |
|
229 iTestStepResult = EFail; |
|
230 CleanupStack::PopAndDestroy(step023_01); |
|
231 |
|
232 |
|
233 return iTestStepResult; |
|
234 |
|
235 } |
|
236 |
|
237 |
|
238 // |
|
239 // Test step 023.05 |
|
240 // |
|
241 |
|
242 // constructor |
|
243 CCommDbTest023_05::CCommDbTest023_05() |
|
244 { |
|
245 // store the name of this test case |
|
246 iTestStepName = _L("step_023_05"); |
|
247 } |
|
248 |
|
249 // destructor |
|
250 CCommDbTest023_05::~CCommDbTest023_05() |
|
251 { |
|
252 } |
|
253 |
|
254 TVerdict CCommDbTest023_05::doTestStepL( ) |
|
255 { |
|
256 Log(_L("Step 023.05 called ")); |
|
257 |
|
258 iTestStepResult = EPass; |
|
259 |
|
260 // Heap test for 023.02 |
|
261 |
|
262 CCommDbTest023_02* step023_02 = new CCommDbTest023_02; |
|
263 CleanupStack::PushL(step023_02); |
|
264 step023_02->iSuite = iSuite; |
|
265 if ( doTestStepWithHeapFailureL( *step023_02, KErrNone) == EFail ) |
|
266 iTestStepResult = EFail; |
|
267 CleanupStack::PopAndDestroy(step023_02); |
|
268 |
|
269 return iTestStepResult; |
|
270 } |
|
271 |
|
272 // |
|
273 // Test step 023.06 |
|
274 // |
|
275 |
|
276 // constructor |
|
277 CCommDbTest023_06::CCommDbTest023_06() |
|
278 { |
|
279 // store the name of this test case |
|
280 iTestStepName = _L("step_023_06"); |
|
281 } |
|
282 |
|
283 // destructor |
|
284 CCommDbTest023_06::~CCommDbTest023_06() |
|
285 { |
|
286 } |
|
287 |
|
288 TVerdict CCommDbTest023_06::doTestStepL( ) |
|
289 { |
|
290 Log(_L("Step 023.06 called ")); |
|
291 |
|
292 iTestStepResult = EPass; |
|
293 |
|
294 // Heap test for 023.03 |
|
295 |
|
296 CCommDbTest023_03* step023_03 = new CCommDbTest023_03; |
|
297 CleanupStack::PushL(step023_03); |
|
298 step023_03->iSuite = iSuite; |
|
299 if ( doTestStepWithHeapFailureL( *step023_03, KErrNone) == EFail ) |
|
300 iTestStepResult = EFail; |
|
301 CleanupStack::PopAndDestroy(step023_03); |
|
302 |
|
303 return iTestStepResult; |
|
304 } |
|
305 |
|
306 //EOF |