24
|
1 |
// Copyright (c) 2008-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 |
//
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file The TEFUnit test suite for PhonebookOnControl in the Common TSY.
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include "cctsyphonebookonfu.h"
|
|
23 |
#include <etel.h>
|
|
24 |
#include <et_clsvr.h>
|
|
25 |
#include <ctsy/mmtsy_names.h>
|
|
26 |
#include <ctsy/serviceapi/mmtsy_ipcdefs.h>
|
|
27 |
#include <test/tmockltsydata.h>
|
|
28 |
#include <ctsy/serviceapi/gsmerror.h>
|
|
29 |
#include <ctsy/ltsy/mltsydispatchphonebookoninterface.h>
|
|
30 |
#include "mockltsyindicatorids.h"
|
|
31 |
#include "listretrieverao.h"
|
|
32 |
|
|
33 |
CTestSuite* CCTsyPhonebookOnFU::CreateSuiteL(const TDesC& aName)
|
|
34 |
{
|
|
35 |
SUB_SUITE;
|
|
36 |
|
|
37 |
//add use-case tests
|
|
38 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookOnFU, TestUseCase0001L);
|
|
39 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookOnFU, TestUseCase0002L);
|
|
40 |
|
|
41 |
//add other unit tests
|
|
42 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookOnFU, TestUnit0001L);
|
|
43 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookOnFU, TestUnit0002L);
|
|
44 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookOnFU, TestUnit0003L);
|
|
45 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookOnFU, TestUnit0004L);
|
|
46 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookOnFU, TestUnit0005L);
|
|
47 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookOnFU, TestUnit0006L);
|
|
48 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookOnFU, TestUnit0007L);
|
|
49 |
|
|
50 |
END_SUITE;
|
|
51 |
}
|
|
52 |
|
|
53 |
|
|
54 |
void CCTsyPhonebookOnFU::GenerateONList3L(CMobilePhoneONList* aONList)
|
|
55 |
/*
|
|
56 |
* Create a list of 3 ON entries
|
|
57 |
* @param aONList The list to be returned.
|
|
58 |
*
|
|
59 |
*/
|
|
60 |
{
|
|
61 |
RMobileONStore::TMobileONEntryV1 writeEntry;
|
|
62 |
|
|
63 |
writeEntry.iMode = RMobilePhone::ENetworkModeGsm;
|
|
64 |
writeEntry.iService = RMobilePhone::ETelephony;
|
|
65 |
writeEntry.iNumber.iTypeOfNumber = RMobilePhone::EAlphanumericNumber;
|
|
66 |
writeEntry.iNumber.iNumberPlan = RMobilePhone::EDataNumberPlan;
|
|
67 |
|
|
68 |
for (TInt i=0; i<3; i++)
|
|
69 |
{
|
|
70 |
writeEntry.iNumber.iTelNumber.Format(KText,i+1);
|
|
71 |
writeEntry.iText.Format(KNumber,i+1);
|
|
72 |
writeEntry.iIndex = i+1;
|
|
73 |
aONList->AddEntryL(writeEntry);
|
|
74 |
}
|
|
75 |
}
|
|
76 |
|
|
77 |
|
|
78 |
void CCTsyPhonebookOnFU::StoreAllL(RMobileONStore& aOnStore)
|
|
79 |
/*
|
|
80 |
* Store all entries into the ON Storage.
|
|
81 |
*
|
|
82 |
* @param aOnStore The ON storage where the entries will be stored.
|
|
83 |
*/
|
|
84 |
{
|
|
85 |
TRequestStatus reqStatus;
|
|
86 |
|
|
87 |
RBuf8 completeData;
|
|
88 |
CleanupClosePushL(completeData);
|
|
89 |
|
|
90 |
TRequestStatus notifyStatus;
|
|
91 |
TUint32 notifyEvent;
|
|
92 |
TInt notifyIndex;
|
|
93 |
|
|
94 |
RBuf8 expectEntryData;
|
|
95 |
CleanupClosePushL(expectEntryData);
|
|
96 |
|
|
97 |
CMobilePhoneONList* onList = CMobilePhoneONList::NewL();
|
|
98 |
CleanupStack::PushL(onList);
|
|
99 |
|
|
100 |
|
|
101 |
GenerateONList3L(onList);
|
|
102 |
TInt size = onList->Enumerate();
|
|
103 |
|
|
104 |
TMockLtsyData1<TInt> sizeLTsyData(size);
|
|
105 |
completeData.Close();
|
|
106 |
sizeLTsyData.SerialiseL(completeData);
|
|
107 |
|
|
108 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId);
|
|
109 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId, KErrNone);
|
|
110 |
|
|
111 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreGetStoreSize::KLtsyDispatchPhonebookOnStoreGetStoreSizeApiId);
|
|
112 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreGetStoreSize::KLtsyDispatchPhonebookOnStoreGetStoreSizeApiId, KErrNone, completeData);
|
|
113 |
|
|
114 |
RMobileONStore::TMobileONEntryV1 writeEntry[3];
|
|
115 |
for (TInt i=0; i<size; i++)
|
|
116 |
{
|
|
117 |
writeEntry[i]=onList->GetEntryL(i);
|
|
118 |
|
|
119 |
TMockLtsyData1<RMobileONStore::TMobileONEntryV1> entryLTsyData(writeEntry[i]);
|
|
120 |
expectEntryData.Close();
|
|
121 |
entryLTsyData.SerialiseL(expectEntryData);
|
|
122 |
|
|
123 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreWriteEntry::KLtsyDispatchPhonebookOnStoreWriteEntryApiId, expectEntryData);
|
|
124 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreWriteEntry::KLtsyDispatchPhonebookOnStoreWriteEntryApiId, KErrNone);
|
|
125 |
}
|
|
126 |
|
|
127 |
aOnStore.NotifyStoreEvent(notifyStatus, notifyEvent, notifyIndex);
|
|
128 |
|
|
129 |
aOnStore.StoreAllL(reqStatus, onList);
|
|
130 |
User::WaitForRequest(reqStatus);
|
|
131 |
ASSERT_EQUALS(reqStatus.Int(), KErrNone);
|
|
132 |
|
|
133 |
User::WaitForRequest(notifyStatus);
|
|
134 |
|
|
135 |
TUint32 tempEventStoreAll = RMobilePhoneStore::KStoreDoRefresh;
|
|
136 |
ASSERT_EQUALS(notifyEvent, tempEventStoreAll);
|
|
137 |
|
|
138 |
AssertMockLtsyStatusL();
|
|
139 |
|
|
140 |
CleanupStack::PopAndDestroy(3, &completeData); // onList, expectEntryData, completeData
|
|
141 |
}
|
|
142 |
|
|
143 |
void CCTsyPhonebookOnFU::ReadAllL(RMobileONStore& aOnStore)
|
|
144 |
/*
|
|
145 |
* Read all entries from the ON Storage.
|
|
146 |
*
|
|
147 |
* @param aAsyncRetrieveList
|
|
148 |
* @param aActiveRetriever
|
|
149 |
*/
|
|
150 |
{
|
|
151 |
TInt size = 3;
|
|
152 |
|
|
153 |
RBuf8 completeData;
|
|
154 |
CleanupClosePushL(completeData);
|
|
155 |
|
|
156 |
RBuf8 expectReadData;
|
|
157 |
CleanupClosePushL(expectReadData);
|
|
158 |
|
|
159 |
TMockLtsyData1<TInt> sizeReadAllLTsyData(size);
|
|
160 |
completeData.Close();
|
|
161 |
sizeReadAllLTsyData.SerialiseL(completeData);
|
|
162 |
|
|
163 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreGetReadStoreSize::KLtsyDispatchPhonebookOnStoreGetReadStoreSizeApiId);
|
|
164 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreGetReadStoreSize::KLtsyDispatchPhonebookOnStoreGetReadStoreSizeApiId, KErrNone, completeData);
|
|
165 |
|
|
166 |
TInt location[3];
|
|
167 |
TBuf<RMobileONStore::KOwnNumberTextSize> name[3];
|
|
168 |
TBuf<KPBStoreNumSize> telNumber[3];
|
|
169 |
|
|
170 |
for (TInt i=0; i<size; i++)
|
|
171 |
{
|
|
172 |
TInt index = i+1;
|
|
173 |
|
|
174 |
location[i] = index;
|
|
175 |
name[i].Format(KText,index);
|
|
176 |
telNumber[i].Format(KNumber,index);
|
|
177 |
|
|
178 |
TMockLtsyData1<TInt> locationLTsyData(location[i]);
|
|
179 |
expectReadData.Close();
|
|
180 |
locationLTsyData.SerialiseL(expectReadData);
|
|
181 |
|
|
182 |
TMockLtsyData3< TInt, TBuf<RMobileONStore::KOwnNumberTextSize>, TBuf<KPBStoreNumSize> > readLTsyDataComplete(location[i], name[i], telNumber[i]);
|
|
183 |
completeData.Close();
|
|
184 |
readLTsyDataComplete.SerialiseL(completeData);
|
|
185 |
|
|
186 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreReadEntry::KLtsyDispatchPhonebookOnStoreReadEntryApiId, expectReadData);
|
|
187 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreReadEntry::KLtsyDispatchPhonebookOnStoreReadEntryApiId, KErrNone, completeData);
|
|
188 |
}
|
|
189 |
|
|
190 |
CGetONListAO* getOnListAO = CGetONListAO::NewLC(aOnStore);
|
|
191 |
|
|
192 |
getOnListAO->TestRetrieveL();
|
|
193 |
ASSERT_EQUALS(KErrNone, getOnListAO->RetrieveLastError());
|
|
194 |
|
|
195 |
CMobilePhoneONList* list = getOnListAO->RetrieveListL();
|
|
196 |
|
|
197 |
for (TInt j=0; j< size; j++)
|
|
198 |
{
|
|
199 |
RMobileONStore::TMobileONEntryV1 readEntry=list->GetEntryL(j);
|
|
200 |
ASSERT_EQUALS(location[j], readEntry.iIndex);
|
|
201 |
ASSERT_EQUALS(name[j], readEntry.iText);
|
|
202 |
ASSERT_EQUALS(telNumber[j], readEntry.iNumber.iTelNumber);
|
|
203 |
}
|
|
204 |
|
|
205 |
AssertMockLtsyStatusL();
|
|
206 |
|
|
207 |
CActiveScheduler::Install(NULL);
|
|
208 |
|
|
209 |
CleanupStack::PopAndDestroy(3, &completeData); // getOnListAO, expectReadData, completeData
|
|
210 |
}
|
|
211 |
|
|
212 |
|
|
213 |
|
|
214 |
//
|
|
215 |
// Use-case tests
|
|
216 |
//
|
|
217 |
|
|
218 |
/**
|
|
219 |
@SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKON-UC0001
|
|
220 |
@SYMComponent telephony_ctsy
|
|
221 |
@SYMTestCaseDesc Test support in CTSY for RMobileONStore::GetInfo(), RMobileONStore::Write(), RMobileONStore::Read(), RMobileONStore::Delete()
|
|
222 |
@SYMTestPriority High
|
|
223 |
@SYMTestActions Invokes RMobileONStore::GetInfo(), RMobileONStore::Write(), RMobileONStore::Read(), RMobileONStore::Delete()
|
|
224 |
@SYMTestExpectedResults Pass
|
|
225 |
@SYMTestType CT
|
|
226 |
*/
|
|
227 |
void CCTsyPhonebookOnFU::TestUseCase0001L()
|
|
228 |
{
|
|
229 |
OpenEtelServerL(EUseExtendedError);
|
|
230 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
231 |
OpenPhoneL();
|
|
232 |
RMobilePhoneBookStore adnPhoneBookStore;
|
|
233 |
CleanupClosePushL(adnPhoneBookStore);
|
|
234 |
OpenCachingPhoneBookL(DispatcherPhonebook::EIccAdn,adnPhoneBookStore,KErrNone);
|
|
235 |
|
|
236 |
RMobileONStore onStore;
|
|
237 |
TInt ret = onStore.Open(iPhone);
|
|
238 |
ASSERT_EQUALS(ret, KErrNone);
|
|
239 |
CleanupClosePushL(onStore);
|
|
240 |
|
|
241 |
RBuf8 expectData;
|
|
242 |
CleanupClosePushL(expectData);
|
|
243 |
|
|
244 |
RBuf8 completeData;
|
|
245 |
CleanupClosePushL(completeData);
|
|
246 |
|
|
247 |
TRequestStatus reqStatus;
|
|
248 |
|
|
249 |
TRequestStatus notifyStatus;
|
|
250 |
TUint32 notifyEvent;
|
|
251 |
TInt notifyIndex;
|
|
252 |
|
|
253 |
//-------------------------------------------------------------------------
|
|
254 |
// TEST A: getinfo
|
|
255 |
//-------------------------------------------------------------------------
|
|
256 |
|
|
257 |
RMobileONStore::TMobileONStoreInfoV1 onStoreInfoV1;
|
|
258 |
TPckg<RMobileONStore::TMobileONStoreInfoV1> pckgInfoV1(onStoreInfoV1);
|
|
259 |
|
|
260 |
TInt numOfEntries = 0;
|
|
261 |
TInt usedEntries = 0;
|
|
262 |
TInt maxNameLen = 25;
|
|
263 |
TInt maxNumLen = 20;
|
|
264 |
|
|
265 |
TMockLtsyData4<TInt, TInt, TInt, TInt> onStoreInfoReturn(numOfEntries, usedEntries, maxNameLen, maxNumLen);
|
|
266 |
completeData.Close();
|
|
267 |
onStoreInfoReturn.SerialiseL(completeData);
|
|
268 |
|
|
269 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreGetInfo::KLtsyDispatchPhonebookOnStoreGetInfoApiId);
|
|
270 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreGetInfo::KLtsyDispatchPhonebookOnStoreGetInfoApiId, KErrNone, completeData);
|
|
271 |
|
|
272 |
onStore.GetInfo(reqStatus, pckgInfoV1);
|
|
273 |
User::WaitForRequest(reqStatus);
|
|
274 |
ASSERT_EQUALS(reqStatus.Int(), KErrNone);
|
|
275 |
ASSERT_EQUALS(onStoreInfoV1.iTotalEntries, numOfEntries);
|
|
276 |
ASSERT_EQUALS(onStoreInfoV1.iUsedEntries, usedEntries);
|
|
277 |
ASSERT_EQUALS(onStoreInfoV1.iTextLen, maxNameLen);
|
|
278 |
ASSERT_EQUALS(onStoreInfoV1.iNumberLen, maxNumLen);
|
|
279 |
|
|
280 |
AssertMockLtsyStatusL();
|
|
281 |
|
|
282 |
//-------------------------------------------------------------------------
|
|
283 |
// TEST B: write
|
|
284 |
//-------------------------------------------------------------------------
|
|
285 |
TInt location = 1;
|
|
286 |
|
|
287 |
RMobileONStore::TMobileONEntryV1 writeEntry1;
|
|
288 |
|
|
289 |
writeEntry1.iMode = RMobilePhone::ENetworkModeGsm;
|
|
290 |
writeEntry1.iService = RMobilePhone::ETelephony;
|
|
291 |
writeEntry1.iNumber.iTypeOfNumber = RMobilePhone::EAlphanumericNumber;
|
|
292 |
writeEntry1.iNumber.iNumberPlan = RMobilePhone::EDataNumberPlan;
|
|
293 |
writeEntry1.iNumber.iTelNumber.Copy(KNumber1);
|
|
294 |
writeEntry1.iText.Copy(KText1);
|
|
295 |
writeEntry1.iIndex = location;
|
|
296 |
|
|
297 |
TPckg<RMobileONStore::TMobileONEntryV1> pckgWriteEntry1(writeEntry1);
|
|
298 |
|
|
299 |
TMockLtsyData1<RMobileONStore::TMobileONEntryV1> writeLTsyData1(writeEntry1);
|
|
300 |
expectData.Close();
|
|
301 |
writeLTsyData1.SerialiseL(expectData);
|
|
302 |
|
|
303 |
TMockLtsyData1<TInt> writeLTsyDataComplete(location);
|
|
304 |
completeData.Close();
|
|
305 |
writeLTsyDataComplete.SerialiseL(completeData);
|
|
306 |
|
|
307 |
|
|
308 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreWrite::KLtsyDispatchPhonebookOnStoreWriteApiId, expectData);
|
|
309 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreWrite::KLtsyDispatchPhonebookOnStoreWriteApiId, KErrNone, completeData);
|
|
310 |
|
|
311 |
onStore.NotifyStoreEvent(notifyStatus, notifyEvent, notifyIndex);
|
|
312 |
|
|
313 |
onStore.Write(reqStatus, pckgWriteEntry1);
|
|
314 |
User::WaitForRequest(reqStatus);
|
|
315 |
ASSERT_EQUALS(reqStatus.Int(), KErrNone);
|
|
316 |
ASSERT_EQUALS(writeEntry1.iIndex, location);
|
|
317 |
|
|
318 |
User::WaitForRequest(notifyStatus);
|
|
319 |
TUint32 tempEventEntryAdded = RMobilePhoneStore::KStoreEntryAdded;
|
|
320 |
ASSERT_EQUALS(notifyEvent, tempEventEntryAdded);
|
|
321 |
ASSERT_EQUALS(notifyIndex, location);
|
|
322 |
|
|
323 |
AssertMockLtsyStatusL();
|
|
324 |
|
|
325 |
//-------------------------------------------------------------------------
|
|
326 |
// TEST C: read
|
|
327 |
//-------------------------------------------------------------------------
|
|
328 |
|
|
329 |
RMobileONStore::TMobileONEntryV1 readEntry;
|
|
330 |
readEntry.iIndex = location;
|
|
331 |
TPckg<RMobileONStore::TMobileONEntryV1> pckgReadEntry(readEntry);
|
|
332 |
|
|
333 |
TBuf<RMobileONStore::KOwnNumberTextSize> name;
|
|
334 |
name.Copy(KText1);
|
|
335 |
TBuf<KPBStoreNumSize> telNumber;
|
|
336 |
telNumber.Copy(KNumber1);
|
|
337 |
|
|
338 |
TMockLtsyData1<TInt> readLTsyData(location);
|
|
339 |
expectData.Close();
|
|
340 |
readLTsyData.SerialiseL(expectData);
|
|
341 |
|
|
342 |
TMockLtsyData3< TInt, TBuf<RMobileONStore::KOwnNumberTextSize>, TBuf<KPBStoreNumSize> > readLTsyDataComplete(location, name, telNumber);
|
|
343 |
completeData.Close();
|
|
344 |
readLTsyDataComplete.SerialiseL(completeData);
|
|
345 |
|
|
346 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreRead::KLtsyDispatchPhonebookOnStoreReadApiId, expectData);
|
|
347 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreRead::KLtsyDispatchPhonebookOnStoreReadApiId, KErrNone, completeData);
|
|
348 |
|
|
349 |
onStore.Read(reqStatus, pckgReadEntry);
|
|
350 |
User::WaitForRequest(reqStatus);
|
|
351 |
ASSERT_EQUALS(reqStatus.Int(), KErrNone);
|
|
352 |
ASSERT_EQUALS(location, readEntry.iIndex);
|
|
353 |
ASSERT_EQUALS(name, readEntry.iText);
|
|
354 |
ASSERT_EQUALS(telNumber, readEntry.iNumber.iTelNumber);
|
|
355 |
|
|
356 |
AssertMockLtsyStatusL();
|
|
357 |
|
|
358 |
//-------------------------------------------------------------------------
|
|
359 |
// TEST D: delete
|
|
360 |
//-------------------------------------------------------------------------
|
|
361 |
|
|
362 |
TMockLtsyData1<TInt> deleteLTsyData(location);
|
|
363 |
expectData.Close();
|
|
364 |
deleteLTsyData.SerialiseL(expectData);
|
|
365 |
|
|
366 |
|
|
367 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreDeleteEntry::KLtsyDispatchPhonebookOnStoreDeleteEntryApiId, expectData);
|
|
368 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreDeleteEntry::KLtsyDispatchPhonebookOnStoreDeleteEntryApiId, KErrNone);
|
|
369 |
|
|
370 |
onStore.NotifyStoreEvent(notifyStatus, notifyEvent, notifyIndex);
|
|
371 |
|
|
372 |
onStore.Delete(reqStatus, location);
|
|
373 |
User::WaitForRequest(reqStatus);
|
|
374 |
ASSERT_EQUALS(reqStatus.Int(), KErrNone);
|
|
375 |
|
|
376 |
User::WaitForRequest(notifyStatus);
|
|
377 |
|
|
378 |
TUint32 tempEventEntryDeleted = RMobilePhoneStore::KStoreEntryDeleted;
|
|
379 |
ASSERT_EQUALS(notifyEvent, tempEventEntryDeleted);
|
|
380 |
ASSERT_EQUALS(notifyIndex, location);
|
|
381 |
|
|
382 |
AssertMockLtsyStatusL();
|
|
383 |
|
|
384 |
CleanupStack::PopAndDestroy(5, this); // completeData, expectData, onStore, adnPhoneBookStore, this
|
|
385 |
}
|
|
386 |
|
|
387 |
/**
|
|
388 |
@SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKON-UC0002
|
|
389 |
@SYMComponent telephony_ctsy
|
|
390 |
@SYMTestCaseDesc Test support in CTSY for RMobileONStore::GetInfo(), RMobileONStore::StoreAll, CRetrieveMobilePhoneONList::Start(), RMobileONStore::DeleteAll()
|
|
391 |
@SYMTestPriority High
|
|
392 |
@SYMTestActions Invokes RMobileONStore::GetInfo(), RMobileONStore::StoreAll, CRetrieveMobilePhoneONList::Start(), RMobileONStore::DeleteAll()
|
|
393 |
@SYMTestExpectedResults Pass
|
|
394 |
@SYMTestType CT
|
|
395 |
*/
|
|
396 |
void CCTsyPhonebookOnFU::TestUseCase0002L()
|
|
397 |
{
|
|
398 |
OpenEtelServerL(EUseExtendedError);
|
|
399 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
400 |
OpenPhoneL();
|
|
401 |
RMobilePhoneBookStore adnPhoneBookStore;
|
|
402 |
CleanupClosePushL(adnPhoneBookStore);
|
|
403 |
OpenCachingPhoneBookL(DispatcherPhonebook::EIccAdn,adnPhoneBookStore,KErrNone);
|
|
404 |
|
|
405 |
RMobileONStore onStore;
|
|
406 |
TInt ret = onStore.Open(iPhone);
|
|
407 |
ASSERT_EQUALS(ret, KErrNone);
|
|
408 |
CleanupClosePushL(onStore);
|
|
409 |
|
|
410 |
RBuf8 completeData;
|
|
411 |
CleanupClosePushL(completeData);
|
|
412 |
|
|
413 |
TRequestStatus reqStatus;
|
|
414 |
|
|
415 |
TRequestStatus notifyStatus;
|
|
416 |
TUint32 notifyEvent;
|
|
417 |
TInt notifyIndex;
|
|
418 |
|
|
419 |
//-------------------------------------------------------------------------
|
|
420 |
// TEST A: getinfo
|
|
421 |
//-------------------------------------------------------------------------
|
|
422 |
|
|
423 |
RMobileONStore::TMobileONStoreInfoV1 onStoreInfoV1;
|
|
424 |
TPckg<RMobileONStore::TMobileONStoreInfoV1> pckgInfoV1(onStoreInfoV1);
|
|
425 |
|
|
426 |
TInt numOfEntries = 3;
|
|
427 |
TInt usedEntries = 3;
|
|
428 |
TInt nameLen = 25;
|
|
429 |
TInt numLen = 20;
|
|
430 |
|
|
431 |
TMockLtsyData4<TInt, TInt, TInt, TInt> onStoreInfoReturn(numOfEntries, usedEntries, nameLen, numLen);
|
|
432 |
completeData.Close();
|
|
433 |
onStoreInfoReturn.SerialiseL(completeData);
|
|
434 |
|
|
435 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreGetInfo::KLtsyDispatchPhonebookOnStoreGetInfoApiId);
|
|
436 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreGetInfo::KLtsyDispatchPhonebookOnStoreGetInfoApiId, KErrNone, completeData);
|
|
437 |
|
|
438 |
onStore.GetInfo(reqStatus, pckgInfoV1);
|
|
439 |
User::WaitForRequest(reqStatus);
|
|
440 |
ASSERT_EQUALS(reqStatus.Int(), KErrNone);
|
|
441 |
ASSERT_EQUALS(onStoreInfoV1.iTotalEntries, numOfEntries);
|
|
442 |
ASSERT_EQUALS(onStoreInfoV1.iUsedEntries, usedEntries);
|
|
443 |
ASSERT_EQUALS(onStoreInfoV1.iTextLen, nameLen);
|
|
444 |
ASSERT_EQUALS(onStoreInfoV1.iNumberLen, numLen);
|
|
445 |
|
|
446 |
AssertMockLtsyStatusL();
|
|
447 |
|
|
448 |
//-------------------------------------------------------------------------
|
|
449 |
// TEST B: storeall
|
|
450 |
//-------------------------------------------------------------------------
|
|
451 |
StoreAllL(onStore);
|
|
452 |
|
|
453 |
//-------------------------------------------------------------------------
|
|
454 |
// TEST C: readall
|
|
455 |
//-------------------------------------------------------------------------
|
|
456 |
|
|
457 |
ReadAllL(onStore);
|
|
458 |
|
|
459 |
//-------------------------------------------------------------------------
|
|
460 |
// TEST D: deleteall
|
|
461 |
//-------------------------------------------------------------------------
|
|
462 |
|
|
463 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId);
|
|
464 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId, KErrNone);
|
|
465 |
|
|
466 |
onStore.NotifyStoreEvent(notifyStatus, notifyEvent, notifyIndex);
|
|
467 |
|
|
468 |
onStore.DeleteAll(reqStatus);
|
|
469 |
User::WaitForRequest(reqStatus);
|
|
470 |
ASSERT_EQUALS(reqStatus.Int(), KErrNone);
|
|
471 |
|
|
472 |
User::WaitForRequest(notifyStatus);
|
|
473 |
|
|
474 |
TUint32 tempEventDeleteAll = RMobilePhoneStore::KStoreEmpty;
|
|
475 |
ASSERT_EQUALS(notifyEvent, tempEventDeleteAll);
|
|
476 |
|
|
477 |
AssertMockLtsyStatusL();
|
|
478 |
|
|
479 |
CleanupStack::PopAndDestroy(4, this); // completeData, onStore, adnPhoneBookStore, this
|
|
480 |
}
|
|
481 |
|
|
482 |
|
|
483 |
//
|
|
484 |
// Other unit tests
|
|
485 |
//
|
|
486 |
|
|
487 |
/**
|
|
488 |
@SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKON-UN0001
|
|
489 |
@SYMComponent telephony_ctsy
|
|
490 |
@SYMTestCaseDesc Test support in CTSY for RMobileONStore::GetInfo()
|
|
491 |
@SYMTestPriority High
|
|
492 |
@SYMTestActions Invokes RMobileONStore::GetInfo()
|
|
493 |
@SYMTestExpectedResults Pass
|
|
494 |
@SYMTestType UT
|
|
495 |
*/
|
|
496 |
void CCTsyPhonebookOnFU::TestUnit0001L()
|
|
497 |
{
|
|
498 |
OpenEtelServerL(EUseExtendedError);
|
|
499 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
500 |
OpenPhoneL();
|
|
501 |
RMobilePhoneBookStore adnPhoneBookStore;
|
|
502 |
CleanupClosePushL(adnPhoneBookStore);
|
|
503 |
OpenCachingPhoneBookL(DispatcherPhonebook::EIccAdn,adnPhoneBookStore,KErrNone);
|
|
504 |
|
|
505 |
RMobileONStore onStore;
|
|
506 |
TInt ret = onStore.Open(iPhone);
|
|
507 |
ASSERT_EQUALS(ret, KErrNone);
|
|
508 |
CleanupClosePushL(onStore);
|
|
509 |
|
|
510 |
RBuf8 data;
|
|
511 |
CleanupClosePushL(data);
|
|
512 |
|
|
513 |
TRequestStatus reqStatus;
|
|
514 |
|
|
515 |
RMobileONStore::TMobileONStoreInfoV1 onStoreInfoV1;
|
|
516 |
TPckg<RMobileONStore::TMobileONStoreInfoV1> pckgInfoV1(onStoreInfoV1);
|
|
517 |
|
|
518 |
TInt numOfEntries = 100;
|
|
519 |
TInt usedEntries = 10;
|
|
520 |
TInt maxNameLen = 25;
|
|
521 |
TInt maxNumLen = 20;
|
|
522 |
|
|
523 |
TMockLtsyData4<TInt, TInt, TInt, TInt> onStoreInfoReturn(numOfEntries, usedEntries, maxNameLen, maxNumLen);
|
|
524 |
data.Close();
|
|
525 |
onStoreInfoReturn.SerialiseL(data);
|
|
526 |
|
|
527 |
//-------------------------------------------------------------------------
|
|
528 |
// TEST A: failure to dispatch request to LTSY
|
|
529 |
//-------------------------------------------------------------------------
|
|
530 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreGetInfo::KLtsyDispatchPhonebookOnStoreGetInfoApiId, KErrNotSupported);
|
|
531 |
|
|
532 |
onStore.GetInfo(reqStatus, pckgInfoV1);
|
|
533 |
|
|
534 |
User::WaitForRequest(reqStatus);
|
|
535 |
ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
|
|
536 |
|
|
537 |
AssertMockLtsyStatusL();
|
|
538 |
|
|
539 |
//-------------------------------------------------------------------------
|
|
540 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
541 |
//-------------------------------------------------------------------------
|
|
542 |
|
|
543 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreGetInfo::KLtsyDispatchPhonebookOnStoreGetInfoApiId);
|
|
544 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreGetInfo::KLtsyDispatchPhonebookOnStoreGetInfoApiId, KErrGeneral, data);
|
|
545 |
|
|
546 |
onStore.GetInfo(reqStatus, pckgInfoV1);
|
|
547 |
|
|
548 |
User::WaitForRequest(reqStatus);
|
|
549 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
|
|
550 |
|
|
551 |
AssertMockLtsyStatusL();
|
|
552 |
|
|
553 |
//-------------------------------------------------------------------------
|
|
554 |
// TEST C: Successful completion request of
|
|
555 |
// RMobileONStore::GetInfo when result is not cached.
|
|
556 |
//-------------------------------------------------------------------------
|
|
557 |
|
|
558 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreGetInfo::KLtsyDispatchPhonebookOnStoreGetInfoApiId);
|
|
559 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreGetInfo::KLtsyDispatchPhonebookOnStoreGetInfoApiId, KErrNone, data);
|
|
560 |
|
|
561 |
onStore.GetInfo(reqStatus, pckgInfoV1);
|
|
562 |
User::WaitForRequest(reqStatus);
|
|
563 |
ASSERT_EQUALS(reqStatus.Int(), KErrNone);
|
|
564 |
ASSERT_EQUALS(onStoreInfoV1.iTotalEntries, numOfEntries);
|
|
565 |
ASSERT_EQUALS(onStoreInfoV1.iUsedEntries, usedEntries);
|
|
566 |
ASSERT_EQUALS(onStoreInfoV1.iTextLen, maxNameLen);
|
|
567 |
ASSERT_EQUALS(onStoreInfoV1.iNumberLen, maxNumLen);
|
|
568 |
|
|
569 |
AssertMockLtsyStatusL();
|
|
570 |
|
|
571 |
//-------------------------------------------------------------------------
|
|
572 |
// TEST D: Unsolicited completion of RMobileONStore::GetInfo
|
|
573 |
// from LTSY.
|
|
574 |
//-------------------------------------------------------------------------
|
|
575 |
|
|
576 |
TRequestStatus mockLtsyStatus;
|
|
577 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
578 |
|
|
579 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreGetInfo::KLtsyDispatchPhonebookOnStoreGetInfoApiId, KErrNone, data);
|
|
580 |
|
|
581 |
User::WaitForRequest(mockLtsyStatus);
|
|
582 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
583 |
AssertMockLtsyStatusL();
|
|
584 |
|
|
585 |
CleanupStack::PopAndDestroy(4, this); // data, onStore, adnPhoneBookStore, this
|
|
586 |
|
|
587 |
}
|
|
588 |
|
|
589 |
/**
|
|
590 |
@SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKON-UN0002
|
|
591 |
@SYMComponent telephony_ctsy
|
|
592 |
@SYMTestCaseDesc Test support in CTSY for RMobileONStore::Write()
|
|
593 |
@SYMTestPriority High
|
|
594 |
@SYMTestActions Invokes RMobileONStore::Write()
|
|
595 |
@SYMTestExpectedResults Pass
|
|
596 |
@SYMTestType UT
|
|
597 |
*/
|
|
598 |
void CCTsyPhonebookOnFU::TestUnit0002L()
|
|
599 |
{
|
|
600 |
OpenEtelServerL(EUseExtendedError);
|
|
601 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
602 |
OpenPhoneL();
|
|
603 |
|
|
604 |
RMobileONStore onStore;
|
|
605 |
TInt ret = onStore.Open(iPhone);
|
|
606 |
ASSERT_EQUALS(ret, KErrNone);
|
|
607 |
CleanupClosePushL(onStore);
|
|
608 |
|
|
609 |
RBuf8 expectData;
|
|
610 |
CleanupClosePushL(expectData);
|
|
611 |
|
|
612 |
RBuf8 completeData;
|
|
613 |
CleanupClosePushL(completeData);
|
|
614 |
|
|
615 |
TRequestStatus reqStatus;
|
|
616 |
|
|
617 |
TInt location = 10;
|
|
618 |
|
|
619 |
RMobileONStore::TMobileONEntryV1 writeEntry1;
|
|
620 |
|
|
621 |
writeEntry1.iMode = RMobilePhone::ENetworkModeGsm;
|
|
622 |
writeEntry1.iService = RMobilePhone::ETelephony;
|
|
623 |
writeEntry1.iNumber.iTypeOfNumber = RMobilePhone::EAlphanumericNumber;
|
|
624 |
writeEntry1.iNumber.iNumberPlan = RMobilePhone::EDataNumberPlan;
|
|
625 |
writeEntry1.iNumber.iTelNumber.Format(KNumber,111);
|
|
626 |
writeEntry1.iText.Format(KText,111);
|
|
627 |
writeEntry1.iIndex = location;
|
|
628 |
|
|
629 |
TPckg<RMobileONStore::TMobileONEntryV1> pckgWriteEntry1(writeEntry1);
|
|
630 |
|
|
631 |
TMockLtsyData1<RMobileONStore::TMobileONEntryV1> writeLTsyData1(writeEntry1);
|
|
632 |
expectData.Close();
|
|
633 |
writeLTsyData1.SerialiseL(expectData);
|
|
634 |
|
|
635 |
TMockLtsyData1<TInt> writeLTsyDataComplete(location);
|
|
636 |
completeData.Close();
|
|
637 |
writeLTsyDataComplete.SerialiseL(completeData);
|
|
638 |
|
|
639 |
//-------------------------------------------------------------------------
|
|
640 |
// TEST A: failure to dispatch request to LTSY
|
|
641 |
//-------------------------------------------------------------------------
|
|
642 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreWrite::KLtsyDispatchPhonebookOnStoreWriteApiId, expectData, KErrNotSupported);
|
|
643 |
|
|
644 |
onStore.Write(reqStatus, pckgWriteEntry1);
|
|
645 |
User::WaitForRequest(reqStatus);
|
|
646 |
ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
|
|
647 |
|
|
648 |
AssertMockLtsyStatusL();
|
|
649 |
|
|
650 |
//-------------------------------------------------------------------------
|
|
651 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
652 |
//-------------------------------------------------------------------------
|
|
653 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreWrite::KLtsyDispatchPhonebookOnStoreWriteApiId, expectData);
|
|
654 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreWrite::KLtsyDispatchPhonebookOnStoreWriteApiId, KErrGeneral, completeData);
|
|
655 |
|
|
656 |
onStore.Write(reqStatus, pckgWriteEntry1);
|
|
657 |
|
|
658 |
User::WaitForRequest(reqStatus);
|
|
659 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
|
|
660 |
|
|
661 |
AssertMockLtsyStatusL();
|
|
662 |
|
|
663 |
//-------------------------------------------------------------------------
|
|
664 |
// TEST C: Successful completion request of
|
|
665 |
// RMobileONStore::Write when result is not cached.
|
|
666 |
//-------------------------------------------------------------------------
|
|
667 |
|
|
668 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreWrite::KLtsyDispatchPhonebookOnStoreWriteApiId, expectData);
|
|
669 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreWrite::KLtsyDispatchPhonebookOnStoreWriteApiId, KErrNone, completeData);
|
|
670 |
|
|
671 |
onStore.Write(reqStatus, pckgWriteEntry1);
|
|
672 |
User::WaitForRequest(reqStatus);
|
|
673 |
ASSERT_EQUALS(reqStatus.Int(), KErrNone);
|
|
674 |
ASSERT_EQUALS(writeEntry1.iIndex, location);
|
|
675 |
|
|
676 |
AssertMockLtsyStatusL();
|
|
677 |
|
|
678 |
//-------------------------------------------------------------------------
|
|
679 |
// TEST D: Unsolicited completion of RMobileONStore::Write
|
|
680 |
// from LTSY.
|
|
681 |
//-------------------------------------------------------------------------
|
|
682 |
|
|
683 |
TRequestStatus mockLtsyStatus;
|
|
684 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
685 |
|
|
686 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreWrite::KLtsyDispatchPhonebookOnStoreWriteApiId, KErrNone, completeData);
|
|
687 |
|
|
688 |
User::WaitForRequest(mockLtsyStatus);
|
|
689 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
690 |
AssertMockLtsyStatusL();
|
|
691 |
|
|
692 |
//-------------------------------------------------------------------------
|
|
693 |
// TEST E: additional test with index = -1
|
|
694 |
//-------------------------------------------------------------------------
|
|
695 |
|
|
696 |
RMobileONStore::TMobileONEntryV1 writeEntry2;
|
|
697 |
TPckg<RMobileONStore::TMobileONEntryV1> pckgWriteEntry2(writeEntry2);
|
|
698 |
|
|
699 |
writeEntry2.iMode = RMobilePhone::ENetworkModeGsm;
|
|
700 |
writeEntry2.iService = RMobilePhone::ETelephony;
|
|
701 |
writeEntry2.iNumber.iTypeOfNumber = RMobilePhone::EAlphanumericNumber;
|
|
702 |
writeEntry2.iNumber.iNumberPlan = RMobilePhone::EDataNumberPlan;
|
|
703 |
writeEntry2.iNumber.iTelNumber.Format(KNumber,123);
|
|
704 |
writeEntry2.iText.Format(KText,123);
|
|
705 |
writeEntry2.iIndex = -1;
|
|
706 |
|
|
707 |
TMockLtsyData1<RMobileONStore::TMobileONEntryV1> writeLTsyData2(writeEntry2);
|
|
708 |
expectData.Close();
|
|
709 |
writeLTsyData2.SerialiseL(expectData);
|
|
710 |
|
|
711 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreWrite::KLtsyDispatchPhonebookOnStoreWriteApiId, expectData);
|
|
712 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreWrite::KLtsyDispatchPhonebookOnStoreWriteApiId, KErrNone, completeData);
|
|
713 |
|
|
714 |
onStore.Write(reqStatus, pckgWriteEntry2);
|
|
715 |
User::WaitForRequest(reqStatus);
|
|
716 |
ASSERT_EQUALS(reqStatus.Int(), KErrNone);
|
|
717 |
ASSERT_EQUALS(writeEntry2.iIndex, location);
|
|
718 |
|
|
719 |
AssertMockLtsyStatusL();
|
|
720 |
|
|
721 |
CleanupStack::PopAndDestroy(4, this); // completeData, expectData, onStore, this
|
|
722 |
|
|
723 |
}
|
|
724 |
|
|
725 |
/**
|
|
726 |
@SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKON-UN0003
|
|
727 |
@SYMComponent telephony_ctsy
|
|
728 |
@SYMTestCaseDesc Test support in CTSY for RMobileONStore::Read()
|
|
729 |
@SYMTestPriority High
|
|
730 |
@SYMTestActions Invokes RMobileONStore::Read()
|
|
731 |
@SYMTestExpectedResults Pass
|
|
732 |
@SYMTestType UT
|
|
733 |
*/
|
|
734 |
void CCTsyPhonebookOnFU::TestUnit0003L()
|
|
735 |
{
|
|
736 |
OpenEtelServerL(EUseExtendedError);
|
|
737 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
738 |
OpenPhoneL();
|
|
739 |
|
|
740 |
RMobileONStore onStore;
|
|
741 |
TInt ret = onStore.Open(iPhone);
|
|
742 |
ASSERT_EQUALS(ret, KErrNone);
|
|
743 |
CleanupClosePushL(onStore);
|
|
744 |
|
|
745 |
RBuf8 expectData;
|
|
746 |
CleanupClosePushL(expectData);
|
|
747 |
|
|
748 |
RBuf8 completeData;
|
|
749 |
CleanupClosePushL(completeData);
|
|
750 |
|
|
751 |
TRequestStatus reqStatus;
|
|
752 |
|
|
753 |
TInt location = 10;
|
|
754 |
|
|
755 |
RMobileONStore::TMobileONEntryV1 readEntry;
|
|
756 |
readEntry.iIndex = location;
|
|
757 |
TPckg<RMobileONStore::TMobileONEntryV1> pckgReadEntry(readEntry);
|
|
758 |
|
|
759 |
_LIT(KName, "My number");
|
|
760 |
_LIT(KTelNumber, "1234567");
|
|
761 |
|
|
762 |
TBuf<RMobileONStore::KOwnNumberTextSize> name;
|
|
763 |
name.Copy(KName);
|
|
764 |
TBuf<KPBStoreNumSize> telNumber;
|
|
765 |
telNumber.Copy(KTelNumber);
|
|
766 |
|
|
767 |
|
|
768 |
TMockLtsyData1<TInt> readLTsyData(location);
|
|
769 |
expectData.Close();
|
|
770 |
readLTsyData.SerialiseL(expectData);
|
|
771 |
|
|
772 |
TMockLtsyData3< TInt, TBuf<RMobileONStore::KOwnNumberTextSize>, TBuf<KPBStoreNumSize> > readLTsyDataComplete(location, name, telNumber);
|
|
773 |
completeData.Close();
|
|
774 |
readLTsyDataComplete.SerialiseL(completeData);
|
|
775 |
|
|
776 |
//-------------------------------------------------------------------------
|
|
777 |
// TEST A: failure to dispatch request to LTSY
|
|
778 |
//-------------------------------------------------------------------------
|
|
779 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreRead::KLtsyDispatchPhonebookOnStoreReadApiId, expectData, KErrNotSupported);
|
|
780 |
|
|
781 |
onStore.Read(reqStatus, pckgReadEntry);
|
|
782 |
User::WaitForRequest(reqStatus);
|
|
783 |
ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
|
|
784 |
|
|
785 |
AssertMockLtsyStatusL();
|
|
786 |
|
|
787 |
//-------------------------------------------------------------------------
|
|
788 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
789 |
//-------------------------------------------------------------------------
|
|
790 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreRead::KLtsyDispatchPhonebookOnStoreReadApiId, expectData);
|
|
791 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreRead::KLtsyDispatchPhonebookOnStoreReadApiId, KErrGeneral, completeData);
|
|
792 |
|
|
793 |
onStore.Read(reqStatus, pckgReadEntry);
|
|
794 |
|
|
795 |
User::WaitForRequest(reqStatus);
|
|
796 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
|
|
797 |
|
|
798 |
AssertMockLtsyStatusL();
|
|
799 |
|
|
800 |
//-------------------------------------------------------------------------
|
|
801 |
// TEST C: Successful completion request of
|
|
802 |
// RMobileONStore::Read when result is not cached.
|
|
803 |
//-------------------------------------------------------------------------
|
|
804 |
|
|
805 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreRead::KLtsyDispatchPhonebookOnStoreReadApiId, expectData);
|
|
806 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreRead::KLtsyDispatchPhonebookOnStoreReadApiId, KErrNone, completeData);
|
|
807 |
|
|
808 |
onStore.Read(reqStatus, pckgReadEntry);
|
|
809 |
User::WaitForRequest(reqStatus);
|
|
810 |
ASSERT_EQUALS(reqStatus.Int(), KErrNone);
|
|
811 |
ASSERT_EQUALS(location, readEntry.iIndex);
|
|
812 |
ASSERT_EQUALS(name, readEntry.iText);
|
|
813 |
ASSERT_EQUALS(telNumber, readEntry.iNumber.iTelNumber);
|
|
814 |
|
|
815 |
AssertMockLtsyStatusL();
|
|
816 |
|
|
817 |
//-------------------------------------------------------------------------
|
|
818 |
// TEST D: Unsolicited completion of RMobileONStore::Read
|
|
819 |
// from LTSY.
|
|
820 |
//-------------------------------------------------------------------------
|
|
821 |
|
|
822 |
TRequestStatus mockLtsyStatus;
|
|
823 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
824 |
|
|
825 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreRead::KLtsyDispatchPhonebookOnStoreReadApiId, KErrNone, completeData);
|
|
826 |
|
|
827 |
User::WaitForRequest(mockLtsyStatus);
|
|
828 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
829 |
AssertMockLtsyStatusL();
|
|
830 |
|
|
831 |
CleanupStack::PopAndDestroy(4, this); // completeData, expectData, onStore, this
|
|
832 |
|
|
833 |
}
|
|
834 |
|
|
835 |
/**
|
|
836 |
@SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKON-UN0004
|
|
837 |
@SYMComponent telephony_ctsy
|
|
838 |
@SYMTestCaseDesc Test support in CTSY for RMobileONStore::Delete()
|
|
839 |
@SYMTestPriority High
|
|
840 |
@SYMTestActions Invokes RMobileONStore::Delete()
|
|
841 |
@SYMTestExpectedResults Pass
|
|
842 |
@SYMTestType UT
|
|
843 |
*/
|
|
844 |
void CCTsyPhonebookOnFU::TestUnit0004L()
|
|
845 |
{
|
|
846 |
OpenEtelServerL(EUseExtendedError);
|
|
847 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
848 |
OpenPhoneL();
|
|
849 |
|
|
850 |
RMobileONStore onStore;
|
|
851 |
TInt ret = onStore.Open(iPhone);
|
|
852 |
ASSERT_EQUALS(ret, KErrNone);
|
|
853 |
CleanupClosePushL(onStore);
|
|
854 |
|
|
855 |
RBuf8 expectData;
|
|
856 |
CleanupClosePushL(expectData);
|
|
857 |
|
|
858 |
TRequestStatus reqStatus;
|
|
859 |
|
|
860 |
TInt index = 10;
|
|
861 |
TMockLtsyData1<TInt> deleteLTsyData(index);
|
|
862 |
expectData.Close();
|
|
863 |
deleteLTsyData.SerialiseL(expectData);
|
|
864 |
|
|
865 |
//-------------------------------------------------------------------------
|
|
866 |
// TEST A: failure to dispatch request to LTSY
|
|
867 |
//-------------------------------------------------------------------------
|
|
868 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreDeleteEntry::KLtsyDispatchPhonebookOnStoreDeleteEntryApiId, expectData, KErrNotSupported);
|
|
869 |
|
|
870 |
onStore.Delete(reqStatus, index);
|
|
871 |
User::WaitForRequest(reqStatus);
|
|
872 |
ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
|
|
873 |
|
|
874 |
AssertMockLtsyStatusL();
|
|
875 |
|
|
876 |
//-------------------------------------------------------------------------
|
|
877 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
878 |
//-------------------------------------------------------------------------
|
|
879 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreDeleteEntry::KLtsyDispatchPhonebookOnStoreDeleteEntryApiId, expectData);
|
|
880 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreDeleteEntry::KLtsyDispatchPhonebookOnStoreDeleteEntryApiId, KErrGeneral);
|
|
881 |
|
|
882 |
onStore.Delete(reqStatus, index);
|
|
883 |
User::WaitForRequest(reqStatus);
|
|
884 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
|
|
885 |
|
|
886 |
AssertMockLtsyStatusL();
|
|
887 |
|
|
888 |
//-------------------------------------------------------------------------
|
|
889 |
// TEST C: Successful completion request of
|
|
890 |
// RMobileONStore::Delete when result is not cached.
|
|
891 |
//-------------------------------------------------------------------------
|
|
892 |
|
|
893 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreDeleteEntry::KLtsyDispatchPhonebookOnStoreDeleteEntryApiId, expectData);
|
|
894 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreDeleteEntry::KLtsyDispatchPhonebookOnStoreDeleteEntryApiId, KErrNone);
|
|
895 |
|
|
896 |
onStore.Delete(reqStatus, index);
|
|
897 |
User::WaitForRequest(reqStatus);
|
|
898 |
ASSERT_EQUALS(reqStatus.Int(), KErrNone);
|
|
899 |
AssertMockLtsyStatusL();
|
|
900 |
|
|
901 |
//-------------------------------------------------------------------------
|
|
902 |
// TEST D: Unsolicited completion of RMobileONStore::Delete
|
|
903 |
// from LTSY.
|
|
904 |
//-------------------------------------------------------------------------
|
|
905 |
|
|
906 |
TRequestStatus mockLtsyStatus;
|
|
907 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
908 |
|
|
909 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreDeleteEntry::KLtsyDispatchPhonebookOnStoreDeleteEntryApiId, KErrNone);
|
|
910 |
|
|
911 |
User::WaitForRequest(mockLtsyStatus);
|
|
912 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
913 |
AssertMockLtsyStatusL();
|
|
914 |
|
|
915 |
CleanupStack::PopAndDestroy(3, this); // expectData, onStore, this
|
|
916 |
|
|
917 |
}
|
|
918 |
|
|
919 |
/**
|
|
920 |
@SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKON-UN0005
|
|
921 |
@SYMComponent telephony_ctsy
|
|
922 |
@SYMTestCaseDesc Test support in CTSY for RMobileONStore::StoreAllL()
|
|
923 |
@SYMTestPriority High
|
|
924 |
@SYMTestActions Invokes RMobileONStore::StoreAllL()
|
|
925 |
@SYMTestExpectedResults Pass
|
|
926 |
@SYMTestType UT
|
|
927 |
*/
|
|
928 |
void CCTsyPhonebookOnFU::TestUnit0005L()
|
|
929 |
{
|
|
930 |
OpenEtelServerL(EUseExtendedError);
|
|
931 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
932 |
OpenPhoneL();
|
|
933 |
|
|
934 |
RMobileONStore onStore;
|
|
935 |
TInt ret = onStore.Open(iPhone);
|
|
936 |
ASSERT_EQUALS(ret, KErrNone);
|
|
937 |
CleanupClosePushL(onStore);
|
|
938 |
|
|
939 |
RBuf8 expectEntryData1;
|
|
940 |
CleanupClosePushL(expectEntryData1);
|
|
941 |
|
|
942 |
RBuf8 completeData;
|
|
943 |
CleanupClosePushL(completeData);
|
|
944 |
|
|
945 |
TRequestStatus reqStatus;
|
|
946 |
|
|
947 |
CMobilePhoneONList* onList = CMobilePhoneONList::NewL();
|
|
948 |
CleanupStack::PushL(onList);
|
|
949 |
|
|
950 |
GenerateONList3L(onList);
|
|
951 |
TInt size=onList->Enumerate();
|
|
952 |
RMobileONStore::TMobileONEntryV1 entry = onList->GetEntryL(0);
|
|
953 |
|
|
954 |
TMockLtsyData1<RMobileONStore::TMobileONEntryV1> entryLTsyData1(entry);
|
|
955 |
expectEntryData1.Close();
|
|
956 |
entryLTsyData1.SerialiseL(expectEntryData1);
|
|
957 |
|
|
958 |
TMockLtsyData1<TInt> sizeLTsyData(size);
|
|
959 |
completeData.Close();
|
|
960 |
sizeLTsyData.SerialiseL(completeData);
|
|
961 |
|
|
962 |
//-------------------------------------------------------------------------
|
|
963 |
// TEST A: failure to dispatch request to LTSY
|
|
964 |
//-------------------------------------------------------------------------
|
|
965 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId);
|
|
966 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId, KErrNone);
|
|
967 |
|
|
968 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreGetStoreSize::KLtsyDispatchPhonebookOnStoreGetStoreSizeApiId, KErrNotSupported);
|
|
969 |
|
|
970 |
onStore.StoreAllL(reqStatus, onList);
|
|
971 |
User::WaitForRequest(reqStatus);
|
|
972 |
ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
|
|
973 |
|
|
974 |
//second step test
|
|
975 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId);
|
|
976 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId, KErrNone);
|
|
977 |
|
|
978 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreGetStoreSize::KLtsyDispatchPhonebookOnStoreGetStoreSizeApiId);
|
|
979 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreGetStoreSize::KLtsyDispatchPhonebookOnStoreGetStoreSizeApiId, KErrNone, completeData);
|
|
980 |
|
|
981 |
//write1
|
|
982 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreWriteEntry::KLtsyDispatchPhonebookOnStoreWriteEntryApiId, expectEntryData1, KErrNotSupported);
|
|
983 |
|
|
984 |
onStore.StoreAllL(reqStatus, onList);
|
|
985 |
User::WaitForRequest(reqStatus);
|
|
986 |
ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
|
|
987 |
|
|
988 |
AssertMockLtsyStatusL();
|
|
989 |
|
|
990 |
//-------------------------------------------------------------------------
|
|
991 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
992 |
//-------------------------------------------------------------------------
|
|
993 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId);
|
|
994 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId, KErrNone);
|
|
995 |
|
|
996 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreGetStoreSize::KLtsyDispatchPhonebookOnStoreGetStoreSizeApiId);
|
|
997 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreGetStoreSize::KLtsyDispatchPhonebookOnStoreGetStoreSizeApiId, KErrGeneral, completeData);
|
|
998 |
|
|
999 |
onStore.StoreAllL(reqStatus, onList);
|
|
1000 |
|
|
1001 |
User::WaitForRequest(reqStatus);
|
|
1002 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
|
|
1003 |
|
|
1004 |
//second step test
|
|
1005 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId);
|
|
1006 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId, KErrNone);
|
|
1007 |
|
|
1008 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreGetStoreSize::KLtsyDispatchPhonebookOnStoreGetStoreSizeApiId);
|
|
1009 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreGetStoreSize::KLtsyDispatchPhonebookOnStoreGetStoreSizeApiId, KErrNone, completeData);
|
|
1010 |
|
|
1011 |
//write1
|
|
1012 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreWriteEntry::KLtsyDispatchPhonebookOnStoreWriteEntryApiId, expectEntryData1);
|
|
1013 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreWriteEntry::KLtsyDispatchPhonebookOnStoreWriteEntryApiId, KErrGeneral);
|
|
1014 |
|
|
1015 |
onStore.StoreAllL(reqStatus, onList);
|
|
1016 |
|
|
1017 |
User::WaitForRequest(reqStatus);
|
|
1018 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
|
|
1019 |
|
|
1020 |
AssertMockLtsyStatusL();
|
|
1021 |
|
|
1022 |
//-------------------------------------------------------------------------
|
|
1023 |
// TEST C: Successful completion request of
|
|
1024 |
// RMobileONStore::StoreAllL when result is not cached.
|
|
1025 |
//-------------------------------------------------------------------------
|
|
1026 |
|
|
1027 |
StoreAllL(onStore);
|
|
1028 |
|
|
1029 |
//-------------------------------------------------------------------------
|
|
1030 |
// TEST D: Unsolicited completion of RMobileONStore::StoreAllL
|
|
1031 |
// from LTSY.
|
|
1032 |
//-------------------------------------------------------------------------
|
|
1033 |
|
|
1034 |
TRequestStatus mockLtsyStatus;
|
|
1035 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
1036 |
|
|
1037 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreGetStoreSize::KLtsyDispatchPhonebookOnStoreGetStoreSizeApiId, KErrNone, completeData);
|
|
1038 |
|
|
1039 |
User::WaitForRequest(mockLtsyStatus);
|
|
1040 |
|
|
1041 |
//second step test
|
|
1042 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
1043 |
|
|
1044 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreWriteEntry::KLtsyDispatchPhonebookOnStoreWriteEntryApiId, KErrNone);
|
|
1045 |
|
|
1046 |
User::WaitForRequest(mockLtsyStatus);
|
|
1047 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
1048 |
AssertMockLtsyStatusL();
|
|
1049 |
|
|
1050 |
CleanupStack::PopAndDestroy(5, this); // onList, completeData, expectEntryData1, onStore, this
|
|
1051 |
|
|
1052 |
}
|
|
1053 |
|
|
1054 |
/**
|
|
1055 |
@SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKON-UN0006
|
|
1056 |
@SYMComponent telephony_ctsy
|
|
1057 |
@SYMTestCaseDesc Test support in CTSY for RMobileONStore::DeleteAll()
|
|
1058 |
@SYMTestPriority High
|
|
1059 |
@SYMTestActions Invokes RMobileONStore::DeleteAll()
|
|
1060 |
@SYMTestExpectedResults Pass
|
|
1061 |
@SYMTestType UT
|
|
1062 |
*/
|
|
1063 |
void CCTsyPhonebookOnFU::TestUnit0006L()
|
|
1064 |
{
|
|
1065 |
OpenEtelServerL(EUseExtendedError);
|
|
1066 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
1067 |
OpenPhoneL();
|
|
1068 |
|
|
1069 |
RMobileONStore onStore;
|
|
1070 |
TInt ret = onStore.Open(iPhone);
|
|
1071 |
ASSERT_EQUALS(ret, KErrNone);
|
|
1072 |
CleanupClosePushL(onStore);
|
|
1073 |
|
|
1074 |
TRequestStatus reqStatus;
|
|
1075 |
|
|
1076 |
//-------------------------------------------------------------------------
|
|
1077 |
// TEST A: failure to dispatch request to LTSY
|
|
1078 |
//-------------------------------------------------------------------------
|
|
1079 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId, KErrNotSupported);
|
|
1080 |
|
|
1081 |
onStore.DeleteAll(reqStatus);
|
|
1082 |
|
|
1083 |
User::WaitForRequest(reqStatus);
|
|
1084 |
ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
|
|
1085 |
|
|
1086 |
AssertMockLtsyStatusL();
|
|
1087 |
|
|
1088 |
//-------------------------------------------------------------------------
|
|
1089 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
1090 |
//-------------------------------------------------------------------------
|
|
1091 |
|
|
1092 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId);
|
|
1093 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId, KErrGeneral);
|
|
1094 |
|
|
1095 |
onStore.DeleteAll(reqStatus);
|
|
1096 |
|
|
1097 |
User::WaitForRequest(reqStatus);
|
|
1098 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
|
|
1099 |
|
|
1100 |
AssertMockLtsyStatusL();
|
|
1101 |
|
|
1102 |
//-------------------------------------------------------------------------
|
|
1103 |
// TEST C: Successful completion request of
|
|
1104 |
// RMobileONStore::DeleteAll when result is not cached.
|
|
1105 |
//-------------------------------------------------------------------------
|
|
1106 |
|
|
1107 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId);
|
|
1108 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId, KErrNone);
|
|
1109 |
|
|
1110 |
onStore.DeleteAll(reqStatus);
|
|
1111 |
|
|
1112 |
User::WaitForRequest(reqStatus);
|
|
1113 |
ASSERT_EQUALS(reqStatus.Int(), KErrNone);
|
|
1114 |
|
|
1115 |
AssertMockLtsyStatusL();
|
|
1116 |
|
|
1117 |
//-------------------------------------------------------------------------
|
|
1118 |
// TEST D: Unsolicited completion of RMobileONStore::DeleteAll
|
|
1119 |
// from LTSY.
|
|
1120 |
//-------------------------------------------------------------------------
|
|
1121 |
|
|
1122 |
TRequestStatus mockLtsyStatus;
|
|
1123 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
1124 |
|
|
1125 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId, KErrNone);
|
|
1126 |
|
|
1127 |
User::WaitForRequest(mockLtsyStatus);
|
|
1128 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
1129 |
AssertMockLtsyStatusL();
|
|
1130 |
|
|
1131 |
CleanupStack::PopAndDestroy(2, this); // onStore, this
|
|
1132 |
|
|
1133 |
}
|
|
1134 |
|
|
1135 |
/**
|
|
1136 |
@SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKON-UN0007
|
|
1137 |
@SYMComponent telephony_ctsy
|
|
1138 |
@SYMTestCaseDesc Test support in CTSY for CRetrieveMobilePhoneONList::Start()
|
|
1139 |
@SYMTestPriority High
|
|
1140 |
@SYMTestActions Invokes CRetrieveMobilePhoneONList::Start()
|
|
1141 |
@SYMTestExpectedResults Pass
|
|
1142 |
@SYMTestType UT
|
|
1143 |
*/
|
|
1144 |
void CCTsyPhonebookOnFU::TestUnit0007L()
|
|
1145 |
{
|
|
1146 |
|
|
1147 |
OpenEtelServerL(EUseExtendedError);
|
|
1148 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
1149 |
OpenPhoneL();
|
|
1150 |
|
|
1151 |
RMobileONStore onStore;
|
|
1152 |
TInt err = onStore.Open(iPhone);
|
|
1153 |
ASSERT_EQUALS(KErrNone, err);
|
|
1154 |
CleanupClosePushL(onStore);
|
|
1155 |
|
|
1156 |
RBuf8 expectData;
|
|
1157 |
CleanupClosePushL(expectData);
|
|
1158 |
|
|
1159 |
RBuf8 completeData;
|
|
1160 |
CleanupClosePushL(completeData);
|
|
1161 |
|
|
1162 |
RBuf8 completeEntryData1;
|
|
1163 |
CleanupClosePushL(completeEntryData1);
|
|
1164 |
|
|
1165 |
TInt size = 3;
|
|
1166 |
TMockLtsyData1<TInt> sizeLTsyData(size);
|
|
1167 |
completeData.Close();
|
|
1168 |
sizeLTsyData.SerialiseL(completeData);
|
|
1169 |
|
|
1170 |
TInt location;
|
|
1171 |
TBuf<RMobileONStore::KOwnNumberTextSize> name;
|
|
1172 |
TBuf<KPBStoreNumSize> telNumber;
|
|
1173 |
|
|
1174 |
location = 1;
|
|
1175 |
name.Copy(KText1);
|
|
1176 |
telNumber.Copy(KNumber1);
|
|
1177 |
|
|
1178 |
TMockLtsyData1<TInt> locationLTsyData1(location);
|
|
1179 |
expectData.Close();
|
|
1180 |
locationLTsyData1.SerialiseL(expectData);
|
|
1181 |
|
|
1182 |
TMockLtsyData3< TInt, TBuf<RMobileONStore::KOwnNumberTextSize>, TBuf<KPBStoreNumSize> > readLTsyDataComplete1(location, name, telNumber);
|
|
1183 |
completeEntryData1.Close();
|
|
1184 |
readLTsyDataComplete1.SerialiseL(completeEntryData1);
|
|
1185 |
|
|
1186 |
CGetONListAO* getOnListAO = CGetONListAO::NewLC(onStore);
|
|
1187 |
|
|
1188 |
//-------------------------------------------------------------------------
|
|
1189 |
// TEST A: failure to dispatch request to LTSY
|
|
1190 |
//-------------------------------------------------------------------------
|
|
1191 |
|
|
1192 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreGetReadStoreSize::KLtsyDispatchPhonebookOnStoreGetReadStoreSizeApiId, KErrNotSupported);
|
|
1193 |
|
|
1194 |
getOnListAO->TestRetrieveL();
|
|
1195 |
ASSERT_EQUALS(KErrNotSupported, getOnListAO->RetrieveLastError());
|
|
1196 |
|
|
1197 |
|
|
1198 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreGetReadStoreSize::KLtsyDispatchPhonebookOnStoreGetReadStoreSizeApiId);
|
|
1199 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreGetReadStoreSize::KLtsyDispatchPhonebookOnStoreGetReadStoreSizeApiId, KErrNone, completeData);
|
|
1200 |
|
|
1201 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreReadEntry::KLtsyDispatchPhonebookOnStoreReadEntryApiId, expectData, KErrNotSupported);
|
|
1202 |
|
|
1203 |
getOnListAO->TestRetrieveL();
|
|
1204 |
ASSERT_EQUALS(KErrNotSupported, getOnListAO->RetrieveLastError());
|
|
1205 |
|
|
1206 |
//-------------------------------------------------------------------------
|
|
1207 |
// TEST B2: failure on completion of pending request from LTSY->CTSY
|
|
1208 |
//-------------------------------------------------------------------------
|
|
1209 |
|
|
1210 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreGetReadStoreSize::KLtsyDispatchPhonebookOnStoreGetReadStoreSizeApiId);
|
|
1211 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreGetReadStoreSize::KLtsyDispatchPhonebookOnStoreGetReadStoreSizeApiId, KErrGeneral, completeData);
|
|
1212 |
|
|
1213 |
getOnListAO->TestRetrieveL();
|
|
1214 |
ASSERT_EQUALS(KErrGeneral, getOnListAO->RetrieveLastError());
|
|
1215 |
|
|
1216 |
|
|
1217 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreGetReadStoreSize::KLtsyDispatchPhonebookOnStoreGetReadStoreSizeApiId);
|
|
1218 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreGetReadStoreSize::KLtsyDispatchPhonebookOnStoreGetReadStoreSizeApiId, KErrNone, completeData);
|
|
1219 |
|
|
1220 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreReadEntry::KLtsyDispatchPhonebookOnStoreReadEntryApiId, expectData);
|
|
1221 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreReadEntry::KLtsyDispatchPhonebookOnStoreReadEntryApiId, KErrGeneral, completeEntryData1);
|
|
1222 |
|
|
1223 |
getOnListAO->TestRetrieveL();
|
|
1224 |
ASSERT_EQUALS(KErrGeneral, getOnListAO->RetrieveLastError());
|
|
1225 |
CleanupStack::PopAndDestroy(1, getOnListAO);
|
|
1226 |
|
|
1227 |
//-------------------------------------------------------------------------
|
|
1228 |
// TEST C: Successful completion request of
|
|
1229 |
// CRetrieveMobilePhoneONList::Start when result is not cached.
|
|
1230 |
//-------------------------------------------------------------------------
|
|
1231 |
|
|
1232 |
ReadAllL(onStore);
|
|
1233 |
|
|
1234 |
//-------------------------------------------------------------------------
|
|
1235 |
// TEST E: Unsolicited completion of CAsyncRetrieveStoreList::Start
|
|
1236 |
// from LTSY.
|
|
1237 |
//-------------------------------------------------------------------------
|
|
1238 |
|
|
1239 |
TRequestStatus requestStatus;
|
|
1240 |
|
|
1241 |
iMockLTSY.NotifyTerminated(requestStatus);
|
|
1242 |
|
|
1243 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreReadEntry::KLtsyDispatchPhonebookOnStoreReadEntryApiId, KErrNone, completeEntryData1);
|
|
1244 |
|
|
1245 |
User::WaitForRequest(requestStatus);
|
|
1246 |
|
|
1247 |
ASSERT_EQUALS(KErrNone, requestStatus.Int());
|
|
1248 |
AssertMockLtsyStatusL();
|
|
1249 |
|
|
1250 |
CleanupStack::PopAndDestroy(5, this); // completeEntryData1, completeData, expectData,
|
|
1251 |
// onStore, this
|
|
1252 |
|
|
1253 |
}
|
|
1254 |
|