|
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_cphoneconferenceandcallsetup.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 "CPhoneConferenceAndCallSetup.h" |
|
28 #include "PEVirtualEngine.h" |
|
29 #include "CPhoneViewControllerStub.h" |
|
30 #include "CPhoneStateMachineStub.h" |
|
31 #include "MPhoneKeyEvents.h" |
|
32 #include "TPhoneCommandParam.h" |
|
33 #include "CPhoneMainResourceResolver.h" |
|
34 #include "phonestatedefinitionsgsm.h" |
|
35 #include "tphonecmdparamcallheaderdata.h" |
|
36 |
|
37 // - Construction ----------------------------------------------------------- |
|
38 |
|
39 ut_cphoneconferenceandcallsetup* ut_cphoneconferenceandcallsetup::NewL() |
|
40 { |
|
41 ut_cphoneconferenceandcallsetup* self = ut_cphoneconferenceandcallsetup::NewLC(); |
|
42 CleanupStack::Pop(); |
|
43 return self; |
|
44 } |
|
45 |
|
46 ut_cphoneconferenceandcallsetup* ut_cphoneconferenceandcallsetup::NewLC() |
|
47 { |
|
48 ut_cphoneconferenceandcallsetup* self = new( ELeave ) ut_cphoneconferenceandcallsetup(); |
|
49 CleanupStack::PushL( self ); |
|
50 self->ConstructL(); |
|
51 return self; |
|
52 } |
|
53 |
|
54 ut_cphoneconferenceandcallsetup::~ut_cphoneconferenceandcallsetup() |
|
55 { |
|
56 CSmcMockContext::Release(); |
|
57 } |
|
58 |
|
59 ut_cphoneconferenceandcallsetup::ut_cphoneconferenceandcallsetup() |
|
60 { |
|
61 } |
|
62 |
|
63 void ut_cphoneconferenceandcallsetup::ConstructL() |
|
64 { |
|
65 CEUnitTestSuiteClass::ConstructL(); |
|
66 iMockContext = CSmcMockContext::InstanceL(); |
|
67 } |
|
68 |
|
69 // - Test methods ----------------------------------------------------------- |
|
70 |
|
71 |
|
72 |
|
73 void ut_cphoneconferenceandcallsetup::SetupL( ) |
|
74 { |
|
75 iMockContext->InitializeL(); |
|
76 iViewCommandHandle = CPhoneViewController::NewL(); |
|
77 iStateMachine = CPhoneStateMachineStub::NewL(); |
|
78 iViewCommandHandle->iCallId = 2; |
|
79 iStateConferenceAndCallSetup = CPhoneConferenceAndCallSetup::NewL( |
|
80 iStateMachine, iViewCommandHandle, NULL ); |
|
81 |
|
82 } |
|
83 |
|
84 |
|
85 void ut_cphoneconferenceandcallsetup::Teardown( ) |
|
86 { |
|
87 delete CPhoneMainResourceResolver::Instance(); |
|
88 delete iStateConferenceAndCallSetup; |
|
89 delete iViewCommandHandle; |
|
90 delete iStateMachine; |
|
91 iMockContext->Reset(); |
|
92 } |
|
93 |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // Test conference and waiting state in connecting |
|
97 // -check commands |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 void ut_cphoneconferenceandcallsetup::T_HandleConnectedL( ) |
|
101 { |
|
102 iStateConferenceAndCallSetup->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageConnected, 2 ); |
|
103 |
|
104 iViewCommandHandle->VerifyViewCommand( EPhoneViewUpdateBubble ); |
|
105 |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // Test idle |
|
110 // -check commands |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 void ut_cphoneconferenceandcallsetup::T_HandleIdleL() |
|
114 { |
|
115 |
|
116 iViewCommandHandle->SetViewGetCountOfActiveCalls(1); |
|
117 |
|
118 iStateConferenceAndCallSetup->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageIdle, 0 ); |
|
119 |
|
120 iViewCommandHandle->VerifyViewCommand( EPhoneViewRemoveCallHeader ); |
|
121 |
|
122 |
|
123 } |
|
124 |
|
125 // ----------------------------------------------------------------------------- |
|
126 // Test conference idle |
|
127 // -check commands |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 void ut_cphoneconferenceandcallsetup::T_HandleConferenceIdleL( ) |
|
131 { |
|
132 |
|
133 iViewCommandHandle->SetViewGetCountOfActiveCalls(1); |
|
134 |
|
135 iStateConferenceAndCallSetup->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageConferenceIdle, 0 ); |
|
136 |
|
137 iViewCommandHandle->VerifyViewCommand( EPhoneViewRemoveConferenceBubble ); |
|
138 |
|
139 |
|
140 } |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // Test conference call setup and zero send |
|
144 // -check commands |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 void ut_cphoneconferenceandcallsetup::T_HandleConferenceAndAlertingL( ) |
|
148 { |
|
149 |
|
150 iViewCommandHandle->SetViewGetCountOfActiveCalls(2); |
|
151 iViewCommandHandle->SetViewGetCallExistsInConference(ETrue); |
|
152 |
|
153 iStateConferenceAndCallSetup->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageConnecting, 0 ); |
|
154 iStateConferenceAndCallSetup->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageIdle, 0 ); |
|
155 |
|
156 if( iStateMachine->iState != EPhoneStateAlertingInSingle ) |
|
157 { |
|
158 EUNIT_FAIL_TEST("Wrong State!"); |
|
159 } |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // Test conference call setup and zero send |
|
164 // -check commands |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 void ut_cphoneconferenceandcallsetup::T_HandleConferenceAndCallSetupL( ) |
|
168 { |
|
169 |
|
170 iViewCommandHandle->SetViewGetCountOfActiveCalls(2); |
|
171 iViewCommandHandle->SetViewGetCallExistsInConference(ETrue); |
|
172 |
|
173 iStateConferenceAndCallSetup->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageIdle, 0 ); |
|
174 |
|
175 if( iStateMachine->iState != EPhoneStateCallSetupInSingle ) |
|
176 { |
|
177 EUNIT_FAIL_TEST("Wrong State!"); |
|
178 } |
|
179 |
|
180 } |
|
181 |
|
182 // - EUnit test table ------------------------------------------------------- |
|
183 |
|
184 EUNIT_BEGIN_TEST_TABLE( |
|
185 ut_cphoneconferenceandcallsetup, |
|
186 "Add test suite description here.", |
|
187 "UNIT" ) |
|
188 |
|
189 EUNIT_TEST( |
|
190 "1- Test handle connecting", |
|
191 "", |
|
192 "Test0", |
|
193 "FUNCTIONALITY", |
|
194 SetupL, T_HandleConnectedL, Teardown) |
|
195 |
|
196 EUNIT_TEST( |
|
197 "2- Test handle idle", |
|
198 "", |
|
199 "Test0", |
|
200 "FUNCTIONALITY", |
|
201 SetupL, T_HandleIdleL, Teardown) |
|
202 |
|
203 EUNIT_TEST( |
|
204 "3- Test handle conference idle", |
|
205 "", |
|
206 "Test0", |
|
207 "FUNCTIONALITY", |
|
208 SetupL, T_HandleConferenceIdleL, Teardown) |
|
209 |
|
210 EUNIT_TEST( |
|
211 "5- Test Conference And Alerting", |
|
212 "", |
|
213 "Test0", |
|
214 "FUNCTIONALITY", |
|
215 SetupL, T_HandleConferenceAndAlertingL, Teardown) |
|
216 |
|
217 EUNIT_TEST( |
|
218 "6- Test Conference And Call Setup", |
|
219 "", |
|
220 "Test0", |
|
221 "FUNCTIONALITY", |
|
222 SetupL, T_HandleConferenceAndCallSetupL, Teardown) |
|
223 |
|
224 |
|
225 EUNIT_END_TEST_TABLE |