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 PhonePower functional unit.
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@internalTechnology
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include "cctsyintegrationtestphonepower.h"
|
|
23 |
#include "cetelsessionmgr.h"
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
CCTSYIntegrationTestPhonePowerBase::CCTSYIntegrationTestPhonePowerBase(CEtelSessionMgr& aEtelSessionMgr)
|
|
28 |
: CCTSYIntegrationTestSuiteStepBase(aEtelSessionMgr), iPhoneTsyTestHelper(*this)
|
|
29 |
/**
|
|
30 |
* Constructor
|
|
31 |
*/
|
|
32 |
{
|
|
33 |
}
|
|
34 |
|
|
35 |
CCTSYIntegrationTestPhonePowerBase::~CCTSYIntegrationTestPhonePowerBase()
|
|
36 |
/*
|
|
37 |
* Destructor
|
|
38 |
*/
|
|
39 |
{
|
|
40 |
}
|
|
41 |
|
|
42 |
|
|
43 |
CCTSYIntegrationTestPhonePower0001::CCTSYIntegrationTestPhonePower0001(CEtelSessionMgr& aEtelSessionMgr)
|
|
44 |
: CCTSYIntegrationTestPhonePowerBase(aEtelSessionMgr)
|
|
45 |
/**
|
|
46 |
* Constructor.
|
|
47 |
*/
|
|
48 |
{
|
|
49 |
SetTestStepName(CCTSYIntegrationTestPhonePower0001::GetTestStepName());
|
|
50 |
}
|
|
51 |
|
|
52 |
CCTSYIntegrationTestPhonePower0001::~CCTSYIntegrationTestPhonePower0001()
|
|
53 |
/**
|
|
54 |
* Destructor.
|
|
55 |
*/
|
|
56 |
{
|
|
57 |
}
|
|
58 |
|
|
59 |
TVerdict CCTSYIntegrationTestPhonePower0001::doTestStepL()
|
|
60 |
/**
|
|
61 |
* @SYMTestCaseID BA-CTSY-INT-PP-0001
|
|
62 |
* @SYMFssID BA/CTSY/PP-0001
|
|
63 |
* @SYMTestCaseDesc Get battery capabilities and information. Verify capabilities are correct and charge level is a valid percentage
|
|
64 |
* @SYMTestPriority High
|
|
65 |
* @SYMTestActions RMobilePhone::GetBatteryCaps, RMobilePhone::GetBatteryInfo
|
|
66 |
* @SYMTestExpectedResults Pass - Battery caps and information returned.
|
|
67 |
* @SYMTestType CIT
|
|
68 |
* @SYMTestCaseDependencies live/automatic
|
|
69 |
*
|
|
70 |
* Reason for test: Verify capabilities are correct and charge level is a valid percentage.
|
|
71 |
*
|
|
72 |
* @return - TVerdict code
|
|
73 |
*/
|
|
74 |
{
|
|
75 |
|
|
76 |
//
|
|
77 |
// SET UP
|
|
78 |
//
|
|
79 |
// Get the battery capabilities and information.
|
|
80 |
// Verify capabilities are correct and charge level is a valid percentage.
|
|
81 |
|
|
82 |
RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
|
|
83 |
|
|
84 |
//
|
|
85 |
// SET UP END
|
|
86 |
//
|
|
87 |
|
|
88 |
StartTest();
|
|
89 |
|
|
90 |
//
|
|
91 |
// TEST START
|
|
92 |
//
|
|
93 |
|
|
94 |
|
|
95 |
// Check RMobilePhone::GetBatteryCaps returns caps in set of KCapsGetBatteryInfo | KCapsNotifyBatteryInfoChange
|
|
96 |
TUint32 batteryCaps;
|
|
97 |
ASSERT_EQUALS(mobilePhone.GetBatteryCaps(batteryCaps), KErrNone,
|
|
98 |
_L("RMobilePhone::GetBatteryCaps returned error"))
|
|
99 |
TUint32 expectedCaps =
|
|
100 |
RMobilePhone::KCapsGetBatteryInfo
|
|
101 |
| RMobilePhone::KCapsNotifyBatteryInfoChange;
|
|
102 |
TUint32 unwantedCaps = 0;
|
|
103 |
|
|
104 |
ASSERT_BITS_SET(batteryCaps, expectedCaps, unwantedCaps, _L("RMobilePhone::GetBatteryCaps returned incorrect caps"))
|
|
105 |
|
|
106 |
TExtEtelRequestStatus requestStatus(mobilePhone,EMobilePhoneGetBatteryInfo);
|
|
107 |
RMobilePhone::TMobilePhoneBatteryInfoV1 batteryInfo;
|
|
108 |
|
|
109 |
// Check RMobilePhone::GetBatteryInfo returns aInfo.iStatus = EPoweredByBattery
|
|
110 |
// Check RMobilePhone::GetBatteryInfo returns aInfo.iChargeLevel > 0 but <= 100
|
|
111 |
mobilePhone.GetBatteryInfo(requestStatus, batteryInfo);
|
|
112 |
ASSERT_EQUALS(WaitForRequestWithTimeOut(requestStatus, ETimeShort),
|
|
113 |
KErrNone, _L("RMobilePhone::GetBatteryInfo did not complete."))
|
|
114 |
ASSERT_EQUALS(requestStatus.Int(),KErrNone ,
|
|
115 |
_L("RMobilePhone::GetBatteryInfo completed with incorrect error"))
|
|
116 |
ASSERT_EQUALS(batteryInfo.iStatus,RMobilePhone::EPoweredByBattery,
|
|
117 |
_L("RMobilePhone::GetBatteryInfo returned unexpected battery status"))
|
|
118 |
ASSERT_TRUE(batteryInfo.iChargeLevel > 0 && batteryInfo.iChargeLevel <= 100 ,
|
|
119 |
_L("RMobilePhone::GetBatteryInfo returned incorrect charge level"))
|
|
120 |
|
|
121 |
|
|
122 |
//
|
|
123 |
// TEST END
|
|
124 |
//
|
|
125 |
|
|
126 |
StartCleanup();
|
|
127 |
|
|
128 |
|
|
129 |
return TestStepResult();
|
|
130 |
}
|
|
131 |
|
|
132 |
TPtrC CCTSYIntegrationTestPhonePower0001::GetTestStepName()
|
|
133 |
/**
|
|
134 |
* @return The test step name.
|
|
135 |
*/
|
|
136 |
{
|
|
137 |
return _L("CCTSYIntegrationTestPhonePower0001");
|
|
138 |
}
|
|
139 |
|
|
140 |
|
|
141 |
|
|
142 |
CCTSYIntegrationTestPhonePower0002::CCTSYIntegrationTestPhonePower0002(CEtelSessionMgr& aEtelSessionMgr)
|
|
143 |
: CCTSYIntegrationTestPhonePowerBase(aEtelSessionMgr)
|
|
144 |
/**
|
|
145 |
* Constructor.
|
|
146 |
*/
|
|
147 |
{
|
|
148 |
SetTestStepName(CCTSYIntegrationTestPhonePower0002::GetTestStepName());
|
|
149 |
}
|
|
150 |
|
|
151 |
CCTSYIntegrationTestPhonePower0002::~CCTSYIntegrationTestPhonePower0002()
|
|
152 |
/**
|
|
153 |
* Destructor.
|
|
154 |
*/
|
|
155 |
{
|
|
156 |
}
|
|
157 |
|
|
158 |
TVerdict CCTSYIntegrationTestPhonePower0002::doTestStepL()
|
|
159 |
/**
|
|
160 |
* @SYMTestCaseID BA-CTSY-INT-PP-0002
|
|
161 |
* @SYMFssID BA/CTSY/PP-0002
|
|
162 |
* @SYMTestCaseDesc Plug and unplug the phone charger.
|
|
163 |
* @SYMTestPriority High
|
|
164 |
* @SYMTestActions RMobilePhone::GetBatteryInfo
|
|
165 |
* @SYMTestExpectedResults Pass - Battery info changes when charger is plugged and unplugged.
|
|
166 |
* @SYMTestType CIT
|
|
167 |
* @SYMTestCaseDependencies live/manual
|
|
168 |
*
|
|
169 |
* Reason for test: Verify battery info change notifications received.
|
|
170 |
*
|
|
171 |
* @return - TVerdict code
|
|
172 |
*/
|
|
173 |
{
|
|
174 |
|
|
175 |
//
|
|
176 |
// SET UP
|
|
177 |
//
|
|
178 |
|
|
179 |
RMobilePhone& mobilePhone = iEtelSessionMgr.GetPhoneL(KMainServer, KMainPhone);
|
|
180 |
|
|
181 |
// Ensure RMobilePhone::GetBatteryCaps returns caps in set of KCapsGetBatteryInfo | KCapsNotifyBatteryInfoChange
|
|
182 |
TUint32 caps;
|
|
183 |
|
|
184 |
CHECK_EQUALS_L(mobilePhone.GetBatteryCaps(caps), KErrNone, _L("RMobilePhone::GetBatteryCaps return value is not KErrNone"));
|
|
185 |
|
|
186 |
TUint32 expectedCaps = RMobilePhone::KCapsGetBatteryInfo | RMobilePhone::KCapsNotifyBatteryInfoChange;
|
|
187 |
CHECK_BITS_SET_L(caps, expectedCaps, KNoUnwantedBits, _L("RMobilePhone::GetBatteryCaps returned wrong caps"));
|
|
188 |
|
|
189 |
// Ensure charger is plugged into the phone.
|
|
190 |
TBuf<120> plugPrompt(_L("Ensure charger is plugged into the phone"));
|
|
191 |
DisplayUserInteractionPromptL(plugPrompt); // 30 seconds
|
|
192 |
|
|
193 |
// Ensure RMobilePhone::GetBatteryInfo returns aInfo.iStatus = EBatteryConnectedButExternallyPowered
|
|
194 |
TExtEtelRequestStatus getBatteryInfoStatus(mobilePhone, EMobilePhoneGetBatteryInfo);
|
|
195 |
CleanupStack::PushL(getBatteryInfoStatus);
|
|
196 |
RMobilePhone::TMobilePhoneBatteryInfoV1 info;
|
|
197 |
|
|
198 |
mobilePhone.GetBatteryInfo(getBatteryInfoStatus, info);
|
|
199 |
|
|
200 |
CHECK_EQUALS_L(WaitForRequestWithTimeOut(getBatteryInfoStatus, ETimeShort), KErrNone, _L("RMobilePhone::GetBatteryInfo timed-out"));
|
|
201 |
CHECK_EQUALS_L(getBatteryInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetBatteryInfo returned with an error"));
|
|
202 |
CHECK_EQUALS_L(info.iStatus, RMobilePhone::EBatteryConnectedButExternallyPowered, _L("RMobilePhone::GetBatteryInfo idServiceStatus is not RMobilePhone::EBatteryConnectedButExternallyPowered"));
|
|
203 |
|
|
204 |
//
|
|
205 |
// SET UP END
|
|
206 |
//
|
|
207 |
|
|
208 |
StartTest();
|
|
209 |
|
|
210 |
//
|
|
211 |
// TEST START
|
|
212 |
//
|
|
213 |
|
|
214 |
// Post notification for RMobilePhone::NotifyBatteryInfoChange
|
|
215 |
TExtEtelRequestStatus notifyBatteryInfoChangeStatus(mobilePhone, EMobilePhoneNotifyBatteryInfoChange);
|
|
216 |
CleanupStack::PushL(notifyBatteryInfoChangeStatus);
|
|
217 |
RMobilePhone::TMobilePhoneBatteryInfoV1 notifyInfo;
|
|
218 |
mobilePhone.NotifyBatteryInfoChange(notifyBatteryInfoChangeStatus, notifyInfo);
|
|
219 |
|
|
220 |
// Unplug the phone charger
|
|
221 |
TBuf<120> unplugPrompt(_L("Ensure charger is unplugged from the phone"));
|
|
222 |
DisplayUserInteractionPromptL(unplugPrompt); // 30 seconds
|
|
223 |
|
|
224 |
// Check RMobilePhone::NotifyBatteryInfoChange completes with aInfo.iStatus = EPoweredByBattery
|
|
225 |
// Check RMobilePhone::NotifyBatteryInfoChange completes with aInfo.iChargeLevel > 0 but <= 100
|
|
226 |
RMobilePhone::TMobilePhoneBatteryInfoV1 expectedInfo = notifyInfo;
|
|
227 |
expectedInfo.iStatus = RMobilePhone::EPoweredByBattery;
|
|
228 |
|
|
229 |
TCmpBase<RMobilePhone::TMobilePhoneBatteryInfoV1> phoneBatteryInfoComp(notifyInfo, expectedInfo, *this);
|
|
230 |
iPhoneTsyTestHelper.WaitForMobilePhoneNotifyBatteryInfoChange(mobilePhone,
|
|
231 |
notifyBatteryInfoChangeStatus,
|
|
232 |
phoneBatteryInfoComp,
|
|
233 |
KErrNone);
|
|
234 |
|
|
235 |
ASSERT_TRUE(notifyInfo.iChargeLevel>0 && notifyInfo.iChargeLevel<=100, _L("RMobilePhone::GetBatteryInfo aInfo.iChargeLevel is not > 0 and <= 100"));
|
|
236 |
|
|
237 |
// Check RMobilePhone::GetBatteryInfo returns aInfo.iStatus = EPoweredByBattery
|
|
238 |
mobilePhone.GetBatteryInfo(getBatteryInfoStatus, info);
|
|
239 |
|
|
240 |
ASSERT_EQUALS(WaitForRequestWithTimeOut(getBatteryInfoStatus, ETimeShort), KErrNone, _L("RMobilePhone::GetBatteryInfo timed-out"));
|
|
241 |
ASSERT_EQUALS(getBatteryInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetBatteryInfo returned with an error"));
|
|
242 |
ASSERT_EQUALS(info.iStatus, RMobilePhone::EPoweredByBattery, _L("RMobilePhone::GetBatteryInfo idServiceStatus is not RMobilePhone::EPoweredByBattery"));
|
|
243 |
|
|
244 |
// Check RMobilePhone::GetBatteryInfo returns aInfo.iChargeLevel > 0 but <= 100
|
|
245 |
ASSERT_TRUE(info.iChargeLevel>0 && info.iChargeLevel<=100, _L("RMobilePhone::GetBatteryInfo aInfo.iChargeLevel is not > 0 and <= 100"));
|
|
246 |
|
|
247 |
// Repost notification for RMobilePhone::NotifyBatteryInfoChange
|
|
248 |
mobilePhone.NotifyBatteryInfoChange(notifyBatteryInfoChangeStatus, notifyInfo);
|
|
249 |
|
|
250 |
// Plug in the phone charger
|
|
251 |
DisplayUserInteractionPromptL(plugPrompt); // 30 seconds
|
|
252 |
|
|
253 |
// Check RMobilePhone::NotifyBatteryInfoChange completes with aInfo.iStatus = EBatteryConnectedButExternallyPowered
|
|
254 |
// Check RMobilePhone::NotifyBatteryInfoChange completes with aInfo.iChargeLevel > 0 but <= 100
|
|
255 |
expectedInfo.iStatus = RMobilePhone::EBatteryConnectedButExternallyPowered;
|
|
256 |
|
|
257 |
TCmpBase<RMobilePhone::TMobilePhoneBatteryInfoV1> phoneBatteryInfoComp2(notifyInfo, expectedInfo, *this);
|
|
258 |
iPhoneTsyTestHelper.WaitForMobilePhoneNotifyBatteryInfoChange(mobilePhone,
|
|
259 |
notifyBatteryInfoChangeStatus,
|
|
260 |
phoneBatteryInfoComp2,
|
|
261 |
KErrNone);
|
|
262 |
|
|
263 |
ASSERT_TRUE(notifyInfo.iChargeLevel>0 && notifyInfo.iChargeLevel<=100, _L("RMobilePhone::GetBatteryInfo aInfo.iChargeLevel is not > 0 and <= 100"));
|
|
264 |
|
|
265 |
// Check RMobilePhone::GetBatteryInfo returns aInfo.iStatus = EBatteryConnectedButExternallyPowered
|
|
266 |
mobilePhone.GetBatteryInfo(getBatteryInfoStatus, info);
|
|
267 |
|
|
268 |
ASSERT_EQUALS(WaitForRequestWithTimeOut(getBatteryInfoStatus, ETimeShort), KErrNone, _L("RMobilePhone::GetBatteryInfo timed-out"));
|
|
269 |
ASSERT_EQUALS(getBatteryInfoStatus.Int(), KErrNone, _L("RMobilePhone::GetBatteryInfo returned with an error"));
|
|
270 |
ASSERT_EQUALS(info.iStatus, RMobilePhone::EBatteryConnectedButExternallyPowered, _L("RMobilePhone::GetBatteryInfo idServiceStatus is not RMobilePhone::EBatteryConnectedButExternallyPowered"));
|
|
271 |
|
|
272 |
// Check RMobilePhone::GetBatteryInfo returns aInfo.iChargeLevel > 0 but <= 100
|
|
273 |
ASSERT_TRUE(info.iChargeLevel>0 && info.iChargeLevel<=100, _L("RMobilePhone::GetBatteryInfo aInfo.iChargeLevel is not > 0 and <= 100"));
|
|
274 |
|
|
275 |
//
|
|
276 |
// TEST END
|
|
277 |
//
|
|
278 |
|
|
279 |
StartCleanup();
|
|
280 |
|
|
281 |
CleanupStack::PopAndDestroy(¬ifyBatteryInfoChangeStatus);
|
|
282 |
CleanupStack::PopAndDestroy(&getBatteryInfoStatus);
|
|
283 |
|
|
284 |
return TestStepResult();
|
|
285 |
}
|
|
286 |
|
|
287 |
TPtrC CCTSYIntegrationTestPhonePower0002::GetTestStepName()
|
|
288 |
/**
|
|
289 |
* @return The test step name.
|
|
290 |
*/
|
|
291 |
{
|
|
292 |
return _L("CCTSYIntegrationTestPhonePower0002");
|
|
293 |
}
|
|
294 |
|
|
295 |
|
|
296 |
|