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