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 061.XX |
|
15 // |
|
16 // |
|
17 |
|
18 // EPOC includes |
|
19 #include <e32base.h> |
|
20 #include <commdb.h> |
|
21 #include <d32comm.h> |
|
22 #include <cdbstore.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 <etelmm.h> |
|
30 #include "Step_061_xx.h" |
|
31 #include <e32math.h> |
|
32 |
|
33 CCommsDbTableView *CCommDbTest061_xx::OpenIspTable(CCommsDatabase* aDb, TInt &aNoOfRows, TInt aExpectedCount) |
|
34 { |
|
35 char OK = 1; |
|
36 TInt ErrCode = KErrGeneral; |
|
37 |
|
38 CCommsDbTableView *TableView = NULL; |
|
39 |
|
40 TRAP(ErrCode, TableView = aDb->OpenTableLC( TPtrC(DIAL_OUT_ISP) ); CleanupStack::Pop(TableView);); |
|
41 |
|
42 if(ErrCode != KErrNone) |
|
43 { |
|
44 Log(_L("CCommDbTest061_xx::OpenIspTable : aDb->OpenTableLC LEFT with %d"),ErrCode); |
|
45 return(NULL); |
|
46 } |
|
47 |
|
48 aNoOfRows = 0; |
|
49 char DropOut = 0; |
|
50 while(!DropOut) |
|
51 { |
|
52 if(aNoOfRows == 0) |
|
53 ErrCode = TableView->GotoFirstRecord(); |
|
54 else |
|
55 ErrCode = TableView->GotoNextRecord(); |
|
56 DropOut = (ErrCode != KErrNone); |
|
57 if(ErrCode == KErrNone) |
|
58 ++aNoOfRows; |
|
59 } |
|
60 |
|
61 OK = (ErrCode == KErrNotFound); // should be the last value returned. |
|
62 if(OK) |
|
63 OK = (aNoOfRows == aExpectedCount); |
|
64 if(OK) |
|
65 { |
|
66 Log(_L("Found expected number of table entries ")); |
|
67 return(TableView); |
|
68 } |
|
69 Log(_L("CCommDbTest061_xx::OpenIspTable : function failed with OK = %d"),OK); |
|
70 return(NULL); |
|
71 } |
|
72 |
|
73 // |
|
74 // Test step 061.01 |
|
75 // |
|
76 |
|
77 // constructor |
|
78 CCommDbTest061_01::CCommDbTest061_01() |
|
79 { |
|
80 // store the name of this test case |
|
81 iTestStepName = _L("step_061_01"); |
|
82 } |
|
83 |
|
84 // destructor |
|
85 CCommDbTest061_01::~CCommDbTest061_01() |
|
86 { |
|
87 } |
|
88 |
|
89 |
|
90 TVerdict CCommDbTest061_01::doTestStepPreambleL() |
|
91 { |
|
92 openDbL(); |
|
93 return EPass; |
|
94 } |
|
95 |
|
96 TInt CCommDbTest061_01::executeStepL() |
|
97 { |
|
98 TInt ret=KErrGeneral; |
|
99 TInt RowCount; |
|
100 |
|
101 // Values tested |
|
102 TInt EnumArray[] = { |
|
103 RMobileCall::EProtocolUnspecified, // first two are different ways of saying unspecified |
|
104 RMobileCall::EProtocolUnspecified, |
|
105 RMobileCall::EProtocolV22bis, |
|
106 RMobileCall::EProtocolV32, |
|
107 RMobileCall::EProtocolV34, |
|
108 RMobileCall::EProtocolV110, |
|
109 RMobileCall::EProtocolV120, |
|
110 RMobileCall::EProtocolX31FlagStuffing, |
|
111 RMobileCall::EProtocolPIAFS, |
|
112 RMobileCall::EProtocolBitTransparent, |
|
113 RMobileCall::EProtocolPstnMultimediaVoiceFallback, |
|
114 RMobileCall::EProtocolPstnMultimedia, |
|
115 RMobileCall::EProtocolIsdnMultimedia |
|
116 }; |
|
117 |
|
118 iTheView = OpenIspTable(iTheDb, RowCount, (sizeof(EnumArray)/sizeof(TInt))); |
|
119 |
|
120 char OK = (iTheView != NULL); |
|
121 |
|
122 if(OK) |
|
123 { |
|
124 for(TInt i = 0; (i < RowCount) && OK; ++i) |
|
125 { |
|
126 TUint32 BearerProtocol; |
|
127 if(i == 0) |
|
128 iTheView->GotoFirstRecord(); |
|
129 else |
|
130 iTheView->GotoNextRecord(); |
|
131 iTheView->ReadUintL(TPtrC(ISP_BEARER_PROTOCOL), BearerProtocol); |
|
132 OK = (BearerProtocol == (TUint)EnumArray[i]); |
|
133 } |
|
134 } |
|
135 |
|
136 ret = (OK ? KErrNone : KErrGeneral); |
|
137 |
|
138 return ret; |
|
139 } |
|
140 |
|
141 |
|
142 TVerdict CCommDbTest061_01::doTestStepL( ) |
|
143 { |
|
144 Log(_L("Step 061.01 called ")); |
|
145 |
|
146 if ( executeStepL() == KErrNone ) |
|
147 iTestStepResult = EPass; |
|
148 else |
|
149 iTestStepResult = EFail; |
|
150 |
|
151 return iTestStepResult; |
|
152 } |
|
153 |
|
154 // |
|
155 // Test step 061.02 |
|
156 // |
|
157 |
|
158 // constructor |
|
159 CCommDbTest061_02::CCommDbTest061_02() |
|
160 { |
|
161 // store the name of this test case |
|
162 iTestStepName = _L("step_061_02"); |
|
163 } |
|
164 |
|
165 // destructor |
|
166 CCommDbTest061_02::~CCommDbTest061_02() |
|
167 { |
|
168 } |
|
169 |
|
170 |
|
171 TVerdict CCommDbTest061_02::doTestStepPreambleL() |
|
172 { |
|
173 openDbL(); |
|
174 return EPass; |
|
175 } |
|
176 |
|
177 TInt CCommDbTest061_02::executeStepL() |
|
178 { |
|
179 TInt ret=KErrGeneral; |
|
180 TInt RowCount; |
|
181 |
|
182 // Values tested |
|
183 TInt EnumArray[] = { |
|
184 RMobileCall::KCapsDataCircuitAsynchronous, |
|
185 RMobileCall::KCapsDataCircuitAsynchronousRDI, |
|
186 RMobileCall::KCapsDataCircuitSynchronous, |
|
187 RMobileCall::KCapsDataCircuitSynchronousRDI, |
|
188 RMobileCall::KCapsPADAsyncUDI, |
|
189 RMobileCall::KCapsPADAsyncRDI, |
|
190 RMobileCall::KCapsPacketAccessSyncUDI, |
|
191 RMobileCall::KCapsPacketAccessSyncRDI, |
|
192 RMobileCall::KCapsServiceExtended |
|
193 }; |
|
194 |
|
195 iTheView = OpenIspTable(iTheDb, RowCount, (sizeof(EnumArray)/sizeof(TInt))); |
|
196 |
|
197 char OK = (iTheView != NULL); |
|
198 |
|
199 if(OK) |
|
200 { |
|
201 for(TInt i = 0; (i < RowCount) && OK; ++i) |
|
202 { |
|
203 TUint32 BearerName; |
|
204 if(i == 0) |
|
205 iTheView->GotoFirstRecord(); |
|
206 else |
|
207 iTheView->GotoNextRecord(); |
|
208 iTheView->ReadUintL(TPtrC(ISP_BEARER_NAME), BearerName); |
|
209 OK = (BearerName == (TUint)EnumArray[i]); |
|
210 } |
|
211 } |
|
212 |
|
213 ret = (OK ? KErrNone : KErrGeneral); |
|
214 |
|
215 return ret; |
|
216 } |
|
217 |
|
218 |
|
219 TVerdict CCommDbTest061_02::doTestStepL( ) |
|
220 { |
|
221 Log(_L("Step 061.02 called ")); |
|
222 |
|
223 if ( executeStepL() == KErrNone ) |
|
224 iTestStepResult = EPass; |
|
225 else |
|
226 iTestStepResult = EFail; |
|
227 |
|
228 return iTestStepResult; |
|
229 } |
|
230 |
|
231 // |
|
232 // Test step 061.03 |
|
233 // |
|
234 |
|
235 // constructor |
|
236 CCommDbTest061_03::CCommDbTest061_03() |
|
237 { |
|
238 // store the name of this test case |
|
239 iTestStepName = _L("step_061_03"); |
|
240 } |
|
241 |
|
242 // destructor |
|
243 CCommDbTest061_03::~CCommDbTest061_03() |
|
244 { |
|
245 } |
|
246 |
|
247 |
|
248 TVerdict CCommDbTest061_03::doTestStepPreambleL() |
|
249 { |
|
250 openDbL(); |
|
251 return EPass; |
|
252 } |
|
253 |
|
254 TInt CCommDbTest061_03::executeStepL() |
|
255 { |
|
256 TInt ret=KErrGeneral; |
|
257 TInt RowCount; |
|
258 |
|
259 // Values tested |
|
260 TInt EnumArray[] = { |
|
261 RMobileCall::ESpeedUnspecified, |
|
262 RMobileCall::ESpeedAutobauding, |
|
263 RMobileCall::ESpeed2400, |
|
264 RMobileCall::ESpeed4800, |
|
265 RMobileCall::ESpeed9600, |
|
266 RMobileCall::ESpeed14400, |
|
267 RMobileCall::ESpeed19200, |
|
268 RMobileCall::ESpeed28800, |
|
269 RMobileCall::ESpeed32000, |
|
270 RMobileCall::ESpeed33600, |
|
271 RMobileCall::ESpeed38400, |
|
272 RMobileCall::ESpeed43200, |
|
273 RMobileCall::ESpeed48000, |
|
274 RMobileCall::ESpeed56000, |
|
275 RMobileCall::ESpeed57600, |
|
276 RMobileCall::ESpeed64000 |
|
277 }; |
|
278 |
|
279 iTheView = OpenIspTable(iTheDb, RowCount, (sizeof(EnumArray)/sizeof(TInt))); |
|
280 |
|
281 char OK = (iTheView != NULL); |
|
282 |
|
283 if(OK) |
|
284 { |
|
285 for(TInt i = 0; (i < RowCount) && OK; ++i) |
|
286 { |
|
287 TUint32 BearerSpeed; |
|
288 if(i == 0) |
|
289 iTheView->GotoFirstRecord(); |
|
290 else |
|
291 iTheView->GotoNextRecord(); |
|
292 iTheView->ReadUintL(TPtrC(ISP_BEARER_SPEED), BearerSpeed); |
|
293 OK = (BearerSpeed == (TUint)EnumArray[i]); |
|
294 } |
|
295 } |
|
296 |
|
297 ret = (OK ? KErrNone : KErrGeneral); |
|
298 |
|
299 return ret; |
|
300 } |
|
301 |
|
302 |
|
303 TVerdict CCommDbTest061_03::doTestStepL( ) |
|
304 { |
|
305 Log(_L("Step 061.03 called ")); |
|
306 |
|
307 if ( executeStepL() == KErrNone ) |
|
308 iTestStepResult = EPass; |
|
309 else |
|
310 iTestStepResult = EFail; |
|
311 |
|
312 return iTestStepResult; |
|
313 } |
|
314 |
|
315 // |
|
316 // Test step 061.04 |
|
317 // |
|
318 |
|
319 // constructor |
|
320 CCommDbTest061_04::CCommDbTest061_04() |
|
321 { |
|
322 // store the name of this test case |
|
323 iTestStepName = _L("step_061_04"); |
|
324 } |
|
325 |
|
326 // destructor |
|
327 CCommDbTest061_04::~CCommDbTest061_04() |
|
328 { |
|
329 } |
|
330 |
|
331 |
|
332 TVerdict CCommDbTest061_04::doTestStepPreambleL() |
|
333 { |
|
334 openDbL(); |
|
335 return EPass; |
|
336 } |
|
337 |
|
338 TInt CCommDbTest061_04::executeStepL() |
|
339 { |
|
340 TInt ret=KErrGeneral; |
|
341 TInt RowCount; |
|
342 |
|
343 // Values tested (see RMobileCall::TMobileCallDataQoS, etelmm.h) |
|
344 TInt EnumArray[] = { |
|
345 RMobileCall::EQoSUnspecified, |
|
346 RMobileCall::EQoSTransparent, |
|
347 RMobileCall::EQoSNonTransparent, |
|
348 RMobileCall::EQosTransparentPreferred, |
|
349 RMobileCall::EQosNonTransparentPreferred |
|
350 }; |
|
351 |
|
352 iTheView = OpenIspTable(iTheDb, RowCount, (sizeof(EnumArray)/sizeof(TInt))); |
|
353 |
|
354 char OK = (iTheView != NULL); |
|
355 |
|
356 if(OK) |
|
357 { |
|
358 for(TInt i = 0; (i < RowCount) && OK; ++i) |
|
359 { |
|
360 TUint32 BearerCE; |
|
361 if(i == 0) |
|
362 iTheView->GotoFirstRecord(); |
|
363 else |
|
364 iTheView->GotoNextRecord(); |
|
365 iTheView->ReadUintL(TPtrC(ISP_BEARER_CE), BearerCE); |
|
366 OK = (BearerCE == (TUint)EnumArray[i]); |
|
367 } |
|
368 } |
|
369 |
|
370 ret = (OK ? KErrNone : KErrGeneral); |
|
371 |
|
372 return ret; |
|
373 } |
|
374 |
|
375 |
|
376 TVerdict CCommDbTest061_04::doTestStepL( ) |
|
377 { |
|
378 Log(_L("Step 061.04 called ")); |
|
379 |
|
380 if ( executeStepL() == KErrNone ) |
|
381 iTestStepResult = EPass; |
|
382 else |
|
383 iTestStepResult = EFail; |
|
384 |
|
385 return iTestStepResult; |
|
386 } |
|
387 |
|