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 RProperty::Set( NMusSessionInformationApi::KCategoryUid, |
|
100 NMusSessionInformationApi::KMusCallEvent, |
|
101 0 ); |
|
102 |
|
103 iConferenceCallMonitor = |
|
104 CMusCallConferenceMonitor::NewL( iMobilePhone, |
|
105 iLine , |
|
106 iCallMonitorArray ); |
|
107 |
|
108 } |
|
109 |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 void UT_CMusCallConferenceMonitor::Teardown() |
|
116 { |
|
117 delete iConferenceCallMonitor; |
|
118 PropertyHelper::Close(); |
|
119 iMobilePhone.Close(); |
|
120 iLine.Close(); |
|
121 iCallMonitorArray.ResetAndDestroy(); |
|
122 |
|
123 } |
|
124 |
|
125 |
|
126 |
|
127 // TEST CASES |
|
128 |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 void UT_CMusCallConferenceMonitor::UT_CMusCallConferenceMonitor_NewLL() |
|
135 { |
|
136 EUNIT_ASSERT( iConferenceCallMonitor ); |
|
137 EUNIT_ASSERT( iConferenceCallMonitor->IsActive() ); |
|
138 EUNIT_ASSERT( iConferenceCallMonitor->iConfCallEvent ); |
|
139 } |
|
140 |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 void UT_CMusCallConferenceMonitor::UT_CMusCallConferenceMonitor_RunLL() |
|
147 { |
|
148 TInt val = RMobileCall::EStatusUnknown; |
|
149 EUNIT_ASSERT( iConferenceCallMonitor ); |
|
150 |
|
151 iConferenceCallMonitor->Cancel(); // Cancel the active object |
|
152 RTelHelper::SetConfStatus( RMobileConferenceCall::EConferenceIdle ); |
|
153 iConferenceCallMonitor->RunL(); |
|
154 RProperty::Get( NMusSessionInformationApi::KCategoryUid, |
|
155 NMusSessionInformationApi::KMusCallEvent, |
|
156 val ); |
|
157 EUNIT_ASSERT( val == RMobileCall::EStatusUnknown ); |
|
158 |
|
159 RTelHelper::SetConfStatus( RMobileConferenceCall::EConferenceActive ); |
|
160 iConferenceCallMonitor->Cancel(); // Cancel the active object |
|
161 iConferenceCallMonitor->RunL(); |
|
162 RProperty::Get( NMusSessionInformationApi::KCategoryUid, |
|
163 NMusSessionInformationApi::KMusCallEvent, |
|
164 val ); |
|
165 EUNIT_ASSERT( val==NMusSessionInformationApi::EConferenceCall); |
|
166 |
|
167 RTelHelper::SetConfStatus( RMobileConferenceCall::EConferenceHold ); |
|
168 iConferenceCallMonitor->Cancel(); // Cancel the active object |
|
169 iConferenceCallMonitor->RunL(); |
|
170 RProperty::Get( NMusSessionInformationApi::KCategoryUid, |
|
171 NMusSessionInformationApi::KMusCallEvent, |
|
172 val ); |
|
173 EUNIT_ASSERT( val==NMusSessionInformationApi::ECallHold); |
|
174 |
|
175 } |
|
176 |
|
177 |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 // ----------------------------------------------------------------------------- |
|
181 // |
|
182 void UT_CMusCallConferenceMonitor::UT_CMusCallConferenceMonitor_DoCancelL() |
|
183 { |
|
184 EUNIT_ASSERT( iConferenceCallMonitor ); |
|
185 iConferenceCallMonitor->DoCancel(); |
|
186 EUNIT_ASSERT( RTelHelper::GetCalledFunction() == |
|
187 RTelSubSessionBase::ECancelAsyncRequest ) |
|
188 } |
|
189 |
|
190 |
|
191 // ----------------------------------------------------------------------------- |
|
192 // |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 void UT_CMusCallConferenceMonitor::UT_CMusCallConferenceMonitor_RunErrorL() |
|
196 { |
|
197 EUNIT_ASSERT( iConferenceCallMonitor ); |
|
198 TInt error = KErrNotFound; |
|
199 iConferenceCallMonitor->RunError(error); |
|
200 } |
|
201 |
|
202 |
|
203 // ----------------------------------------------------------------------------- |
|
204 // |
|
205 // ----------------------------------------------------------------------------- |
|
206 // |
|
207 void UT_CMusCallConferenceMonitor::UT_CMusCallConferenceMonitor_MonitorCallLL() |
|
208 { |
|
209 EUNIT_ASSERT( iConferenceCallMonitor ); |
|
210 EUNIT_ASSERT( iConferenceCallMonitor->iCallMonitorArray.Count() == 0 ); |
|
211 |
|
212 iConferenceCallMonitor->MonitorCallL(); |
|
213 EUNIT_ASSERT( iConferenceCallMonitor->iCallMonitorArray.Count() == 0 ); |
|
214 |
|
215 RTelHelper::SetCallStatus( RMobileCall::EStatusConnected ); |
|
216 iConferenceCallMonitor->MonitorCallL(); |
|
217 EUNIT_ASSERT( iConferenceCallMonitor->iCallMonitorArray.Count() == 0 ); |
|
218 |
|
219 } |
|
220 |
|
221 |
|
222 // TEST TABLE |
|
223 |
|
224 EUNIT_BEGIN_TEST_TABLE( |
|
225 UT_CMusCallConferenceMonitor, |
|
226 "UT_CMusCallConferenceMonitor", |
|
227 "UNIT" ) |
|
228 |
|
229 EUNIT_TEST( |
|
230 "NewL - test ", |
|
231 "CMusConferenceCallMonitor", |
|
232 "NewL", |
|
233 "FUNCTIONALITY", |
|
234 SetupL, UT_CMusCallConferenceMonitor_NewLL, Teardown) |
|
235 |
|
236 EUNIT_TEST( |
|
237 "RunL - test ", |
|
238 "CMusConferenceCallMonitor", |
|
239 "RunL", |
|
240 "FUNCTIONALITY", |
|
241 SetupL, UT_CMusCallConferenceMonitor_RunLL, Teardown) |
|
242 |
|
243 EUNIT_TEST( |
|
244 "DoCancel - test ", |
|
245 "CMusConferenceCallMonitor", |
|
246 "DoCancel", |
|
247 "FUNCTIONALITY", |
|
248 SetupL, UT_CMusCallConferenceMonitor_DoCancelL, Teardown) |
|
249 |
|
250 EUNIT_TEST( |
|
251 "RunError - test ", |
|
252 "CMusConferenceCallMonitor", |
|
253 "RunError", |
|
254 "FUNCTIONALITY", |
|
255 SetupL, UT_CMusCallConferenceMonitor_RunErrorL, Teardown) |
|
256 |
|
257 EUNIT_TEST( |
|
258 "MonitorCallL - test ", |
|
259 "CMusConferenceCallMonitor", |
|
260 "MonitorCallL", |
|
261 "FUNCTIONALITY", |
|
262 SetupL, UT_CMusCallConferenceMonitor_MonitorCallLL, Teardown) |
|
263 |
|
264 |
|
265 EUNIT_END_TEST_TABLE |
|
266 |
|
267 // END OF FILE |
|
268 |
|
269 |
|