74
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "ut_cphonestateidle.h"
|
|
19 |
#include <EUnitMacros.h>
|
|
20 |
#include <EUnitDecorators.h>
|
78
|
21 |
#include <apgtask.h>
|
74
|
22 |
#include <featmgr.h>
|
|
23 |
#include <coemain.h>
|
|
24 |
#include "cpeengineinfo.h"
|
|
25 |
#include "cphonestatemachinegsm.h"
|
|
26 |
#include "PEVirtualEngine.h"
|
|
27 |
#include "mock_cphoneviewcommandhandle.h"
|
|
28 |
#include "CPhoneStateMachine.h"
|
|
29 |
#include "MPhoneKeyEvents.h"
|
|
30 |
#include "CPhoneMainResourceResolver.h"
|
|
31 |
#include "phoneappcommands.hrh"
|
|
32 |
#include "cphonecustomizationvoip.h"
|
|
33 |
|
|
34 |
#include "CPhoneStateIdle.h"
|
|
35 |
#include "CPhoneStateIdle_Inherited.h"
|
|
36 |
|
|
37 |
#include <csmcmockcontext.h>
|
|
38 |
#include <msmcmockspecbuilder.h>
|
|
39 |
#include <MProfileEngine.h>
|
|
40 |
|
|
41 |
#include "phonerssbase.h"
|
|
42 |
#include <PhoneUI.rsg>
|
|
43 |
#include "TPhoneCmdParamInteger.h"
|
|
44 |
#include "tphonecmdparamkeycapture.h"
|
|
45 |
|
|
46 |
|
|
47 |
MProfileEngine * CreateProfileEngineL() {}
|
|
48 |
|
|
49 |
#include <w32std.h>
|
|
50 |
void RWsSession::SimulateKeyEvent(TKeyEvent) {}
|
|
51 |
void RWsSession::Flush() {}
|
|
52 |
RWsSession::RWsSession() {}
|
|
53 |
|
|
54 |
RWindowGroup::RWindowGroup() {}
|
|
55 |
|
|
56 |
MWsClientClass::MWsClientClass() {}
|
|
57 |
RWindowTreeNode::RWindowTreeNode() {}
|
|
58 |
|
|
59 |
// needed for mocking CPhoneMainResourceResolver::Instance()
|
|
60 |
class CPhoneMainResourceResolverMock : public CPhoneMainResourceResolver
|
|
61 |
{
|
|
62 |
|
|
63 |
};
|
|
64 |
|
|
65 |
|
|
66 |
// -----------------------------------------------------------------------------
|
|
67 |
// operator for comparing parameter expected and result value.
|
|
68 |
// -
|
|
69 |
// -----------------------------------------------------------------------------
|
|
70 |
//
|
|
71 |
|
|
72 |
TBool operator==(const TPhoneCommandParam& param1, const TPhoneCommandParam& param2 )
|
|
73 |
{
|
|
74 |
TBool ret( ETrue );
|
|
75 |
|
|
76 |
if ( param1.ParamId() == param2.ParamId() )
|
|
77 |
{
|
|
78 |
|
|
79 |
if ( TPhoneCommandParam::EPhoneParamIdInteger == param1.ParamId() )
|
|
80 |
{
|
|
81 |
const TPhoneCmdParamInteger &value1 = static_cast<const TPhoneCmdParamInteger&> (param1);
|
|
82 |
const TPhoneCmdParamInteger &value2 = static_cast<const TPhoneCmdParamInteger&> (param2);
|
|
83 |
if ( value1.Integer() != value2.Integer() )
|
|
84 |
{
|
|
85 |
ret = EFalse;
|
|
86 |
}
|
|
87 |
}
|
|
88 |
else
|
|
89 |
{
|
|
90 |
ret = ETrue; // just paramiId compared
|
|
91 |
}
|
|
92 |
}
|
|
93 |
return ret;
|
|
94 |
}
|
|
95 |
|
|
96 |
// - Construction -----------------------------------------------------------
|
|
97 |
|
|
98 |
ut_cphonestateidle* ut_cphonestateidle::NewL()
|
|
99 |
{
|
|
100 |
ut_cphonestateidle* self = ut_cphonestateidle::NewLC();
|
|
101 |
CleanupStack::Pop();
|
|
102 |
return self;
|
|
103 |
}
|
|
104 |
|
|
105 |
ut_cphonestateidle* ut_cphonestateidle::NewLC()
|
|
106 |
{
|
|
107 |
ut_cphonestateidle* self = new( ELeave ) ut_cphonestateidle();
|
|
108 |
CleanupStack::PushL( self );
|
|
109 |
self->ConstructL();
|
|
110 |
return self;
|
|
111 |
}
|
|
112 |
|
|
113 |
ut_cphonestateidle::~ut_cphonestateidle()
|
|
114 |
{
|
|
115 |
CSmcMockContext::Release();
|
|
116 |
}
|
|
117 |
|
|
118 |
ut_cphonestateidle::ut_cphonestateidle()
|
|
119 |
{
|
|
120 |
}
|
|
121 |
|
|
122 |
void ut_cphonestateidle::ConstructL()
|
|
123 |
{
|
|
124 |
CEUnitTestSuiteClass::ConstructL();
|
|
125 |
iMockContext = CSmcMockContext::InstanceL();
|
|
126 |
}
|
|
127 |
|
|
128 |
// - Test methods -----------------------------------------------------------
|
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
void ut_cphonestateidle::SetupL( )
|
|
133 |
{
|
|
134 |
iMockContext->InitializeL();
|
78
|
135 |
|
|
136 |
RWsSession wsSession;
|
|
137 |
iTask = new TApaTask(wsSession);
|
|
138 |
SmcDefaultValue<TApaTask>::SetL( *iTask );
|
74
|
139 |
iCoeEnvMock = new (ELeave ) CCoeEnv();
|
|
140 |
SmcDefaultValue<CCoeEnv*>::SetL( iCoeEnvMock );
|
|
141 |
|
|
142 |
iEngineInfoMock = CPEEngineInfo::NewL();
|
|
143 |
SmcDefaultValue<MPEEngineInfo*>::SetL( iEngineInfoMock );
|
|
144 |
|
|
145 |
iCPhoneMainResourceResolverMock = new ( ELeave ) CPhoneMainResourceResolverMock();
|
|
146 |
SmcDefaultValue<CPhoneMainResourceResolver*>::SetL( iCPhoneMainResourceResolverMock );
|
|
147 |
|
|
148 |
iViewCmdHandleMock = new CPhoneViewCommandHandleMock();
|
|
149 |
|
|
150 |
iStateMachineGsmMock = CPhoneStateMachineGSM::NewL( iViewCmdHandleMock );
|
|
151 |
|
|
152 |
iCustomizationMock =
|
|
153 |
CPhoneCustomizationVoip::NewL( *iStateMachineGsmMock, *iViewCmdHandleMock );
|
|
154 |
|
|
155 |
iStateIdle = CPhoneStateIdle_Inherited::NewL(
|
|
156 |
iStateMachineGsmMock, iViewCmdHandleMock, iCustomizationMock);
|
|
157 |
}
|
|
158 |
|
|
159 |
|
|
160 |
void ut_cphonestateidle::Teardown( )
|
|
161 |
{
|
|
162 |
delete iStateIdle;
|
|
163 |
iStateIdle = NULL;
|
|
164 |
delete iStateMachineGsmMock;
|
|
165 |
iStateMachineGsmMock = NULL;
|
|
166 |
delete iViewCmdHandleMock;
|
|
167 |
iViewCmdHandleMock = NULL;
|
|
168 |
delete iCustomizationMock;
|
|
169 |
iCustomizationMock = NULL;
|
|
170 |
|
|
171 |
delete iCPhoneMainResourceResolverMock;
|
|
172 |
iCPhoneMainResourceResolverMock = NULL;
|
|
173 |
SmcDefaultValue<CPhoneMainResourceResolver*>::Reset();
|
|
174 |
|
|
175 |
delete iEngineInfoMock;
|
|
176 |
iEngineInfoMock = NULL;
|
|
177 |
SmcDefaultValue<MPEEngineInfo*>::Reset();
|
|
178 |
iMockContext->Reset();
|
|
179 |
delete iCoeEnvMock;
|
|
180 |
iCoeEnvMock = NULL;
|
|
181 |
SmcDefaultValue<CCoeEnv*>::Reset();
|
78
|
182 |
SmcDefaultValue<TApaTask>::Reset();
|
|
183 |
delete iTask;
|
|
184 |
iTask = NULL;
|
74
|
185 |
}
|
|
186 |
|
|
187 |
|
|
188 |
void ut_cphonestateidle::T_IdlePhoneFocusLost_DiallerNotUsedL( )
|
|
189 |
{
|
|
190 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::IsNumberEntryUsedL" ).
|
|
191 |
ReturnsL( EFalse );
|
|
192 |
iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ).
|
|
193 |
WithL( EPhoneViewUpdateFSW );
|
|
194 |
iStateIdle->HandlePhoneFocusLostEventL();
|
|
195 |
EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() );
|
|
196 |
}
|
|
197 |
|
|
198 |
void ut_cphonestateidle::T_IdlePhoneFocusLost_DiallerUsedL( )
|
|
199 |
{
|
|
200 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::IsNumberEntryUsedL" ).
|
|
201 |
ReturnsL( ETrue );
|
|
202 |
// check that T_IdlePhoneFocusLost_DiallerUsedL is not called.
|
|
203 |
iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ).
|
|
204 |
WithL( T_IdlePhoneFocusLost_DiallerUsedL ).
|
|
205 |
TimesL(0);
|
|
206 |
iStateIdle->HandlePhoneFocusLostEventL();
|
|
207 |
EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() );
|
|
208 |
}
|
|
209 |
|
|
210 |
void ut_cphonestateidle::T_IdleEndKeyPressGeneratesCancelNotificationsL( )
|
|
211 |
{
|
|
212 |
iMockContext->ExpectCallL( "CPhoneState::IsAutoLockOn" ).
|
|
213 |
ReturnsL( EFalse );
|
|
214 |
iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ).
|
|
215 |
WithL( EPhoneViewCancelAllNotications ).
|
|
216 |
TimesL(1);
|
|
217 |
iMockContext->ExpectCallL( "CPhoneState::IsSimOk" ).
|
|
218 |
ReturnsL( ETrue ).
|
|
219 |
TimesL(1);
|
|
220 |
iStateIdle->HandleKeyMessageL( MPhoneKeyEvents::EPhoneKeyLongPress, EKeyNo );
|
|
221 |
EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() );
|
|
222 |
}
|
|
223 |
|
|
224 |
void ut_cphonestateidle::T_HandleKeyMessageL( )
|
|
225 |
{
|
|
226 |
_LIT( KPhoneNumber, "12345" );
|
|
227 |
HBufC* phoneNumber = KPhoneNumber().AllocLC();
|
|
228 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::IsNumberEntryUsedL" ).
|
|
229 |
ReturnsL( ETrue ).
|
|
230 |
TimesL(2);
|
|
231 |
iMockContext->ExpectCallL( "TPhoneCmdParamBoolean::Boolean" ).
|
|
232 |
ReturnsL( ETrue );
|
|
233 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::PhoneNumberFromEntryLC" ).
|
|
234 |
ReturnsL( phoneNumber );
|
|
235 |
iMockContext->ExpectCallL( "CPhoneState::IsSimOk" ).
|
|
236 |
ReturnsL( ETrue );
|
|
237 |
|
|
238 |
iStateIdle->HandleKeyMessageL( MPhoneKeyEvents::EPhoneKeyShortPress, EKeyYes );
|
|
239 |
EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() );
|
|
240 |
CleanupStack::Pop( phoneNumber );
|
|
241 |
}
|
|
242 |
|
|
243 |
void ut_cphonestateidle::T_HandleKeyMessageL_AppKeyL( )
|
|
244 |
{
|
|
245 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::IsNumberEntryUsedL" ).
|
|
246 |
ReturnsL( EFalse );
|
|
247 |
iMockContext->ExpectCallL( "CPhoneState::HandleCommandL" ).
|
|
248 |
WithL( EPhoneNumberAcqSecurityDialer );
|
|
249 |
|
|
250 |
iStateIdle->HandleKeyMessageL( MPhoneKeyEvents::EPhoneKeyShortPress, EKeyApplication0 );
|
|
251 |
EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() );
|
|
252 |
}
|
|
253 |
|
|
254 |
|
|
255 |
void ut_cphonestateidle::T_HandleKeyMessageL_AppKeyL_NEOpen( )
|
|
256 |
{
|
|
257 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::IsNumberEntryUsedL" ).
|
|
258 |
ReturnsL( ETrue );
|
|
259 |
iMockContext->ExpectCallL( "CPhoneState::HandleCommandL" ).
|
|
260 |
TimesL( 0 );
|
|
261 |
|
|
262 |
iStateIdle->HandleKeyMessageL( MPhoneKeyEvents::EPhoneKeyShortPress, EKeyApplication0 );
|
|
263 |
EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() );
|
|
264 |
}
|
|
265 |
|
|
266 |
void ut_cphonestateidle::T_HandleCommand_NumberAcqCmdCallL()
|
|
267 |
{
|
|
268 |
_LIT( KPhoneNumber, "12345" );
|
|
269 |
HBufC* phoneNumber = KPhoneNumber().AllocLC();
|
|
270 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::IsNumberEntryUsedL" ).
|
|
271 |
ReturnsL( ETrue );
|
|
272 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::PhoneNumberFromEntryLC" ).
|
|
273 |
ReturnsL( phoneNumber );
|
|
274 |
// SIM NOK
|
|
275 |
iMockContext->ExpectCallL( "CPhoneState::IsSimOk" ).
|
|
276 |
ReturnsL( EFalse );
|
|
277 |
iMockContext->ExpectCallL( "CPhoneStateMachine::SendPhoneEngineMessage" ).
|
|
278 |
WithL( MPEPhoneModel::EPEMessageCheckEmergencyNumber );
|
|
279 |
iStateIdle->HandleCommandL( EPhoneNumberAcqCmdCall );
|
|
280 |
|
|
281 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::IsNumberEntryUsedL" ).
|
|
282 |
ReturnsL( ETrue );
|
|
283 |
HBufC* phoneNumber2 = KPhoneNumber().AllocLC();
|
|
284 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::PhoneNumberFromEntryLC" ).
|
|
285 |
ReturnsL( phoneNumber2 );
|
|
286 |
// SIM OK
|
|
287 |
iMockContext->ExpectCallL( "CPhoneState::IsSimOk" ).
|
|
288 |
ReturnsL( ETrue );
|
|
289 |
iMockContext->ExpectCallL( "CPhoneState::DialVoiceCallL" );
|
|
290 |
|
|
291 |
iStateIdle->HandleCommandL( EPhoneNumberAcqCmdCall );
|
|
292 |
EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() );
|
|
293 |
CleanupStack::Pop( phoneNumber2 );
|
|
294 |
CleanupStack::Pop( phoneNumber );
|
|
295 |
}
|
|
296 |
|
|
297 |
void ut_cphonestateidle::T_HandleCommand_NumberAcqCmdSendCommandL()
|
|
298 |
{
|
|
299 |
_LIT( KPhoneNumber, "12345" );
|
|
300 |
HBufC* phoneNumber = KPhoneNumber().AllocLC();
|
|
301 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::IsNumberEntryUsedL" ).
|
|
302 |
ReturnsL( ETrue );
|
|
303 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::PhoneNumberFromEntryLC" ).
|
|
304 |
ReturnsL( phoneNumber );
|
|
305 |
// SIM NOK
|
|
306 |
iMockContext->ExpectCallL( "CPhoneState::IsSimOk" ).
|
|
307 |
ReturnsL( EFalse );
|
|
308 |
iMockContext->ExpectCallL( "CPhoneStateMachine::SendPhoneEngineMessage" ).
|
|
309 |
WithL( MPEPhoneModel::EPEMessageCheckEmergencyNumber );
|
|
310 |
iStateIdle->HandleCommandL( EPhoneNumberAcqCmdCall );
|
|
311 |
|
|
312 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::IsNumberEntryUsedL" ).
|
|
313 |
ReturnsL( ETrue );
|
|
314 |
HBufC* phoneNumber2 = KPhoneNumber().AllocLC();
|
|
315 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::PhoneNumberFromEntryLC" ).
|
|
316 |
ReturnsL( phoneNumber2 );
|
|
317 |
// SIM OK
|
|
318 |
iMockContext->ExpectCallL( "CPhoneState::IsSimOk" ).
|
|
319 |
ReturnsL( ETrue );
|
|
320 |
iMockContext->ExpectCallL( "CPhoneState::DialVoiceCallL" );
|
|
321 |
|
|
322 |
iStateIdle->HandleCommandL( EPhoneNumberAcqCmdSendCommand );
|
|
323 |
EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() );
|
|
324 |
CleanupStack::Pop( phoneNumber2 );
|
|
325 |
CleanupStack::Pop( phoneNumber );
|
|
326 |
}
|
|
327 |
|
|
328 |
void ut_cphonestateidle::T_DialL()
|
|
329 |
{
|
|
330 |
_LIT( KPhoneNumber, "23322" );
|
|
331 |
iMockContext->ExpectCallL( "CPEEngineInfoImpl::SetPhoneNumber" ).
|
|
332 |
WithL( KPhoneNumber() );
|
|
333 |
iMockContext->ExpectCallL( "FeatureManager::FeatureSupported" ).
|
|
334 |
WithL( KFeatureIdCsVideoTelephony ).
|
|
335 |
ReturnsL( ETrue );
|
|
336 |
|
|
337 |
iStateIdle->DialL_UserL(
|
|
338 |
KPhoneNumber,
|
|
339 |
CPhoneStateIdle::EPhoneNumberTypeVideo,
|
|
340 |
CPhoneStateIdle::EDialMethodUnknown );
|
|
341 |
|
|
342 |
iMockContext->ExpectCallL( "CPEEngineInfoImpl::SetPhoneNumber" ).
|
|
343 |
WithL( KPhoneNumber() );
|
|
344 |
|
|
345 |
iStateIdle->DialL_UserL(
|
|
346 |
KPhoneNumber,
|
|
347 |
CPhoneStateIdle::EPhoneNumberTypeCS,
|
|
348 |
CPhoneStateIdle::EDialMethodUnknown );
|
|
349 |
|
|
350 |
iMockContext->ExpectCallL( "CPEEngineInfoImpl::SetPhoneNumber" ).
|
|
351 |
WithL( KPhoneNumber() );
|
|
352 |
iMockContext->ExpectCallL( "CPhoneCustomizationVoip::HandleDialL" ).
|
|
353 |
WithL( KPhoneNumber() );
|
|
354 |
|
|
355 |
iStateIdle->DialL_UserL(
|
|
356 |
KPhoneNumber,
|
|
357 |
CPhoneStateIdle::EPhoneNumberTypeVoip,
|
|
358 |
CPhoneStateIdle::EDialMethodUnknown );
|
|
359 |
EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() );
|
|
360 |
}
|
|
361 |
|
|
362 |
void ut_cphonestateidle::T_DialVideoCallL()
|
|
363 |
{
|
|
364 |
_LIT( KPhoneNumber, "123456" );
|
|
365 |
HBufC* phoneNumber = KPhoneNumber().AllocLC();
|
|
366 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::IsNumberEntryUsedL" ).
|
|
367 |
ReturnsL( ETrue );
|
|
368 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::PhoneNumberFromEntryLC" ).
|
|
369 |
ReturnsL( phoneNumber );
|
|
370 |
iMockContext->ExpectCallL( "CPEEngineInfoImpl::SetPhoneNumber" ).
|
|
371 |
WithL( KPhoneNumber() );
|
78
|
372 |
iMockContext->ExpectCallL( "CPhoneState::DialMultimediaCall" );
|
74
|
373 |
|
|
374 |
//DialVideoCallL is used via handlecommand because it's private method.
|
|
375 |
iStateIdle->HandleCommandL( EPhoneNumberAcqCmdVideoCall );
|
|
376 |
|
|
377 |
_LIT( KSpeedDialNumber, "2" );
|
|
378 |
HBufC* phoneNumber2 = KSpeedDialNumber().AllocLC();
|
|
379 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::IsNumberEntryUsedL" ).
|
|
380 |
ReturnsL( ETrue );
|
|
381 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::PhoneNumberFromEntryLC" ).
|
|
382 |
ReturnsL( phoneNumber2 );
|
|
383 |
|
|
384 |
//DialVideoCallL is used via handlecommand because it's private method.
|
|
385 |
iStateIdle->HandleCommandL( EPhoneNumberAcqCmdVideoCall );
|
|
386 |
|
|
387 |
iMockContext->ExpectCallL( "CPhoneState::DialMultimediaCallL" ).
|
|
388 |
TimesL(0);
|
|
389 |
|
|
390 |
EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() );
|
|
391 |
CleanupStack::Pop( phoneNumber2 );
|
|
392 |
CleanupStack::Pop( phoneNumber );
|
|
393 |
}
|
|
394 |
|
|
395 |
// -----------------------------------------------------------------------------
|
|
396 |
// ut_cphonestateidle::T_HandleEndKeyPressSecurityNoteShownSimlessOfflineUndefL
|
|
397 |
// -check commands
|
|
398 |
// TRLM-7Q3HVZ
|
|
399 |
// -----------------------------------------------------------------------------
|
|
400 |
//
|
|
401 |
void ut_cphonestateidle::T_HandleEndKeyPressSecurityNoteShownSimlessOfflineUndefL( )
|
|
402 |
{
|
|
403 |
iMockContext->ExpectCallL( "CPhoneState::IsSimStateNotPresentWithSecurityModeEnabled" ).
|
|
404 |
TimesL(1).
|
|
405 |
ReturnsL(ETrue);
|
|
406 |
iMockContext->ExpectCallL( "FeatureManager::FeatureSupported" ).
|
|
407 |
TimesL(1).
|
|
408 |
ReturnsL(EFalse);
|
|
409 |
iMockContext->ExpectCallL( "CPhoneNumberEntryManager::IsNumberEntryUsedL" ).
|
|
410 |
TimesL(1).
|
|
411 |
ReturnsL(ETrue);
|
|
412 |
// ExecuteCommandL is expected to be called only 2 times because SecutiryNote is shown and
|
|
413 |
// SimlessOffline is Undefined.
|
|
414 |
iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ).
|
|
415 |
TimesL(2);
|
|
416 |
iMockContext->ExpectCallL( "CPhoneState::IsSimOk" ).
|
|
417 |
ReturnsL( ETrue ).
|
|
418 |
TimesL(1);
|
|
419 |
|
|
420 |
iStateIdle->HandleKeyMessageL( MPhoneKeyEvents::EPhoneKeyLongPress, EKeyNo );
|
|
421 |
EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() );
|
|
422 |
}
|
|
423 |
|
|
424 |
// -----------------------------------------------------------------------------
|
|
425 |
// ut_cphonestateidle::T_HandleEndKeyPressSecurityNoteShownSimlessOfflineDefinedL
|
|
426 |
// -check commands
|
|
427 |
// TRLM-7Q3HVZ
|
|
428 |
// -----------------------------------------------------------------------------
|
|
429 |
//
|
|
430 |
void ut_cphonestateidle::T_HandleEndKeyPressSecurityNoteShownSimlessOfflineDefinedL( )
|
|
431 |
{
|
|
432 |
iMockContext->ExpectCallL( "CPhoneState::IsSimStateNotPresentWithSecurityModeEnabled" ).
|
|
433 |
TimesL(1).
|
|
434 |
ReturnsL(ETrue);
|
|
435 |
iMockContext->ExpectCallL( "FeatureManager::FeatureSupported" ).
|
|
436 |
TimesL(1).
|
|
437 |
ReturnsL(ETrue);
|
|
438 |
iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ).
|
|
439 |
WithL(EPhoneViewRemovePhoneDialogs);
|
|
440 |
iMockContext->ExpectCallL( "CPhoneState::IsSimOk" ).
|
|
441 |
ReturnsL( ETrue ).
|
|
442 |
TimesL(1);
|
|
443 |
|
|
444 |
iStateIdle->HandleKeyMessageL( MPhoneKeyEvents::EPhoneKeyLongPress, EKeyNo );
|
|
445 |
EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() );
|
|
446 |
}
|
|
447 |
|
|
448 |
// -----------------------------------------------------------------------------
|
|
449 |
// ut_cphonestateidle::T_HandleNumberEntryClearedL
|
|
450 |
// -check commands
|
|
451 |
// EAYG-7N4BGE
|
|
452 |
// -----------------------------------------------------------------------------
|
|
453 |
//
|
|
454 |
void ut_cphonestateidle::T_HandleNumberEntryClearedL()
|
|
455 |
{
|
|
456 |
iMockContext->ExpectCallL( "CPhoneState::IsSimOk" ).
|
|
457 |
ReturnsL( ETrue );
|
|
458 |
iMockContext->ExpectCallL( "CPhoneStateMachineGSM::State" ).
|
|
459 |
ReturnsL<MPhoneState*>( iStateIdle );
|
|
460 |
iMockContext->ExpectCallL( "CPhoneState::RemoveDialogsAndSendPhoneToBackgroundL" );
|
|
461 |
|
|
462 |
iStateIdle->HandleNumberEntryClearedL_UserL();
|
|
463 |
EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() );
|
|
464 |
|
|
465 |
}
|
|
466 |
|
|
467 |
// - EUnit test table -------------------------------------------------------
|
|
468 |
EUNIT_BEGIN_TEST_TABLE(
|
|
469 |
ut_cphonestateidle,
|
|
470 |
"Add test suite description here.",
|
|
471 |
"UNIT" )
|
|
472 |
|
|
473 |
EUNIT_TEST(
|
|
474 |
"Test0 - T_IdlePhoneFocusLost_DiallerNotUsedL",
|
|
475 |
"",
|
|
476 |
"Test0",
|
|
477 |
"FUNCTIONALITY",
|
|
478 |
SetupL, T_IdlePhoneFocusLost_DiallerNotUsedL, Teardown)
|
|
479 |
|
|
480 |
EUNIT_TEST(
|
|
481 |
"Test1 - T_IdlePhoneFocusLost_DiallerUsedL",
|
|
482 |
"",
|
|
483 |
"Test1",
|
|
484 |
"FUNCTIONALITY",
|
|
485 |
SetupL, T_IdlePhoneFocusLost_DiallerUsedL, Teardown)
|
|
486 |
|
|
487 |
EUNIT_TEST(
|
|
488 |
"Test2 - End key generates cancel notification message",
|
|
489 |
"CPhoneIdleState",
|
|
490 |
"Test2",
|
|
491 |
"FUNCTIONALITY",
|
|
492 |
SetupL, T_IdleEndKeyPressGeneratesCancelNotificationsL, Teardown)
|
|
493 |
|
|
494 |
EUNIT_TEST(
|
|
495 |
"Test7 - HandleKeyMessageL",
|
|
496 |
"CPhoneIdleState",
|
|
497 |
"Test7",
|
|
498 |
"FUNCTIONALITY",
|
|
499 |
SetupL, T_HandleKeyMessageL, Teardown)
|
|
500 |
|
|
501 |
EUNIT_TEST(
|
|
502 |
"Test8 - HandleKeyMessageL_AppKeyL",
|
|
503 |
"CPhoneIdleState",
|
|
504 |
"Test8",
|
|
505 |
"FUNCTIONALITY",
|
|
506 |
SetupL, T_HandleKeyMessageL_AppKeyL, Teardown )
|
|
507 |
|
|
508 |
EUNIT_TEST(
|
|
509 |
"Test9 - HandleKeyMessageL_AppKeyL_NEOpen",
|
|
510 |
"CPhoneIdleState",
|
|
511 |
"Test9",
|
|
512 |
"FUNCTIONALITY",
|
|
513 |
SetupL, T_HandleKeyMessageL_AppKeyL_NEOpen, Teardown )
|
|
514 |
|
|
515 |
EUNIT_TEST(
|
|
516 |
"Test10 - HandleCommand_NumberAcqCmdCall",
|
|
517 |
"CPhoneIdleState",
|
|
518 |
"Test10",
|
|
519 |
"FUNCTIONALITY",
|
|
520 |
SetupL, T_HandleCommand_NumberAcqCmdCallL, Teardown)
|
|
521 |
|
|
522 |
EUNIT_TEST(
|
|
523 |
"Test11 - HandleCommand_NumberAcqCmdSendCommand",
|
|
524 |
"CPhoneIdleState",
|
|
525 |
"Test11",
|
|
526 |
"FUNCTIONALITY",
|
|
527 |
SetupL, T_HandleCommand_NumberAcqCmdSendCommandL, Teardown)
|
|
528 |
|
|
529 |
EUNIT_TEST(
|
|
530 |
"Test12 - DialL",
|
|
531 |
"CPhoneIdleState",
|
|
532 |
"Test12",
|
|
533 |
"FUNCTIONALITY",
|
|
534 |
SetupL, T_DialL, Teardown)
|
|
535 |
|
|
536 |
EUNIT_TEST(
|
|
537 |
"Test13 - DialVideoCallL",
|
|
538 |
"CPhoneIdleState",
|
|
539 |
"Test13",
|
|
540 |
"FUNCTIONALITY",
|
|
541 |
SetupL, T_DialVideoCallL, Teardown)
|
|
542 |
|
|
543 |
EUNIT_TEST(
|
|
544 |
"Test14 - HandleEndKeyPressSecurityNoteShownSimlessOfflineUndefL",
|
|
545 |
"CPhoneIdleState",
|
|
546 |
"Test14",
|
|
547 |
"FUNCTIONALITY",
|
|
548 |
SetupL, T_HandleEndKeyPressSecurityNoteShownSimlessOfflineUndefL, Teardown)
|
|
549 |
|
|
550 |
EUNIT_TEST(
|
|
551 |
"Test15 - HandleEndKeyPressSecurityNoteShownSimlessOfflineDefinedL",
|
|
552 |
"CPhoneIdleState",
|
|
553 |
"Test15",
|
|
554 |
"FUNCTIONALITY",
|
|
555 |
SetupL, T_HandleEndKeyPressSecurityNoteShownSimlessOfflineDefinedL, Teardown)
|
|
556 |
|
|
557 |
EUNIT_TEST(
|
|
558 |
"Test16 - HandleNumberEntryClearedL",
|
|
559 |
"CPhoneIdleState",
|
|
560 |
"Test16",
|
|
561 |
"FUNCTIONALITY",
|
|
562 |
SetupL, T_HandleNumberEntryClearedL, Teardown)
|
|
563 |
|
|
564 |
EUNIT_END_TEST_TABLE
|