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 "ut_musengremotevideoplayer.h" |
|
21 #include "musengremotevideoplayer.h" |
|
22 #include "mceinsession.h" |
|
23 #include "mcevideostream.h" |
|
24 #include "mcertpsource.h" |
|
25 #include "mcedisplaysink.h" |
|
26 |
|
27 // SYSTEM INCLUDES |
|
28 #include <eunitmacros.h> |
|
29 |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 UT_CMusEngRemoteVideoPlayer* UT_CMusEngRemoteVideoPlayer::NewL() |
|
36 { |
|
37 UT_CMusEngRemoteVideoPlayer* self = UT_CMusEngRemoteVideoPlayer::NewLC(); |
|
38 CleanupStack::Pop( self ); |
|
39 return self; |
|
40 } |
|
41 |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 UT_CMusEngRemoteVideoPlayer* UT_CMusEngRemoteVideoPlayer::NewLC() |
|
48 { |
|
49 UT_CMusEngRemoteVideoPlayer* self = new( ELeave ) UT_CMusEngRemoteVideoPlayer(); |
|
50 CleanupStack::PushL( self ); |
|
51 self->ConstructL(); |
|
52 return self; |
|
53 } |
|
54 |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 UT_CMusEngRemoteVideoPlayer::~UT_CMusEngRemoteVideoPlayer() |
|
61 { |
|
62 // NOP |
|
63 } |
|
64 |
|
65 |
|
66 // ----------------------------------------------------------------------------- |
|
67 // Default constructor |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 UT_CMusEngRemoteVideoPlayer::UT_CMusEngRemoteVideoPlayer() |
|
71 { |
|
72 // NOP |
|
73 } |
|
74 |
|
75 |
|
76 // ----------------------------------------------------------------------------- |
|
77 // Second phase construct |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 void UT_CMusEngRemoteVideoPlayer::ConstructL() |
|
81 { |
|
82 // The ConstructL from the base class CEUnitTestSuiteClass must be called. |
|
83 // It generates the test case table. |
|
84 CEUnitTestSuiteClass::ConstructL(); |
|
85 } |
|
86 |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 void UT_CMusEngRemoteVideoPlayer::SetupL() |
|
93 { |
|
94 iMceSession = CMceInSession::NewL(); |
|
95 CMceVideoStream* videoStream = CMceVideoStream::NewLC(); |
|
96 CMceRtpSource* source = CMceRtpSource::NewLC(); |
|
97 videoStream->SetSourceL( source ); |
|
98 CleanupStack::Pop( source ); |
|
99 CMceDisplaySink* sink = CMceDisplaySink::NewLC(); |
|
100 videoStream->AddSinkL( sink ); |
|
101 CleanupStack::Pop( sink ); |
|
102 iMceSession->AddStreamL( videoStream ); |
|
103 CleanupStack::Pop( videoStream ); |
|
104 |
|
105 iRemoteVideoPlayer = CMusEngRemoteVideoPlayer::NewL( |
|
106 iDisplayHandlerStub, |
|
107 iLcAudioControlStub ); |
|
108 iRemoteVideoPlayer->SetMceSession( iMceSession ); |
|
109 } |
|
110 |
|
111 |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 // ----------------------------------------------------------------------------- |
|
115 // |
|
116 void UT_CMusEngRemoteVideoPlayer::Teardown() |
|
117 { |
|
118 delete iRemoteVideoPlayer; |
|
119 delete iMceSession; |
|
120 iLcAudioControlStub.Reset(); |
|
121 } |
|
122 |
|
123 |
|
124 |
|
125 // TEST CASES |
|
126 |
|
127 |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 // ----------------------------------------------------------------------------- |
|
131 // |
|
132 void UT_CMusEngRemoteVideoPlayer::UT_NewLL() |
|
133 { |
|
134 } |
|
135 |
|
136 // ----------------------------------------------------------------------------- |
|
137 // |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 void UT_CMusEngRemoteVideoPlayer::UT_LcVideoPlayerStateL() |
|
141 { |
|
142 // iMceSession not set |
|
143 iRemoteVideoPlayer->SetMceSession( NULL ); |
|
144 EUNIT_ASSERT_EQUALS( TInt( MLcVideoPlayer::EUnavailable ), |
|
145 TInt( iRemoteVideoPlayer->LcVideoPlayerState() ) ) |
|
146 iRemoteVideoPlayer->SetMceSession( iMceSession ); |
|
147 |
|
148 // Establish Session and simulate media playing. |
|
149 iMceSession->iState = CMceSession::EEstablished; |
|
150 for ( TInt i = 0; i < iMceSession->Streams().Count(); i++ ) |
|
151 { |
|
152 iMceSession->Streams()[i]->iState = CMceMediaStream::EStreaming; |
|
153 } |
|
154 |
|
155 EUNIT_ASSERT_EQUALS( TInt( MLcVideoPlayer::EPlaying ), |
|
156 TInt( iRemoteVideoPlayer->LcVideoPlayerState() ) ) |
|
157 |
|
158 // Media streams unavailable |
|
159 iMceSession->Streams()[0]->iState = CMceMediaStream::EUninitialized; |
|
160 EUNIT_ASSERT_EQUALS( TInt( MLcVideoPlayer::EUnavailable ), |
|
161 TInt( iRemoteVideoPlayer->LcVideoPlayerState() ) ) |
|
162 |
|
163 // All other stream states |
|
164 iMceSession->Streams()[0]->iState = CMceMediaStream::EInitialized; |
|
165 EUNIT_ASSERT_EQUALS( TInt( MLcVideoPlayer::EInit ), |
|
166 TInt( iRemoteVideoPlayer->LcVideoPlayerState() ) ) |
|
167 |
|
168 iMceSession->Streams()[0]->iState = CMceMediaStream::EBuffering; |
|
169 EUNIT_ASSERT_EQUALS( TInt( MLcVideoPlayer::EBuffering ), |
|
170 TInt( iRemoteVideoPlayer->LcVideoPlayerState() ) ) |
|
171 |
|
172 iMceSession->Streams()[0]->iState = CMceMediaStream::EIdle; |
|
173 EUNIT_ASSERT_EQUALS( TInt( MLcVideoPlayer::EPaused ), |
|
174 TInt( iRemoteVideoPlayer->LcVideoPlayerState() ) ) |
|
175 |
|
176 iMceSession->Streams()[0]->iState = CMceMediaStream::EDisabled; |
|
177 EUNIT_ASSERT_EQUALS( TInt( MLcVideoPlayer::EPaused ), |
|
178 TInt( iRemoteVideoPlayer->LcVideoPlayerState() ) ) |
|
179 |
|
180 iDisplayHandlerStub.iIsActive = ETrue; |
|
181 iMceSession->Streams()[0]->iState = CMceMediaStream::EStreaming; |
|
182 EUNIT_ASSERT_EQUALS( TInt( MLcVideoPlayer::EPlaying ), |
|
183 TInt( iRemoteVideoPlayer->LcVideoPlayerState() ) ) |
|
184 |
|
185 iDisplayHandlerStub.iIsActive = EFalse; |
|
186 iMceSession->Streams()[0]->iState = CMceMediaStream::EStreaming; |
|
187 EUNIT_ASSERT_EQUALS( TInt( MLcVideoPlayer::EPaused ), |
|
188 TInt( iRemoteVideoPlayer->LcVideoPlayerState() ) ) |
|
189 |
|
190 iMceSession->Streams()[0]->iState = CMceMediaStream::ENoResources; |
|
191 EUNIT_ASSERT_EQUALS( TInt( MLcVideoPlayer::EUnavailable ), |
|
192 TInt( iRemoteVideoPlayer->LcVideoPlayerState() ) ) |
|
193 |
|
194 iMceSession->Streams()[0]->iState = CMceMediaStream::ETranscodingRequired; |
|
195 EUNIT_ASSERT_EQUALS( TInt( MLcVideoPlayer::EUnavailable ), |
|
196 TInt( iRemoteVideoPlayer->LcVideoPlayerState() ) ) |
|
197 |
|
198 iMceSession->Streams()[0]->iState = CMceMediaStream::ETranscoding; |
|
199 EUNIT_ASSERT_EQUALS( TInt( MLcVideoPlayer::EUnavailable ), |
|
200 TInt( iRemoteVideoPlayer->LcVideoPlayerState() ) ) |
|
201 } |
|
202 |
|
203 // ----------------------------------------------------------------------------- |
|
204 // |
|
205 // ----------------------------------------------------------------------------- |
|
206 // |
|
207 void UT_CMusEngRemoteVideoPlayer::UT_LcPlayL() |
|
208 { |
|
209 // iMceSession not set |
|
210 iRemoteVideoPlayer->SetMceSession( NULL ); |
|
211 EUNIT_ASSERT( !iRemoteVideoPlayer->LcIsPlayingL() ) |
|
212 iRemoteVideoPlayer->SetMceSession( iMceSession ); |
|
213 |
|
214 iMceSession->iState = CMceSession::EEstablished; |
|
215 for ( TInt i = 0; i < iMceSession->Streams().Count(); i++ ) |
|
216 { |
|
217 iMceSession->Streams()[i]->iState = CMceMediaStream::EStreaming; |
|
218 } |
|
219 |
|
220 // Play Test |
|
221 iRemoteVideoPlayer->LcPlayL(); |
|
222 EUNIT_ASSERT( iRemoteVideoPlayer->LcIsPlayingL() ) |
|
223 |
|
224 // Pause Test |
|
225 iMceSession->Streams()[0]->iState = CMceMediaStream::EDisabled; |
|
226 iRemoteVideoPlayer->LcPauseL(); |
|
227 EUNIT_ASSERT( !iRemoteVideoPlayer->LcIsPlayingL() ) |
|
228 } |
|
229 |
|
230 // ----------------------------------------------------------------------------- |
|
231 // |
|
232 // ----------------------------------------------------------------------------- |
|
233 // |
|
234 void UT_CMusEngRemoteVideoPlayer::UT_LcWindowL() |
|
235 { |
|
236 EUNIT_ASSERT( iRemoteVideoPlayer->LcWindow() == iRemoteVideoPlayer ) |
|
237 } |
|
238 |
|
239 // ----------------------------------------------------------------------------- |
|
240 // |
|
241 // ----------------------------------------------------------------------------- |
|
242 // |
|
243 void UT_CMusEngRemoteVideoPlayer::UT_LcCameraControlL() |
|
244 { |
|
245 EUNIT_ASSERT( iRemoteVideoPlayer->LcCameraControl() == NULL ) |
|
246 } |
|
247 |
|
248 // ----------------------------------------------------------------------------- |
|
249 // |
|
250 // ----------------------------------------------------------------------------- |
|
251 // |
|
252 void UT_CMusEngRemoteVideoPlayer::UT_LcSourceFileControlL() |
|
253 { |
|
254 EUNIT_ASSERT( iRemoteVideoPlayer->LcSourceFileControl() == NULL ) |
|
255 } |
|
256 |
|
257 // ----------------------------------------------------------------------------- |
|
258 // |
|
259 // ----------------------------------------------------------------------------- |
|
260 // |
|
261 void UT_CMusEngRemoteVideoPlayer::UT_LcDestinationFileControlL() |
|
262 { |
|
263 EUNIT_ASSERT( iRemoteVideoPlayer->LcDestinationFileControl() == NULL ) |
|
264 } |
|
265 |
|
266 // ----------------------------------------------------------------------------- |
|
267 // |
|
268 // ----------------------------------------------------------------------------- |
|
269 // |
|
270 void UT_CMusEngRemoteVideoPlayer::UT_LcAudioControlL() |
|
271 { |
|
272 EUNIT_ASSERT( iRemoteVideoPlayer->LcAudioControl() == &iLcAudioControlStub ) |
|
273 } |
|
274 |
|
275 // ----------------------------------------------------------------------------- |
|
276 // |
|
277 // ----------------------------------------------------------------------------- |
|
278 // |
|
279 void UT_CMusEngRemoteVideoPlayer::UT_LcZoomControlL() |
|
280 { |
|
281 EUNIT_ASSERT( iRemoteVideoPlayer->LcZoomControl() == NULL ) |
|
282 } |
|
283 |
|
284 // ----------------------------------------------------------------------------- |
|
285 // |
|
286 // ----------------------------------------------------------------------------- |
|
287 // |
|
288 void UT_CMusEngRemoteVideoPlayer::UT_LcBrightnessControlL() |
|
289 { |
|
290 EUNIT_ASSERT( iRemoteVideoPlayer->LcBrightnessControl() == NULL ) |
|
291 } |
|
292 |
|
293 // ----------------------------------------------------------------------------- |
|
294 // |
|
295 // ----------------------------------------------------------------------------- |
|
296 // |
|
297 void UT_CMusEngRemoteVideoPlayer::UT_EnableLcWindowL() |
|
298 { |
|
299 EUNIT_ASSERT( !iRemoteVideoPlayer->IsLcWindowEnabled() ) |
|
300 |
|
301 // Enable |
|
302 iRemoteVideoPlayer->EnableLcWindowL( ETrue ); |
|
303 EUNIT_ASSERT( iRemoteVideoPlayer->IsLcWindowEnabled() ) |
|
304 |
|
305 // Disable |
|
306 iRemoteVideoPlayer->EnableLcWindowL( EFalse ); |
|
307 EUNIT_ASSERT( !iRemoteVideoPlayer->IsLcWindowEnabled() ) |
|
308 } |
|
309 |
|
310 // ----------------------------------------------------------------------------- |
|
311 // |
|
312 // ----------------------------------------------------------------------------- |
|
313 // |
|
314 void UT_CMusEngRemoteVideoPlayer::UT_LcWindowRectL() |
|
315 { |
|
316 TRect rect( 12, 34, 56, 78 ); |
|
317 iRemoteVideoPlayer->SetLcWindowRectL( rect ); |
|
318 EUNIT_ASSERT( iRemoteVideoPlayer->LcWindowRect() == rect ) |
|
319 } |
|
320 |
|
321 // ----------------------------------------------------------------------------- |
|
322 // |
|
323 // ----------------------------------------------------------------------------- |
|
324 // |
|
325 void UT_CMusEngRemoteVideoPlayer::UT_LcWindowOrientationL() |
|
326 { |
|
327 iRemoteVideoPlayer->SetLcWindowOrientationL( MLcWindow::EPortrait ); |
|
328 EUNIT_ASSERT_EQUALS( TInt( MLcWindow::EPortrait ), |
|
329 TInt( iRemoteVideoPlayer->LcWindowOrientationL() ) ) |
|
330 |
|
331 iRemoteVideoPlayer->SetLcWindowOrientationL( MLcWindow::ELandscape ); |
|
332 EUNIT_ASSERT_EQUALS( TInt( MLcWindow::ELandscape ), |
|
333 TInt( iRemoteVideoPlayer->LcWindowOrientationL() ) ) |
|
334 } |
|
335 |
|
336 |
|
337 // TEST TABLE |
|
338 |
|
339 EUNIT_BEGIN_TEST_TABLE( |
|
340 UT_CMusEngRemoteVideoPlayer, |
|
341 "UT_CMusEngRemoteVideoPlayer", |
|
342 "UNIT" ) |
|
343 |
|
344 EUNIT_TEST( |
|
345 "NewL - test ", |
|
346 "CMusEngRemoteVideoPlayer", |
|
347 "NewL", |
|
348 "FUNCTIONALITY", |
|
349 SetupL, UT_NewLL, Teardown) |
|
350 |
|
351 EUNIT_TEST( |
|
352 "LcVideoPlayerState - test ", |
|
353 "CMusEngRemoteVideoPlayer", |
|
354 "LcVideoPlayerState", |
|
355 "FUNCTIONALITY", |
|
356 SetupL, UT_LcVideoPlayerStateL, Teardown) |
|
357 |
|
358 EUNIT_TEST( |
|
359 "LcPlayL - test ", |
|
360 "CMusEngRemoteVideoPlayer", |
|
361 "LcPlayL", |
|
362 "FUNCTIONALITY", |
|
363 SetupL, UT_LcPlayL, Teardown) |
|
364 |
|
365 EUNIT_TEST( |
|
366 "LcWindow - test ", |
|
367 "CMusEngRemoteVideoPlayer", |
|
368 "LcWindow", |
|
369 "FUNCTIONALITY", |
|
370 SetupL, UT_LcWindowL, Teardown) |
|
371 |
|
372 EUNIT_TEST( |
|
373 "LcCameraControl - test ", |
|
374 "CMusEngRemoteVideoPlayer", |
|
375 "LcCameraControl", |
|
376 "FUNCTIONALITY", |
|
377 SetupL, UT_LcCameraControlL, Teardown) |
|
378 |
|
379 EUNIT_TEST( |
|
380 "LcSourceFile - test ", |
|
381 "CMusEngRemoteVideoPlayer", |
|
382 "LcSourceFile", |
|
383 "FUNCTIONALITY", |
|
384 SetupL, UT_LcSourceFileControlL, Teardown) |
|
385 |
|
386 EUNIT_TEST( |
|
387 "LcDestinationFile - test ", |
|
388 "CMusEngRemoteVideoPlayer", |
|
389 "LcDestinationFile", |
|
390 "FUNCTIONALITY", |
|
391 SetupL, UT_LcDestinationFileControlL, Teardown) |
|
392 |
|
393 EUNIT_TEST( |
|
394 "LcAudioControl - test ", |
|
395 "CMusEngRemoteVideoPlayer", |
|
396 "LcAudioControl", |
|
397 "FUNCTIONALITY", |
|
398 SetupL, UT_LcAudioControlL, Teardown) |
|
399 |
|
400 EUNIT_TEST( |
|
401 "LcZoomControl - test ", |
|
402 "CMusEngRemoteVideoPlayer", |
|
403 "LcZoomControl", |
|
404 "FUNCTIONALITY", |
|
405 SetupL, UT_LcZoomControlL, Teardown) |
|
406 |
|
407 EUNIT_TEST( |
|
408 "LcBrightnessControl - test ", |
|
409 "CMusEngRemoteVideoPlayer", |
|
410 "LcBrightnessControl", |
|
411 "FUNCTIONALITY", |
|
412 SetupL, UT_LcBrightnessControlL, Teardown) |
|
413 |
|
414 EUNIT_TEST( |
|
415 "EnableLcWindowL - test ", |
|
416 "CMusEngRemoteVideoPlayer", |
|
417 "EnableLcWindowL", |
|
418 "FUNCTIONALITY", |
|
419 SetupL, UT_EnableLcWindowL, Teardown) |
|
420 |
|
421 EUNIT_TEST( |
|
422 "LcWindowRect - test ", |
|
423 "CMusEngRemoteVideoPlayer", |
|
424 "LcWindowRect", |
|
425 "FUNCTIONALITY", |
|
426 SetupL, UT_LcWindowRectL, Teardown) |
|
427 |
|
428 EUNIT_TEST( |
|
429 "LcWindowOrientation - test ", |
|
430 "CMusEngRemoteVideoPlayer", |
|
431 "LcWindowOrientation", |
|
432 "FUNCTIONALITY", |
|
433 SetupL, UT_LcWindowOrientationL, Teardown) |
|
434 |
|
435 |
|
436 EUNIT_END_TEST_TABLE |
|
437 |
|
438 // END OF FILE |
|
439 |
|
440 |
|