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 |
// The TEFUnit test suite for PhoneControl in the Common TSY.
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include "cctsyphonecontrolfu.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 "tmockltsydata.h"
|
|
29 |
#include <ctsy/serviceapi/gsmerror.h>
|
|
30 |
#include "MmTsy_conf.h"
|
|
31 |
|
|
32 |
CTestSuite* CCTsyPhoneControlFU::CreateSuiteL(const TDesC& aName)
|
|
33 |
{
|
|
34 |
SUB_SUITE;
|
|
35 |
|
|
36 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhoneControlFU, TestNotifyModemDetected0001L);
|
|
37 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhoneControlFU, TestGetPhoneInfo0001L);
|
|
38 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhoneControlFU, TestGetPhoneInfo0003L);
|
|
39 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhoneControlFU, TestIsSupportedByModule0001L);
|
|
40 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhoneControlFU, TestIsSupportedByModule0003L);
|
|
41 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhoneControlFU, TestGetCaps0001L);
|
|
42 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhoneControlFU, TestGetInfo0001L);
|
|
43 |
ADD_TEST_STEP_ISO_CPP(CCTsyPhoneControlFU, TestGetStatus0001L);
|
|
44 |
|
|
45 |
END_SUITE;
|
|
46 |
}
|
|
47 |
|
|
48 |
|
|
49 |
//
|
|
50 |
// Actual test cases
|
|
51 |
//
|
|
52 |
|
|
53 |
|
|
54 |
/**
|
|
55 |
@SYMTestCaseID BA-CTSY-PCON-PNMD-0001
|
|
56 |
@SYMComponent telephony_ctsy
|
|
57 |
@SYMTestCaseDesc Test support in CTSY for RPhone::NotifyModemDetected
|
|
58 |
@SYMTestPriority High
|
|
59 |
@SYMTestActions Invokes RPhone::NotifyModemDetected
|
|
60 |
@SYMTestExpectedResults Pass
|
|
61 |
@SYMTestType CT
|
|
62 |
*/
|
|
63 |
void CCTsyPhoneControlFU::TestNotifyModemDetected0001L()
|
|
64 |
{
|
|
65 |
|
|
66 |
OpenEtelServerL(EUseExtendedError);
|
|
67 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
68 |
OpenPhoneL();
|
|
69 |
|
|
70 |
RBuf8 data;
|
|
71 |
CleanupClosePushL(data);
|
|
72 |
|
|
73 |
//-------------------------------------------------------------------------
|
|
74 |
// TEST C: Successful completion request of
|
|
75 |
// RPhone::NotifyModemDetected.
|
|
76 |
//-------------------------------------------------------------------------
|
|
77 |
|
|
78 |
TRequestStatus reqStatus;
|
|
79 |
RPhone::TModemDetection detection(RPhone::EDetectedPresent);
|
|
80 |
iPhone.NotifyModemDetected(reqStatus, detection);
|
|
81 |
|
|
82 |
TRequestStatus mockLtsyStatus;
|
|
83 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
84 |
|
|
85 |
RPhone::TStatus status;
|
|
86 |
status.iModemDetected = RPhone::EDetectedNotPresent;
|
|
87 |
status.iMode = RPhone::EModeUnknown;
|
|
88 |
TMockLtsyData1<RPhone::TStatus> completeData(status);
|
|
89 |
completeData.SerialiseL(data);
|
|
90 |
iMockLTSY.CompleteL(EEtelPhoneNotifyModemDetected, KErrNone, data);
|
|
91 |
|
|
92 |
User::WaitForRequest(mockLtsyStatus);
|
|
93 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
94 |
AssertMockLtsyStatusL();
|
|
95 |
|
|
96 |
User::WaitForRequest(reqStatus);
|
|
97 |
ASSERT_EQUALS(KErrNone, reqStatus.Int());
|
|
98 |
ASSERT_EQUALS(detection, status.iModemDetected);
|
|
99 |
|
|
100 |
//-------------------------------------------------------------------------
|
|
101 |
// TEST E: Unsolicited completion of RPhone::NotifyModemDetected
|
|
102 |
// from LTSY.
|
|
103 |
//-------------------------------------------------------------------------
|
|
104 |
|
|
105 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
106 |
iMockLTSY.CompleteL(EEtelPhoneNotifyModemDetected, KErrNone, data);
|
|
107 |
User::WaitForRequest(mockLtsyStatus);
|
|
108 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
109 |
AssertMockLtsyStatusL();
|
|
110 |
|
|
111 |
CleanupStack::PopAndDestroy(2, this); // data, this
|
|
112 |
|
|
113 |
}
|
|
114 |
|
|
115 |
|
|
116 |
/**
|
|
117 |
@SYMTestCaseID BA-CTSY-PCON-TGPI-0001
|
|
118 |
@SYMComponent telephony_ctsy
|
|
119 |
@SYMTestCaseDesc Test support in CTSY for RTelServer::GetPhoneInfo
|
|
120 |
@SYMTestPriority High
|
|
121 |
@SYMTestActions Invokes RTelServer::GetPhoneInfo
|
|
122 |
@SYMTestExpectedResults Pass
|
|
123 |
@SYMTestType CT
|
|
124 |
*/
|
|
125 |
void CCTsyPhoneControlFU::TestGetPhoneInfo0001L()
|
|
126 |
{
|
|
127 |
|
|
128 |
OpenEtelServerL(EUseExtendedError);
|
|
129 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
130 |
|
|
131 |
//-------------------------------------------------------------------------
|
|
132 |
// Successful completion request of
|
|
133 |
// RTelServer::GetPhoneInfo.
|
|
134 |
//-------------------------------------------------------------------------
|
|
135 |
|
|
136 |
RTelServer::TPhoneInfo info;
|
|
137 |
TInt res = iTelServer.GetPhoneInfo(0, info);
|
|
138 |
ASSERT_EQUALS(KErrNone, res);
|
|
139 |
ASSERT_EQUALS(KMmTsyNetworkType, info.iNetworkType);
|
|
140 |
ASSERT_TRUE( 0 == KMmTsyPhoneName().Compare(info.iName) );
|
|
141 |
ASSERT_EQUALS(static_cast<TUint>(KMmTsyNumOfSupportedLines), info.iNumberOfLines);
|
|
142 |
ASSERT_EQUALS(static_cast<TUint>(KETelExtMultimodeV1), info.iExtensions);
|
|
143 |
|
|
144 |
CleanupStack::PopAndDestroy(this);
|
|
145 |
|
|
146 |
}
|
|
147 |
|
|
148 |
|
|
149 |
/**
|
|
150 |
@SYMTestCaseID BA-CTSY-PCON-TGPI-0003
|
|
151 |
@SYMComponent telephony_ctsy
|
|
152 |
@SYMTestCaseDesc Test support in CTSY for RTelServer::GetPhoneInfo with bad parameter data
|
|
153 |
@SYMTestPriority High
|
|
154 |
@SYMTestActions Invokes RTelServer::GetPhoneInfo with bad parameter data
|
|
155 |
@SYMTestExpectedResults Pass
|
|
156 |
@SYMTestType CT
|
|
157 |
*/
|
|
158 |
void CCTsyPhoneControlFU::TestGetPhoneInfo0003L()
|
|
159 |
{
|
|
160 |
|
|
161 |
OpenEtelServerL(EUseExtendedError);
|
|
162 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
163 |
|
|
164 |
//-------------------------------------------------------------------------
|
|
165 |
// Test C: Test passing out of bounds parameters to
|
|
166 |
// RTelServer::GetPhoneInfo
|
|
167 |
//-------------------------------------------------------------------------
|
|
168 |
|
|
169 |
RTelServer::TPhoneInfo info;
|
|
170 |
TInt res = iTelServer.GetPhoneInfo(1, info);
|
|
171 |
ASSERT_EQUALS(KErrNotFound, res);
|
|
172 |
|
|
173 |
// Done !
|
|
174 |
CleanupStack::PopAndDestroy(this);
|
|
175 |
|
|
176 |
}
|
|
177 |
|
|
178 |
|
|
179 |
/**
|
|
180 |
@SYMTestCaseID BA-CTSY-PCON-TISBM-0001
|
|
181 |
@SYMComponent telephony_ctsy
|
|
182 |
@SYMTestCaseDesc Test support in CTSY for RTelServer::IsSupportedByModule
|
|
183 |
@SYMTestPriority High
|
|
184 |
@SYMTestActions Invokes RTelServer::IsSupportedByModule
|
|
185 |
@SYMTestExpectedResults Pass
|
|
186 |
@SYMTestType CT
|
|
187 |
*/
|
|
188 |
void CCTsyPhoneControlFU::TestIsSupportedByModule0001L()
|
|
189 |
{
|
|
190 |
|
|
191 |
OpenEtelServerL(EUseExtendedError);
|
|
192 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
193 |
|
|
194 |
//-------------------------------------------------------------------------
|
|
195 |
// Successful completion request of
|
|
196 |
// RTelServer::IsSupportedByModule.
|
|
197 |
//-------------------------------------------------------------------------
|
|
198 |
|
|
199 |
TBool supported(EFalse);
|
|
200 |
TInt res = iTelServer.IsSupportedByModule(KMmTsyModuleName, KETelExtMultimodeV1, supported);
|
|
201 |
ASSERT_EQUALS(KErrNone, res);
|
|
202 |
ASSERT_EQUALS(static_cast<TBool>(ETrue), supported);
|
|
203 |
|
|
204 |
res = iTelServer.IsSupportedByModule(KMmTsyModuleName, 0, supported);
|
|
205 |
ASSERT_EQUALS(KErrNone, res);
|
|
206 |
ASSERT_EQUALS(static_cast<TBool>(EFalse), supported);
|
|
207 |
|
|
208 |
CleanupStack::PopAndDestroy(this);
|
|
209 |
|
|
210 |
}
|
|
211 |
|
|
212 |
|
|
213 |
/**
|
|
214 |
@SYMTestCaseID BA-CTSY-PCON-TISBM-0003
|
|
215 |
@SYMComponent telephony_ctsy
|
|
216 |
@SYMTestCaseDesc Test support in CTSY for RTelServer::IsSupportedByModule with bad parameter data
|
|
217 |
@SYMTestPriority High
|
|
218 |
@SYMTestActions Invokes RTelServer::IsSupportedByModule with bad parameter data
|
|
219 |
@SYMTestExpectedResults Pass
|
|
220 |
@SYMTestType CT
|
|
221 |
*/
|
|
222 |
void CCTsyPhoneControlFU::TestIsSupportedByModule0003L()
|
|
223 |
{
|
|
224 |
|
|
225 |
OpenEtelServerL(EUseExtendedError);
|
|
226 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
227 |
|
|
228 |
//-------------------------------------------------------------------------
|
|
229 |
// Test C: Test passing out of bounds parameters to
|
|
230 |
// RTelServer::IsSupportedByModule
|
|
231 |
//-------------------------------------------------------------------------
|
|
232 |
|
|
233 |
TBool supported(EFalse);
|
|
234 |
TInt res = iTelServer.IsSupportedByModule(KNullDesC, 0, supported);
|
|
235 |
ASSERT_EQUALS(KErrNotFound, res);
|
|
236 |
|
|
237 |
// Done !
|
|
238 |
CleanupStack::PopAndDestroy(this);
|
|
239 |
|
|
240 |
}
|
|
241 |
|
|
242 |
|
|
243 |
/**
|
|
244 |
@SYMTestCaseID BA-CTSY-PCON-PGC-0001
|
|
245 |
@SYMComponent telephony_ctsy
|
|
246 |
@SYMTestCaseDesc Test support in CTSY for RPhone::GetCaps
|
|
247 |
@SYMTestPriority High
|
|
248 |
@SYMTestActions Invokes RPhone::GetCaps
|
|
249 |
@SYMTestExpectedResults Pass
|
|
250 |
@SYMTestType CT
|
|
251 |
*/
|
|
252 |
void CCTsyPhoneControlFU::TestGetCaps0001L()
|
|
253 |
{
|
|
254 |
|
|
255 |
OpenEtelServerL(EUseExtendedError);
|
|
256 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
257 |
OpenPhoneL();
|
|
258 |
|
|
259 |
//-------------------------------------------------------------------------
|
|
260 |
// TEST C: Successful completion request of
|
|
261 |
// RPhone::GetCaps when result is not cached.
|
|
262 |
//-------------------------------------------------------------------------
|
|
263 |
|
|
264 |
RPhone::TCaps caps;
|
|
265 |
// function always returns KPhoneCoreCaps at the moment
|
|
266 |
TInt res = iPhone.GetCaps(caps);
|
|
267 |
ASSERT_EQUALS(KErrNone, res);
|
|
268 |
ASSERT_EQUALS(KPhoneCoreCaps, caps.iFlags);
|
|
269 |
AssertMockLtsyStatusL();
|
|
270 |
|
|
271 |
CleanupStack::PopAndDestroy(this);
|
|
272 |
|
|
273 |
}
|
|
274 |
|
|
275 |
|
|
276 |
/**
|
|
277 |
@SYMTestCaseID BA-CTSY-PCON-PGI-0001
|
|
278 |
@SYMComponent telephony_ctsy
|
|
279 |
@SYMTestCaseDesc Test support in CTSY for RPhone::GetInfo
|
|
280 |
@SYMTestPriority High
|
|
281 |
@SYMTestActions Invokes RPhone::GetInfo
|
|
282 |
@SYMTestExpectedResults Pass
|
|
283 |
@SYMTestType CT
|
|
284 |
*/
|
|
285 |
void CCTsyPhoneControlFU::TestGetInfo0001L()
|
|
286 |
{
|
|
287 |
|
|
288 |
OpenEtelServerL(EUseExtendedError);
|
|
289 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
290 |
OpenPhoneL();
|
|
291 |
|
|
292 |
RBuf8 data;
|
|
293 |
CleanupClosePushL(data);
|
|
294 |
|
|
295 |
//-------------------------------------------------------------------------
|
|
296 |
// Successful completion request of
|
|
297 |
// RPhone::GetInfo.
|
|
298 |
//-------------------------------------------------------------------------
|
|
299 |
|
|
300 |
RPhone::TPhoneInfo phoneInfo;
|
|
301 |
TInt res = iPhone.GetInfo(phoneInfo);
|
|
302 |
ASSERT_EQUALS(KErrNone, res);
|
|
303 |
ASSERT_EQUALS(RPhone::EDetectedPresent, phoneInfo.iDetection);
|
|
304 |
AssertMockLtsyStatusL();
|
|
305 |
|
|
306 |
// invoke phone info change
|
|
307 |
TRequestStatus mockLtsyStatus;
|
|
308 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
309 |
RPhone::TStatus status;
|
|
310 |
status.iModemDetected = RPhone::EDetectedNotPresent;
|
|
311 |
status.iMode = RPhone::EModeUnknown;
|
|
312 |
TMockLtsyData1<RPhone::TStatus> completeData(status);
|
|
313 |
completeData.SerialiseL(data);
|
|
314 |
iMockLTSY.CompleteL(EEtelPhoneNotifyModemDetected, KErrNone, data);
|
|
315 |
User::WaitForRequest(mockLtsyStatus);
|
|
316 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
317 |
AssertMockLtsyStatusL();
|
|
318 |
|
|
319 |
res = iPhone.GetInfo(phoneInfo);
|
|
320 |
ASSERT_EQUALS(KErrNone, res);
|
|
321 |
ASSERT_EQUALS(status.iModemDetected, phoneInfo.iDetection);
|
|
322 |
AssertMockLtsyStatusL();
|
|
323 |
|
|
324 |
CleanupStack::PopAndDestroy(2, this); // data, this
|
|
325 |
|
|
326 |
}
|
|
327 |
|
|
328 |
|
|
329 |
/**
|
|
330 |
@SYMTestCaseID BA-CTSY-PCON-PGS-0001
|
|
331 |
@SYMComponent telephony_ctsy
|
|
332 |
@SYMTestCaseDesc Test support in CTSY for RPhone::GetStatus
|
|
333 |
@SYMTestPriority High
|
|
334 |
@SYMTestActions Invokes RPhone::GetStatus
|
|
335 |
@SYMTestExpectedResults Pass
|
|
336 |
@SYMTestType CT
|
|
337 |
*/
|
|
338 |
void CCTsyPhoneControlFU::TestGetStatus0001L()
|
|
339 |
{
|
|
340 |
|
|
341 |
OpenEtelServerL(EUseExtendedError);
|
|
342 |
CleanupStack::PushL(TCleanupItem(Cleanup,this));
|
|
343 |
OpenPhoneL();
|
|
344 |
|
|
345 |
RBuf8 data;
|
|
346 |
CleanupClosePushL(data);
|
|
347 |
|
|
348 |
//-------------------------------------------------------------------------
|
|
349 |
// Successful completion request of
|
|
350 |
// RPhone::GetStatus.
|
|
351 |
//-------------------------------------------------------------------------
|
|
352 |
|
|
353 |
RPhone::TStatus status;
|
|
354 |
TInt res = iPhone.GetStatus(status);
|
|
355 |
ASSERT_EQUALS(KErrNone, res);
|
|
356 |
ASSERT_EQUALS(RPhone::EDetectedPresent, status.iModemDetected);
|
|
357 |
ASSERT_EQUALS(RPhone::EModeIdle, status.iMode);
|
|
358 |
AssertMockLtsyStatusL();
|
|
359 |
|
|
360 |
// invoke phone info change
|
|
361 |
TRequestStatus mockLtsyStatus;
|
|
362 |
iMockLTSY.NotifyTerminated(mockLtsyStatus);
|
|
363 |
RPhone::TStatus completeStatus;
|
|
364 |
completeStatus.iModemDetected = RPhone::EDetectedNotPresent;
|
|
365 |
completeStatus.iMode = RPhone::EModeUnknown;
|
|
366 |
TMockLtsyData1<RPhone::TStatus> completeData(completeStatus);
|
|
367 |
completeData.SerialiseL(data);
|
|
368 |
iMockLTSY.CompleteL(EEtelPhoneNotifyModemDetected, KErrNone, data);
|
|
369 |
User::WaitForRequest(mockLtsyStatus);
|
|
370 |
ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int());
|
|
371 |
AssertMockLtsyStatusL();
|
|
372 |
|
|
373 |
res = iPhone.GetStatus(status);
|
|
374 |
ASSERT_EQUALS(KErrNone, res);
|
|
375 |
ASSERT_EQUALS(status.iModemDetected, completeStatus.iModemDetected);
|
|
376 |
ASSERT_EQUALS(status.iMode, completeStatus.iMode);
|
|
377 |
AssertMockLtsyStatusL();
|
|
378 |
|
|
379 |
CleanupStack::PopAndDestroy(2, this); // data, this
|
|
380 |
|
|
381 |
}
|