|
1 /* |
|
2 * Copyright (c) 2006-2007 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: Implements unit tests for CMusManager class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "muslogger.h" |
|
21 #include "musmanager.h" |
|
22 #include "ut_cmusmanager.h" |
|
23 #include "musmanagerimpl.h" |
|
24 #include "FeatMgr.h" |
|
25 #include <digia/eunit/eunitmacros.h> |
|
26 |
|
27 // ======== MEMBER FUNCTIONS ======== |
|
28 |
|
29 |
|
30 UT_CMusManager::UT_CMusManager() |
|
31 : CEUnitTestSuiteClass() |
|
32 { |
|
33 } |
|
34 |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // The ConstructL from the base class CEUnitTestSuiteClass must be called. |
|
38 // It generates the test case table. |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 void UT_CMusManager::ConstructL() |
|
42 { |
|
43 CEUnitTestSuiteClass::ConstructL(); |
|
44 } |
|
45 |
|
46 |
|
47 UT_CMusManager* UT_CMusManager::NewL() |
|
48 { |
|
49 UT_CMusManager* self = UT_CMusManager::NewLC(); |
|
50 CleanupStack::Pop( self ); |
|
51 return self; |
|
52 } |
|
53 |
|
54 |
|
55 UT_CMusManager* UT_CMusManager::NewLC() |
|
56 { |
|
57 UT_CMusManager* self = new( ELeave ) UT_CMusManager; |
|
58 CleanupStack::PushL( self ); |
|
59 self->ConstructL(); |
|
60 return self; |
|
61 } |
|
62 |
|
63 |
|
64 UT_CMusManager::~UT_CMusManager() |
|
65 { |
|
66 } |
|
67 |
|
68 |
|
69 // --------------------------------------------------------------------------- |
|
70 // Sets up a test case by instantiating tested class. |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 void UT_CMusManager::SetupL( ) |
|
74 { |
|
75 iImpl = CMusManager::NewL(); |
|
76 } |
|
77 |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // Finalizes a test case by freeing resources. |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 void UT_CMusManager::Teardown( ) |
|
84 { |
|
85 delete iImpl; |
|
86 } |
|
87 |
|
88 |
|
89 // ======== UNIT TEST METHODS ======== |
|
90 |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 // Dummy test to increase execution coverage. |
|
94 // --------------------------------------------------------------------------- |
|
95 // |
|
96 void UT_CMusManager::UT_CMusManager_ExamineAvailabilityLL() |
|
97 { |
|
98 iImpl->ExamineAvailabilityL(); |
|
99 } |
|
100 |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // Dummy test to increase execution coverage. |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 void UT_CMusManager::UT_CMusManager_AvailabilityLL() |
|
107 { |
|
108 iImpl->AvailabilityL(); |
|
109 } |
|
110 |
|
111 |
|
112 // --------------------------------------------------------------------------- |
|
113 // Dummy test to increase execution coverage. |
|
114 // --------------------------------------------------------------------------- |
|
115 // |
|
116 void UT_CMusManager::UT_CMusManager_HandleSipRequestLL() |
|
117 { |
|
118 iImpl->HandleSipRequestL( CMusManager::ESipOptions ); |
|
119 } |
|
120 |
|
121 |
|
122 // --------------------------------------------------------------------------- |
|
123 // Dummy test to increase execution coverage. |
|
124 // --------------------------------------------------------------------------- |
|
125 // |
|
126 void UT_CMusManager::UT_CMusManager_StartApplicationLL() |
|
127 { |
|
128 iImpl->StartApplicationL( MultimediaSharing::EMusLiveVideo ); |
|
129 iImpl->StartApplicationL( MultimediaSharing::EMusClipVideo ); |
|
130 iImpl->StartApplicationL( MultimediaSharing::EMusStillImage ); |
|
131 } |
|
132 |
|
133 |
|
134 void UT_CMusManager::UT_CMusManager_HandleCommandLL() |
|
135 { |
|
136 MultimediaSharing::TCommandType commandType = MultimediaSharing::ECommandNotDefined; |
|
137 iImpl->HandleCommandL( commandType ); |
|
138 commandType = MultimediaSharing::ECommandManualActivation; |
|
139 iImpl->HandleCommandL( commandType ); |
|
140 |
|
141 } |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // Dummy test to increase execution coverage. |
|
145 // --------------------------------------------------------------------------- |
|
146 // |
|
147 void UT_CMusManager::UT_CMusManager_StopApplicationLL() |
|
148 { |
|
149 iImpl->StopApplicationL(); |
|
150 } |
|
151 |
|
152 // --------------------------------------------------------------------------- |
|
153 // Sets up dummy |
|
154 // --------------------------------------------------------------------------- |
|
155 // |
|
156 void UT_CMusManager::SetupDummyL( ) |
|
157 { |
|
158 } |
|
159 |
|
160 |
|
161 // --------------------------------------------------------------------------- |
|
162 // Teardown Dummy |
|
163 // --------------------------------------------------------------------------- |
|
164 // |
|
165 void UT_CMusManager::TeardownDummy( ) |
|
166 { |
|
167 } |
|
168 |
|
169 // --------------------------------------------------------------------------- |
|
170 // NewLL |
|
171 // --------------------------------------------------------------------------- |
|
172 // |
|
173 void UT_CMusManager::UT_CMusManager_NewLL() |
|
174 { |
|
175 CMusManager *self = NULL; |
|
176 |
|
177 FeatureManager::MultimediaSharingNotSupported(); |
|
178 TRAPD(err, self =CMusManager::NewL( this )); |
|
179 EUNIT_ASSERT( err == KErrNoMemory||err == KErrNotSupported ); |
|
180 delete self; |
|
181 |
|
182 FeatureManager::MultimediaSharingSupported(); |
|
183 TRAPD(error, self =CMusManager::NewL( this )); |
|
184 EUNIT_ASSERT( error == KErrNoMemory||error == KErrNone ); |
|
185 delete self; |
|
186 } |
|
187 |
|
188 // --------------------------------------------------------------------------- |
|
189 // MusAvailabilityChangedL |
|
190 // --------------------------------------------------------------------------- |
|
191 // |
|
192 void UT_CMusManager::MusAvailabilityChangedL( |
|
193 MultimediaSharing::TMusAvailabilityStatus /*aAvailabilityStatus*/ ) |
|
194 { |
|
195 |
|
196 } |
|
197 |
|
198 |
|
199 // ======== EUNIT TEST TABLE ======== |
|
200 |
|
201 |
|
202 EUNIT_BEGIN_TEST_TABLE( |
|
203 UT_CMusManager, |
|
204 "CMusManager", |
|
205 "CMusManager" ) |
|
206 |
|
207 EUNIT_TEST( |
|
208 "StopApplicationL - test", |
|
209 "CMusManager", |
|
210 "StopApplicationL", |
|
211 "FUNCTIONALITY", |
|
212 SetupL, UT_CMusManager_StopApplicationLL, Teardown) |
|
213 |
|
214 EUNIT_TEST( |
|
215 "StartApplicationL - test", |
|
216 "CMusManager", |
|
217 "StartApplicationL", |
|
218 "FUNCTIONALITY", |
|
219 SetupL, UT_CMusManager_StartApplicationLL, Teardown) |
|
220 |
|
221 EUNIT_TEST( |
|
222 "HandleSipRequestL - test", |
|
223 "CMusManager", |
|
224 "HandleSipRequestL", |
|
225 "FUNCTIONALITY", |
|
226 SetupL, UT_CMusManager_HandleSipRequestLL, Teardown) |
|
227 |
|
228 |
|
229 EUNIT_TEST( |
|
230 "AvailabilityL - test", |
|
231 "CMusManager", |
|
232 "AvailabilityL", |
|
233 "FUNCTIONALITY", |
|
234 SetupL, UT_CMusManager_AvailabilityLL, Teardown) |
|
235 |
|
236 |
|
237 EUNIT_TEST( |
|
238 "ExamineAvailabilityL - test", |
|
239 "CMusManager", |
|
240 "ExamineAvailabilityL", |
|
241 "FUNCTIONALITY", |
|
242 SetupL, UT_CMusManager_ExamineAvailabilityLL, Teardown) |
|
243 |
|
244 EUNIT_TEST( |
|
245 "NewL - test", |
|
246 "CMusManager", |
|
247 "NewL", |
|
248 "FUNCTIONALITY", |
|
249 SetupDummyL, UT_CMusManager_NewLL, TeardownDummy ) |
|
250 |
|
251 EUNIT_TEST( |
|
252 "HandleCommandL - test", |
|
253 "CMusManager", |
|
254 "HandleCommandL", |
|
255 "FUNCTIONALITY", |
|
256 SetupL, UT_CMusManager_HandleCommandLL, Teardown ) |
|
257 |
|
258 |
|
259 EUNIT_END_TEST_TABLE |
|
260 |