|
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 #include <csmcmockcontext.h> |
|
18 #include <smcdefaultvalue.h> |
|
19 #include <msmcmockspecbuilder.h> |
|
20 #include <smcobjecttotypemapper.h> |
|
21 #include <EUnitMacros.h> |
|
22 #include <EUnitDecorators.h> |
|
23 #include <featmgr.h> |
|
24 #include "ut_cphoneemergency.h" |
|
25 #include "CPhoneMainResourceResolver.h" |
|
26 #include "CPhoneStateMachineGSM.h" |
|
27 #include "mock_cphoneviewcommandhandle.h" |
|
28 #include "PEVirtualEngine.h" |
|
29 #include "MPhoneKeyEvents.h" |
|
30 #include "TPhoneCommandParam.h" |
|
31 #include "TPhoneCmdParamCallHeaderData.h" |
|
32 #include "TPhoneCmdParamAudioOutput.h" |
|
33 #include "cpeengineinfoimpl.h" |
|
34 #include "phonerssbase.h" |
|
35 #include "phonestatedefinitionsgsm.h" |
|
36 #include "TPhoneCmdParamInteger.h" |
|
37 #include "CPhoneEmergency.h" |
|
38 |
|
39 // needed for mocking CPhoneMainResourceResolver::Instance() |
|
40 class CPhoneMainResourceResolverMock : public CPhoneMainResourceResolver |
|
41 { |
|
42 }; |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // operator for comparing parameter expected and result value. |
|
46 // - |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 TBool operator==(const TPhoneCommandParam& param1, const TPhoneCommandParam& param2 ) |
|
50 { |
|
51 TBool ret( EFalse ); |
|
52 |
|
53 if ( param1.ParamId() == param2.ParamId() ) |
|
54 { |
|
55 if ( TPhoneCommandParam::EPhoneParamIdBoolean == param1.ParamId() ) |
|
56 { |
|
57 const TPhoneCmdParamBoolean &value1 = static_cast<const TPhoneCmdParamBoolean&> (param1); |
|
58 const TPhoneCmdParamBoolean &value2 = static_cast<const TPhoneCmdParamBoolean&> (param2); |
|
59 if ( value1.Boolean() == value2.Boolean() ) |
|
60 { |
|
61 ret = ETrue; |
|
62 } |
|
63 } |
|
64 else if ( TPhoneCommandParam::EPhoneParamIdCallHeaderData == param1.ParamId() ) |
|
65 { |
|
66 const TPhoneCmdParamCallHeaderData &value1 = static_cast<const TPhoneCmdParamCallHeaderData&> (param1); |
|
67 const TPhoneCmdParamCallHeaderData &value2 = static_cast<const TPhoneCmdParamCallHeaderData&> (param2); |
|
68 if ( value1.CallState() == value2.CallState() ) |
|
69 { |
|
70 ret = ETrue; |
|
71 } |
|
72 } |
|
73 else if ( TPhoneCommandParam::EPhoneParamIdInteger == param1.ParamId() ) |
|
74 { |
|
75 const TPhoneCmdParamInteger &value1 = static_cast<const TPhoneCmdParamInteger&> (param1); |
|
76 const TPhoneCmdParamInteger &value2 = static_cast<const TPhoneCmdParamInteger&> (param2); |
|
77 if ( value1.Integer() == value2.Integer() ) |
|
78 { |
|
79 ret = ETrue; |
|
80 } |
|
81 } |
|
82 else if ( TPhoneCommandParam::EPhoneParamIdAudioOutput == param1.ParamId() ) |
|
83 { |
|
84 const TPhoneCmdParamAudioOutput &value1 = static_cast<const TPhoneCmdParamAudioOutput&> (param1); |
|
85 const TPhoneCmdParamAudioOutput &value2 = static_cast<const TPhoneCmdParamAudioOutput&> (param2); |
|
86 if ( value1.AudioOutput() == value2.AudioOutput() ) |
|
87 { |
|
88 ret = ETrue; |
|
89 } |
|
90 } |
|
91 else |
|
92 { |
|
93 ret = ETrue; // just paramiId compared |
|
94 } |
|
95 } |
|
96 return ret; |
|
97 } |
|
98 |
|
99 // - Construction ----------------------------------------------------------- |
|
100 |
|
101 ut_cphoneemergency* ut_cphoneemergency::NewL() |
|
102 { |
|
103 ut_cphoneemergency* self = ut_cphoneemergency::NewLC(); |
|
104 CleanupStack::Pop(); |
|
105 return self; |
|
106 } |
|
107 |
|
108 ut_cphoneemergency* ut_cphoneemergency::NewLC() |
|
109 { |
|
110 ut_cphoneemergency* self = new( ELeave ) ut_cphoneemergency(); |
|
111 CleanupStack::PushL( self ); |
|
112 self->ConstructL(); |
|
113 return self; |
|
114 } |
|
115 |
|
116 ut_cphoneemergency::~ut_cphoneemergency() |
|
117 { |
|
118 CSmcMockContext::Release(); |
|
119 } |
|
120 |
|
121 ut_cphoneemergency::ut_cphoneemergency() |
|
122 { |
|
123 } |
|
124 |
|
125 void ut_cphoneemergency::ConstructL() |
|
126 { |
|
127 CEUnitTestSuiteClass::ConstructL(); |
|
128 iMockContext = CSmcMockContext::InstanceL(); |
|
129 } |
|
130 |
|
131 // - Test methods ----------------------------------------------------------- |
|
132 |
|
133 |
|
134 |
|
135 void ut_cphoneemergency::SetupL( ) |
|
136 { |
|
137 iMockContext->InitializeL(); |
|
138 |
|
139 iCPhoneMainResourceResolverMock = new ( ELeave ) CPhoneMainResourceResolverMock(); |
|
140 SmcDefaultValue<CPhoneMainResourceResolver*>::SetL( iCPhoneMainResourceResolverMock ); |
|
141 |
|
142 iViewCmdHandleMock = new CPhoneViewCommandHandleMock(); |
|
143 |
|
144 iStateMachineMock = CPhoneStateMachineGSM::NewL( iViewCmdHandleMock ); |
|
145 |
|
146 iStateEmergency = CPhoneEmergency::NewL( |
|
147 iStateMachineMock, iViewCmdHandleMock, NULL ); |
|
148 |
|
149 iEngineInfoMock = CPEEngineInfoImpl::NewL(); |
|
150 SmcDefaultValue<MPEEngineInfo*>::SetL( iEngineInfoMock ); |
|
151 |
|
152 SmcDefaultValue<TPESimState>::SetL( EPESimUsable ); |
|
153 SmcDefaultValue<const TPEAudioOutput&>::SetL( EPENotActive ); |
|
154 |
|
155 } |
|
156 |
|
157 |
|
158 void ut_cphoneemergency::Teardown( ) |
|
159 { |
|
160 delete iViewCmdHandleMock; |
|
161 iViewCmdHandleMock = NULL; |
|
162 delete iStateEmergency; |
|
163 iStateEmergency = NULL; |
|
164 delete iStateMachineMock; |
|
165 iStateMachineMock = NULL; |
|
166 delete iEngineInfoMock; |
|
167 iEngineInfoMock = NULL; |
|
168 delete iCPhoneMainResourceResolverMock; |
|
169 iCPhoneMainResourceResolverMock = NULL; |
|
170 |
|
171 SmcDefaultValue<TPESimState>::Reset(); |
|
172 SmcDefaultValue<const TPEAudioOutput&>::Reset(); |
|
173 |
|
174 iMockContext->Reset(); |
|
175 } |
|
176 |
|
177 |
|
178 // ----------------------------------------------------------------------------- |
|
179 // Test emergency state in connecting |
|
180 // -check commands |
|
181 // ----------------------------------------------------------------------------- |
|
182 // |
|
183 void ut_cphoneemergency::T_HandleConnectingL( ) |
|
184 { |
|
185 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
186 WithL( EPhoneViewRemoveGlobalNote ); |
|
187 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
188 WithL( EPhoneViewRemoveNote ); |
|
189 |
|
190 TPhoneCmdParamBoolean globalNotifierParam; |
|
191 globalNotifierParam.SetBoolean( EFalse ); |
|
192 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
193 WithL<TPhoneViewCommandId, TPhoneCommandParam&> ( EPhoneViewSetGlobalNotifiersDisabled, globalNotifierParam ); |
|
194 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
195 WithL<TPhoneViewCommandId, TPhoneCommandParam&> ( EPhoneViewSetEikonNotifiersDisabled, globalNotifierParam ); |
|
196 |
|
197 TInt callID(0); |
|
198 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
199 WithL<TPhoneViewCommandId, TInt> ( EPhoneViewUpdateBubble, callID ); |
|
200 |
|
201 iStateEmergency->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageConnecting, 0 ); |
|
202 EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() ); |
|
203 |
|
204 } |
|
205 // ----------------------------------------------------------------------------- |
|
206 // ut_cphoneemergency::T_HandleDialingL |
|
207 // -check commands |
|
208 // ----------------------------------------------------------------------------- |
|
209 // |
|
210 void ut_cphoneemergency::T_HandleDialingL() |
|
211 { |
|
212 TPhoneCmdParamBoolean globalNotifierParam; |
|
213 globalNotifierParam.SetBoolean( ETrue ); |
|
214 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
215 WithL<TPhoneViewCommandId, TPhoneCommandParam&> ( EPhoneViewSetGlobalNotifiersDisabled, globalNotifierParam ); |
|
216 |
|
217 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
218 WithL<TPhoneViewCommandId> ( EPhoneViewBringPhoneAppToForeground ); |
|
219 |
|
220 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
221 WithL( EPhoneViewRemoveQuery ); |
|
222 |
|
223 iStateEmergency->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageDialing, KEmergencyCallId ); |
|
224 EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() ); |
|
225 } |
|
226 |
|
227 // ----------------------------------------------------------------------------- |
|
228 // ut_cphoneemergency::T_HandleConnectedL |
|
229 // -check commands |
|
230 // ----------------------------------------------------------------------------- |
|
231 // |
|
232 void ut_cphoneemergency::T_HandleConnectedL( ) |
|
233 { |
|
234 |
|
235 TInt callID(0); |
|
236 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
237 WithL<TPhoneViewCommandId, TInt> ( EPhoneViewUpdateBubble, callID ); |
|
238 |
|
239 //first callsetup runs connecting before connected |
|
240 iStateEmergency->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageConnected, 0 ); |
|
241 |
|
242 EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() ); |
|
243 } |
|
244 |
|
245 // ----------------------------------------------------------------------------- |
|
246 // ut_cphoneemergency::T_HandleIdleEmergencyL |
|
247 // -check commands |
|
248 // ----------------------------------------------------------------------------- |
|
249 // |
|
250 void ut_cphoneemergency::T_HandleIdleEmergencyL( ) |
|
251 { |
|
252 TPhoneCmdParamBoolean globalNotifierParam; |
|
253 globalNotifierParam.SetBoolean( EFalse ); |
|
254 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
255 WithL<TPhoneViewCommandId, TPhoneCommandParam&> ( EPhoneViewSetGlobalNotifiersDisabled, globalNotifierParam ); |
|
256 |
|
257 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
258 WithL( EPhoneViewRemoveCallHeader, KEmergencyCallId ); |
|
259 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
260 WithL( EPhoneViewRemoveNote ); |
|
261 |
|
262 iMockContext->ExpectCallL( "CPhoneState::IsSimStateNotPresentWithSecurityModeEnabled" ). |
|
263 TimesL(2). |
|
264 ReturnsL(EFalse); |
|
265 |
|
266 iMockContext->ExpectCallL( "CPhoneState::RemoveDialogsAndSendPhoneToBackgroundL" ). |
|
267 TimesL(1); // Set this zero if not expected to call |
|
268 |
|
269 |
|
270 iStateEmergency->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageIdle, KEmergencyCallId ); |
|
271 EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() ); |
|
272 |
|
273 } |
|
274 |
|
275 // ----------------------------------------------------------------------------- |
|
276 // ut_cphoneemergency::T_HandleAudioOutputChangedL |
|
277 // -check commands |
|
278 // ----------------------------------------------------------------------------- |
|
279 // |
|
280 void ut_cphoneemergency::T_HandleAudioOutputChangedL( ) |
|
281 { |
|
282 TPhoneCmdParamAudioOutput outputParam; |
|
283 outputParam.SetAudioOutput( EPEHandset ); |
|
284 |
|
285 iMockContext->ExpectCallL( "CPEEngineInfoImpl::AudioOutput" ). |
|
286 ReturnsL( EPEHandset ); |
|
287 |
|
288 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
289 WithL<TPhoneViewCommandId, TPhoneCommandParam&> ( EPhoneViewActivateAudioPathUIChanges, outputParam ); |
|
290 |
|
291 iStateEmergency->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageAudioOutputChanged, KEmergencyCallId ); |
|
292 |
|
293 EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() ); |
|
294 } |
|
295 |
|
296 // ----------------------------------------------------------------------------- |
|
297 // ut_cphoneemergency::EmergencyCallSetup_HandleEPEMessageConnectedL |
|
298 // -check commands |
|
299 // ----------------------------------------------------------------------------- |
|
300 // |
|
301 void ut_cphoneemergency::T_EmergencyCallSetup_HandleEPEMessageConnectedL() |
|
302 { |
|
303 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
304 WithL<TPhoneViewCommandId> ( EPhoneViewRemoveGlobalNote ); |
|
305 |
|
306 TPhoneCmdParamBoolean globalNotifierParam; |
|
307 globalNotifierParam.SetBoolean( EFalse ); |
|
308 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
309 WithL<TPhoneViewCommandId, TPhoneCommandParam&> ( EPhoneViewSetGlobalNotifiersDisabled, globalNotifierParam ); |
|
310 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
311 WithL<TPhoneViewCommandId, TPhoneCommandParam&> ( EPhoneViewSetEikonNotifiersDisabled, globalNotifierParam ); |
|
312 |
|
313 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
314 WithL<TPhoneViewCommandId, TInt> ( EPhoneViewUpdateBubble, 0 ); |
|
315 |
|
316 iMockContext->ExpectCallL( "CPhoneState::SetToolbarButtonLoudspeakerEnabled" ). |
|
317 TimesL(1); |
|
318 |
|
319 iMockContext->ExpectCallL( "CPhoneState::UpdateUiCommands" ); |
|
320 |
|
321 //first callsetup runs connecting before connected |
|
322 iStateEmergency->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageConnected, 0 ); |
|
323 EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() ); |
|
324 } |
|
325 |
|
326 // ----------------------------------------------------------------------------- |
|
327 // ut_cphoneemergency::T_HandleIdleEmergencyWithNeOpenL |
|
328 // Handle idle when number entry is open |
|
329 // Expected results: - Number entry is shown |
|
330 // - State is changed to idle |
|
331 // ----------------------------------------------------------------------------- |
|
332 // |
|
333 void ut_cphoneemergency::T_HandleIdleEmergencyWithNeOpenL( ) |
|
334 { |
|
335 iMockContext->ExpectCallL( "CPhoneState::IsSimOk" ). |
|
336 ReturnsL( ETrue ); |
|
337 |
|
338 iMockContext->ExpectCallL( "CPhoneNumberEntryManager::IsNumberEntryUsedL" ). |
|
339 ReturnsL( ETrue ); |
|
340 |
|
341 iMockContext->ExpectCallL( "CPhoneNumberEntryManager::SetNumberEntryVisibilityL" ). |
|
342 WithL(ETrue); |
|
343 |
|
344 iMockContext->ExpectCallL( "CPhoneState::RemoveDialogsAndSendPhoneToBackgroundL" ); |
|
345 |
|
346 iMockContext->ExpectCallL( "CPhoneStateMachine::ChangeState" ). |
|
347 WithL( EPhoneStateIdle ); |
|
348 |
|
349 iStateEmergency->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageIdle, KEmergencyCallId ); |
|
350 EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() ); |
|
351 |
|
352 } |
|
353 |
|
354 // ----------------------------------------------------------------------------- |
|
355 // ut_cphoneemergency::T_HandleKeyEventSimNotUsableL |
|
356 // Use case: Handle key event during emergency call when sim not inserted |
|
357 // Expected results: Number entry and keys are shown |
|
358 // Motivation: EMQN-7Q883L Can not input any numbers to number entry during an |
|
359 // active emergency call in offline mode |
|
360 // ----------------------------------------------------------------------------- |
|
361 |
|
362 void ut_cphoneemergency::T_HandleKeyEventSimNotUsableL() |
|
363 { |
|
364 SmcDefaultValue<TPESimState>::SetL( EPESimNotPresent ); |
|
365 TKeyEvent aKeyEvent; |
|
366 TEventCode aEventCode; |
|
367 iMockContext->ExpectCallL( "CPhoneState::HandleKeyEventL" ). |
|
368 WithL( aKeyEvent, aEventCode ); |
|
369 MPhoneKeyEvents* keyEmergency = iStateEmergency; |
|
370 |
|
371 keyEmergency->HandleKeyEventL( aKeyEvent,aEventCode ); |
|
372 EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() ); |
|
373 |
|
374 } |
|
375 |
|
376 // ----------------------------------------------------------------------------- |
|
377 // ut_cphoneemergency::T_HandleOtherIdleThanEmergency |
|
378 // Use case: Emergency call created from active call which idle comes to |
|
379 // Emergency state |
|
380 // Expected results: No idle screen |
|
381 // Motivation: ELVW-7Q85X5 Emergency call view is not displayed |
|
382 // when making an Emergency call in Log application with active call. |
|
383 // ----------------------------------------------------------------------------- |
|
384 |
|
385 void ut_cphoneemergency::T_HandleOtherIdleThanEmergency () |
|
386 { |
|
387 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
388 WithL( EPhoneViewRemoveAllCallHeaders ); |
|
389 iMockContext->ExpectCallL("CPhoneState::SetupIdleScreenInBackgroundL") |
|
390 .TimesL(0); // not expected to call |
|
391 |
|
392 iStateEmergency->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageIdle, 1 ); |
|
393 EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() ); |
|
394 } |
|
395 |
|
396 // ----------------------------------------------------------------------------- |
|
397 // ut_cphoneemergency::T_HandleIdleEmergencySecurityNoteShownSimlessOfflineOffL |
|
398 // -check commands |
|
399 // TRLM-7Q3HVZ |
|
400 // ----------------------------------------------------------------------------- |
|
401 // |
|
402 void ut_cphoneemergency::T_HandleIdleEmergencySecurityNoteShownSimlessOfflineOffL( ) |
|
403 { |
|
404 TPhoneCmdParamBoolean globalNotifierParam; |
|
405 globalNotifierParam.SetBoolean( EFalse ); |
|
406 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
407 WithL<TPhoneViewCommandId, TPhoneCommandParam&> ( EPhoneViewSetGlobalNotifiersDisabled, globalNotifierParam ); |
|
408 |
|
409 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
410 WithL( EPhoneViewRemoveCallHeader, KEmergencyCallId ); |
|
411 iMockContext->ExpectCallL( "CPhoneViewCommandHandleMock::ExecuteCommandL" ). |
|
412 WithL( EPhoneViewRemoveNote ); |
|
413 |
|
414 iMockContext->ExpectCallL( "CPhoneState::IsSimStateNotPresentWithSecurityModeEnabled" ). |
|
415 TimesL(2). |
|
416 ReturnsL(ETrue); |
|
417 iMockContext->ExpectCallL( "FeatureManager::FeatureSupported" ). |
|
418 TimesL(1). |
|
419 ReturnsL(EFalse); |
|
420 iMockContext->ExpectCallL( "CPhoneState::RemoveDialogsAndSendPhoneToBackgroundL" ). |
|
421 TimesL(0); // Set this zero if not expected to call |
|
422 |
|
423 iStateEmergency->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageIdle, KEmergencyCallId ); |
|
424 EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() ); |
|
425 } |
|
426 |
|
427 // ----------------------------------------------------------------------------- |
|
428 // ut_cphoneemergency::T_HandleIdleEmergencySecurityNoteShownSimlessOfflineOnL |
|
429 // -check commands |
|
430 // TRLM-7Q3HVZ |
|
431 // ----------------------------------------------------------------------------- |
|
432 // |
|
433 void ut_cphoneemergency::T_HandleIdleEmergencySecurityNoteShownSimlessOfflineOnL( ) |
|
434 { |
|
435 |
|
436 iMockContext->ExpectCallL( "CPhoneState::IsSimStateNotPresentWithSecurityModeEnabled" ). |
|
437 TimesL(2). |
|
438 ReturnsL(ETrue); |
|
439 |
|
440 iMockContext->ExpectCallL( "CPhoneState::StartShowSecurityNoteL" ). |
|
441 TimesL(1); |
|
442 |
|
443 iMockContext->ExpectCallL( "FeatureManager::FeatureSupported" ). |
|
444 TimesL(1). |
|
445 ReturnsL(ETrue); |
|
446 |
|
447 iMockContext->ExpectCallL( "CPhoneState::RemoveDialogsAndSendPhoneToBackgroundL" ). |
|
448 TimesL(1); |
|
449 |
|
450 iStateEmergency->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageIdle, KEmergencyCallId ); |
|
451 EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() ); |
|
452 } |
|
453 |
|
454 // ----------------------------------------------------------------------------- |
|
455 // ut_cphoneemergency::T_HandleIdleEmergencySecurityNoteNotShownSimlessOfflineOffL |
|
456 // -check commands |
|
457 // TRLM-7Q3HVZ |
|
458 // ----------------------------------------------------------------------------- |
|
459 // |
|
460 void ut_cphoneemergency::T_HandleIdleEmergencySecurityNoteNotShownSimlessOfflineOffL( ) |
|
461 { |
|
462 iMockContext->ExpectCallL( "CPhoneState::IsSimStateNotPresentWithSecurityModeEnabled" ). |
|
463 TimesL(2). |
|
464 ReturnsL(EFalse); |
|
465 |
|
466 iMockContext->ExpectCallL( "CPhoneNumberEntryManager::IsNumberEntryUsedL" ). |
|
467 ReturnsL( EFalse ); |
|
468 |
|
469 iMockContext->ExpectCallL( "FeatureManager::FeatureSupported" ). |
|
470 TimesL(0); |
|
471 |
|
472 iMockContext->ExpectCallL( "CPhoneState::RemoveDialogsAndSendPhoneToBackgroundL" ). |
|
473 TimesL(1); |
|
474 |
|
475 iStateEmergency->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageIdle, KEmergencyCallId ); |
|
476 EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() ); |
|
477 } |
|
478 |
|
479 // ----------------------------------------------------------------------------- |
|
480 // ut_cphoneemergency::T_HandleIdleEmergencySecurityNoteNotShownSimlessOfflineOnL |
|
481 // -check commands |
|
482 // TRLM-7Q3HVZ |
|
483 // ----------------------------------------------------------------------------- |
|
484 // |
|
485 void ut_cphoneemergency::T_HandleIdleEmergencySecurityNoteNotShownSimlessOfflineOnL( ) |
|
486 { |
|
487 iMockContext->ExpectCallL( "CPhoneState::IsSimStateNotPresentWithSecurityModeEnabled" ). |
|
488 TimesL(2). |
|
489 ReturnsL(ETrue); |
|
490 |
|
491 iMockContext->ExpectCallL( "CPhoneNumberEntryManager::IsNumberEntryUsedL" ). |
|
492 ReturnsL( EFalse ); |
|
493 |
|
494 iMockContext->ExpectCallL( "FeatureManager::FeatureSupported" ). |
|
495 TimesL(1). |
|
496 ReturnsL(ETrue); |
|
497 |
|
498 iMockContext->ExpectCallL( "CPhoneState::RemoveDialogsAndSendPhoneToBackgroundL" ). |
|
499 TimesL(1); |
|
500 |
|
501 iStateEmergency->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageIdle, KEmergencyCallId ); |
|
502 EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() ); |
|
503 } |
|
504 |
|
505 |
|
506 // ----------------------------------------------------------------------------- |
|
507 // ut_cphoneemergency::T_HandleRemConCommand_MuteL |
|
508 // -check commands |
|
509 // ELVW-7RTC22 |
|
510 // ----------------------------------------------------------------------------- |
|
511 // |
|
512 void ut_cphoneemergency::T_HandleRemConCommand_MuteL( ) |
|
513 { |
|
514 MPhoneState* stateEmergency = iStateEmergency; |
|
515 iMockContext->ExpectCallL( "CPhoneState::HandleRemConCommandL" ). |
|
516 TimesL(0); |
|
517 |
|
518 stateEmergency->HandleRemConCommandL( ERemConCoreApiMute, ERemConCoreApiButtonPress ); |
|
519 EUNIT_ASSERT_EQUALS( KErrNone, iMockContext->VerifyExpectations() ); |
|
520 } |
|
521 |
|
522 // - EUnit test table ------------------------------------------------------- |
|
523 |
|
524 EUNIT_BEGIN_TEST_TABLE( |
|
525 ut_cphoneemergency, |
|
526 "Add test suite description here.", |
|
527 "UNIT" ) |
|
528 |
|
529 EUNIT_TEST( |
|
530 "1- Test handle connecting", |
|
531 "CPhoneEmergency", |
|
532 "Test1", |
|
533 "FUNCTIONALITY", |
|
534 SetupL, T_HandleConnectingL, Teardown) |
|
535 |
|
536 EUNIT_TEST( |
|
537 "2- test handle dialing ", |
|
538 "CPhoneEmergency", |
|
539 "Test2", |
|
540 "FUNCTIONALITY", |
|
541 SetupL, T_HandleDialingL, Teardown) |
|
542 |
|
543 EUNIT_TEST( |
|
544 "3- test handle connected", |
|
545 "CPhoneEmergency", |
|
546 "Test3", |
|
547 "FUNCTIONALITY", |
|
548 SetupL, T_HandleConnectedL, Teardown) |
|
549 |
|
550 EUNIT_TEST( |
|
551 "4- test handle idle", |
|
552 "CPhoneEmergency", |
|
553 "Test4", |
|
554 "FUNCTIONALITY", |
|
555 SetupL, T_HandleIdleEmergencyL, Teardown) |
|
556 |
|
557 EUNIT_TEST( |
|
558 "5- Audio output change", |
|
559 "CPhoneEmergency", |
|
560 "Test5", |
|
561 "FUNCTIONALITY", |
|
562 SetupL, T_HandleAudioOutputChangedL, Teardown) |
|
563 |
|
564 EUNIT_TEST( |
|
565 "8- EmergencyCallSetup_HandleEPEMessageConnected", |
|
566 "CPhoneEmergency", |
|
567 "Test8", |
|
568 "FUNCTIONALITY", |
|
569 SetupL, T_EmergencyCallSetup_HandleEPEMessageConnectedL, Teardown) |
|
570 |
|
571 EUNIT_TEST( |
|
572 "9- To idle, NE open", |
|
573 "CPhoneEmergency", |
|
574 "Test9", |
|
575 "FUNCTIONALITY", |
|
576 SetupL, T_HandleIdleEmergencyWithNeOpenL, Teardown) |
|
577 |
|
578 EUNIT_TEST( |
|
579 "10- Key event, SIM not usable", |
|
580 "CPhoneEmergency", |
|
581 "Test10", |
|
582 "FUNCTIONALITY", |
|
583 SetupL, T_HandleKeyEventSimNotUsableL, Teardown) |
|
584 |
|
585 EUNIT_TEST( |
|
586 "11- Other call idle", |
|
587 "CPhoneEmergency", |
|
588 "Test11", |
|
589 "FUNCTIONALITY", |
|
590 SetupL, T_HandleOtherIdleThanEmergency, Teardown) |
|
591 |
|
592 EUNIT_TEST( |
|
593 "13- Handle Idle message when security note is SHOWN and KFeatureIdFfSimlessOfflineSupport flag is UNDEF", |
|
594 "CPhoneEmergency", |
|
595 "Test13", |
|
596 "FUNCTIONALITY", |
|
597 SetupL, T_HandleIdleEmergencySecurityNoteShownSimlessOfflineOffL, Teardown) |
|
598 |
|
599 EUNIT_TEST( |
|
600 "14- Handle Idle message when security note is SHOWN and KFeatureIdFfSimlessOfflineSupport flag is DEFINED", |
|
601 "CPhoneEmergency", |
|
602 "Test14", |
|
603 "FUNCTIONALITY", |
|
604 SetupL, T_HandleIdleEmergencySecurityNoteShownSimlessOfflineOnL, Teardown) |
|
605 |
|
606 EUNIT_TEST( |
|
607 "15- Handle Idle message when security note is NOT SHOWN and KFeatureIdFfSimlessOfflineSupport flag is UNDEF", |
|
608 "CPhoneEmergency", |
|
609 "Test15", |
|
610 "FUNCTIONALITY", |
|
611 SetupL, T_HandleIdleEmergencySecurityNoteNotShownSimlessOfflineOffL, Teardown) |
|
612 |
|
613 EUNIT_TEST( |
|
614 "16- Handle Idle message when security note is NOT SHOWN and KFeatureIdFfSimlessOfflineSupport flag is DEFINED", |
|
615 "CPhoneEmergency", |
|
616 "Test16", |
|
617 "FUNCTIONALITY", |
|
618 SetupL, T_HandleIdleEmergencySecurityNoteNotShownSimlessOfflineOnL, Teardown) |
|
619 |
|
620 EUNIT_TEST( |
|
621 "17- Handle Remote Control ERemConCoreApiMute operation ", |
|
622 "CPhoneEmergency", |
|
623 "Test17", |
|
624 "FUNCTIONALITY", |
|
625 SetupL, T_HandleRemConCommand_MuteL, Teardown) |
|
626 |
|
627 |
|
628 |
|
629 EUNIT_END_TEST_TABLE |
|
630 |