|
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_cphoneconference.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 "tphonecmdparamcallheaderdata.h" |
|
34 |
|
35 #define protected public |
|
36 #include "CPhoneConference.h" |
|
37 |
|
38 // - Construction ----------------------------------------------------------- |
|
39 |
|
40 ut_cphoneconference* ut_cphoneconference::NewL() |
|
41 { |
|
42 ut_cphoneconference* self = ut_cphoneconference::NewLC(); |
|
43 CleanupStack::Pop(); |
|
44 return self; |
|
45 } |
|
46 |
|
47 ut_cphoneconference* ut_cphoneconference::NewLC() |
|
48 { |
|
49 ut_cphoneconference* self = new( ELeave ) ut_cphoneconference(); |
|
50 CleanupStack::PushL( self ); |
|
51 self->ConstructL(); |
|
52 return self; |
|
53 } |
|
54 |
|
55 ut_cphoneconference::~ut_cphoneconference() |
|
56 { |
|
57 CSmcMockContext::Release(); |
|
58 } |
|
59 |
|
60 ut_cphoneconference::ut_cphoneconference() |
|
61 { |
|
62 } |
|
63 |
|
64 void ut_cphoneconference::ConstructL() |
|
65 { |
|
66 CEUnitTestSuiteClass::ConstructL(); |
|
67 iMockContext = CSmcMockContext::InstanceL(); |
|
68 } |
|
69 |
|
70 // - Test methods ----------------------------------------------------------- |
|
71 |
|
72 |
|
73 |
|
74 void ut_cphoneconference::SetupL( ) |
|
75 { |
|
76 iMockContext->InitializeL(); |
|
77 iViewCommandHandle = CPhoneViewController::NewL(); |
|
78 iStateMachine = CPhoneStateMachineStub::NewL(); |
|
79 iViewCommandHandle->iCallId = 2; |
|
80 iStateConference = CPhoneConference::NewL( |
|
81 iStateMachine, iViewCommandHandle, NULL ); |
|
82 |
|
83 } |
|
84 |
|
85 |
|
86 void ut_cphoneconference::Teardown( ) |
|
87 { |
|
88 delete CPhoneMainResourceResolver::Instance(); |
|
89 delete iStateConference; |
|
90 delete iViewCommandHandle; |
|
91 delete iStateMachine; |
|
92 iMockContext->Reset(); |
|
93 } |
|
94 |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // Test conference and waiting state in connecting |
|
98 // -check commands |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 void ut_cphoneconference::T_HandleConnectedL( ) |
|
102 { |
|
103 |
|
104 iStateConference->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageConnected, 2 ); |
|
105 |
|
106 iViewCommandHandle->VerifyViewCommand( EPhoneViewUpdateBubble ); |
|
107 |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // Test idle |
|
112 // -check commands |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 void ut_cphoneconference::T_HandleIdleL() |
|
116 { |
|
117 |
|
118 iViewCommandHandle->SetViewGetCountOfActiveCalls(1); |
|
119 |
|
120 iStateConference->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageIdle, 0 ); |
|
121 |
|
122 iViewCommandHandle->VerifyViewCommandBoolean( EPhoneViewGetIsConference, EFalse ); |
|
123 |
|
124 } |
|
125 |
|
126 // ----------------------------------------------------------------------------- |
|
127 // Test conference idle |
|
128 // -check commands |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 void ut_cphoneconference::T_HandleConferenceIdleL( ) |
|
132 { |
|
133 |
|
134 iViewCommandHandle->SetViewGetCountOfActiveCalls(2); |
|
135 |
|
136 iStateConference->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageConferenceIdle, 0 ); |
|
137 |
|
138 iViewCommandHandle->VerifyViewCommand( EPhoneViewRemoveConferenceBubble ); |
|
139 |
|
140 iViewCommandHandle->SetViewGetCountOfActiveCalls(0); |
|
141 |
|
142 iStateConference->HandlePhoneEngineMessageL( MEngineMonitor::EPEMessageConferenceIdle, 0 ); |
|
143 |
|
144 |
|
145 } |
|
146 |
|
147 // - EUnit test table ------------------------------------------------------- |
|
148 |
|
149 EUNIT_BEGIN_TEST_TABLE( |
|
150 ut_cphoneconference, |
|
151 "Add test suite description here.", |
|
152 "UNIT" ) |
|
153 |
|
154 EUNIT_TEST( |
|
155 "1- Test handle connecting", |
|
156 "", |
|
157 "Test0", |
|
158 "FUNCTIONALITY", |
|
159 SetupL, T_HandleConnectedL, Teardown) |
|
160 |
|
161 EUNIT_TEST( |
|
162 "2- Test handle idle", |
|
163 "", |
|
164 "Test0", |
|
165 "FUNCTIONALITY", |
|
166 SetupL, T_HandleIdleL, Teardown) |
|
167 |
|
168 EUNIT_TEST( |
|
169 "3- Test handle conference idle", |
|
170 "", |
|
171 "Test0", |
|
172 "FUNCTIONALITY", |
|
173 SetupL, T_HandleConferenceIdleL, Teardown) |
|
174 |
|
175 |
|
176 EUNIT_END_TEST_TABLE |