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 "etelmm.h" |
|
21 #include "e32property.h" |
|
22 #include "ut_muspropertymonitor.h" |
|
23 #include "muspropertymonitor.h" |
|
24 #include "mussesseioninformationapi.h" |
|
25 |
|
26 |
|
27 // SYSTEM INCLUDES |
|
28 #include <digia/eunit/eunitmacros.h> |
|
29 |
|
30 _LIT(KTelNo,"1234"); |
|
31 |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 UT_CMusPropertyMonitor* UT_CMusPropertyMonitor::NewL() |
|
38 { |
|
39 UT_CMusPropertyMonitor* self = UT_CMusPropertyMonitor::NewLC(); |
|
40 CleanupStack::Pop( self ); |
|
41 return self; |
|
42 } |
|
43 |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 UT_CMusPropertyMonitor* UT_CMusPropertyMonitor::NewLC() |
|
50 { |
|
51 UT_CMusPropertyMonitor* self = new( ELeave ) UT_CMusPropertyMonitor(); |
|
52 CleanupStack::PushL( self ); |
|
53 self->ConstructL(); |
|
54 return self; |
|
55 } |
|
56 |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 UT_CMusPropertyMonitor::~UT_CMusPropertyMonitor() |
|
63 { |
|
64 } |
|
65 |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // Default constructor |
|
69 // ----------------------------------------------------------------------------- |
|
70 // |
|
71 UT_CMusPropertyMonitor::UT_CMusPropertyMonitor() |
|
72 { |
|
73 // NOP |
|
74 } |
|
75 |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // Second phase construct |
|
79 // ----------------------------------------------------------------------------- |
|
80 // |
|
81 void UT_CMusPropertyMonitor::ConstructL() |
|
82 { |
|
83 // The ConstructL from the base class CEUnitTestSuiteClass must be called. |
|
84 // It generates the test case table. |
|
85 CEUnitTestSuiteClass::ConstructL(); |
|
86 } |
|
87 |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 void UT_CMusPropertyMonitor::SetupL() |
|
94 { |
|
95 iMusPropertyMonitor = CMusPropertyMonitor::NewL(); |
|
96 iMusPropertyMonitor->iPropertyEvent.iPValue = NMusSessionInformationApi::ENoCall; |
|
97 } |
|
98 |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 void UT_CMusPropertyMonitor::Teardown() |
|
105 { |
|
106 delete iMusPropertyMonitor; |
|
107 PropertyHelper::Close(); |
|
108 } |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 // TEST CASES |
|
116 |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 void UT_CMusPropertyMonitor::UT_CMusPropertyMonitor_RunLL() |
|
122 { |
|
123 EUNIT_ASSERT( iMusPropertyMonitor); |
|
124 EUNIT_ASSERT( !iMusPropertyMonitor->iManager ); |
|
125 |
|
126 iMusPropertyMonitor->iPropertyEvent.iPValue = NMusSessionInformationApi::ENoCall; |
|
127 iMusPropertyMonitor->Cancel(); |
|
128 iMusPropertyMonitor->RunL(); |
|
129 EUNIT_ASSERT( !iMusPropertyMonitor->iManager ); |
|
130 |
|
131 iMusPropertyMonitor->iPropertyEvent.iPValue = NMusSessionInformationApi::ECallConnected; |
|
132 iMusPropertyMonitor->Cancel(); |
|
133 iMusPropertyMonitor->RunL(); |
|
134 EUNIT_ASSERT( iMusPropertyMonitor->iManager ); |
|
135 |
|
136 iMusPropertyMonitor->iPropertyEvent.iPValue = NMusSessionInformationApi::ECallConnected; |
|
137 iMusPropertyMonitor->Cancel(); |
|
138 iMusPropertyMonitor->RunL(); |
|
139 EUNIT_ASSERT( iMusPropertyMonitor->iManager ); |
|
140 |
|
141 iMusPropertyMonitor->iPropertyEvent.iPValue = NMusSessionInformationApi::ECallHold; |
|
142 iMusPropertyMonitor->Cancel(); |
|
143 iMusPropertyMonitor->RunL(); |
|
144 EUNIT_ASSERT( iMusPropertyMonitor->iManager ); |
|
145 |
|
146 iMusPropertyMonitor->iPropertyEvent.iPValue = NMusSessionInformationApi::EConferenceCall; |
|
147 iMusPropertyMonitor->Cancel(); |
|
148 iMusPropertyMonitor->RunL(); |
|
149 EUNIT_ASSERT( iMusPropertyMonitor->iManager ); |
|
150 |
|
151 iMusPropertyMonitor->iPropertyEvent.iPValue = NMusSessionInformationApi::ENoCall; |
|
152 iMusPropertyMonitor->Cancel(); |
|
153 iMusPropertyMonitor->RunL(); |
|
154 EUNIT_ASSERT( !iMusPropertyMonitor->iManager ); |
|
155 |
|
156 iMusPropertyMonitor->iPropertyEvent.iPValue = 555; |
|
157 iMusPropertyMonitor->Cancel(); |
|
158 iMusPropertyMonitor->RunL(); |
|
159 EUNIT_ASSERT( !iMusPropertyMonitor->iManager ); |
|
160 |
|
161 } |
|
162 |
|
163 |
|
164 |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 // ----------------------------------------------------------------------------- |
|
168 // |
|
169 void UT_CMusPropertyMonitor::UT_CMusPropertyMonitor_DoCancelL() |
|
170 { |
|
171 EUNIT_ASSERT( iMusPropertyMonitor ); |
|
172 iMusPropertyMonitor->DoCancel(); |
|
173 EUNIT_ASSERT( PropertyHelper::GetCalledFunction() == |
|
174 RProperty::ECancel ) |
|
175 } |
|
176 |
|
177 |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 // ----------------------------------------------------------------------------- |
|
181 // |
|
182 void UT_CMusPropertyMonitor::UT_CMusPropertyMonitor_RunErrorL() |
|
183 { |
|
184 EUNIT_ASSERT( iMusPropertyMonitor ); |
|
185 TInt error = KErrNotFound; |
|
186 iMusPropertyMonitor->RunError(error); |
|
187 } |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 // TEST TABLE |
|
195 |
|
196 EUNIT_BEGIN_TEST_TABLE( |
|
197 UT_CMusPropertyMonitor, |
|
198 "UT_CMusPropertyMonitor", |
|
199 "UNIT" ) |
|
200 |
|
201 EUNIT_TEST( |
|
202 "RunL - test", |
|
203 "CMusCallStatusMonitor", |
|
204 "RunL", |
|
205 "FUNCTIONALITY", |
|
206 SetupL, UT_CMusPropertyMonitor_RunLL, Teardown) |
|
207 |
|
208 EUNIT_TEST( |
|
209 "DoCancel - test", |
|
210 "CMusCallStatusMonitor", |
|
211 "DoCancel", |
|
212 "FUNCTIONALITY", |
|
213 SetupL, UT_CMusPropertyMonitor_DoCancelL, Teardown) |
|
214 |
|
215 EUNIT_TEST( |
|
216 "RunError - test", |
|
217 "CMusCallStatusMonitor", |
|
218 "RunErrorL", |
|
219 "FUNCTIONALITY", |
|
220 SetupL, UT_CMusPropertyMonitor_RunErrorL, Teardown) |
|
221 |
|
222 EUNIT_END_TEST_TABLE |
|
223 |
|
224 // END OF FILE |
|
225 |
|
226 |
|