24
|
1 |
// Copyright (c) 2000-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 |
// Contains tests for RMobileSmsStore API
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#include <e32test.h>
|
|
19 |
|
|
20 |
#include "TE_EtelMMTestStepBase.h"
|
|
21 |
#include "TE_mmsmsstore.h"
|
|
22 |
#include "testdef.h"
|
|
23 |
|
|
24 |
CTestSmsStore::CTestSmsStore()
|
|
25 |
/** Each test step initialises it's own name
|
|
26 |
*/
|
|
27 |
{
|
|
28 |
// store the name of this test case
|
|
29 |
// this is the name that is used by the script file
|
|
30 |
SetTestStepName(_L("TestSmsStore"));
|
|
31 |
}
|
|
32 |
|
|
33 |
enum TVerdict CTestSmsStore::doTestStepL()
|
|
34 |
//
|
|
35 |
// Test SMS Storage Functions
|
|
36 |
//
|
|
37 |
{
|
|
38 |
|
|
39 |
iTestCount=1;
|
|
40 |
INFO_PRINTF1(_L(""));
|
|
41 |
INFO_PRINTF1(_L("Test Mobile SMS Storage Functionality"));
|
|
42 |
// LOGTEXT(_L8("Test Mobile SMS Storage Functionality"));
|
|
43 |
|
|
44 |
RMobilePhone mmPhone;
|
|
45 |
TInt ret=mmPhone.Open(iTelServer,DMMTSY_PHONE_NAME);
|
|
46 |
TEST(ret==KErrNone);
|
|
47 |
|
|
48 |
RMobileSmsMessaging smsMessaging;
|
|
49 |
ret=smsMessaging.Open(mmPhone);
|
|
50 |
TEST(ret==KErrNone);
|
|
51 |
|
|
52 |
RMobileSmsStore smsStore;
|
|
53 |
ret=smsStore.Open(smsMessaging, KETelIccSmsStore);
|
|
54 |
TEST(ret==KErrNone);
|
|
55 |
|
|
56 |
TRequestStatus reqStatus;
|
|
57 |
|
|
58 |
// Get SMS store information
|
|
59 |
|
|
60 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1 asyncInfo;
|
|
61 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg asyncInfoPckg(asyncInfo);
|
|
62 |
|
|
63 |
// asynchronous
|
|
64 |
|
|
65 |
smsStore.GetInfo(reqStatus, asyncInfoPckg);
|
|
66 |
User::WaitForRequest(reqStatus);
|
|
67 |
TEST(reqStatus.Int()==KErrNone);
|
|
68 |
ValidateSmsStoreInfo(asyncInfo);
|
|
69 |
|
|
70 |
// asynchronous & cancel
|
|
71 |
|
|
72 |
smsStore.GetInfo(reqStatus, asyncInfoPckg);
|
|
73 |
smsStore.CancelAsyncRequest(EMobilePhoneStoreGetInfo);
|
|
74 |
User::WaitForRequest(reqStatus);
|
|
75 |
TEST(reqStatus.Int()==KErrNone || reqStatus.Int() == KErrCancel);
|
|
76 |
if (reqStatus.Int()==KErrCancel)
|
|
77 |
INFO_PRINTF2(_L("Test %d - RMobileSmsStore::GetInfo (async & cancel (Cancelled Request)) passed"), iTestCount++);
|
|
78 |
else
|
|
79 |
{
|
|
80 |
ValidateSmsStoreInfo(asyncInfo);
|
|
81 |
INFO_PRINTF2(_L("Test %d - RMobileSmsStore::GetInfo (async & cancel (Request not cancelled)) passed"), iTestCount++);
|
|
82 |
}
|
|
83 |
|
|
84 |
// test.Next(_L("OK: RMobileSmsStore's Get Info"));
|
|
85 |
|
|
86 |
// Read one entry
|
|
87 |
|
|
88 |
RMobileSmsStore::TMobileGsmSmsEntryV1 asyncEntry1;
|
|
89 |
asyncEntry1.iIndex = DMMTSY_SMS_STORE_INDEX1;
|
|
90 |
|
|
91 |
// asynchronous
|
|
92 |
|
|
93 |
RMobileSmsStore::TMobileGsmSmsEntryV1Pckg asyncEntry1Pckg(asyncEntry1);
|
|
94 |
smsStore.Read(reqStatus,asyncEntry1Pckg);
|
|
95 |
User::WaitForRequest(reqStatus);
|
|
96 |
TEST(reqStatus.Int()==KErrNone);
|
|
97 |
|
|
98 |
ValidateSmsRead(asyncEntry1);
|
|
99 |
|
|
100 |
// asynchronous cancel
|
|
101 |
|
|
102 |
asyncEntry1.iIndex = DMMTSY_SMS_STORE_INDEX1;
|
|
103 |
smsStore.Read(reqStatus, asyncEntry1Pckg);
|
|
104 |
smsStore.CancelAsyncRequest(EMobilePhoneStoreRead);
|
|
105 |
User::WaitForRequest(reqStatus);
|
|
106 |
|
|
107 |
if (reqStatus.Int()==KErrCancel)
|
|
108 |
INFO_PRINTF2(_L("Test %d - RMobileSmsStore::Read (async & cancel (Cancelled Request)) passed"), iTestCount++);
|
|
109 |
else
|
|
110 |
{
|
|
111 |
ValidateSmsRead(asyncEntry1);
|
|
112 |
INFO_PRINTF2(_L("Test %d - RMobileSmsStore::Read (async & cancel (Request Not Cancelled)) passed"), iTestCount++);
|
|
113 |
}
|
|
114 |
|
|
115 |
// test.Next(_L("OK: RMobileSmsStore's Read Entry"));
|
|
116 |
|
|
117 |
// Write one entry
|
|
118 |
|
|
119 |
RMobileSmsStore::TMobileCdmaSmsEntryV1 entry2;
|
|
120 |
RMobileSmsStore::TMobileCdmaSmsEntryV1Pckg entry2Pckg(entry2);
|
|
121 |
|
|
122 |
// asynchronous
|
|
123 |
|
|
124 |
entry2.iIndex = DMMTSY_SMS_STORE_INDEX2;
|
|
125 |
entry2.iMsgData = DMMTSY_SMS_MESSAGE_PDU2;
|
|
126 |
entry2.iMsgStatus =DMMTSY_SMS_STORE_STATUS2;
|
|
127 |
entry2.iRemoteParty.iTelNumber =DMMTSY_SMS_MESSAGE_REMOTEPARTYNUMBER2;
|
|
128 |
entry2.iTeleservice=DMMTSY_SMS_MESSAGE_TELESERVICE;
|
|
129 |
|
|
130 |
smsStore.Write(reqStatus, entry2Pckg);
|
|
131 |
User::WaitForRequest(reqStatus);
|
|
132 |
TEST(reqStatus.Int()==KErrNone);
|
|
133 |
|
|
134 |
// asynchronous & cancel
|
|
135 |
|
|
136 |
smsStore.Write(reqStatus, entry2Pckg);
|
|
137 |
smsStore.CancelAsyncRequest(EMobilePhoneStoreWrite);
|
|
138 |
User::WaitForRequest(reqStatus);
|
|
139 |
TEST(reqStatus.Int()==KErrNone || reqStatus.Int() == KErrCancel);
|
|
140 |
|
|
141 |
if (reqStatus.Int() == KErrCancel)
|
|
142 |
INFO_PRINTF2(_L("Test %d - RMobileSmsStore::Write (async & cancel (Cancelled Request)) passed"), iTestCount++);
|
|
143 |
else
|
|
144 |
INFO_PRINTF2(_L("Test %d - RMobileSmsStore::Write (async & cancel (Request Not Cancelled)) passed"), iTestCount++);
|
|
145 |
|
|
146 |
// test.Next(_L("OK: RMobileSmsStore's Write Entry"));
|
|
147 |
|
|
148 |
// Delete one entry
|
|
149 |
|
|
150 |
// asynchronous
|
|
151 |
|
|
152 |
smsStore.Delete(reqStatus, DMMTSY_SMS_STORE_INDEX3);
|
|
153 |
User::WaitForRequest(reqStatus);
|
|
154 |
TEST(reqStatus.Int()==KErrNone);
|
|
155 |
|
|
156 |
// asyncrhonous & cancel
|
|
157 |
|
|
158 |
smsStore.Delete(reqStatus, DMMTSY_SMS_STORE_INDEX3);
|
|
159 |
smsStore.CancelAsyncRequest(EMobilePhoneStoreDelete);
|
|
160 |
User::WaitForRequest(reqStatus);
|
|
161 |
TEST(reqStatus.Int()==KErrNone || reqStatus.Int() == KErrCancel);
|
|
162 |
|
|
163 |
|
|
164 |
if (reqStatus.Int() == KErrCancel)
|
|
165 |
INFO_PRINTF2(_L("Test %d - RMobileSmsStore::Delete (async & cancel (Cancelled Request)) passed"), iTestCount++);
|
|
166 |
else
|
|
167 |
INFO_PRINTF2(_L("Test %d - RMobileSmsStore::Delete (async & cancel (Request not Cancelled)) passed"), iTestCount++);
|
|
168 |
|
|
169 |
// Delete all entries
|
|
170 |
|
|
171 |
// asynchronous
|
|
172 |
|
|
173 |
smsStore.DeleteAll(reqStatus);
|
|
174 |
User::WaitForRequest(reqStatus);
|
|
175 |
TEST(reqStatus.Int()==KErrNone);
|
|
176 |
|
|
177 |
// asynchronous and cancel
|
|
178 |
|
|
179 |
smsStore.DeleteAll(reqStatus);
|
|
180 |
smsStore.CancelAsyncRequest(EMobilePhoneStoreDeleteAll);
|
|
181 |
User::WaitForRequest(reqStatus);
|
|
182 |
|
|
183 |
TEST(reqStatus.Int()==KErrNone || reqStatus.Int()==KErrCancel);
|
|
184 |
|
|
185 |
if (reqStatus.Int() == KErrCancel)
|
|
186 |
INFO_PRINTF2(_L("Test %d - RMobileSmsStore::DeleteAll (async & cancel (Cancelled Request)) passed"), iTestCount++);
|
|
187 |
else
|
|
188 |
INFO_PRINTF2(_L("Test %d - RMobileSmsStore::DeleteAll (async & cancel (Request Not Cancelled)) passed"), iTestCount++);
|
|
189 |
|
|
190 |
// test.Next(_L("OK: RMobileSmsStore's Delete Entries"));
|
|
191 |
|
|
192 |
// Notify Entry Changed
|
|
193 |
|
|
194 |
// asynchronous
|
|
195 |
|
|
196 |
TUint32 event;
|
|
197 |
TInt index;
|
|
198 |
smsStore.NotifyStoreEvent(reqStatus,event,index);
|
|
199 |
User::WaitForRequest(reqStatus);
|
|
200 |
TEST(reqStatus.Int()==KErrNone);
|
|
201 |
TEST(index==DMMTSY_SMS_STORE_INDEX4);
|
|
202 |
TEST(event == DMMTSY_MESSAGE_STORE_EVENT);
|
|
203 |
|
|
204 |
// asynchronous cancel
|
|
205 |
|
|
206 |
smsStore.NotifyStoreEvent(reqStatus,event,index);
|
|
207 |
smsStore.CancelAsyncRequest(EMobilePhoneStoreNotifyStoreEvent);
|
|
208 |
User::WaitForRequest(reqStatus);
|
|
209 |
TEST(reqStatus.Int()==KErrNone || reqStatus.Int()==KErrCancel);
|
|
210 |
if (reqStatus.Int()==KErrCancel)
|
|
211 |
INFO_PRINTF2(_L("Test %d - RMobileSmsStore::NotifyStoreEvent (async & cancel (Cancelled Request)) passed"), iTestCount++);
|
|
212 |
else
|
|
213 |
{
|
|
214 |
TEST(index==DMMTSY_SMS_STORE_INDEX4);
|
|
215 |
TEST(event == DMMTSY_MESSAGE_STORE_EVENT);
|
|
216 |
INFO_PRINTF2(_L("Test %d - RMobileSmsStore::NotifyStoreEvent (async & cancel (Request Not Cancelled)) passed"), iTestCount++);
|
|
217 |
}
|
|
218 |
|
|
219 |
// test.Next(_L("OK: RMobileSmsStore's Notify Store Event"));
|
|
220 |
|
|
221 |
// Get SMS list using asynchronous AO version
|
|
222 |
CTestGetSmsList* getSmsList=CTestGetSmsList::NewLC(smsStore,EFalse,DMMTSY_SMS_STORE_GSMENTRY_TYPE, this);
|
|
223 |
|
|
224 |
getSmsList->Start();
|
|
225 |
CActiveScheduler::Start();
|
|
226 |
|
|
227 |
// Ensure that the same AO can be used to retrieve more than one list
|
|
228 |
|
|
229 |
getSmsList->Start();
|
|
230 |
CActiveScheduler::Start();
|
|
231 |
|
|
232 |
// I only need to delete the retrieval object because the destructor
|
|
233 |
// of this will also delete the list object.
|
|
234 |
CleanupStack::PopAndDestroy(); // getSmsList
|
|
235 |
|
|
236 |
//Test deletion of list object whilst async request in progress
|
|
237 |
CRetrieveMobilePhoneSmsList* retrieve=CRetrieveMobilePhoneSmsList::NewL(smsStore,DMMTSY_SMS_STORE_GSMENTRY_TYPE);
|
|
238 |
retrieve->Start(reqStatus);
|
|
239 |
delete retrieve;
|
|
240 |
retrieve = NULL;
|
|
241 |
User::WaitForRequest(reqStatus);
|
|
242 |
TEST(reqStatus == KErrCancel);
|
|
243 |
|
|
244 |
// Now test the cancelling
|
|
245 |
|
|
246 |
getSmsList=CTestGetSmsList::NewLC(smsStore,EFalse,DMMTSY_SMS_STORE_GSMENTRY_TYPE, this);
|
|
247 |
getSmsList->Start();
|
|
248 |
|
|
249 |
CTestCanceller* cancelGetSmsList = getSmsList->RetrieveCancelPtr();
|
|
250 |
cancelGetSmsList->Call();
|
|
251 |
|
|
252 |
CActiveScheduler::Start();
|
|
253 |
TBool cancelled = (getSmsList->iStatus == KErrCancel);
|
|
254 |
|
|
255 |
// Ensure that an AO can be used to retrieve a list after the previous request was cancelled
|
|
256 |
|
|
257 |
getSmsList->Start();
|
|
258 |
CActiveScheduler::Start();
|
|
259 |
|
|
260 |
if (cancelled)
|
|
261 |
INFO_PRINTF2(_L("Test %d - RMobileSmsStore::ReadAll (sync & async & cancel (Cancelled Request)) passed"), iTestCount++);
|
|
262 |
else
|
|
263 |
INFO_PRINTF2(_L("Test %d - RMobileSmsStore::ReadAll (sync & async & cancel (Request Not Cancelled)) passed"), iTestCount++);
|
|
264 |
|
|
265 |
CleanupStack::PopAndDestroy(); // getSmsList
|
|
266 |
|
|
267 |
// Get SMS list using asynchronous AO version
|
|
268 |
getSmsList=CTestGetSmsList::NewLC(smsStore,ETrue,DMMTSY_SMS_STORE_CDMAENTRY_TYPE, this);
|
|
269 |
getSmsList->Start();
|
|
270 |
CActiveScheduler::Start();
|
|
271 |
|
|
272 |
getSmsList->Start();
|
|
273 |
CActiveScheduler::Start();
|
|
274 |
|
|
275 |
// I only need to delete the retrieval object because the destructor
|
|
276 |
// of this will also delete the list object.
|
|
277 |
CleanupStack::PopAndDestroy(); // getSmsList
|
|
278 |
|
|
279 |
// Now test the cancelling
|
|
280 |
|
|
281 |
getSmsList=CTestGetSmsList::NewLC(smsStore,ETrue,DMMTSY_SMS_STORE_CDMAENTRY_TYPE, this);
|
|
282 |
getSmsList->Start();
|
|
283 |
|
|
284 |
cancelGetSmsList = getSmsList->RetrieveCancelPtr();
|
|
285 |
cancelGetSmsList->Call();
|
|
286 |
|
|
287 |
CActiveScheduler::Start();
|
|
288 |
cancelled = (getSmsList->iStatus == KErrCancel);
|
|
289 |
|
|
290 |
getSmsList->Start();
|
|
291 |
CActiveScheduler::Start();
|
|
292 |
|
|
293 |
if (cancelled)
|
|
294 |
INFO_PRINTF2(_L("Test %d - RMobileSmsStore::ReadBatch (sync & async & cancel (Cancelled Request)) passed"), iTestCount++);
|
|
295 |
else
|
|
296 |
INFO_PRINTF2(_L("Test %d - RMobileSmsStore::ReadBatch (sync & async & cancel (Request Not Cancelled)) passed"), iTestCount++);
|
|
297 |
|
|
298 |
CleanupStack::PopAndDestroy(); // getSmsList
|
|
299 |
|
|
300 |
// test.Next(_L("OK: RMobileSmsStore's Read All Entries"));
|
|
301 |
|
|
302 |
smsStore.Close();
|
|
303 |
smsMessaging.Close();
|
|
304 |
mmPhone.Close();
|
|
305 |
INFO_PRINTF1(_L(""));
|
|
306 |
|
|
307 |
return TestStepResult();
|
|
308 |
}
|
|
309 |
|
|
310 |
|
|
311 |
void CTestSmsStore::ValidateSmsStoreInfo(const RMobilePhoneStore::TMobilePhoneStoreInfoV1 &aSyncInfo)
|
|
312 |
{
|
|
313 |
TEST(aSyncInfo.iName.Compare(DMMTSY_MESSAGE_STORE_NAME)==0);
|
|
314 |
TEST(aSyncInfo.iType==DMMTSY_MESSAGE_STORE_TYPE);
|
|
315 |
TEST(aSyncInfo.iTotalEntries==DMMTSY_MESSAGE_STORE_TOTAL_ENTRIES);
|
|
316 |
TEST(aSyncInfo.iUsedEntries==DMMTSY_MESSAGE_STORE_USED_ENTRIES);
|
|
317 |
TEST(aSyncInfo.iCaps==DMMTSY_MESSAGE_STORE_CAPS);
|
|
318 |
TEST(aSyncInfo.ExtensionId()==RMobilePhoneStore::KETelMobilePhoneStoreV1);
|
|
319 |
}
|
|
320 |
|
|
321 |
void CTestSmsStore::ValidateSmsRead(const RMobileSmsStore::TMobileGsmSmsEntryV1 &aSyncEntry)
|
|
322 |
{
|
|
323 |
TEST(aSyncEntry.iIndex==DMMTSY_SMS_STORE_INDEX1);
|
|
324 |
TEST(aSyncEntry.iMsgData.Compare(DMMTSY_SMS_MESSAGE_PDU1)==0);
|
|
325 |
TEST(aSyncEntry.iServiceCentre.iTelNumber.Compare(DMMTSY_PHONE_TEL_NUMBER) == 0);
|
|
326 |
TEST(aSyncEntry.iServiceCentre.iTypeOfNumber == DMMTSY_PHONE_TON);
|
|
327 |
TEST(aSyncEntry.iServiceCentre.iNumberPlan == DMMTSY_PHONE_NPI);
|
|
328 |
TEST(aSyncEntry.iMsgStatus==DMMTSY_SMS_STORE_STATUS1);
|
|
329 |
}
|
|
330 |
|
|
331 |
|
|
332 |
/**************************************************************/
|
|
333 |
//
|
|
334 |
// Testing asynchronous retrieve of SMS list
|
|
335 |
//
|
|
336 |
/**************************************************************/
|
|
337 |
|
|
338 |
CTestSmsStore::CTestGetSmsList* CTestSmsStore::CTestGetSmsList::NewLC(RMobilePhoneStore& aStore, TBool aBatch,RMobileSmsStore::TMobileSmsEntryExtensionId aEntryType, CTestSmsStore* aTestSmsStore)
|
|
339 |
{
|
|
340 |
CTestGetSmsList* r=new(ELeave) CTestGetSmsList(aStore,aBatch,aEntryType,aTestSmsStore);
|
|
341 |
CleanupStack::PushL(r);
|
|
342 |
r->ConstructL();
|
|
343 |
return r;
|
|
344 |
}
|
|
345 |
|
|
346 |
CTestSmsStore::CTestGetSmsList::CTestGetSmsList(RMobilePhoneStore& aStore, TBool aBatch,RMobileSmsStore::TMobileSmsEntryExtensionId aEntryType, CTestSmsStore* aTestSmsStore)
|
|
347 |
: CActive(EPriorityNormal), iStore(aStore), iBatch(aBatch), iEntryType(aEntryType), iTestSmsStore(aTestSmsStore)
|
|
348 |
{}
|
|
349 |
|
|
350 |
|
|
351 |
void CTestSmsStore::CTestGetSmsList::ConstructL()
|
|
352 |
{
|
|
353 |
CActiveScheduler::Add(this);
|
|
354 |
iRetrieve=CRetrieveMobilePhoneSmsList::NewL(iStore,iEntryType);
|
|
355 |
iCanceller=new (ELeave) CTestCanceller(this);
|
|
356 |
}
|
|
357 |
|
|
358 |
CTestSmsStore::CTestGetSmsList::~CTestGetSmsList()
|
|
359 |
{
|
|
360 |
Cancel();
|
|
361 |
delete iRetrieve;
|
|
362 |
delete iCanceller;
|
|
363 |
}
|
|
364 |
|
|
365 |
void CTestSmsStore::CTestGetSmsList::Start()
|
|
366 |
{
|
|
367 |
if (!iBatch)
|
|
368 |
{
|
|
369 |
iRetrieve->Start(iStatus);
|
|
370 |
TRequestStatus tmpStatus;
|
|
371 |
iRetrieve->Start(tmpStatus);
|
|
372 |
User::WaitForRequest(tmpStatus);
|
|
373 |
iTestSmsStore->TEST(tmpStatus.Int() == KErrInUse);
|
|
374 |
}
|
|
375 |
else
|
|
376 |
{
|
|
377 |
iRetrieve->StartBatch(iStatus,DMMTSY_SMS_STORE_START,DMMTSY_SMS_STORE_BATCH);
|
|
378 |
TRequestStatus tmpStatus;
|
|
379 |
iRetrieve->StartBatch(tmpStatus,DMMTSY_SMS_STORE_START,DMMTSY_SMS_STORE_BATCH);
|
|
380 |
User::WaitForRequest(tmpStatus);
|
|
381 |
iTestSmsStore->TEST(tmpStatus.Int() == KErrInUse);
|
|
382 |
}
|
|
383 |
SetActive();
|
|
384 |
}
|
|
385 |
|
|
386 |
CTestCanceller* CTestSmsStore::CTestGetSmsList::RetrieveCancelPtr()
|
|
387 |
{
|
|
388 |
return iCanceller;
|
|
389 |
}
|
|
390 |
|
|
391 |
void CTestSmsStore::CTestGetSmsList::RunL()
|
|
392 |
{
|
|
393 |
TInt ret=iStatus.Int();
|
|
394 |
|
|
395 |
User::LeaveIfError(ret);
|
|
396 |
if (iEntryType==DMMTSY_SMS_STORE_CDMAENTRY_TYPE)
|
|
397 |
ret=CheckCdmaResults();
|
|
398 |
else
|
|
399 |
ret=CheckGsmResults();
|
|
400 |
User::LeaveIfError(ret);
|
|
401 |
|
|
402 |
CActiveScheduler::Stop();
|
|
403 |
}
|
|
404 |
|
|
405 |
|
|
406 |
void CTestSmsStore::CTestGetSmsList::DoCancel()
|
|
407 |
{
|
|
408 |
iRetrieve->Cancel();
|
|
409 |
}
|
|
410 |
|
|
411 |
TInt CTestSmsStore::CTestGetSmsList::CheckGsmResults()
|
|
412 |
{
|
|
413 |
TInt ret=KErrNone;
|
|
414 |
|
|
415 |
CMobilePhoneGsmSmsList* smsList=NULL;
|
|
416 |
TInt leaveCode=KErrNone;
|
|
417 |
TRAP(leaveCode, smsList=iRetrieve->RetrieveGsmListL(););
|
|
418 |
|
|
419 |
if (smsList)
|
|
420 |
{
|
|
421 |
iTestSmsStore->TEST(smsList->Enumerate()==DMMTSY_SMS_STORE_COUNT);
|
|
422 |
|
|
423 |
RMobileSmsStore::TMobileGsmSmsEntryV1 entry;
|
|
424 |
|
|
425 |
for (TInt i=0; i<DMMTSY_SMS_STORE_COUNT; ++i)
|
|
426 |
{
|
|
427 |
TRAP(ret,entry=smsList->GetEntryL(i));
|
|
428 |
if (ret != KErrNone)
|
|
429 |
break;
|
|
430 |
switch(i)
|
|
431 |
{
|
|
432 |
case 0:
|
|
433 |
{
|
|
434 |
iTestSmsStore->TEST(entry.iIndex==DMMTSY_SMS_STORE_INDEX1);
|
|
435 |
iTestSmsStore->TEST(entry.iMsgData.Compare(DMMTSY_SMS_MESSAGE_PDU1) == 0);
|
|
436 |
iTestSmsStore->TEST(entry.iServiceCentre.iTelNumber.Compare(DMMTSY_PHONE_TEL_NUMBER) == 0);
|
|
437 |
iTestSmsStore->TEST(entry.iServiceCentre.iTypeOfNumber == DMMTSY_PHONE_TON);
|
|
438 |
iTestSmsStore->TEST(entry.iServiceCentre.iNumberPlan == DMMTSY_PHONE_NPI);
|
|
439 |
iTestSmsStore->TEST(entry.iMsgStatus==DMMTSY_SMS_STORE_STATUS1);
|
|
440 |
break;
|
|
441 |
}
|
|
442 |
case 1:
|
|
443 |
{
|
|
444 |
iTestSmsStore->TEST(entry.iIndex==DMMTSY_SMS_STORE_INDEX2);
|
|
445 |
iTestSmsStore->TEST(entry.iMsgData.Compare(DMMTSY_SMS_MESSAGE_PDU2) == 0);
|
|
446 |
iTestSmsStore->TEST(entry.iServiceCentre.iTelNumber.Compare(DMMTSY_SMSP_STORE_SCA) == 0);
|
|
447 |
iTestSmsStore->TEST(entry.iServiceCentre.iTypeOfNumber == DMMTSY_PHONE_TON);
|
|
448 |
iTestSmsStore->TEST(entry.iServiceCentre.iNumberPlan == DMMTSY_PHONE_NPI);
|
|
449 |
iTestSmsStore->TEST(entry.iMsgStatus==DMMTSY_SMS_STORE_STATUS2);
|
|
450 |
break;
|
|
451 |
}
|
|
452 |
case 2:
|
|
453 |
{
|
|
454 |
iTestSmsStore->TEST(entry.iIndex==DMMTSY_SMS_STORE_INDEX3);
|
|
455 |
break;
|
|
456 |
}
|
|
457 |
case 3:
|
|
458 |
{
|
|
459 |
iTestSmsStore->TEST(entry.iIndex==DMMTSY_SMS_STORE_INDEX4);
|
|
460 |
break;
|
|
461 |
}
|
|
462 |
default:
|
|
463 |
break;
|
|
464 |
}
|
|
465 |
}
|
|
466 |
delete smsList;
|
|
467 |
}
|
|
468 |
|
|
469 |
return ret;
|
|
470 |
}
|
|
471 |
|
|
472 |
|
|
473 |
TInt CTestSmsStore::CTestGetSmsList::CheckCdmaResults()
|
|
474 |
{
|
|
475 |
TInt ret=KErrNone;
|
|
476 |
|
|
477 |
CMobilePhoneCdmaSmsList* smsList=NULL;
|
|
478 |
TInt leaveCode=KErrNone;
|
|
479 |
TRAP(leaveCode, smsList=iRetrieve->RetrieveCdmaListL(););
|
|
480 |
|
|
481 |
if (smsList)
|
|
482 |
{
|
|
483 |
iTestSmsStore->TEST(smsList->Enumerate()==DMMTSY_SMS_STORE_COUNT);
|
|
484 |
|
|
485 |
RMobileSmsStore::TMobileCdmaSmsEntryV1 entry;
|
|
486 |
|
|
487 |
for (TInt i=0; i<DMMTSY_SMS_STORE_COUNT; ++i)
|
|
488 |
{
|
|
489 |
TRAP(ret,entry=smsList->GetEntryL(i));
|
|
490 |
if (ret != KErrNone)
|
|
491 |
break;
|
|
492 |
switch(i)
|
|
493 |
{
|
|
494 |
case 0:
|
|
495 |
{
|
|
496 |
iTestSmsStore->TEST(entry.iIndex==DMMTSY_SMS_STORE_INDEX1);
|
|
497 |
iTestSmsStore->TEST(entry.iMsgData.Compare(DMMTSY_SMS_MESSAGE_PDU1) == 0);
|
|
498 |
iTestSmsStore->TEST(entry.iMsgStatus==DMMTSY_SMS_STORE_STATUS1);
|
|
499 |
iTestSmsStore->TEST(entry.iRemoteParty.iTelNumber==DMMTSY_SMS_MESSAGE_REMOTEPARTYNUMBER1);
|
|
500 |
iTestSmsStore->TEST(entry.iTeleservice==DMMTSY_SMS_MESSAGE_TELESERVICE);
|
|
501 |
break;
|
|
502 |
}
|
|
503 |
case 1:
|
|
504 |
{
|
|
505 |
iTestSmsStore->TEST(entry.iIndex==DMMTSY_SMS_STORE_INDEX2);
|
|
506 |
iTestSmsStore->TEST(entry.iMsgData.Compare(DMMTSY_SMS_MESSAGE_PDU2) == 0);
|
|
507 |
iTestSmsStore->TEST(entry.iMsgStatus==DMMTSY_SMS_STORE_STATUS2);
|
|
508 |
iTestSmsStore->TEST(entry.iRemoteParty.iTelNumber==DMMTSY_SMS_MESSAGE_REMOTEPARTYNUMBER1);
|
|
509 |
iTestSmsStore->TEST(entry.iTeleservice==DMMTSY_SMS_MESSAGE_TELESERVICE);
|
|
510 |
break;
|
|
511 |
}
|
|
512 |
case 2:
|
|
513 |
{
|
|
514 |
iTestSmsStore->TEST(entry.iIndex==DMMTSY_SMS_STORE_INDEX3);
|
|
515 |
iTestSmsStore->TEST(entry.iMsgData.Compare(DMMTSY_SMS_MESSAGE_PDU2) == 0);
|
|
516 |
iTestSmsStore->TEST(entry.iMsgStatus==DMMTSY_SMS_STORE_STATUS2);
|
|
517 |
iTestSmsStore->TEST(entry.iRemoteParty.iTelNumber==DMMTSY_SMS_MESSAGE_REMOTEPARTYNUMBER1);
|
|
518 |
iTestSmsStore->TEST(entry.iTeleservice==DMMTSY_SMS_MESSAGE_TELESERVICE);
|
|
519 |
break;
|
|
520 |
}
|
|
521 |
case 3:
|
|
522 |
{
|
|
523 |
iTestSmsStore->TEST(entry.iIndex==DMMTSY_SMS_STORE_INDEX4);
|
|
524 |
iTestSmsStore->TEST(entry.iMsgData.Compare(DMMTSY_SMS_MESSAGE_PDU2) == 0);
|
|
525 |
iTestSmsStore->TEST(entry.iMsgStatus==DMMTSY_SMS_STORE_STATUS2);
|
|
526 |
iTestSmsStore->TEST(entry.iRemoteParty.iTelNumber==DMMTSY_SMS_MESSAGE_REMOTEPARTYNUMBER1);
|
|
527 |
iTestSmsStore->TEST(entry.iTeleservice==DMMTSY_SMS_MESSAGE_TELESERVICE);
|
|
528 |
break;
|
|
529 |
}
|
|
530 |
default:
|
|
531 |
break;
|
|
532 |
}
|
|
533 |
}
|
|
534 |
delete smsList;
|
|
535 |
}
|
|
536 |
|
|
537 |
return ret;
|
|
538 |
}
|