24
|
1 |
// Copyright (c) 2007-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 |
#ifndef TSIMTSYTESTHELPER_H
|
|
17 |
#define TSIMTSYTESTHELPER_H
|
|
18 |
|
|
19 |
|
|
20 |
#include "ttsytesthelperbase.h"
|
|
21 |
#include "tnetworktsytesthelper.h"
|
|
22 |
|
|
23 |
class TSimTsyTestHelper : public TTsyTestHelperBase
|
|
24 |
{
|
|
25 |
public:
|
|
26 |
TSimTsyTestHelper(CCTSYIntegrationTestSuiteStepBase& aTestStep);
|
|
27 |
|
|
28 |
void WaitForMobilePhoneNotifyUSimApplicationsInfoChange(
|
|
29 |
RMobilePhone& aMobilePhone,
|
|
30 |
TEtelRequestBase& aRequestStatus,
|
|
31 |
TInt& aCount,
|
|
32 |
TInt aExpectedCount,
|
|
33 |
RMobilePhone::TAID &aActiveAID,
|
|
34 |
TInt aWantedStatus );
|
|
35 |
|
|
36 |
void WaitForMobilePhoneNotifyUSimAppsSelectionModeChange(
|
|
37 |
RMobilePhone& aMobilePhone,
|
|
38 |
TEtelRequestBase& aRequestStatus,
|
|
39 |
RMobilePhone::TUSimSelectionMode& aUSimSelectionMode,
|
|
40 |
RMobilePhone::TUSimSelectionMode aExpectedUSimSelectionMode,
|
|
41 |
TInt aWantedStatus );
|
|
42 |
|
|
43 |
void WaitForMobilePhoneNotifyUUSSettingChange(
|
|
44 |
RMobilePhone& aMobilePhone,
|
|
45 |
TEtelRequestBase& aRequestStatus,
|
|
46 |
RMobilePhone::TMobilePhoneUUSSetting& aSetting,
|
|
47 |
RMobilePhone::TMobilePhoneUUSSetting aExpectedSetting,
|
|
48 |
TInt aWantedStatus );
|
|
49 |
|
|
50 |
void WaitForMobilePhoneNotifyIccMessageWaitingIndicatorsChange(
|
|
51 |
RMobilePhone& aMobilePhone,
|
|
52 |
TEtelRequestBase& aRequestStatus,
|
|
53 |
TCmpBase<RMobilePhone::TMobilePhoneMessageWaitingV1> &aMobilePhoneMessageWaitingV1,
|
|
54 |
TInt aWantedStatus );
|
|
55 |
|
|
56 |
void WaitForMobilePhoneNotifyImsAuthorizationInfoChange(
|
|
57 |
TEtelRequestBase& aRequestStatus,
|
|
58 |
TInt aWantedStatus );
|
|
59 |
|
|
60 |
void WaitForMobilePhoneNotifySmartCardApplicationInfoChange(
|
|
61 |
RMobilePhone& aMobilePhone,
|
|
62 |
TEtelRequestBase& aRequestStatus,
|
|
63 |
RMobilePhone::TAID& aAID,
|
|
64 |
RMobilePhone::TAID& aExpectedAID,
|
|
65 |
RMobilePhone::TSmartCardApplicationEvent &aEvent,
|
|
66 |
TInt aWantedStatus );
|
|
67 |
|
|
68 |
void WaitForMobilePhoneNotifyMailboxNumbersChange(
|
|
69 |
RMobilePhone& aMobilePhone,
|
|
70 |
TEtelRequestBase& aRequestStatus,
|
|
71 |
TCmpBase<RMobilePhone::TMobilePhoneVoicemailIdsV3> &aMobilePhoneVoicemailIdsV3,
|
|
72 |
TInt aWantedStatus );
|
|
73 |
|
|
74 |
void WaitForMobilePhoneStoreNotifyStoreEvent(
|
|
75 |
RMobilePhoneStore& aMobilePhoneStore,
|
|
76 |
TEtelRequestBase& aRequestStatus,
|
|
77 |
TUint32& aEvent,
|
|
78 |
TUint32 aExpectedEvent,
|
|
79 |
TInt &aIndex,
|
|
80 |
TInt aWantedStatus );
|
|
81 |
|
|
82 |
void WaitForMobileSmartCardEapNotifyEapMethodAccessStatusChange(
|
|
83 |
RMobileSmartCardEap& aMobileSmartCardEap,
|
|
84 |
TEtelRequestBase& aRequestStatus,
|
|
85 |
RMobileSmartCardEap::TEapMethodAccessStatus& aEapMethodStatus,
|
|
86 |
RMobileSmartCardEap::TEapMethodAccessStatus aExpectedEapMethodStatus,
|
|
87 |
TInt aWantedStatus );
|
|
88 |
|
|
89 |
template<typename T>
|
|
90 |
TInt GetNumberOfUsedEntriesInStoreL(
|
|
91 |
RMobilePhoneStore& aPhoneStore,
|
|
92 |
const TDesC& aStoreName,
|
|
93 |
T& aInfoPkg,
|
|
94 |
RMobilePhone& aPhone,
|
|
95 |
TInt& aUsedEntries1,
|
|
96 |
TInt& aUsedEntries2)
|
|
97 |
/**
|
|
98 |
* Uses two methods of getting the number of entries in the ICC SMS/phonebook store.
|
|
99 |
*
|
|
100 |
* @param aPhoneStore reference to phone store object for GetInfo API
|
|
101 |
* @param aStoreName const reference to TDesC holding the name of the store, for which information is required
|
|
102 |
* @param aInfoPkg type TMobilePhoneStoreInfoV1 or one of its derived classes' package types to hold phone store information
|
|
103 |
* @param aPhone reference to mobile phone object for GetPhoneStoreInfo API
|
|
104 |
* @param aUsedEntries1 reference of TInt type to hold iUsedEntries returned by GetInfo API
|
|
105 |
* @param aUsedEntries2 reference of TInt type to hold iUsedEntries returned by GetPhoneStoreInfo API
|
|
106 |
*
|
|
107 |
* @return KErrNone if one of the get info APIs are supported, KErrNotSupported if neither
|
|
108 |
* are supported.
|
|
109 |
*/
|
|
110 |
{ // Get number of entries using RMobilePhoneStore::GetInfo
|
|
111 |
TExtEtelRequestStatus getInfoStatus (aPhoneStore,EMobilePhoneStoreGetInfo);
|
|
112 |
CleanupStack::PushL(getInfoStatus);
|
|
113 |
aPhoneStore.GetInfo(getInfoStatus,aInfoPkg);
|
|
114 |
ASSERT_EQUALS(iTestStep.WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium), KErrNone,_L("RMobileSmsStore::GetInfo timed out"));
|
|
115 |
if (getInfoStatus.Int() == KErrNone)
|
|
116 |
{
|
|
117 |
aUsedEntries1 = aInfoPkg().iUsedEntries;
|
|
118 |
}
|
|
119 |
else
|
|
120 |
{
|
|
121 |
DEBUG_PRINTF2(_L("RMobilePhoneStore::GetInfo returned with error = %d"), getInfoStatus.Int());
|
|
122 |
}
|
|
123 |
|
|
124 |
// Get number of entries using RMobilePhone::GetPhoneStoreInfo
|
|
125 |
TExtEtelRequestStatus getInfoStatus2 (aPhoneStore,EMobilePhoneStoreGetInfo);
|
|
126 |
CleanupStack::PushL(getInfoStatus2);
|
|
127 |
aPhone.GetPhoneStoreInfo(getInfoStatus2,aInfoPkg, aStoreName);
|
|
128 |
ASSERT_EQUALS(iTestStep.WaitForRequestWithTimeOut(getInfoStatus2, ETimeMedium), KErrNone,_L("RMobilePhone::GetPhoneStoreInfo timed out"));
|
|
129 |
if (getInfoStatus2.Int() == KErrNone)
|
|
130 |
{
|
|
131 |
aUsedEntries2 = aInfoPkg().iUsedEntries;
|
|
132 |
}
|
|
133 |
else
|
|
134 |
{
|
|
135 |
DEBUG_PRINTF2(_L("RMobilePhone::GetPhoneStoreInfo returned with error = %d"), getInfoStatus2.Int());
|
|
136 |
}
|
|
137 |
|
|
138 |
if (getInfoStatus.Int() == KErrNone || getInfoStatus2.Int() == KErrNone)
|
|
139 |
{
|
|
140 |
CleanupStack::PopAndDestroy(2);
|
|
141 |
return KErrNone;
|
|
142 |
}
|
|
143 |
else
|
|
144 |
{
|
|
145 |
CleanupStack::PopAndDestroy(2);
|
|
146 |
return KErrNotSupported;
|
|
147 |
}
|
|
148 |
}
|
|
149 |
;
|
|
150 |
|
|
151 |
template<typename T>
|
|
152 |
TInt AssertNumberOfUsedEntriesCorrectL(
|
|
153 |
RMobilePhoneStore& aPhoneStore,
|
|
154 |
const TDesC& aStoreName,
|
|
155 |
T& aInfoPkg,
|
|
156 |
RMobilePhone& aPhone,
|
|
157 |
TInt aExpectedGetInfoEntries,
|
|
158 |
TInt aExpectedGetPhoneStoreInfoEntries)
|
|
159 |
/**
|
|
160 |
* Call RMobilePhone::GetPhoneStoreInfo and RMobilePhoneStore::GetInfo and checks
|
|
161 |
* that the number of used entries in the phone book is the expected value if the
|
|
162 |
* API is supported.
|
|
163 |
*
|
|
164 |
* @param aPhoneStore reference to phone store object for GetInfo API
|
|
165 |
* @param aStoreName const reference to TDesC holding the name of the store, for which information is required
|
|
166 |
* @param aInfoPkg type TMobilePhoneStoreInfoV1 or one of its derived classes' package types to hold phone store information
|
|
167 |
* @param aPhone reference to mobile phone object for GetPhoneStoreInfo API
|
|
168 |
* @param aExpectedGetInfoEntries holding value for comparision with iUsedEntries returned by GetInfo API
|
|
169 |
* @param aExpectedGetPhoneStoreInfoEntries holding value for comparision with iUsedEntries returned by GetPhoneStoreInfo API
|
|
170 |
*
|
|
171 |
* @return KErrNone if one of the get info APIs are supported, KErrNotSupported if neither
|
|
172 |
* are supported.
|
|
173 |
*/
|
|
174 |
{
|
|
175 |
// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is equal to aExpectedGetInfoEntries
|
|
176 |
TExtEtelRequestStatus getInfoStatus (aPhoneStore, EMobilePhoneStoreGetInfo);
|
|
177 |
CleanupStack::PushL(getInfoStatus);
|
|
178 |
aPhoneStore.GetInfo(getInfoStatus,aInfoPkg);
|
|
179 |
ASSERT_EQUALS(iTestStep.WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium), KErrNone, _L("RMobilePhoneStore::GetInfo, Timed out"));
|
|
180 |
|
|
181 |
if (getInfoStatus.Int() == KErrNone)
|
|
182 |
{
|
|
183 |
ASSERT_EQUALS(getInfoStatus.Int(), KErrNone, _L("RMobilePhoneStore::GetInfo returned an error"));
|
|
184 |
ASSERT_EQUALS((aInfoPkg().iUsedEntries),aExpectedGetInfoEntries, _L("RMobilePhoneStore::GetInfo Unexpected number of iUsedEntries returned" ));
|
|
185 |
}
|
|
186 |
|
|
187 |
// Check RMobilePhone::GetPhoneStoreInfo returns iUsedEntries which is equal to aExpectedGetPhoneStoreInfoEntries
|
|
188 |
TExtEtelRequestStatus getInfoStatus2 (aPhoneStore, EMobilePhoneStoreGetInfo);
|
|
189 |
CleanupStack::PushL(getInfoStatus2);
|
|
190 |
aPhone.GetPhoneStoreInfo(getInfoStatus2,aInfoPkg, aStoreName);
|
|
191 |
ASSERT_EQUALS(iTestStep.WaitForRequestWithTimeOut(getInfoStatus2, ETimeMedium), KErrNone, _L("RMobilePhone::GetPhoneStoreInfo timed out"));
|
|
192 |
|
|
193 |
if (getInfoStatus2.Int() == KErrNone)
|
|
194 |
{
|
|
195 |
ASSERT_EQUALS(getInfoStatus2.Int(), KErrNone, _L("RMobilePhone::GetPhoneStoreInfo returned an error"));
|
|
196 |
ASSERT_EQUALS((aInfoPkg().iUsedEntries ),aExpectedGetPhoneStoreInfoEntries, _L("RMobilePhone::GetPhoneStoreInfo Unexpected number of iUsedEntries returned" ));
|
|
197 |
}
|
|
198 |
|
|
199 |
if (getInfoStatus.Int() == KErrNone || getInfoStatus2.Int() == KErrNone)
|
|
200 |
{
|
|
201 |
CleanupStack::PopAndDestroy(2);
|
|
202 |
return KErrNone;
|
|
203 |
}
|
|
204 |
else
|
|
205 |
{
|
|
206 |
CleanupStack::PopAndDestroy(2);
|
|
207 |
return KErrNotSupported;
|
|
208 |
}
|
|
209 |
|
|
210 |
}
|
|
211 |
template<class INFO>
|
|
212 |
TInt EnsureEmptyStoreSpaceL(RMobilePhoneStore& aPhoneStore,
|
|
213 |
const TDesC& aStoreName,
|
|
214 |
INFO &aInfo,
|
|
215 |
RMobilePhone& aPhone)
|
|
216 |
/**
|
|
217 |
* Check the number of used entries in the store, and if all the entries are used, erase the last one.
|
|
218 |
*
|
|
219 |
* @param aPhoneStore reference to phone store object for GetInfo API
|
|
220 |
* @param aStoreName const reference to TDesC holding the name of the store, for which information is required
|
|
221 |
* @param aInfo type TMobilePhoneStoreInfoV1 or one of its derived classes' package types to hold phone store information
|
|
222 |
* @param aPhone reference to mobile phone object for GetPhoneStoreInfo API
|
|
223 |
*
|
|
224 |
* @return an index to an empty entry in the store; negative number if fails.
|
|
225 |
*/
|
|
226 |
{
|
|
227 |
TPckg<INFO> infoPckg(aInfo);
|
|
228 |
TInt ret=0;
|
|
229 |
// Check RMobilePhoneStore::GetInfo returns iUsedEntries which is equal to aExpectedGetInfoEntries
|
|
230 |
TExtEtelRequestStatus getInfoStatus (aPhoneStore, EMobilePhoneStoreGetInfo);
|
|
231 |
CleanupStack::PushL(getInfoStatus);
|
|
232 |
TExtEtelRequestStatus getInfoStatus2 (aPhoneStore, EMobilePhoneStoreGetInfo);
|
|
233 |
CleanupStack::PushL(getInfoStatus2);
|
|
234 |
aPhoneStore.GetInfo(getInfoStatus,infoPckg);
|
|
235 |
ASSERT_EQUALS(iTestStep.WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium), KErrNone, _L("RMobilePhoneStore::GetInfo, Timed out"));
|
|
236 |
if (getInfoStatus.Int() != KErrNone)
|
|
237 |
{
|
|
238 |
aPhone.GetPhoneStoreInfo(getInfoStatus2,infoPckg, aStoreName);
|
|
239 |
ASSERT_EQUALS(iTestStep.WaitForRequestWithTimeOut(getInfoStatus2, ETimeMedium), KErrNone, _L("RMobilePhone::GetPhoneStoreInfo timed out"));
|
|
240 |
if (getInfoStatus2.Int() != KErrNone)
|
|
241 |
{
|
|
242 |
ret=-1;
|
|
243 |
}
|
|
244 |
}
|
|
245 |
if(ret!=-1) //Delete the last entry
|
|
246 |
{
|
|
247 |
TExtEtelRequestStatus deleteStatus(aPhoneStore, EMobilePhoneStoreDelete);
|
|
248 |
CleanupStack::PushL (deleteStatus);
|
|
249 |
aPhoneStore.Delete (deleteStatus, aInfo.iUsedEntries);
|
|
250 |
ASSERT_EQUALS(iTestStep.WaitForRequestWithTimeOut(deleteStatus, ETimeMedium), KErrNone, _L("RMobilePhoneStore::Delete timed out"));
|
|
251 |
ret=aInfo.iUsedEntries;
|
|
252 |
|
|
253 |
// check that the entry was deleted
|
|
254 |
aPhoneStore.GetInfo(getInfoStatus,infoPckg);
|
|
255 |
ASSERT_EQUALS(iTestStep.WaitForRequestWithTimeOut(getInfoStatus, ETimeMedium), KErrNone, _L("RMobilePhoneStore::GetInfo, Timed out"));
|
|
256 |
if(getInfoStatus.Int() != KErrNone)
|
|
257 |
{
|
|
258 |
aPhone.GetPhoneStoreInfo(getInfoStatus2,infoPckg, aStoreName);
|
|
259 |
ASSERT_EQUALS(iTestStep.WaitForRequestWithTimeOut(getInfoStatus2, ETimeMedium), KErrNone, _L("RMobilePhone::GetPhoneStoreInfo timed out"));
|
|
260 |
if (getInfoStatus2.Int() != KErrNone)
|
|
261 |
{
|
|
262 |
ret=-1;
|
|
263 |
}
|
|
264 |
}
|
|
265 |
if(aInfo.iUsedEntries==aInfo.iTotalEntries)
|
|
266 |
{
|
|
267 |
ret =-1;
|
|
268 |
}
|
|
269 |
|
|
270 |
CleanupStack::PopAndDestroy(&deleteStatus);
|
|
271 |
|
|
272 |
}
|
|
273 |
CleanupStack::PopAndDestroy(2);
|
|
274 |
return ret;
|
|
275 |
}
|
|
276 |
|
|
277 |
void VerifyPin2L(RMobilePhone& aMobilePhone, TNetworkTsyTestHelper& aNetworkTsyTestHelper);
|
|
278 |
|
|
279 |
}; // class TSimTsyTestHelper
|
|
280 |
|
|
281 |
#endif
|