|
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_cphonecallsetupandwaiting.h" |
|
19 |
|
20 #include <csmcmockcontext.h> |
|
21 #include <smcdefaultvalue.h> |
|
22 #include <msmcmockspecbuilder.h> |
|
23 #include <smcobjecttotypemapper.h> |
|
24 #include <EUnitMacros.h> |
|
25 #include <EUnitDecorators.h> |
|
26 #include <featmgr.h> |
|
27 #include "PEVirtualEngine.h" |
|
28 #include "CPhoneViewControllerStub.h" |
|
29 #include "CPhoneStateMachineStub.h" |
|
30 #include "MPhoneKeyEvents.h" |
|
31 #include "TPhoneCommandParam.h" |
|
32 #include "CPhoneMainResourceResolver.h" |
|
33 #include "phoneappcommands.hrh" |
|
34 |
|
35 #define protected public |
|
36 #include "CPhoneCallSetupAndWaiting.h" |
|
37 |
|
38 // - Construction ----------------------------------------------------------- |
|
39 |
|
40 ut_cphonecallsetupandwaiting* ut_cphonecallsetupandwaiting::NewL() |
|
41 { |
|
42 ut_cphonecallsetupandwaiting* self = ut_cphonecallsetupandwaiting::NewLC(); |
|
43 CleanupStack::Pop(); |
|
44 return self; |
|
45 } |
|
46 |
|
47 ut_cphonecallsetupandwaiting* ut_cphonecallsetupandwaiting::NewLC() |
|
48 { |
|
49 ut_cphonecallsetupandwaiting* self = new( ELeave ) ut_cphonecallsetupandwaiting(); |
|
50 CleanupStack::PushL( self ); |
|
51 self->ConstructL(); |
|
52 return self; |
|
53 } |
|
54 |
|
55 ut_cphonecallsetupandwaiting::~ut_cphonecallsetupandwaiting() |
|
56 { |
|
57 CSmcMockContext::Release(); |
|
58 } |
|
59 |
|
60 ut_cphonecallsetupandwaiting::ut_cphonecallsetupandwaiting() |
|
61 { |
|
62 } |
|
63 |
|
64 void ut_cphonecallsetupandwaiting::ConstructL() |
|
65 { |
|
66 CEUnitTestSuiteClass::ConstructL(); |
|
67 iMockContext = CSmcMockContext::InstanceL(); |
|
68 } |
|
69 |
|
70 // - Test methods ----------------------------------------------------------- |
|
71 |
|
72 |
|
73 |
|
74 void ut_cphonecallsetupandwaiting::SetupL( ) |
|
75 { |
|
76 iMockContext->InitializeL(); |
|
77 iViewCommandHandle = CPhoneViewController::NewL(); |
|
78 iStateMachine = CPhoneStateMachineStub::NewL(); |
|
79 |
|
80 iStateCallSetupAndWaiting = CPhoneCallSetupAndWaiting::NewL( |
|
81 iStateMachine, iViewCommandHandle, NULL ); |
|
82 } |
|
83 |
|
84 |
|
85 void ut_cphonecallsetupandwaiting::Teardown( ) |
|
86 { |
|
87 delete CPhoneMainResourceResolver::Instance(); |
|
88 delete iStateCallSetupAndWaiting; |
|
89 delete iViewCommandHandle; |
|
90 delete iStateMachine; |
|
91 iMockContext->Reset(); |
|
92 } |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // Test conference idle |
|
96 // -check commands |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 void ut_cphonecallsetupandwaiting::T_HandleIdleL( ) |
|
100 { |
|
101 |
|
102 iViewCommandHandle->SetViewGetCountOfActiveCalls(1); |
|
103 |
|
104 iStateCallSetupAndWaiting->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageIdle, 0 ); |
|
105 |
|
106 iViewCommandHandle->VerifyViewCommand( EPhoneViewRemoveCallHeader ); |
|
107 |
|
108 } |
|
109 |
|
110 // - EUnit test table ------------------------------------------------------- |
|
111 |
|
112 EUNIT_BEGIN_TEST_TABLE( |
|
113 ut_cphonecallsetupandwaiting, |
|
114 "Add test suite description here.", |
|
115 "UNIT" ) |
|
116 |
|
117 EUNIT_TEST( |
|
118 "2- CPhoneTwoSinglesAndWaiting: Test idle", |
|
119 "", |
|
120 "Test0", |
|
121 "FUNCTIONALITY", |
|
122 SetupL, T_HandleIdleL, Teardown) |
|
123 |
|
124 EUNIT_END_TEST_TABLE |