|
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 |
|
19 // INTERNAL INCLUDES |
|
20 #include "e32property.h" |
|
21 #include "etel.h" |
|
22 #include "etelmm.h" |
|
23 #include "ut_muscallconferencemonitor.h" |
|
24 #include "muscallconferencemonitor.h" |
|
25 |
|
26 // SYSTEM INCLUDES |
|
27 #include <digia/eunit/eunitmacros.h> |
|
28 |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 UT_CMusCallConferenceMonitor* UT_CMusCallConferenceMonitor::NewL() |
|
35 { |
|
36 UT_CMusCallConferenceMonitor* self = UT_CMusCallConferenceMonitor::NewLC(); |
|
37 CleanupStack::Pop( self ); |
|
38 return self; |
|
39 } |
|
40 |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 UT_CMusCallConferenceMonitor* UT_CMusCallConferenceMonitor::NewLC() |
|
47 { |
|
48 UT_CMusCallConferenceMonitor* self = new( ELeave ) UT_CMusCallConferenceMonitor(); |
|
49 CleanupStack::PushL( self ); |
|
50 self->ConstructL(); |
|
51 return self; |
|
52 } |
|
53 |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 UT_CMusCallConferenceMonitor::~UT_CMusCallConferenceMonitor() |
|
60 { |
|
61 // NOP |
|
62 } |
|
63 |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // Default constructor |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 UT_CMusCallConferenceMonitor::UT_CMusCallConferenceMonitor() |
|
70 { |
|
71 // NOP |
|
72 } |
|
73 |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // Second phase construct |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 void UT_CMusCallConferenceMonitor::ConstructL() |
|
80 { |
|
81 // The ConstructL from the base class CEUnitTestSuiteClass must be called. |
|
82 // It generates the test case table. |
|
83 CEUnitTestSuiteClass::ConstructL(); |
|
84 } |
|
85 |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 void UT_CMusCallConferenceMonitor::SetupL() |
|
92 { |
|
93 //setup |
|
94 /* |
|
95 RProperty::Set( NMusSessionInformationApi::KCategoryUid, |
|
96 NMusSessionInformationApi::KMusCallCount, |
|
97 1 ); |
|
98 */ |
|
99 |
|
100 RTelHelper::SetConfStatus( RMobileConferenceCall::EConferenceIdle ); |
|
101 |
|
102 RProperty::Set( NMusSessionInformationApi::KCategoryUid, |
|
103 NMusSessionInformationApi::KMusCallEvent, |
|
104 0 ); |
|
105 |
|
106 iConferenceCallMonitor = |
|
107 CMusCallConferenceMonitor::NewL( iMobilePhone, |
|
108 iLine , |
|
109 iCallMonitorArray ); |
|
110 } |
|
111 |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 void UT_CMusCallConferenceMonitor::Teardown() |
|
118 { |
|
119 delete iConferenceCallMonitor; |
|
120 PropertyHelper::Close(); |
|
121 iMobilePhone.Close(); |
|
122 iLine.Close(); |
|
123 iCallMonitorArray.ResetAndDestroy(); |
|
124 |
|
125 } |
|
126 |
|
127 |
|
128 |
|
129 // TEST CASES |
|
130 |
|
131 |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 void UT_CMusCallConferenceMonitor::UT_CMusCallConferenceMonitor_NewLL() |
|
137 { |
|
138 EUNIT_ASSERT( iConferenceCallMonitor ); |
|
139 EUNIT_ASSERT( iConferenceCallMonitor->IsActive() ); |
|
140 EUNIT_ASSERT( iConferenceCallMonitor->iConfCallEvent ); |
|
141 } |
|
142 |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 void UT_CMusCallConferenceMonitor::UT_CMusCallConferenceMonitor_RunLL() |
|
149 { |
|
150 TInt val = RMobileCall::EStatusUnknown; |
|
151 EUNIT_ASSERT( iConferenceCallMonitor ); |
|
152 |
|
153 iConferenceCallMonitor->Cancel(); // Cancel the active object |
|
154 RTelHelper::SetConfStatus( RMobileConferenceCall::EConferenceIdle ); |
|
155 iConferenceCallMonitor->RunL(); |
|
156 RProperty::Get( NMusSessionInformationApi::KCategoryUid, |
|
157 NMusSessionInformationApi::KMusCallEvent, |
|
158 val ); |
|
159 EUNIT_ASSERT( val == RMobileCall::EStatusUnknown ); |
|
160 |
|
161 RTelHelper::SetConfStatus( RMobileConferenceCall::EConferenceActive ); |
|
162 iConferenceCallMonitor->Cancel(); // Cancel the active object |
|
163 iConferenceCallMonitor->RunL(); |
|
164 RProperty::Get( NMusSessionInformationApi::KCategoryUid, |
|
165 NMusSessionInformationApi::KMusCallEvent, |
|
166 val ); |
|
167 EUNIT_ASSERT( val==NMusSessionInformationApi::EConferenceCall); |
|
168 |
|
169 RTelHelper::SetConfStatus( RMobileConferenceCall::EConferenceHold ); |
|
170 iConferenceCallMonitor->Cancel(); // Cancel the active object |
|
171 iConferenceCallMonitor->RunL(); |
|
172 RProperty::Get( NMusSessionInformationApi::KCategoryUid, |
|
173 NMusSessionInformationApi::KMusCallEvent, |
|
174 val ); |
|
175 EUNIT_ASSERT( val==NMusSessionInformationApi::ECallHold); |
|
176 |
|
177 } |
|
178 |
|
179 |
|
180 // ----------------------------------------------------------------------------- |
|
181 // |
|
182 // ----------------------------------------------------------------------------- |
|
183 // |
|
184 void UT_CMusCallConferenceMonitor::UT_CMusCallConferenceMonitor_DoCancelL() |
|
185 { |
|
186 EUNIT_ASSERT( iConferenceCallMonitor ); |
|
187 iConferenceCallMonitor->DoCancel(); |
|
188 EUNIT_ASSERT( RTelHelper::GetCalledFunction() == |
|
189 RTelSubSessionBase::ECancelAsyncRequest ) |
|
190 } |
|
191 |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 // ----------------------------------------------------------------------------- |
|
196 // |
|
197 void UT_CMusCallConferenceMonitor::UT_CMusCallConferenceMonitor_RunErrorL() |
|
198 { |
|
199 EUNIT_ASSERT( iConferenceCallMonitor ); |
|
200 TInt error = KErrNotFound; |
|
201 iConferenceCallMonitor->RunError(error); |
|
202 } |
|
203 |
|
204 |
|
205 // ----------------------------------------------------------------------------- |
|
206 // |
|
207 // ----------------------------------------------------------------------------- |
|
208 // |
|
209 void UT_CMusCallConferenceMonitor::UT_CMusCallConferenceMonitor_MonitorCallLL() |
|
210 { |
|
211 EUNIT_ASSERT( iConferenceCallMonitor ); |
|
212 EUNIT_ASSERT( iConferenceCallMonitor->iCallMonitorArray.Count() == 0 ); |
|
213 |
|
214 iConferenceCallMonitor->MonitorCallL(); |
|
215 EUNIT_ASSERT( iConferenceCallMonitor->iCallMonitorArray.Count() == 0 ); |
|
216 |
|
217 RTelHelper::SetCallStatus( RMobileCall::EStatusConnected ); |
|
218 iConferenceCallMonitor->MonitorCallL(); |
|
219 EUNIT_ASSERT( iConferenceCallMonitor->iCallMonitorArray.Count() == 0 ); |
|
220 |
|
221 } |
|
222 |
|
223 // ----------------------------------------------------------------------------- |
|
224 // |
|
225 // ----------------------------------------------------------------------------- |
|
226 // |
|
227 void UT_CMusCallConferenceMonitor::UT_CMusCallConferenceMonitor_GetConfStatus() |
|
228 { |
|
229 EUNIT_ASSERT( iConferenceCallMonitor->GetConfStatus() == RMobileConferenceCall::EConferenceIdle ); |
|
230 } |
|
231 |
|
232 // TEST TABLE |
|
233 |
|
234 EUNIT_BEGIN_TEST_TABLE( |
|
235 UT_CMusCallConferenceMonitor, |
|
236 "UT_CMusCallConferenceMonitor", |
|
237 "UNIT" ) |
|
238 |
|
239 EUNIT_TEST( |
|
240 "NewL - test ", |
|
241 "CMusConferenceCallMonitor", |
|
242 "NewL", |
|
243 "FUNCTIONALITY", |
|
244 SetupL, UT_CMusCallConferenceMonitor_NewLL, Teardown) |
|
245 |
|
246 EUNIT_TEST( |
|
247 "RunL - test ", |
|
248 "CMusConferenceCallMonitor", |
|
249 "RunL", |
|
250 "FUNCTIONALITY", |
|
251 SetupL, UT_CMusCallConferenceMonitor_RunLL, Teardown) |
|
252 |
|
253 EUNIT_TEST( |
|
254 "DoCancel - test ", |
|
255 "CMusConferenceCallMonitor", |
|
256 "DoCancel", |
|
257 "FUNCTIONALITY", |
|
258 SetupL, UT_CMusCallConferenceMonitor_DoCancelL, Teardown) |
|
259 |
|
260 EUNIT_TEST( |
|
261 "RunError - test ", |
|
262 "CMusConferenceCallMonitor", |
|
263 "RunError", |
|
264 "FUNCTIONALITY", |
|
265 SetupL, UT_CMusCallConferenceMonitor_RunErrorL, Teardown) |
|
266 |
|
267 EUNIT_TEST( |
|
268 "MonitorCallL - test ", |
|
269 "CMusConferenceCallMonitor", |
|
270 "MonitorCallL", |
|
271 "FUNCTIONALITY", |
|
272 SetupL, UT_CMusCallConferenceMonitor_MonitorCallLL, Teardown) |
|
273 |
|
274 EUNIT_TEST( |
|
275 "GetCconfStatusL - test ", |
|
276 "CMusConferenceCallMonitor", |
|
277 "GetCconfStatus", |
|
278 "FUNCTIONALITY", |
|
279 SetupL, UT_CMusCallConferenceMonitor_GetConfStatus, Teardown) |
|
280 |
|
281 |
|
282 EUNIT_END_TEST_TABLE |
|
283 |
|
284 // END OF FILE |
|
285 |
|
286 |