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 |
// Test step definitions for the SignalStrength functional unit.
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@internalTechnology
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include "cctsyintegrationtestsignalstrength.h"
|
|
23 |
#include "cetelsessionmgr.h"
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
CCTSYIntegrationTestSignalStrengthBase::CCTSYIntegrationTestSignalStrengthBase(CEtelSessionMgr& aEtelSessionMgr)
|
|
28 |
: CCTSYIntegrationTestSuiteStepBase(aEtelSessionMgr), iNetworkTestHelper(*this)
|
|
29 |
/**
|
|
30 |
* Constructor
|
|
31 |
*/
|
|
32 |
{
|
|
33 |
}
|
|
34 |
|
|
35 |
CCTSYIntegrationTestSignalStrengthBase::~CCTSYIntegrationTestSignalStrengthBase()
|
|
36 |
/*
|
|
37 |
* Destructor
|
|
38 |
*/
|
|
39 |
{
|
|
40 |
}
|
|
41 |
|
|
42 |
/**************************************************************/
|
|
43 |
|
|
44 |
CCTSYIntegrationTestSignalStrength0001::CCTSYIntegrationTestSignalStrength0001(CEtelSessionMgr& aEtelSessionMgr)
|
|
45 |
: CCTSYIntegrationTestSignalStrengthBase(aEtelSessionMgr)
|
|
46 |
/**
|
|
47 |
* Constructor.
|
|
48 |
*/
|
|
49 |
{
|
|
50 |
SetTestStepName(CCTSYIntegrationTestSignalStrength0001::GetTestStepName());
|
|
51 |
}
|
|
52 |
|
|
53 |
CCTSYIntegrationTestSignalStrength0001::~CCTSYIntegrationTestSignalStrength0001()
|
|
54 |
/**
|
|
55 |
* Destructor.
|
|
56 |
*/
|
|
57 |
{
|
|
58 |
}
|
|
59 |
|
|
60 |
TVerdict CCTSYIntegrationTestSignalStrength0001::doTestStepL()
|
|
61 |
/**
|
|
62 |
* @SYMTestCaseID BA-CTSY-INT-SIGS-0001
|
|
63 |
* @SYMFssID BA/CTSY/SIGS-0001
|
|
64 |
* @SYMTestCaseDesc Get the signal strength
|
|
65 |
* @SYMTestPriority High
|
|
66 |
* @SYMTestActions RMobilePhone::NotifySignalStrengthChange
|
|
67 |
* @SYMTestExpectedResults Pass - Signal strength can be retrieved and notifications are received
|
|
68 |
* @SYMTestType CIT
|
|
69 |
* @SYMTestCaseDependencies live/automatic
|
|
70 |
*
|
|
71 |
* Reason for test: Check signal strength is updated
|
|
72 |
*
|
|
73 |
* @return - TVerdict code
|
|
74 |
*/
|
|
75 |
{
|
|
76 |
|
|
77 |
//
|
|
78 |
// SET UP
|
|
79 |
//
|
|
80 |
// Ensure phone has RMobilePhone::GetSignalCaps returns caps in set of KCapsGetSignalStrength | KCapsNotifySignalStrengthChange
|
|
81 |
RMobilePhone& phone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
|
|
82 |
|
|
83 |
// Call TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL
|
|
84 |
CHECK_EQUALS_L(iNetworkTestHelper.WaitForRegisteredOnHomeNetworkL(phone), KErrNone, _L("TNetworkTsyTestHelper::WaitForRegisteredOnHomeNetworkL returned with an error"));
|
|
85 |
|
|
86 |
TUint32 caps;
|
|
87 |
TInt err = phone.GetSignalCaps(caps);
|
|
88 |
|
|
89 |
CHECK_EQUALS_L( err, KErrNone, _L("RMobilePhone::GetSignalCaps failed."))
|
|
90 |
|
|
91 |
TUint neededCaps = RMobilePhone::KCapsGetSignalStrength |
|
|
92 |
RMobilePhone::KCapsNotifySignalStrengthChange;
|
|
93 |
|
|
94 |
CHECK_BITS_SET_L( caps, neededCaps, KNoUnwantedBits, _L("RMobilePhone::GetSignalCaps returned wrong mask") )
|
|
95 |
|
|
96 |
// Ensure RMobilePhone::GetNetworkRegistrationStatus returns ERegisteredOnHomeNetwork
|
|
97 |
|
|
98 |
TExtEtelRequestStatus reqNetworkRegStatus(phone, EMobilePhoneGetNetworkRegistrationStatus);
|
|
99 |
CleanupStack::PushL(reqNetworkRegStatus);
|
|
100 |
|
|
101 |
// We will give the phone some time to give us the expected status
|
|
102 |
RMobilePhone::TMobilePhoneRegistrationStatus phoneRegStatus;
|
|
103 |
|
|
104 |
phone.GetNetworkRegistrationStatus(reqNetworkRegStatus, phoneRegStatus);
|
|
105 |
err = WaitForRequestWithTimeOut(reqNetworkRegStatus, ETimeShort);
|
|
106 |
ASSERT_EQUALS( err, KErrNone,_L("RMobilePhone::GetNetworkRegistrationStatus timed out"));
|
|
107 |
|
|
108 |
CHECK_EQUALS_L( phoneRegStatus, RMobilePhone::ERegisteredOnHomeNetwork,
|
|
109 |
_L("RMobilePhone::GetNetworkRegistrationStatus did not return ERegisteredOnHomeNetwork ") )
|
|
110 |
|
|
111 |
//
|
|
112 |
// SET UP END
|
|
113 |
//
|
|
114 |
|
|
115 |
StartTest();
|
|
116 |
|
|
117 |
//
|
|
118 |
// TEST START
|
|
119 |
//
|
|
120 |
|
|
121 |
|
|
122 |
TInt32 sigStrength=0;
|
|
123 |
TInt8 sigBars=0;
|
|
124 |
|
|
125 |
TExtEtelRequestStatus reqGetSigStrengthStatus(phone, EMobilePhoneGetSignalStrength);
|
|
126 |
CleanupStack::PushL(reqGetSigStrengthStatus);
|
|
127 |
|
|
128 |
phone.GetSignalStrength( reqGetSigStrengthStatus, sigStrength, sigBars );
|
|
129 |
ASSERT_EQUALS( WaitForRequestWithTimeOut(reqGetSigStrengthStatus, ETimeMedium), KErrNone,
|
|
130 |
_L("RMobilePhone::GetSignalStrength timed out"))
|
|
131 |
ASSERT_EQUALS( reqGetSigStrengthStatus.Int(), KErrNone,
|
|
132 |
_L("RMobilePhone::GetSignalStrength returned with an error"))
|
|
133 |
|
|
134 |
// Check RMobilePhone::GetSignalStrength returns aSignalStrength > 0
|
|
135 |
ASSERT_TRUE( sigStrength > 0, _L("RMobilePhone::GetSignalStrength - signal strength was <= 0 ") )
|
|
136 |
|
|
137 |
// Check RMobilePhone::GetSignalStrength returns aBar > 0
|
|
138 |
ASSERT_TRUE( sigBars > 0,_L("RMobilePhone::GetSignalStrength - bars was <= 0 ") )
|
|
139 |
|
|
140 |
// === Listen for 30 seconds for a changes in signal strength. ===
|
|
141 |
TExtEtelRequestStatus reqSigStrengthChange( phone, EMobilePhoneNotifySignalStrengthChange );
|
|
142 |
CleanupStack::PushL(reqSigStrengthChange);
|
|
143 |
|
|
144 |
phone.NotifySignalStrengthChange(reqSigStrengthChange,sigStrength,sigBars);
|
|
145 |
err = WaitForRequestWithTimeOut(reqSigStrengthChange, ETimeShort);
|
|
146 |
|
|
147 |
// Check RMobilePhone::GetSignalStrength returns aSignalStrength > 0
|
|
148 |
phone.GetSignalStrength( reqGetSigStrengthStatus, sigStrength, sigBars );
|
|
149 |
ASSERT_EQUALS( WaitForRequestWithTimeOut(reqGetSigStrengthStatus, ETimeMedium), KErrNone,
|
|
150 |
_L("RMobilePhone::GetSignalStrength timed out"))
|
|
151 |
ASSERT_EQUALS( reqGetSigStrengthStatus.Int(), KErrNone,
|
|
152 |
_L("RMobilePhone::GetSignalStrength returned with an error"))
|
|
153 |
|
|
154 |
|
|
155 |
ASSERT_TRUE( sigStrength > 0, _L("RMobilePhone::GetSignalStrength - signal strength was <= 0 ") )
|
|
156 |
|
|
157 |
// Check RMobilePhone::GetSignalStrength returns aBar > 0
|
|
158 |
ASSERT_TRUE( sigBars > 0,_L("RMobilePhone::GetSignalStrength - bars was <= 0 ") )
|
|
159 |
|
|
160 |
|
|
161 |
//
|
|
162 |
// TEST END
|
|
163 |
//
|
|
164 |
|
|
165 |
StartCleanup();
|
|
166 |
|
|
167 |
//
|
|
168 |
// CleanupStack items
|
|
169 |
// reqSigStrengthChange
|
|
170 |
// reqGetSigStrengthStatus
|
|
171 |
// reqNetworkRegStatus
|
|
172 |
CleanupStack::PopAndDestroy(3, &reqNetworkRegStatus);
|
|
173 |
|
|
174 |
return TestStepResult();
|
|
175 |
}
|
|
176 |
|
|
177 |
TPtrC CCTSYIntegrationTestSignalStrength0001::GetTestStepName()
|
|
178 |
/**
|
|
179 |
* @return The test step name.
|
|
180 |
*/
|
|
181 |
{
|
|
182 |
return _L("CCTSYIntegrationTestSignalStrength0001");
|
|
183 |
}
|
|
184 |
|
|
185 |
|
|
186 |
|
|
187 |
CCTSYIntegrationTestSignalStrength0002::CCTSYIntegrationTestSignalStrength0002(CEtelSessionMgr& aEtelSessionMgr)
|
|
188 |
: CCTSYIntegrationTestSignalStrengthBase(aEtelSessionMgr)
|
|
189 |
/**
|
|
190 |
* Constructor.
|
|
191 |
*/
|
|
192 |
{
|
|
193 |
SetTestStepName(CCTSYIntegrationTestSignalStrength0002::GetTestStepName());
|
|
194 |
}
|
|
195 |
|
|
196 |
CCTSYIntegrationTestSignalStrength0002::~CCTSYIntegrationTestSignalStrength0002()
|
|
197 |
/**
|
|
198 |
* Destructor.
|
|
199 |
*/
|
|
200 |
{
|
|
201 |
}
|
|
202 |
|
|
203 |
TVerdict CCTSYIntegrationTestSignalStrength0002::doTestStepL()
|
|
204 |
/**
|
|
205 |
* @SYMTestCaseID BA-CTSY-INT-SIGS-0002
|
|
206 |
* @SYMFssID BA/CTSY/SIGS-0002
|
|
207 |
* @SYMTestCaseDesc Get signal caps.
|
|
208 |
* @SYMTestPriority High
|
|
209 |
* @SYMTestActions RMobilePhone::GetSignalCaps
|
|
210 |
* @SYMTestExpectedResults Pass - Signal caps retrieved.
|
|
211 |
* @SYMTestType CIT
|
|
212 |
* @SYMTestCaseDependencies live/automatic
|
|
213 |
*
|
|
214 |
* Reason for test: Verify signal caps are correct.
|
|
215 |
*
|
|
216 |
* @return - TVerdict code
|
|
217 |
*/
|
|
218 |
{
|
|
219 |
|
|
220 |
//
|
|
221 |
// SET UP
|
|
222 |
//
|
|
223 |
//Get signal caps.
|
|
224 |
//Verify signal caps are correct.
|
|
225 |
RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
|
|
226 |
|
|
227 |
|
|
228 |
|
|
229 |
//
|
|
230 |
// SET UP END
|
|
231 |
//
|
|
232 |
|
|
233 |
StartTest();
|
|
234 |
|
|
235 |
//
|
|
236 |
// TEST START
|
|
237 |
//
|
|
238 |
// Check RMobilePhone::GetSignalCaps returns caps in set of
|
|
239 |
// KCapsGetSignalStrength | KCapsNotifySignalStrengthChange
|
|
240 |
TUint32 signalCaps;
|
|
241 |
ASSERT_EQUALS(mobilePhone.GetSignalCaps(signalCaps), KErrNone,
|
|
242 |
_L("RMobilePhone::GetSignalCaps returned error"))
|
|
243 |
TUint32 expectedCaps =
|
|
244 |
RMobilePhone::KCapsGetSignalStrength
|
|
245 |
| RMobilePhone::KCapsNotifySignalStrengthChange;
|
|
246 |
TUint32 unwantedCaps = 0;
|
|
247 |
|
|
248 |
ASSERT_BITS_SET(signalCaps, expectedCaps, unwantedCaps, _L("RMobilePhone::GetSignalCaps returned incorrect caps"))
|
|
249 |
|
|
250 |
|
|
251 |
|
|
252 |
|
|
253 |
//
|
|
254 |
// TEST END
|
|
255 |
//
|
|
256 |
|
|
257 |
StartCleanup();
|
|
258 |
|
|
259 |
|
|
260 |
return TestStepResult();
|
|
261 |
}
|
|
262 |
|
|
263 |
TPtrC CCTSYIntegrationTestSignalStrength0002::GetTestStepName()
|
|
264 |
/**
|
|
265 |
* @return The test step name.
|
|
266 |
*/
|
|
267 |
{
|
|
268 |
return _L("CCTSYIntegrationTestSignalStrength0002");
|
|
269 |
}
|
|
270 |
|
|
271 |
|
|
272 |
|