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 PhonebookEnControl in the Common TSY.
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include "cctsyphonebookenfu.h"
|
|
23 |
#include <etel.h>
|
|
24 |
#include <etelmm.h>
|
|
25 |
#include <et_clsvr.h>
|
|
26 |
#include <ctsy/mmtsy_names.h>
|
|
27 |
#include <ctsy/serviceapi/mmtsy_ipcdefs.h>
|
|
28 |
#include <test/tmockltsydata.h>
|
|
29 |
#include <ctsy/serviceapi/gsmerror.h>
|
|
30 |
#include <ctsy/ltsy/mltsydispatchphonebookeninterface.h>
|
|
31 |
#include "listretrieverao.h"
|
|
32 |
|
|
33 |
|
|
34 |
CTestSuite* CCTsyPhonebookEnFU::CreateSuiteL(const TDesC& aName)
|
|
35 |
{
|
|
36 |
SUB_SUITE;
|
|
37 |
|
|
38 |
//add other unit tests
|
|
39 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookEnFU, TestUnit0001L);
|
|
40 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookEnFU, TestUnit0002L);
|
|
41 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookEnFU, TestUnit0003L);
|
|
42 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookEnFU, TestUnit0003BL);
|
|
43 |
|
|
44 |
END_SUITE;
|
|
45 |
}
|
|
46 |
|
|
47 |
|
|
48 |
//
|
|
49 |
// Other unit tests
|
|
50 |
//
|
|
51 |
|
|
52 |
/**
|
|
53 |
@SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKEN-UN0001
|
|
54 |
@SYMComponent telephony_ctsy
|
|
55 |
@SYMTestCaseDesc Test support in CTSY for RMobileENStore::GetInfo()
|
|
56 |
@SYMTestPriority High
|
|
57 |
@SYMTestActions Invokes RMobileENStore::GetInfo()
|
|
58 |
@SYMTestExpectedResults Pass
|
|
59 |
@SYMTestType UT
|
|
60 |
*/
|
|
61 |
void CCTsyPhonebookEnFU::TestUnit0001L()
|
|
62 |
{
|
|
63 |
OpenEtelServerL(EUseExtendedError);
|
|
64 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
65 |
OpenPhoneL();
|
|
66 |
|
|
67 |
RMobileENStore enStore;
|
|
68 |
TInt ret = enStore.Open(iPhone);
|
|
69 |
ASSERT_EQUALS(ret, KErrNone);
|
|
70 |
CleanupClosePushL(enStore);
|
|
71 |
|
|
72 |
RBuf8 data;
|
|
73 |
CleanupClosePushL(data);
|
|
74 |
|
|
75 |
TRequestStatus reqStatus;
|
|
76 |
|
|
77 |
RMobilePhoneStore::TMobilePhoneStoreInfoV1 enStoreInfoV1;
|
|
78 |
TPckg<RMobilePhoneStore::TMobilePhoneStoreInfoV1> pckgInfoV1(enStoreInfoV1);
|
|
79 |
|
|
80 |
TInt usedEntries = 10;
|
|
81 |
|
|
82 |
TMockLtsyData1<TInt> enStoreInfoReturn(usedEntries);
|
|
83 |
data.Close();
|
|
84 |
enStoreInfoReturn.SerialiseL(data);
|
|
85 |
|
|
86 |
//-------------------------------------------------------------------------
|
|
87 |
// TEST A: failure to dispatch request to LTSY
|
|
88 |
//-------------------------------------------------------------------------
|
|
89 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookEnStoreGetInfo::KLtsyDispatchPhonebookEnStoreGetInfoApiId, KErrNotSupported);
|
|
90 |
|
|
91 |
enStore.GetInfo(reqStatus, pckgInfoV1);
|
|
92 |
|
|
93 |
User::WaitForRequest(reqStatus);
|
|
94 |
ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
|
|
95 |
|
|
96 |
AssertMockLtsyStatusL();
|
|
97 |
|
|
98 |
//-------------------------------------------------------------------------
|
|
99 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
100 |
//-------------------------------------------------------------------------
|
|
101 |
|
|
102 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookEnStoreGetInfo::KLtsyDispatchPhonebookEnStoreGetInfoApiId);
|
|
103 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreGetInfo::KLtsyDispatchPhonebookEnStoreGetInfoApiId, KErrGeneral, data);
|
|
104 |
|
|
105 |
enStore.GetInfo(reqStatus, pckgInfoV1);
|
|
106 |
|
|
107 |
User::WaitForRequest(reqStatus);
|
|
108 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
|
|
109 |
|
|
110 |
AssertMockLtsyStatusL();
|
|
111 |
|
|
112 |
//-------------------------------------------------------------------------
|
|
113 |
// TEST C: Successful completion request of
|
|
114 |
// RMobileENStore::GetInfo() when result is not cached.
|
|
115 |
//-------------------------------------------------------------------------
|
|
116 |
|
|
117 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookEnStoreGetInfo::KLtsyDispatchPhonebookEnStoreGetInfoApiId);
|
|
118 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreGetInfo::KLtsyDispatchPhonebookEnStoreGetInfoApiId, KErrNone, data);
|
|
119 |
|
|
120 |
enStore.GetInfo(reqStatus, pckgInfoV1);
|
|
121 |
User::WaitForRequest(reqStatus);
|
|
122 |
ASSERT_EQUALS(reqStatus.Int(), KErrNone);
|
|
123 |
ASSERT_EQUALS(enStoreInfoV1.iUsedEntries, usedEntries);
|
|
124 |
|
|
125 |
AssertMockLtsyStatusL();
|
|
126 |
|
|
127 |
//-------------------------------------------------------------------------
|
|
128 |
// TEST D: Unsolicited completion of RMobileENStore::GetInfo()
|
|
129 |
// from LTSY.
|
|
130 |
//-------------------------------------------------------------------------
|
|
131 |
|
|
132 |
TRequestStatus mockLtsyStatus;
|
|
133 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
134 |
|
|
135 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreGetInfo::KLtsyDispatchPhonebookEnStoreGetInfoApiId, KErrNone, data);
|
|
136 |
|
|
137 |
User::WaitForRequest(mockLtsyStatus);
|
|
138 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
139 |
|
|
140 |
AssertMockLtsyStatusL();
|
|
141 |
|
|
142 |
CleanupStack::PopAndDestroy(3, this); // data, enStore, this
|
|
143 |
|
|
144 |
}
|
|
145 |
|
|
146 |
/**
|
|
147 |
@SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKEN-UN0002
|
|
148 |
@SYMComponent telephony_ctsy
|
|
149 |
@SYMTestCaseDesc Test support in CTSY for RMobileONStore::Read()
|
|
150 |
@SYMTestPriority High
|
|
151 |
@SYMTestActions Invokes RMobileONStore::Read()
|
|
152 |
@SYMTestExpectedResults Pass
|
|
153 |
@SYMTestType UT
|
|
154 |
*/
|
|
155 |
void CCTsyPhonebookEnFU::TestUnit0002L()
|
|
156 |
{
|
|
157 |
OpenEtelServerL(EUseExtendedError);
|
|
158 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
159 |
OpenPhoneL();
|
|
160 |
|
|
161 |
RMobileENStore enStore;
|
|
162 |
TInt ret = enStore.Open(iPhone);
|
|
163 |
ASSERT_EQUALS(ret, KErrNone);
|
|
164 |
CleanupClosePushL(enStore);
|
|
165 |
|
|
166 |
RBuf8 expectData;
|
|
167 |
CleanupClosePushL(expectData);
|
|
168 |
|
|
169 |
RBuf8 completeData;
|
|
170 |
CleanupClosePushL(completeData);
|
|
171 |
|
|
172 |
TRequestStatus reqStatus;
|
|
173 |
|
|
174 |
TInt index = 10;
|
|
175 |
|
|
176 |
RMobileENStore::TMobileENEntryV1 readEntry;
|
|
177 |
readEntry.iIndex = index;
|
|
178 |
TPckg<RMobileENStore::TMobileENEntryV1> pckgReadEntry(readEntry);
|
|
179 |
|
|
180 |
_LIT(KTelNumber, "123456");
|
|
181 |
TBuf<RMobileENStore::KEmergencyNumberSize> telNumber;
|
|
182 |
telNumber.Copy(KTelNumber);
|
|
183 |
|
|
184 |
TMockLtsyData1<TInt> readLTsyData(index);
|
|
185 |
expectData.Close();
|
|
186 |
readLTsyData.SerialiseL(expectData);
|
|
187 |
|
|
188 |
TMockLtsyData2< TInt, TBuf<RMobileENStore::KEmergencyNumberSize> > readLTsyDataComplete(index, telNumber);
|
|
189 |
completeData.Close();
|
|
190 |
readLTsyDataComplete.SerialiseL(completeData);
|
|
191 |
|
|
192 |
//-------------------------------------------------------------------------
|
|
193 |
// TEST A: failure to dispatch request to LTSY
|
|
194 |
//-------------------------------------------------------------------------
|
|
195 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookEnStoreReadEntry::KLtsyDispatchPhonebookEnStoreReadEntryApiId, expectData, KErrNotSupported);
|
|
196 |
|
|
197 |
enStore.Read(reqStatus, pckgReadEntry);
|
|
198 |
User::WaitForRequest(reqStatus);
|
|
199 |
ASSERT_EQUALS(KErrNotSupported, reqStatus.Int());
|
|
200 |
|
|
201 |
AssertMockLtsyStatusL();
|
|
202 |
|
|
203 |
//-------------------------------------------------------------------------
|
|
204 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
205 |
//-------------------------------------------------------------------------
|
|
206 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookEnStoreReadEntry::KLtsyDispatchPhonebookEnStoreReadEntryApiId, expectData);
|
|
207 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadEntry::KLtsyDispatchPhonebookEnStoreReadEntryApiId, KErrGeneral, completeData);
|
|
208 |
|
|
209 |
enStore.Read(reqStatus, pckgReadEntry);
|
|
210 |
|
|
211 |
User::WaitForRequest(reqStatus);
|
|
212 |
ASSERT_EQUALS(KErrGeneral, reqStatus.Int());
|
|
213 |
|
|
214 |
AssertMockLtsyStatusL();
|
|
215 |
|
|
216 |
//-------------------------------------------------------------------------
|
|
217 |
// TEST C: Successful completion request of
|
|
218 |
// RMobileENStore::Read() when result is not cached.
|
|
219 |
//-------------------------------------------------------------------------
|
|
220 |
|
|
221 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookEnStoreReadEntry::KLtsyDispatchPhonebookEnStoreReadEntryApiId, expectData);
|
|
222 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadEntry::KLtsyDispatchPhonebookEnStoreReadEntryApiId, KErrNone, completeData);
|
|
223 |
|
|
224 |
enStore.Read(reqStatus, pckgReadEntry);
|
|
225 |
User::WaitForRequest(reqStatus);
|
|
226 |
ASSERT_EQUALS(reqStatus.Int(), KErrNone);
|
|
227 |
ASSERT_EQUALS(index, readEntry.iIndex);
|
|
228 |
ASSERT_EQUALS(telNumber, readEntry.iNumber);
|
|
229 |
|
|
230 |
AssertMockLtsyStatusL();
|
|
231 |
|
|
232 |
//-------------------------------------------------------------------------
|
|
233 |
// TEST D: Unsolicited completion of RMobileENStore::Read()
|
|
234 |
// from LTSY.
|
|
235 |
//-------------------------------------------------------------------------
|
|
236 |
|
|
237 |
TRequestStatus mockLtsyStatus;
|
|
238 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
239 |
|
|
240 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadEntry::KLtsyDispatchPhonebookEnStoreReadEntryApiId, KErrNone, completeData);
|
|
241 |
|
|
242 |
User::WaitForRequest(mockLtsyStatus);
|
|
243 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
244 |
|
|
245 |
AssertMockLtsyStatusL();
|
|
246 |
|
|
247 |
//-------------------------------------------------------------------------
|
|
248 |
// TEST E: Parameters out of bound test
|
|
249 |
//-------------------------------------------------------------------------
|
|
250 |
index = 300;
|
|
251 |
TMockLtsyData2< TInt, TBuf<RMobileENStore::KEmergencyNumberSize> > readLTsyDataComplete2(index, telNumber);
|
|
252 |
completeData.Close();
|
|
253 |
readLTsyDataComplete2.SerialiseL(completeData);
|
|
254 |
|
|
255 |
|
|
256 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookEnStoreReadEntry::KLtsyDispatchPhonebookEnStoreReadEntryApiId, expectData);
|
|
257 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadEntry::KLtsyDispatchPhonebookEnStoreReadEntryApiId, KErrNone, completeData);
|
|
258 |
|
|
259 |
enStore.Read(reqStatus, pckgReadEntry);
|
|
260 |
|
|
261 |
User::WaitForRequest(reqStatus);
|
|
262 |
ASSERT_EQUALS(KErrCorrupt, reqStatus.Int());
|
|
263 |
|
|
264 |
|
|
265 |
AssertMockLtsyStatusL();
|
|
266 |
|
|
267 |
CleanupStack::PopAndDestroy(4, this); // completeData, expectData, onStore, this
|
|
268 |
|
|
269 |
}
|
|
270 |
|
|
271 |
/**
|
|
272 |
@SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKEN-UN0003
|
|
273 |
@SYMComponent telephony_ctsy
|
|
274 |
@SYMTestCaseDesc Test support in CTSY for CRetrieveMobilePhoneENList::Start()
|
|
275 |
@SYMTestPriority High
|
|
276 |
@SYMTestActions Invokes CRetrieveMobilePhoneENList::Start()
|
|
277 |
@SYMTestExpectedResults Pass
|
|
278 |
@SYMTestType UT
|
|
279 |
*/
|
|
280 |
void CCTsyPhonebookEnFU::TestUnit0003L()
|
|
281 |
{
|
|
282 |
|
|
283 |
OpenEtelServerL(EUseExtendedError);
|
|
284 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
285 |
OpenPhoneL();
|
|
286 |
|
|
287 |
RMobileENStore enStore;
|
|
288 |
TInt err = enStore.Open(iPhone);
|
|
289 |
ASSERT_EQUALS(KErrNone, err);
|
|
290 |
CleanupClosePushL(enStore);
|
|
291 |
|
|
292 |
CGetENListAO* getEnListAO = CGetENListAO::NewLC(enStore);
|
|
293 |
|
|
294 |
RBuf8 completeEntryData1;
|
|
295 |
CleanupClosePushL(completeEntryData1);
|
|
296 |
|
|
297 |
RBuf8 completeEntryData2;
|
|
298 |
CleanupClosePushL(completeEntryData2);
|
|
299 |
|
|
300 |
RBuf8 completeEntryData3;
|
|
301 |
CleanupClosePushL(completeEntryData3);
|
|
302 |
|
|
303 |
TInt index[3];
|
|
304 |
TBuf<RMobileENStore::KEmergencyNumberSize> telNumber[3];
|
|
305 |
|
|
306 |
TBool moreToCome = ETrue;
|
|
307 |
index[0] = 1;
|
|
308 |
_LIT(KNumber1, "000001");
|
|
309 |
telNumber[0].Copy(KNumber1);
|
|
310 |
|
|
311 |
TMockLtsyData3< TInt, TBuf<RMobileENStore::KEmergencyNumberSize>, TBool > readLTsyDataComplete1(index[0], telNumber[0], moreToCome);
|
|
312 |
completeEntryData1.Close();
|
|
313 |
readLTsyDataComplete1.SerialiseL(completeEntryData1);
|
|
314 |
|
|
315 |
|
|
316 |
index[1] = 2;
|
|
317 |
_LIT(KNumber2, "111112");
|
|
318 |
telNumber[1].Copy(KNumber2);
|
|
319 |
|
|
320 |
TMockLtsyData3< TInt, TBuf<RMobileENStore::KEmergencyNumberSize>, TBool > readLTsyDataComplete2(index[1], telNumber[1], moreToCome);
|
|
321 |
completeEntryData2.Close();
|
|
322 |
readLTsyDataComplete2.SerialiseL(completeEntryData2);
|
|
323 |
|
|
324 |
moreToCome = EFalse;
|
|
325 |
index[2] = 3;
|
|
326 |
_LIT(KNumber3, "111113");
|
|
327 |
telNumber[2].Copy(KNumber3);
|
|
328 |
|
|
329 |
TMockLtsyData3< TInt, TBuf<RMobileENStore::KEmergencyNumberSize>, TBool > readLTsyDataComplete3(index[2], telNumber[2], moreToCome);
|
|
330 |
completeEntryData3.Close();
|
|
331 |
readLTsyDataComplete3.SerialiseL(completeEntryData3);
|
|
332 |
|
|
333 |
//-------------------------------------------------------------------------
|
|
334 |
// TEST A: failure to dispatch request to LTSY
|
|
335 |
//-------------------------------------------------------------------------
|
|
336 |
|
|
337 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId, KErrNotSupported);
|
|
338 |
|
|
339 |
getEnListAO->TestRetrieveL();
|
|
340 |
ASSERT_EQUALS(KErrNotSupported, getEnListAO->RetrieveLastError());
|
|
341 |
|
|
342 |
//-------------------------------------------------------------------------
|
|
343 |
// TEST B: failure on completion of pending request from LTSY->CTSY
|
|
344 |
//-------------------------------------------------------------------------
|
|
345 |
|
|
346 |
// failure on the 1st entry
|
|
347 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId);
|
|
348 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId, KErrGeneral, completeEntryData1);
|
|
349 |
|
|
350 |
getEnListAO->TestRetrieveL();
|
|
351 |
ASSERT_EQUALS(KErrGeneral, getEnListAO->RetrieveLastError());
|
|
352 |
|
|
353 |
// failure on the middle entry
|
|
354 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId);
|
|
355 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId, KErrNone, completeEntryData1);
|
|
356 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId, KErrGeneral, completeEntryData2);
|
|
357 |
|
|
358 |
getEnListAO->TestRetrieveL();
|
|
359 |
ASSERT_EQUALS(KErrGeneral, getEnListAO->RetrieveLastError());
|
|
360 |
|
|
361 |
// failure on the last entry
|
|
362 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId);
|
|
363 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId, KErrNone, completeEntryData1);
|
|
364 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId, KErrNone, completeEntryData2);
|
|
365 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId, KErrGeneral, completeEntryData3);
|
|
366 |
|
|
367 |
getEnListAO->TestRetrieveL();
|
|
368 |
ASSERT_EQUALS(KErrGeneral, getEnListAO->RetrieveLastError());
|
|
369 |
|
|
370 |
// parameter out of bound test
|
|
371 |
RBuf8 completeEntryData4;
|
|
372 |
CleanupClosePushL(completeEntryData4);
|
|
373 |
TInt indexOutOfBound = 300;
|
|
374 |
TMockLtsyData3< TInt, TBuf<RMobileENStore::KEmergencyNumberSize>, TBool > readLTsyDataComplete4(indexOutOfBound, telNumber[2], moreToCome);
|
|
375 |
completeEntryData4.Close();
|
|
376 |
readLTsyDataComplete4.SerialiseL(completeEntryData4);
|
|
377 |
|
|
378 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId);
|
|
379 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId, KErrNone, completeEntryData1);
|
|
380 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId, KErrNone, completeEntryData4);
|
|
381 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId, KErrNone, completeEntryData3);
|
|
382 |
|
|
383 |
getEnListAO->TestRetrieveL();
|
|
384 |
ASSERT_EQUALS(KErrCorrupt, getEnListAO->RetrieveLastError());
|
|
385 |
|
|
386 |
AssertMockLtsyStatusL();
|
|
387 |
|
|
388 |
//-------------------------------------------------------------------------
|
|
389 |
// TEST C: Successful completion request of
|
|
390 |
// CRetrieveMobilePhoneENList::Start() when result is not cached.
|
|
391 |
//-------------------------------------------------------------------------
|
|
392 |
|
|
393 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId);
|
|
394 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId, KErrNone, completeEntryData1);
|
|
395 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId, KErrNone, completeEntryData2);
|
|
396 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId, KErrNone, completeEntryData3);
|
|
397 |
|
|
398 |
getEnListAO->TestRetrieveL();
|
|
399 |
ASSERT_EQUALS(KErrNone, getEnListAO->RetrieveLastError());
|
|
400 |
|
|
401 |
CMobilePhoneENList* list = getEnListAO->RetrieveListL();
|
|
402 |
RMobileENStore::TMobileENEntryV1 readEntry;
|
|
403 |
|
|
404 |
for (TInt i=0; i< list->Enumerate(); i++)
|
|
405 |
{
|
|
406 |
readEntry=list->GetEntryL(i);
|
|
407 |
ASSERT_EQUALS(index[i], readEntry.iIndex);
|
|
408 |
ASSERT_EQUALS(telNumber[i], readEntry.iNumber);
|
|
409 |
}
|
|
410 |
|
|
411 |
AssertMockLtsyStatusL();
|
|
412 |
|
|
413 |
|
|
414 |
//-------------------------------------------------------------------------
|
|
415 |
// TEST E: Unsolicited completion of CAsyncRetrieveStoreList::Start()
|
|
416 |
// from LTSY.
|
|
417 |
//-------------------------------------------------------------------------
|
|
418 |
|
|
419 |
TRequestStatus requestStatus;
|
|
420 |
|
|
421 |
iMockLTSY.NotifyTerminated(requestStatus);
|
|
422 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId, KErrNone, completeEntryData1);
|
|
423 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId, KErrNone, completeEntryData2);
|
|
424 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId, KErrNone, completeEntryData3);
|
|
425 |
User::WaitForRequest(requestStatus);
|
|
426 |
ASSERT_EQUALS(KErrNone, requestStatus.Int());
|
|
427 |
|
|
428 |
AssertMockLtsyStatusL();
|
|
429 |
|
|
430 |
CActiveScheduler::Install(NULL);
|
|
431 |
|
|
432 |
|
|
433 |
CleanupStack::PopAndDestroy(7, this); // completeEntryData4, completeEntryData3, completeEntryData2, completeEntryData1, getEnListAO,
|
|
434 |
// enStore, this
|
|
435 |
|
|
436 |
}
|
|
437 |
|
|
438 |
/**
|
|
439 |
@SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKEN-UN0003B
|
|
440 |
@SYMComponent telephony_ctsy
|
|
441 |
@SYMTestCaseDesc Test support in CTSY for CRetrieveMobilePhoneENList::Start() when the storage is empty
|
|
442 |
@SYMTestPriority High
|
|
443 |
@SYMTestActions Invokes CRetrieveMobilePhoneENList::Start() when the storage is empty
|
|
444 |
@SYMTestExpectedResults Pass
|
|
445 |
@SYMTestType UT
|
|
446 |
*/
|
|
447 |
void CCTsyPhonebookEnFU::TestUnit0003BL()
|
|
448 |
{
|
|
449 |
|
|
450 |
OpenEtelServerL(EUseExtendedError);
|
|
451 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
452 |
OpenPhoneL();
|
|
453 |
|
|
454 |
RMobileENStore enStore;
|
|
455 |
TInt err = enStore.Open(iPhone);
|
|
456 |
ASSERT_EQUALS(KErrNone, err);
|
|
457 |
CleanupClosePushL(enStore);
|
|
458 |
|
|
459 |
CGetENListAO* getEnListAO = CGetENListAO::NewLC(enStore);
|
|
460 |
|
|
461 |
RBuf8 completeEntryData;
|
|
462 |
CleanupClosePushL(completeEntryData);
|
|
463 |
|
|
464 |
_LIT(KNumber, "");
|
|
465 |
TInt index = 0;
|
|
466 |
TBuf<RMobileENStore::KEmergencyNumberSize> telNumber;
|
|
467 |
telNumber.Copy(KNumber);
|
|
468 |
|
|
469 |
TBool moreToCome = EFalse;
|
|
470 |
|
|
471 |
TMockLtsyData3< TInt, TBuf<RMobileENStore::KEmergencyNumberSize>, TBool > readLTsyDataComplete(index, telNumber, moreToCome);
|
|
472 |
completeEntryData.Close();
|
|
473 |
readLTsyDataComplete.SerialiseL(completeEntryData);
|
|
474 |
|
|
475 |
iMockLTSY.ExpectL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId);
|
|
476 |
iMockLTSY.CompleteL(MLtsyDispatchPhonebookEnStoreReadAll::KLtsyDispatchPhonebookEnStoreReadAllApiId, KErrNotFound, completeEntryData);
|
|
477 |
|
|
478 |
getEnListAO->TestRetrieveL();
|
|
479 |
ASSERT_EQUALS(KErrNotFound, getEnListAO->RetrieveLastError());
|
|
480 |
|
|
481 |
AssertMockLtsyStatusL();
|
|
482 |
|
|
483 |
CleanupStack::PopAndDestroy(4, this); // completeEntryData, getEnListAO,
|
|
484 |
// enStore, this
|
|
485 |
|
|
486 |
}
|