|
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 017.XX |
|
19 |
|
20 // EPOC includes |
|
21 #include <e32base.h> |
|
22 #include <commdb.h> |
|
23 #include <d32comm.h> |
|
24 #include <e32property.h> |
|
25 |
|
26 // Test system includes |
|
27 #include "Teststepcommdb.h" |
|
28 #include "Step_017_xx.h" |
|
29 |
|
30 |
|
31 #include <commsdattypesv1_1.h> |
|
32 using namespace CommsDat; |
|
33 |
|
34 |
|
35 ///////////////////// |
|
36 // Test step 017.01 |
|
37 ///////////////////// |
|
38 |
|
39 // constructor |
|
40 CCommDbTest017_01::CCommDbTest017_01() |
|
41 { |
|
42 // store the name of this test case |
|
43 SetTestStepName(_L("step_017_01")); |
|
44 } |
|
45 |
|
46 // destructor |
|
47 CCommDbTest017_01::~CCommDbTest017_01() |
|
48 { |
|
49 } |
|
50 |
|
51 |
|
52 TVerdict CCommDbTest017_01::doTestStepPreambleL() |
|
53 { |
|
54 openDbL(); |
|
55 SetTestStepResult(EPass); return TestStepResult(); |
|
56 } |
|
57 |
|
58 #define TEST_VALUE 42 |
|
59 |
|
60 TInt CCommDbTest017_01::GlobalSettingTestL( const TDesC& aName ) |
|
61 { |
|
62 TUint32 newValue = 0; |
|
63 TInt ret = KErrGeneral; |
|
64 |
|
65 //Perform a read/write test on the global |
|
66 iTheDb->SetGlobalSettingL( aName, TEST_VALUE ); |
|
67 iTheDb->GetGlobalSettingL( aName, newValue ); |
|
68 iTheDb->ClearGlobalSettingL( aName ); |
|
69 |
|
70 //Should leave with KErrNotFound |
|
71 TRAPD(r, iTheDb->GetGlobalSettingL( aName, newValue ) ); |
|
72 if ( r!= KErrNotFound ) |
|
73 User::Leave(r); |
|
74 |
|
75 if ( newValue == TEST_VALUE ) |
|
76 { |
|
77 ret = KErrNone; |
|
78 } |
|
79 return ret; |
|
80 |
|
81 } |
|
82 |
|
83 TInt CCommDbTest017_01::GlobalSettingClearL( const TDesC& aName ) |
|
84 { |
|
85 TUint32 newValue = 0; |
|
86 |
|
87 // Check for Global Setting existing. If exists then clear it |
|
88 TRAPD(ret,iTheDb->GetGlobalSettingL( aName, newValue )); |
|
89 if(ret==KErrNone) |
|
90 { |
|
91 iTheDb->ClearGlobalSettingL( aName ); |
|
92 } |
|
93 else if(ret==KErrNotFound) |
|
94 { |
|
95 ret=KErrNone; |
|
96 } |
|
97 return ret; |
|
98 } |
|
99 |
|
100 TVerdict CCommDbTest017_01::doTestStepPostambleL() |
|
101 { |
|
102 TInt ret=KErrNone; |
|
103 |
|
104 CDBLEAVE( ret = GlobalSettingClearL( TPtrC(REDIAL_ATTEMPTS) ), KErrNone ); |
|
105 CDBLEAVE( ret = GlobalSettingClearL( TPtrC(SMS_BEARER) ), KErrNone ); |
|
106 CDBLEAVE( ret = GlobalSettingClearL( TPtrC(SMS_RECEIVE_MODE) ), KErrNone ); |
|
107 CDBLEAVE( ret = GlobalSettingClearL( TPtrC(GPRS_ATTACH_MODE) ), KErrNone ); |
|
108 CDBLEAVE( ret = GlobalSettingClearL( TPtrC(ACCEPT_INCOMING_GPRS) ), KErrNone ); |
|
109 CDBLEAVE( ret = GlobalSettingClearL( TPtrC(GPRS_CLASS_C_BEARER) ), KErrNone ); |
|
110 CDBLEAVE( ret = GlobalSettingClearL( TPtrC(CONNECTION_ATTEMPTS) ), KErrNone ); |
|
111 CDBLEAVE( ret = GlobalSettingClearL( TPtrC(MODEM_DATA_FAX) ), KErrNone ); |
|
112 CDBLEAVE( ret = GlobalSettingClearL( TPtrC(MODEM_PHONE_SERVICES_SMS) ), KErrNone ); |
|
113 CDBLEAVE( ret = GlobalSettingClearL( TPtrC(LOCATION_DATA_FAX) ), KErrNone ); |
|
114 CDBLEAVE( ret = GlobalSettingClearL( TPtrC(LOCATION_PHONE_SERVICES_SMS) ), KErrNone ); |
|
115 CDBLEAVE( ret = GlobalSettingClearL( TPtrC(MAXMBUF_HEAP) ), KErrNone ); |
|
116 CDBLEAVE( ret = GlobalSettingClearL( TPtrC(DEFAULT_AGENT) ), KErrNone ); |
|
117 CDBLEAVE( ret = GlobalSettingClearL( TPtrC(DEFAULT_NETWORK) ), KErrNone ); |
|
118 |
|
119 // Cleanup after test run |
|
120 CTestStepCommDb::doTestStepPostambleL(); |
|
121 if(ret == KErrNone) |
|
122 { |
|
123 SetTestStepResult(EPass); return TestStepResult(); |
|
124 } |
|
125 else |
|
126 { |
|
127 SetTestStepResult(EFail); return TestStepResult(); |
|
128 } |
|
129 } |
|
130 |
|
131 TInt CCommDbTest017_01::executeStepL() |
|
132 { |
|
133 TInt ret=KErrNone; |
|
134 |
|
135 CDBLEAVE( ret = GlobalSettingTestL( TPtrC(REDIAL_ATTEMPTS) ), KErrNone ); |
|
136 CDBLEAVE( ret = GlobalSettingTestL( TPtrC(SMS_BEARER) ), KErrNone ); |
|
137 CDBLEAVE( ret = GlobalSettingTestL( TPtrC(SMS_RECEIVE_MODE) ), KErrNone ); |
|
138 CDBLEAVE( ret = GlobalSettingTestL( TPtrC(GPRS_ATTACH_MODE) ), KErrNone ); |
|
139 CDBLEAVE( ret = GlobalSettingTestL( TPtrC(ACCEPT_INCOMING_GPRS) ), KErrNone ); |
|
140 CDBLEAVE( ret = GlobalSettingTestL( TPtrC(GPRS_CLASS_C_BEARER) ), KErrNone ); |
|
141 CDBLEAVE( ret = GlobalSettingTestL( TPtrC(CONNECTION_ATTEMPTS) ), KErrNone ); |
|
142 CDBLEAVE( ret = GlobalSettingTestL( TPtrC(MODEM_DATA_FAX) ), KErrNone ); |
|
143 CDBLEAVE( ret = GlobalSettingTestL( TPtrC(MODEM_PHONE_SERVICES_SMS) ), KErrNone ); |
|
144 CDBLEAVE( ret = GlobalSettingTestL( TPtrC(LOCATION_DATA_FAX ) ), KErrNone ); |
|
145 CDBLEAVE( ret = GlobalSettingTestL( TPtrC(LOCATION_PHONE_SERVICES_SMS) ), KErrNone ); |
|
146 CDBLEAVE( ret = GlobalSettingTestL( TPtrC(MAXMBUF_HEAP) ), KErrNone ); |
|
147 CDBLEAVE( ret = GlobalSettingTestL( TPtrC(DEFAULT_AGENT) ), KErrNone ); |
|
148 CDBLEAVE( ret = GlobalSettingTestL( TPtrC(DEFAULT_NETWORK) ), KErrNone ); |
|
149 |
|
150 return ret; |
|
151 } |
|
152 |
|
153 |
|
154 |
|
155 TVerdict CCommDbTest017_01::doTestStepL( ) |
|
156 { |
|
157 INFO_PRINTF1(_L("Step 017.01 called ")); |
|
158 |
|
159 |
|
160 if ( executeStepL() == KErrNone ) |
|
161 SetTestStepResult(EPass); else |
|
162 SetTestStepResult(EFail); |
|
163 return TestStepResult(); |
|
164 } |
|
165 |
|
166 |
|
167 ///////////////////// |
|
168 // Test step 017.02 |
|
169 ///////////////////// |
|
170 |
|
171 // constructor |
|
172 CCommDbTest017_02::CCommDbTest017_02() |
|
173 { |
|
174 // store the name of this test case |
|
175 SetTestStepName(_L("step_017_02")); |
|
176 } |
|
177 |
|
178 // destructor |
|
179 CCommDbTest017_02::~CCommDbTest017_02() |
|
180 { |
|
181 } |
|
182 |
|
183 |
|
184 TVerdict CCommDbTest017_02::doTestStepPreambleL() |
|
185 { |
|
186 openDbAndViewL(TPtrC(MODEM_BEARER)); |
|
187 SetTestStepResult(EPass); return TestStepResult(); |
|
188 } |
|
189 |
|
190 |
|
191 |
|
192 TInt CCommDbTest017_02::executeStepL() |
|
193 { |
|
194 TInt ret=KErrNone; |
|
195 TUint32 id; |
|
196 |
|
197 //Checks for notifications when deleting global modem settings |
|
198 |
|
199 CMDBSession* ptrSession = CMDBSession::NewL(CMDBSession::LatestVersion()); |
|
200 ptrSession->PublishProperties(); |
|
201 delete ptrSession; |
|
202 ptrSession = NULL; |
|
203 |
|
204 RProperty propCdbMdmRecordChange; |
|
205 RProperty propCdbMdmDataFaxChange; |
|
206 RProperty propCdbMdmNameChange; |
|
207 RProperty propCdbPhoneSMSChange; |
|
208 |
|
209 TRequestStatus rqstatMdmRecordChange; |
|
210 TRequestStatus rqstatMdmDatafaxChange; |
|
211 TRequestStatus rqstatMdmNameChange; |
|
212 TRequestStatus rqstatPhoneSMSChange; |
|
213 |
|
214 CDBLEAVE(propCdbMdmRecordChange.Attach(KUidSystemCategory,KUidCommDbModemRecordChange.iUid), KErrNone); |
|
215 CleanupClosePushL(propCdbMdmRecordChange); |
|
216 CDBLEAVE(propCdbMdmDataFaxChange.Attach(KUidSystemCategory,KUidCommDbModemDataAndFaxChange.iUid), KErrNone); |
|
217 CleanupClosePushL(propCdbMdmDataFaxChange); |
|
218 CDBLEAVE(propCdbMdmNameChange.Attach(KUidSystemCategory,KUidCommDbModemTsyNameChange.iUid), KErrNone); |
|
219 CleanupClosePushL(propCdbMdmNameChange); |
|
220 CDBLEAVE(propCdbPhoneSMSChange.Attach(KUidSystemCategory,KUidCommDbModemPhoneServicesAndSMSChange.iUid), KErrNone); |
|
221 CleanupClosePushL(propCdbPhoneSMSChange); |
|
222 |
|
223 |
|
224 //create two modem table entries |
|
225 CDBLEAVE( iTheView->InsertRecord( id ), KErrNone ); |
|
226 |
|
227 _LIT(KModem,"US Robotics Sportster"); |
|
228 _LIT(KTsy,"HAYES"); |
|
229 _LIT8(KModemInitString,"AT&F1"); |
|
230 _LIT8(KModemFaxInitString,"AT&d2"); |
|
231 //Write some sample data into the table |
|
232 iTheView->WriteTextL(TPtrC(COMMDB_NAME),KModem); |
|
233 iTheView->WriteTextL(TPtrC(MODEM_TSY_NAME),KTsy); |
|
234 iTheView->WriteUintL(TPtrC(MODEM_RATE),(TUint32)EBps57600); |
|
235 iTheView->WriteUintL(TPtrC(MODEM_DATA_BITS),(TUint32)EData8); |
|
236 iTheView->WriteUintL(TPtrC(MODEM_STOP_BITS),(TUint32)EStop1); |
|
237 iTheView->WriteUintL(TPtrC(MODEM_PARITY),(TUint32)EParityNone); |
|
238 iTheView->WriteUintL(TPtrC(MODEM_HANDSHAKING),(TUint32)(KConfigObeyCTS|KConfigObeyDSR|KConfigFailDSR|KConfigObeyDCD|KConfigFailDCD)); //KConfigObeyCTS; |
|
239 iTheView->WriteUintL(TPtrC(MODEM_SPECIAL_RATE),(TUint32)0); |
|
240 iTheView->WriteUintL(TPtrC(MODEM_XON_CHAR),(TUint32)0); |
|
241 iTheView->WriteUintL(TPtrC(MODEM_XOFF_CHAR),(TUint32)0); |
|
242 iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING),KModemInitString); |
|
243 iTheView->WriteTextL(TPtrC(MODEM_DATA_INIT_STRING),KNullDesC8); |
|
244 iTheView->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING),KModemFaxInitString); |
|
245 iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_PREF),(TUint32)EModemSpeakerSettingAfterDialUntilAnswer); |
|
246 iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_VOL_PREF),(TUint32)EModemSpeakerVolumeQuiet); |
|
247 CDBLEAVE( iTheView->PutRecordChanges(), KErrNone ); |
|
248 |
|
249 iTheDb->SetGlobalSettingL( TPtrC(MODEM_DATA_FAX), id ); |
|
250 |
|
251 //Open a new view up |
|
252 delete iTheView; |
|
253 iTheView =0; |
|
254 iTheView = iTheDb->OpenTableLC( TPtrC(MODEM_BEARER) ); |
|
255 CleanupStack::Pop(); |
|
256 |
|
257 |
|
258 //Request the notifications |
|
259 |
|
260 propCdbMdmRecordChange.Subscribe(rqstatMdmRecordChange); |
|
261 __ASSERT_ALWAYS(rqstatMdmRecordChange == KRequestPending, User::Invariant()); |
|
262 propCdbMdmDataFaxChange.Subscribe(rqstatMdmDatafaxChange); |
|
263 __ASSERT_ALWAYS(rqstatMdmDatafaxChange == KRequestPending, User::Invariant()); |
|
264 propCdbMdmNameChange.Subscribe(rqstatMdmNameChange); |
|
265 __ASSERT_ALWAYS(rqstatMdmNameChange == KRequestPending, User::Invariant()); |
|
266 |
|
267 //Delete the modem record and then wait for the notifications |
|
268 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ); |
|
269 CDBLEAVE( iTheView->DeleteRecord(), KErrNone ); |
|
270 |
|
271 User::WaitForRequest(rqstatMdmRecordChange); |
|
272 if (rqstatMdmRecordChange != KErrNone) |
|
273 { |
|
274 ret = KErrNotFound; |
|
275 } |
|
276 User::WaitForRequest(rqstatMdmDatafaxChange); |
|
277 if (rqstatMdmDatafaxChange != KErrNone) |
|
278 { |
|
279 ret = KErrNotFound; |
|
280 } |
|
281 User::WaitForRequest(rqstatMdmNameChange); |
|
282 if (rqstatMdmNameChange != KErrNone) |
|
283 { |
|
284 ret = KErrNotFound; |
|
285 } |
|
286 |
|
287 //Now try the same thing with the MODEM_PHONE_SERVICES_SMS global setting |
|
288 CDBLEAVE( iTheView->InsertRecord( id ), KErrNone ); |
|
289 |
|
290 _LIT(KModem2,"Another US Robotics Sportster"); |
|
291 //Write some sample data into the table |
|
292 iTheView->WriteTextL(TPtrC(COMMDB_NAME),KModem2); |
|
293 iTheView->WriteTextL(TPtrC(MODEM_TSY_NAME),KTsy); |
|
294 iTheView->WriteUintL(TPtrC(MODEM_RATE),(TUint32)EBps57600); |
|
295 iTheView->WriteUintL(TPtrC(MODEM_DATA_BITS),(TUint32)EData8); |
|
296 iTheView->WriteUintL(TPtrC(MODEM_STOP_BITS),(TUint32)EStop1); |
|
297 iTheView->WriteUintL(TPtrC(MODEM_PARITY),(TUint32)EParityNone); |
|
298 iTheView->WriteUintL(TPtrC(MODEM_HANDSHAKING),(TUint32)(KConfigObeyCTS|KConfigObeyDSR|KConfigFailDSR|KConfigObeyDCD|KConfigFailDCD)); //KConfigObeyCTS; |
|
299 iTheView->WriteUintL(TPtrC(MODEM_SPECIAL_RATE),(TUint32)0); |
|
300 iTheView->WriteUintL(TPtrC(MODEM_XON_CHAR),(TUint32)0); |
|
301 iTheView->WriteUintL(TPtrC(MODEM_XOFF_CHAR),(TUint32)0); |
|
302 iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING),KModemInitString); |
|
303 iTheView->WriteTextL(TPtrC(MODEM_DATA_INIT_STRING),KNullDesC8); |
|
304 iTheView->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING),KModemFaxInitString); |
|
305 iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_PREF),(TUint32)EModemSpeakerSettingAfterDialUntilAnswer); |
|
306 iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_VOL_PREF),(TUint32)EModemSpeakerVolumeQuiet); |
|
307 CDBLEAVE( iTheView->PutRecordChanges(), KErrNone ); |
|
308 |
|
309 iTheDb->SetGlobalSettingL( TPtrC(MODEM_PHONE_SERVICES_SMS), id ); |
|
310 |
|
311 |
|
312 //Open a new view up |
|
313 delete iTheView; |
|
314 iTheView =0; |
|
315 iTheView = iTheDb->OpenTableLC( TPtrC(MODEM_BEARER) ); |
|
316 CleanupStack::Pop(); |
|
317 |
|
318 //Reset notifications |
|
319 propCdbMdmRecordChange.Subscribe(rqstatMdmRecordChange); |
|
320 __ASSERT_ALWAYS(rqstatMdmRecordChange == KRequestPending, User::Invariant()); |
|
321 propCdbMdmNameChange.Subscribe(rqstatMdmNameChange); |
|
322 __ASSERT_ALWAYS(rqstatMdmNameChange == KRequestPending, User::Invariant()); |
|
323 propCdbPhoneSMSChange.Subscribe(rqstatPhoneSMSChange); |
|
324 __ASSERT_ALWAYS(rqstatPhoneSMSChange == KRequestPending, User::Invariant()); |
|
325 |
|
326 //Delete the record and wait for the notifications |
|
327 CDBLEAVE( iTheView->DeleteRecord(), KErrNone ); |
|
328 |
|
329 User::WaitForRequest(rqstatMdmRecordChange); |
|
330 if (rqstatMdmRecordChange != KErrNone) |
|
331 { |
|
332 ret = rqstatMdmRecordChange.Int(); |
|
333 } |
|
334 User::WaitForRequest(rqstatPhoneSMSChange); |
|
335 if (rqstatPhoneSMSChange != KErrNone) |
|
336 { |
|
337 ret = rqstatMdmRecordChange.Int(); |
|
338 } |
|
339 User::WaitForRequest(rqstatMdmNameChange); |
|
340 if (rqstatMdmNameChange != KErrNone) |
|
341 { |
|
342 ret = rqstatMdmRecordChange.Int(); |
|
343 } |
|
344 |
|
345 CleanupStack::PopAndDestroy(); // propCdbPhoneSMSChange |
|
346 CleanupStack::PopAndDestroy(); // propCdbMdmNameChange |
|
347 CleanupStack::PopAndDestroy(); // propCdbMdmDataFaxChange |
|
348 CleanupStack::PopAndDestroy(); // propCdbMdmRecordChange |
|
349 |
|
350 |
|
351 return ret; |
|
352 } |
|
353 |
|
354 |
|
355 |
|
356 TVerdict CCommDbTest017_02::doTestStepL( ) |
|
357 { |
|
358 INFO_PRINTF1(_L("Step 017.02 called ")); |
|
359 |
|
360 if ( executeStepL() == KErrNone ) |
|
361 SetTestStepResult(EPass); else |
|
362 SetTestStepResult(EFail); |
|
363 return TestStepResult(); |
|
364 } |
|
365 |
|
366 |
|
367 ///////////////////// |
|
368 // Test step 017.03 |
|
369 ///////////////////// |
|
370 |
|
371 // constructor |
|
372 CCommDbTest017_03::CCommDbTest017_03() |
|
373 { |
|
374 // store the name of this test case |
|
375 SetTestStepName(_L("step_017_03")); |
|
376 } |
|
377 |
|
378 // destructor |
|
379 CCommDbTest017_03::~CCommDbTest017_03() |
|
380 { |
|
381 } |
|
382 |
|
383 TVerdict CCommDbTest017_03::doTestStepPreambleL() |
|
384 { |
|
385 openDbAndViewL(TPtrC(MODEM_BEARER)); |
|
386 SetTestStepResult(EPass); return TestStepResult(); |
|
387 } |
|
388 |
|
389 |
|
390 TInt CCommDbTest017_03::executeStepL() |
|
391 { |
|
392 TInt ret=KErrNone; |
|
393 TUint32 id; |
|
394 |
|
395 //Checks for notifications when deleting global modem settings |
|
396 |
|
397 RProperty propCdbMdmRecordChange; |
|
398 RProperty propCdbMdmDataFaxChange; |
|
399 RProperty propCdbMdmNameChange; |
|
400 RProperty propCdbPhoneSMSChange; |
|
401 |
|
402 TRequestStatus rqstatMdmRecordChange; |
|
403 TRequestStatus rqstatMdmDatafaxChange; |
|
404 TRequestStatus rqstatMdmNameChange; |
|
405 TRequestStatus rqstatPhoneSMSChange; |
|
406 |
|
407 CDBLEAVE(propCdbMdmRecordChange.Attach(KUidSystemCategory, KUidCommDbModemRecordChange.iUid), KErrNone); |
|
408 CleanupClosePushL(propCdbMdmRecordChange); |
|
409 CDBLEAVE(propCdbMdmDataFaxChange.Attach(KUidSystemCategory, KUidCommDbModemDataAndFaxChange.iUid), KErrNone); //this KUid has been deprecated |
|
410 CleanupClosePushL(propCdbMdmDataFaxChange); |
|
411 CDBLEAVE(propCdbMdmNameChange.Attach(KUidSystemCategory, KUidCommDbModemTsyNameChange.iUid), KErrNone); |
|
412 CleanupClosePushL(propCdbMdmNameChange); |
|
413 CDBLEAVE(propCdbPhoneSMSChange.Attach(KUidSystemCategory, KUidCommDbModemPhoneServicesAndSMSChange.iUid), KErrNone); //this KUid has been deprecated |
|
414 CleanupClosePushL(propCdbPhoneSMSChange); |
|
415 |
|
416 |
|
417 //create two modem table entries |
|
418 CDBLEAVE( iTheView->InsertRecord( id ), KErrNone ); |
|
419 |
|
420 _LIT(KModem,"US Robotics Sportster"); |
|
421 _LIT(KTsy,"HAYES"); |
|
422 _LIT8(KModemInitString,"AT&F1"); |
|
423 _LIT8(KModemFaxInitString,"AT&d2"); |
|
424 //Write some sample data into the table |
|
425 iTheView->WriteTextL(TPtrC(COMMDB_NAME),KModem); |
|
426 iTheView->WriteTextL(TPtrC(MODEM_TSY_NAME),KTsy); |
|
427 iTheView->WriteUintL(TPtrC(MODEM_RATE),(TUint32)EBps57600); |
|
428 iTheView->WriteUintL(TPtrC(MODEM_DATA_BITS),(TUint32)EData8); |
|
429 iTheView->WriteUintL(TPtrC(MODEM_STOP_BITS),(TUint32)EStop1); |
|
430 iTheView->WriteUintL(TPtrC(MODEM_PARITY),(TUint32)EParityNone); |
|
431 iTheView->WriteUintL(TPtrC(MODEM_HANDSHAKING),(TUint32)(KConfigObeyCTS|KConfigObeyDSR|KConfigFailDSR|KConfigObeyDCD|KConfigFailDCD)); //KConfigObeyCTS; |
|
432 iTheView->WriteUintL(TPtrC(MODEM_SPECIAL_RATE),(TUint32)0); |
|
433 iTheView->WriteUintL(TPtrC(MODEM_XON_CHAR),(TUint32)0); |
|
434 iTheView->WriteUintL(TPtrC(MODEM_XOFF_CHAR),(TUint32)0); |
|
435 iTheView->WriteTextL(TPtrC(MODEM_MODEM_INIT_STRING),KModemInitString); |
|
436 iTheView->WriteTextL(TPtrC(MODEM_DATA_INIT_STRING),KNullDesC8); |
|
437 iTheView->WriteTextL(TPtrC(MODEM_FAX_INIT_STRING),KModemFaxInitString); |
|
438 iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_PREF),(TUint32)EModemSpeakerSettingAfterDialUntilAnswer); |
|
439 iTheView->WriteUintL(TPtrC(MODEM_SPEAKER_VOL_PREF),(TUint32)EModemSpeakerVolumeQuiet); |
|
440 CDBLEAVE( iTheView->PutRecordChanges(), KErrNone ); |
|
441 |
|
442 //Set both modem gloabls to the same record |
|
443 iTheDb->SetGlobalSettingL( TPtrC(MODEM_DATA_FAX), id ); |
|
444 iTheDb->SetGlobalSettingL( TPtrC(MODEM_PHONE_SERVICES_SMS), id ); |
|
445 |
|
446 //Open a new view up |
|
447 delete iTheView; |
|
448 iTheView =0; |
|
449 iTheView = iTheDb->OpenTableLC( TPtrC(MODEM_BEARER) ); |
|
450 CleanupStack::Pop(); |
|
451 |
|
452 |
|
453 //Request the notifications |
|
454 propCdbMdmRecordChange.Subscribe(rqstatMdmRecordChange); |
|
455 __ASSERT_ALWAYS(rqstatMdmRecordChange == KRequestPending, User::Invariant()); |
|
456 propCdbMdmDataFaxChange.Subscribe(rqstatMdmDatafaxChange); |
|
457 __ASSERT_ALWAYS(rqstatMdmDatafaxChange == KRequestPending, User::Invariant()); |
|
458 propCdbMdmNameChange.Subscribe(rqstatMdmNameChange); |
|
459 __ASSERT_ALWAYS(rqstatMdmNameChange == KRequestPending, User::Invariant()); |
|
460 propCdbPhoneSMSChange.Subscribe(rqstatPhoneSMSChange); |
|
461 __ASSERT_ALWAYS(rqstatPhoneSMSChange == KRequestPending, User::Invariant()); |
|
462 |
|
463 //Delete the modem record and then wait for the four notifications |
|
464 CDBLEAVE( iTheView->GotoFirstRecord(), KErrNone ); |
|
465 CDBLEAVE( iTheView->DeleteRecord(), KErrNone ); |
|
466 |
|
467 User::WaitForRequest(rqstatMdmRecordChange); |
|
468 if (rqstatMdmRecordChange != KErrNone) |
|
469 { |
|
470 ret = KErrNotFound; |
|
471 } |
|
472 User::WaitForRequest(rqstatMdmDatafaxChange); |
|
473 if (rqstatMdmDatafaxChange != KErrNone) |
|
474 { |
|
475 ret = KErrNotFound; |
|
476 } |
|
477 User::WaitForRequest(rqstatPhoneSMSChange); |
|
478 if (rqstatPhoneSMSChange != KErrNone) |
|
479 { |
|
480 ret = KErrNotFound; |
|
481 } |
|
482 |
|
483 User::WaitForRequest(rqstatMdmNameChange); |
|
484 if (rqstatMdmNameChange != KErrNone) |
|
485 { |
|
486 ret = KErrNotFound; |
|
487 } |
|
488 |
|
489 CleanupStack::PopAndDestroy(); // propCdbPhoneSMSChange |
|
490 CleanupStack::PopAndDestroy(); // propCdbMdmNameChange |
|
491 CleanupStack::PopAndDestroy(); // propCdbMdmDataFaxChange |
|
492 CleanupStack::PopAndDestroy(); // propCdbMdmRecordChange |
|
493 |
|
494 return ret; |
|
495 } |
|
496 |
|
497 |
|
498 |
|
499 TVerdict CCommDbTest017_03::doTestStepL( ) |
|
500 { |
|
501 INFO_PRINTF1(_L("Step 017.03 called ")); |
|
502 |
|
503 if ( executeStepL() == KErrNone ) |
|
504 SetTestStepResult(EPass); else |
|
505 SetTestStepResult(EFail); |
|
506 |
|
507 return TestStepResult(); |
|
508 } |
|
509 |
|
510 |
|
511 |
|
512 ///////////////////// |
|
513 // Test step 017.04 |
|
514 ///////////////////// |
|
515 |
|
516 // constructor |
|
517 CCommDbTest017_04::CCommDbTest017_04() |
|
518 { |
|
519 // store the name of this test case |
|
520 SetTestStepName(_L("step_017_04")); |
|
521 } |
|
522 |
|
523 // destructor |
|
524 CCommDbTest017_04::~CCommDbTest017_04() |
|
525 { |
|
526 } |
|
527 |
|
528 TVerdict CCommDbTest017_04::doTestStepPreambleL() |
|
529 { |
|
530 openDbL(); |
|
531 SetTestStepResult(EPass); return TestStepResult(); |
|
532 } |
|
533 |
|
534 |
|
535 #define INVALID_GLOBAL_NAME _L("Invalid") |
|
536 |
|
537 TInt CCommDbTest017_04::executeStepL() |
|
538 { |
|
539 TRAPD( r, iTheDb->SetGlobalSettingL( TPtrC(INVALID_GLOBAL_NAME), 0x55 ) ); |
|
540 if ( r!=KErrNotSupported ) |
|
541 return r; |
|
542 |
|
543 TUint32 dummInt; |
|
544 TRAP( r, iTheDb->GetGlobalSettingL( TPtrC(INVALID_GLOBAL_NAME), dummInt ) ); |
|
545 return r; |
|
546 } |
|
547 |
|
548 |
|
549 |
|
550 TVerdict CCommDbTest017_04::doTestStepL( ) |
|
551 { |
|
552 INFO_PRINTF1(_L("Step 017.04 called ")); |
|
553 |
|
554 |
|
555 if ( executeStepL() == KErrNotSupported) |
|
556 SetTestStepResult(EPass); else |
|
557 SetTestStepResult(EFail); |
|
558 return TestStepResult(); |
|
559 } |
|
560 |
|
561 |
|
562 |
|
563 ///////////////////// |
|
564 // Test step 017.05 |
|
565 ///////////////////// |
|
566 |
|
567 // constructor |
|
568 CCommDbTest017_05::CCommDbTest017_05() |
|
569 { |
|
570 // store the name of this test case |
|
571 SetTestStepName(_L("step_017_05")); |
|
572 } |
|
573 |
|
574 // destructor |
|
575 CCommDbTest017_05::~CCommDbTest017_05() |
|
576 { |
|
577 } |
|
578 |
|
579 TVerdict CCommDbTest017_05::doTestStepL( ) |
|
580 { |
|
581 INFO_PRINTF1(_L("Step 017.05 called ")); |
|
582 |
|
583 SetTestStepResult(EPass); |
|
584 // Have backup of Database in c:\default1.dat |
|
585 // copyDatabaseToDefault (EDatabase_1); |
|
586 |
|
587 // Heap test for 017.01 |
|
588 |
|
589 // copyTestDatabase( EDatabase_1 ); |
|
590 CCommDbTest017_01* step017_01 = new(ELeave) CCommDbTest017_01; |
|
591 CleanupStack::PushL(step017_01); |
|
592 if ( doTestStepWithHeapFailureL( *step017_01, KErrNone) == EFail ) |
|
593 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step017_01); |
|
594 |
|
595 // Heap test for 017.02 |
|
596 |
|
597 // copyTestDatabase( EDatabase_1 ); |
|
598 CCommDbTest017_02* step017_02 = new CCommDbTest017_02; |
|
599 CleanupStack::PushL(step017_02); |
|
600 if ( doTestStepWithHeapFailureL( *step017_02, KErrNone) == EFail ) |
|
601 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step017_02); |
|
602 |
|
603 // Heap test for 017.03 |
|
604 |
|
605 // copyTestDatabase( EDatabase_1 ); |
|
606 CCommDbTest017_03* step017_03 = new CCommDbTest017_03; |
|
607 CleanupStack::PushL(step017_03); |
|
608 if ( doTestStepWithHeapFailureL( *step017_03, KErrNone) == EFail ) |
|
609 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step017_03); |
|
610 |
|
611 // Heap test for 017.04 |
|
612 |
|
613 // copyTestDatabase( EDatabase_1 ); |
|
614 CCommDbTest017_04* step017_04 = new CCommDbTest017_04; |
|
615 CleanupStack::PushL(step017_04); |
|
616 if ( doTestStepWithHeapFailureL( *step017_04, KErrNotSupported) == EFail ) |
|
617 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step017_04); |
|
618 |
|
619 |
|
620 return TestStepResult(); |
|
621 |
|
622 } |
|
623 |
|
624 ///////////////////// |
|
625 // Test step 017.06 |
|
626 ///////////////////// |
|
627 |
|
628 // constructor |
|
629 CCommDbTest017_06::CCommDbTest017_06() |
|
630 { |
|
631 // store the name of this test case |
|
632 SetTestStepName(_L("step_017_06")); |
|
633 } |
|
634 |
|
635 // destructor |
|
636 CCommDbTest017_06::~CCommDbTest017_06() |
|
637 { |
|
638 } |
|
639 |
|
640 TVerdict CCommDbTest017_06::doTestStepPreambleL() |
|
641 { |
|
642 openDbL(); |
|
643 SetTestStepResult(EPass); return TestStepResult(); |
|
644 } |
|
645 |
|
646 |
|
647 #define DEFAULT_TSY _L("DEFAULT_TSY") |
|
648 |
|
649 TInt CCommDbTest017_06::executeStepL() |
|
650 { |
|
651 TRAPD(r, iTheDb->SetGlobalSettingL(TPtrC(BEARER_AVAILABILITY_CHECK_TSY), TPtrC(DEFAULT_TSY)) ); |
|
652 |
|
653 if (r != KErrNone) |
|
654 return r; |
|
655 |
|
656 TBuf<KCommsDbSvrMaxFieldLength> defaultTsy; |
|
657 TRAP(r, iTheDb->GetGlobalSettingL( TPtrC(BEARER_AVAILABILITY_CHECK_TSY), defaultTsy ) ); |
|
658 |
|
659 if (r != KErrNone) |
|
660 { |
|
661 return r; |
|
662 } |
|
663 |
|
664 if (defaultTsy.Compare(TPtrC(DEFAULT_TSY)) != 0) |
|
665 { |
|
666 return KErrArgument; |
|
667 } |
|
668 |
|
669 defaultTsy.Zero(); |
|
670 TRAP(r, iTheDb->GetDefaultTsyL(defaultTsy)); |
|
671 |
|
672 if (r != KErrNone) |
|
673 { |
|
674 return r; |
|
675 } |
|
676 |
|
677 if (defaultTsy.Compare(TPtrC(DEFAULT_TSY)) != 0) |
|
678 { |
|
679 return KErrArgument; |
|
680 } |
|
681 return KErrNone; |
|
682 } |
|
683 |
|
684 |
|
685 TVerdict CCommDbTest017_06::doTestStepL( ) |
|
686 { |
|
687 INFO_PRINTF1(_L("Step 017.06 called ")); |
|
688 |
|
689 |
|
690 if ( executeStepL() == KErrNone) |
|
691 SetTestStepResult(EPass); else |
|
692 SetTestStepResult(EFail); |
|
693 return TestStepResult(); |
|
694 } |
|
695 |
|
696 ///////////////////// |
|
697 // Test step 017.07 |
|
698 ///////////////////// |
|
699 |
|
700 // constructor |
|
701 CCommDbTest017_07::CCommDbTest017_07() |
|
702 { |
|
703 // store the name of this test case |
|
704 SetTestStepName(_L("step_017_07")); |
|
705 } |
|
706 |
|
707 // destructor |
|
708 CCommDbTest017_07::~CCommDbTest017_07() |
|
709 { |
|
710 } |
|
711 |
|
712 TVerdict CCommDbTest017_07::doTestStepL( ) |
|
713 { |
|
714 INFO_PRINTF1(_L("Step 017.07 called ")); |
|
715 |
|
716 SetTestStepResult(EPass); |
|
717 // Heap test for 017.06 |
|
718 |
|
719 // copyTestDatabase( EDatabase_1 ); |
|
720 CCommDbTest017_06* step017_06 = new(ELeave) CCommDbTest017_06; |
|
721 CleanupStack::PushL(step017_06); |
|
722 if ( doTestStepWithHeapFailureL( *step017_06, KErrNone) == EFail ) |
|
723 SetTestStepResult(EFail); CleanupStack::PopAndDestroy(step017_06); |
|
724 |
|
725 return TestStepResult(); |
|
726 |
|
727 } |
|
728 |