|
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_musenglivesession.h" |
|
21 #include "musengstubs.h" |
|
22 #include "musengtestdefs.h" |
|
23 #include "musenglivesession.h" |
|
24 #include "mussipprofilehandler.h" |
|
25 #include "musengmceutils.h" |
|
26 #include "mussettings.h" |
|
27 |
|
28 // SYSTEM INCLUDES |
|
29 #include <digia/eunit/eunitmacros.h> |
|
30 #include <mceoutsession.h> |
|
31 #include <mcestreambundle.h> |
|
32 #include <mcevideostream.h> |
|
33 #include <mcecamerasource.h> |
|
34 #include <mcertpsink.h> |
|
35 #include <mcefilesink.h> |
|
36 #include <mceh263codec.h> |
|
37 #include <mceavccodec.h> |
|
38 #include <mceaudiocodec.h> |
|
39 |
|
40 |
|
41 _LIT8( KMusAvcBitrateLevel1TestText, "TestTextForAvcBrL1Level" ); |
|
42 _LIT8( KMusAvcBitrateLevel1bTestText, "TestTextForAvcBrL1bLevel" ); |
|
43 _LIT8( KMusAvcBitrateLevel1_1TestText, "TestTextForAvcBrL1_1Level" ); |
|
44 _LIT8( KMusAvcBitrateLevel1_2TestText, "TestTextForAvcBrL1_2Level" ); |
|
45 _LIT8( KMusAvcBitrateLevel1_3TestText, "TestTextForAvcBrL1_3Level" ); |
|
46 _LIT8( KMusAvcBitrateLevel2TestText, "TestTextForAvcBrL2Level" ); |
|
47 |
|
48 _LIT8( KMusAvcBitrateLevel_1b_ConfigKey, "AvcBrL1b=TestTextForAvcBrL1bLevel;" ); |
|
49 |
|
50 _LIT8( KMusAvcBitrateLevel_1_1_ConfigKey, |
|
51 "AvcBrL1_1=TestTextForAvcBrL1_1Level;"); |
|
52 |
|
53 _LIT8( KMusAvcBitrateLevels_1_1_And_1b_ConfigKeys, |
|
54 "AvcBrL1_1=TestTextForAvcBrL1_1Level;\ |
|
55 AvcBrL1b=TestTextForAvcBrL1bLevel;" ); |
|
56 |
|
57 _LIT8( KMusAvcAllLevelsConcatenation, |
|
58 "AvcBrL1=TestTextForAvcBrL1Level;\ |
|
59 AvcBrL1b=TestTextForAvcBrL1bLevel;\ |
|
60 AvcBrL1_1=TestTextForAvcBrL1_1Level;\ |
|
61 AvcBrL1_2=TestTextForAvcBrL1_2Level;\ |
|
62 AvcBrL1_3=TestTextForAvcBrL1_3Level;\ |
|
63 AvcBrL2=TestTextForAvcBrL2Level;" ); |
|
64 |
|
65 |
|
66 |
|
67 //use step in different time period |
|
68 const TInt KZoomBigStepCount = 15; |
|
69 const TInt KZoomSmallStepCount = KZoomBigStepCount*2; |
|
70 const TInt KZoomStepMinSize = 1; |
|
71 |
|
72 // 0.4 second |
|
73 const TInt64 KZoomFasterTime = 400000;//must bigger than 1/3 second |
|
74 |
|
75 //insure that step is 1 |
|
76 #define USER_SLEEP User::After(KZoomFasterTime) |
|
77 |
|
78 |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 UT_CMusEngLiveSession* UT_CMusEngLiveSession::NewL() |
|
85 { |
|
86 UT_CMusEngLiveSession* self = UT_CMusEngLiveSession::NewLC(); |
|
87 CleanupStack::Pop( self ); |
|
88 return self; |
|
89 } |
|
90 |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 UT_CMusEngLiveSession* UT_CMusEngLiveSession::NewLC() |
|
97 { |
|
98 UT_CMusEngLiveSession* self = new( ELeave ) UT_CMusEngLiveSession(); |
|
99 CleanupStack::PushL( self ); |
|
100 self->ConstructL(); |
|
101 return self; |
|
102 } |
|
103 |
|
104 |
|
105 // ----------------------------------------------------------------------------- |
|
106 // |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 UT_CMusEngLiveSession::~UT_CMusEngLiveSession() |
|
110 { |
|
111 // NOP |
|
112 } |
|
113 |
|
114 |
|
115 // ----------------------------------------------------------------------------- |
|
116 // Default constructor |
|
117 // ----------------------------------------------------------------------------- |
|
118 // |
|
119 UT_CMusEngLiveSession::UT_CMusEngLiveSession() |
|
120 { |
|
121 // NOP |
|
122 } |
|
123 |
|
124 |
|
125 // ----------------------------------------------------------------------------- |
|
126 // Second phase construct |
|
127 // ----------------------------------------------------------------------------- |
|
128 // |
|
129 void UT_CMusEngLiveSession::ConstructL() |
|
130 { |
|
131 // The ConstructL from the base class CEUnitTestSuiteClass must be called. |
|
132 // It generates the test case table. |
|
133 CEUnitTestSuiteClass::ConstructL(); |
|
134 } |
|
135 |
|
136 |
|
137 // ----------------------------------------------------------------------------- |
|
138 // |
|
139 // ----------------------------------------------------------------------------- |
|
140 // |
|
141 void UT_CMusEngLiveSession::SetupL() |
|
142 { |
|
143 iObserver = new( ELeave ) CMusEngObserverStub; |
|
144 |
|
145 iLiveSession = CMusEngLiveSession::NewL( TRect(0, 0, 100, 100), |
|
146 *iObserver, |
|
147 *iObserver, |
|
148 *iObserver ); |
|
149 |
|
150 iRecordedLiveSession = CMusEngLiveSession::NewL( KTestVideoFileName(), |
|
151 TRect(0, 0, 100, 100), |
|
152 *iObserver, |
|
153 *iObserver, |
|
154 *iObserver ); |
|
155 |
|
156 } |
|
157 |
|
158 |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 // ----------------------------------------------------------------------------- |
|
162 // |
|
163 void UT_CMusEngLiveSession::Teardown() |
|
164 { |
|
165 delete iLiveSession; |
|
166 delete iRecordedLiveSession; |
|
167 delete iObserver; |
|
168 |
|
169 // Delete static data from CenRep stub |
|
170 CRepository::iStaticWriteAvcKeysToStaticData = EFalse; |
|
171 CRepository::DeleteStubAvcConfigKeys(); |
|
172 CRepository::iForceFailWithCode = KErrNone; |
|
173 } |
|
174 |
|
175 |
|
176 |
|
177 // TEST CASES |
|
178 |
|
179 |
|
180 // ----------------------------------------------------------------------------- |
|
181 // |
|
182 // ----------------------------------------------------------------------------- |
|
183 // |
|
184 void UT_CMusEngLiveSession::UT_NewLL() |
|
185 { |
|
186 EUNIT_ASSERT( iLiveSession ); |
|
187 EUNIT_ASSERT( iLiveSession->iRecordedFile == KNullDesC() ); |
|
188 EUNIT_ASSERT( iRecordedLiveSession ); |
|
189 EUNIT_ASSERT( iRecordedLiveSession->iRecordedFile == KTestVideoFileName() ); |
|
190 } |
|
191 |
|
192 |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 // ----------------------------------------------------------------------------- |
|
196 // |
|
197 void UT_CMusEngLiveSession::UT_CurrentZoomLL() |
|
198 { |
|
199 // Check that checking current zoom is not possible before invite |
|
200 TRAPD( error, iLiveSession->CurrentZoomL() ); |
|
201 MUS_TEST_FORWARD_ALLOC_FAILURE( error ); |
|
202 EUNIT_ASSERT( error == KErrNotReady ); |
|
203 |
|
204 // simulate session establishment |
|
205 ESTABLISH_OUT_SESSION( iLiveSession ); |
|
206 |
|
207 CMceCameraSource* camera = |
|
208 MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); |
|
209 |
|
210 // Check that originally current and default zoom are the same |
|
211 EUNIT_ASSERT( iLiveSession->iDefaultZoomFactor == |
|
212 iLiveSession->CurrentZoomL() ); |
|
213 |
|
214 // Zoom to maximum optical value |
|
215 while ( camera->iZoomFactor < iLiveSession->iCameraInfo.iMaxZoom ) |
|
216 { |
|
217 iLiveSession->ZoomInL(); |
|
218 } |
|
219 |
|
220 EUNIT_ASSERT( iLiveSession->iCameraInfo.iMaxZoom == |
|
221 iLiveSession->CurrentZoomL() ); |
|
222 |
|
223 // Zoom using digital zoom |
|
224 |
|
225 iLiveSession->ZoomInL(); |
|
226 |
|
227 EUNIT_ASSERT( iLiveSession->CurrentZoomL() == |
|
228 iLiveSession->iCameraInfo.iMaxZoom + |
|
229 camera->iDigitalZoomFactor ) |
|
230 |
|
231 } |
|
232 |
|
233 |
|
234 // ----------------------------------------------------------------------------- |
|
235 // |
|
236 // ----------------------------------------------------------------------------- |
|
237 // |
|
238 void UT_CMusEngLiveSession::UT_MaxZoomLL() |
|
239 { |
|
240 // Check that checking maximum zoom is not possible before invite |
|
241 TRAPD( error, iLiveSession->MaxZoomL() ); |
|
242 MUS_TEST_FORWARD_ALLOC_FAILURE( error ); |
|
243 EUNIT_ASSERT( error == KErrNotReady ); |
|
244 |
|
245 // simulate session establishment |
|
246 ESTABLISH_OUT_SESSION( iLiveSession ); |
|
247 |
|
248 EUNIT_ASSERT( iLiveSession->MaxZoomL() == |
|
249 iLiveSession->iCameraInfo.iMaxZoom + |
|
250 iLiveSession->iCameraInfo.iMaxDigitalZoom ); |
|
251 } |
|
252 |
|
253 |
|
254 // ----------------------------------------------------------------------------- |
|
255 // |
|
256 // ----------------------------------------------------------------------------- |
|
257 // |
|
258 void UT_CMusEngLiveSession::UT_ZoomInLL() |
|
259 { |
|
260 // Check that zooming is not possible before invite |
|
261 TRAPD( error, iLiveSession->ZoomInL() ); |
|
262 MUS_TEST_FORWARD_ALLOC_FAILURE( error ); |
|
263 EUNIT_ASSERT( error == KErrNotReady ); |
|
264 |
|
265 // simulate session establishment |
|
266 ESTABLISH_OUT_SESSION( iLiveSession ); |
|
267 |
|
268 CMceCameraSource* camera = |
|
269 MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); |
|
270 |
|
271 // Check the default value |
|
272 EUNIT_ASSERT( iLiveSession->iDefaultZoomFactor == camera->iZoomFactor ); |
|
273 |
|
274 // Check that zoom factor can be increased |
|
275 USER_SLEEP; //insure that small step is used |
|
276 iLiveSession->ZoomInL(); |
|
277 EUNIT_ASSERT( camera->iZoomFactor == iLiveSession->iDefaultZoomFactor + |
|
278 iLiveSession->iSmallZoomStep ); |
|
279 |
|
280 //Check the "burst" mode (immediate second ZoomIn), big step should be used |
|
281 TInt nZoom = camera->iZoomFactor + camera->iDigitalZoomFactor; |
|
282 iLiveSession->ZoomInL(); |
|
283 TInt nStep = camera->iZoomFactor + camera->iDigitalZoomFactor - nZoom; |
|
284 EUNIT_ASSERT( nStep == iLiveSession->iBigZoomStep ); |
|
285 |
|
286 // Zoom to maximum optical value |
|
287 while ( camera->iZoomFactor < iLiveSession->iCameraInfo.iMaxZoom ) |
|
288 { |
|
289 iLiveSession->ZoomInL(); |
|
290 } |
|
291 |
|
292 TInt maxOpticalZoomFactor = camera->ZoomFactorL(); |
|
293 |
|
294 // Check that digital zoom is used instead of optical |
|
295 iLiveSession->ZoomInL(); |
|
296 EUNIT_ASSERT( camera->iZoomFactor == maxOpticalZoomFactor ); |
|
297 EUNIT_ASSERT( camera->iDigitalZoomFactor > 0 ); |
|
298 |
|
299 // Zoom to maximum digital value |
|
300 while ( camera->iDigitalZoomFactor < |
|
301 iLiveSession->iCameraInfo.iMaxDigitalZoom ) |
|
302 { |
|
303 iLiveSession->ZoomInL(); |
|
304 } |
|
305 |
|
306 TInt maxDigitalZoomFactor = camera->DigitalZoomFactorL(); |
|
307 |
|
308 // Check that further zooming is impossible |
|
309 iLiveSession->ZoomInL(); |
|
310 EUNIT_ASSERT( camera->iZoomFactor == maxOpticalZoomFactor ); |
|
311 EUNIT_ASSERT( camera->iDigitalZoomFactor == maxDigitalZoomFactor ); |
|
312 |
|
313 } |
|
314 |
|
315 |
|
316 // ----------------------------------------------------------------------------- |
|
317 // |
|
318 // ----------------------------------------------------------------------------- |
|
319 // |
|
320 void UT_CMusEngLiveSession::UT_ZoomOutLL() |
|
321 { |
|
322 // Check that zooming is not possible before invite |
|
323 TRAPD( error, iLiveSession->ZoomOutL() ); |
|
324 MUS_TEST_FORWARD_ALLOC_FAILURE( error ); |
|
325 EUNIT_ASSERT( error == KErrNotReady ); |
|
326 |
|
327 // simulate session establishment |
|
328 ESTABLISH_OUT_SESSION( iLiveSession ); |
|
329 |
|
330 CMceCameraSource* camera = |
|
331 MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); |
|
332 |
|
333 // Check the default value |
|
334 EUNIT_ASSERT( iLiveSession->iDefaultZoomFactor == camera->iZoomFactor ); |
|
335 |
|
336 // Simulate maximum zoom |
|
337 camera->iZoomFactor = iLiveSession->iCameraInfo.iMaxZoom; |
|
338 camera->iDigitalZoomFactor = iLiveSession->iCameraInfo.iMaxDigitalZoom; |
|
339 |
|
340 // Check that digital zoom factor can be decreased |
|
341 USER_SLEEP; //insure that small step is used |
|
342 iLiveSession->ZoomOutL(); |
|
343 EUNIT_ASSERT( camera->iZoomFactor == iLiveSession->iCameraInfo.iMaxZoom ); |
|
344 EUNIT_ASSERT( camera->iDigitalZoomFactor == |
|
345 iLiveSession->iCameraInfo.iMaxDigitalZoom - |
|
346 iLiveSession->iSmallZoomStep ); |
|
347 |
|
348 //Check the "burst" mode (immediate second ZoomOut), big step should be used |
|
349 TInt nZoom = camera->iZoomFactor + camera->iDigitalZoomFactor; |
|
350 iLiveSession->ZoomOutL(); |
|
351 TInt nStep; |
|
352 nStep = nZoom - (camera->iZoomFactor + camera->iDigitalZoomFactor ); |
|
353 EUNIT_ASSERT( nStep == iLiveSession->iBigZoomStep ); |
|
354 |
|
355 // Simulate maximum zoom again |
|
356 camera->iZoomFactor = iLiveSession->iCameraInfo.iMaxZoom; |
|
357 camera->iDigitalZoomFactor = iLiveSession->iCameraInfo.iMaxDigitalZoom; |
|
358 |
|
359 // Zoom to minimum digital zoom |
|
360 while ( camera->iDigitalZoomFactor > 0 ) |
|
361 { |
|
362 iLiveSession->ZoomOutL(); |
|
363 } |
|
364 |
|
365 EUNIT_ASSERT( camera->iZoomFactor == iLiveSession->iCameraInfo.iMaxZoom ); |
|
366 EUNIT_ASSERT( camera->iDigitalZoomFactor == 0 ); |
|
367 |
|
368 // Check that optical zoom is decreased instead of digital |
|
369 USER_SLEEP; //insure that step is the small one |
|
370 iLiveSession->ZoomOutL(); |
|
371 EUNIT_ASSERT( camera->iZoomFactor == |
|
372 iLiveSession->iCameraInfo.iMaxZoom - |
|
373 iLiveSession->iSmallZoomStep ); |
|
374 EUNIT_ASSERT( camera->iDigitalZoomFactor == 0 ); |
|
375 |
|
376 // Zoom to minimum optical zoom |
|
377 while ( camera->iZoomFactor > iLiveSession->iCameraInfo.iMinZoom ) |
|
378 { |
|
379 iLiveSession->ZoomOutL(); |
|
380 } |
|
381 |
|
382 // Check that further zooming is impossible |
|
383 iLiveSession->ZoomOutL(); |
|
384 EUNIT_ASSERT( camera->iZoomFactor == iLiveSession->iCameraInfo.iMinZoom ); |
|
385 EUNIT_ASSERT( camera->iDigitalZoomFactor == 0 ); |
|
386 } |
|
387 |
|
388 |
|
389 // ----------------------------------------------------------------------------- |
|
390 // |
|
391 // ----------------------------------------------------------------------------- |
|
392 // |
|
393 void UT_CMusEngLiveSession::UT_ZoomDefaultLL() |
|
394 { |
|
395 // Check that zooming is not possible before invite |
|
396 TRAPD( error, iLiveSession->ZoomDefaultL() ); |
|
397 MUS_TEST_FORWARD_ALLOC_FAILURE( error ); |
|
398 EUNIT_ASSERT( error == KErrNotReady ); |
|
399 |
|
400 // simulate session establishment |
|
401 ESTABLISH_OUT_SESSION( iLiveSession ); |
|
402 |
|
403 CMceCameraSource* camera = |
|
404 MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); |
|
405 |
|
406 // Check the default value |
|
407 EUNIT_ASSERT( iLiveSession->iDefaultZoomFactor == camera->iZoomFactor ); |
|
408 |
|
409 // increase zoom factor so much that optical zoom is in maximum value |
|
410 // and digital zoom is in use |
|
411 while ( camera->iDigitalZoomFactor == 0 ) |
|
412 { |
|
413 iLiveSession->ZoomInL(); |
|
414 } |
|
415 EUNIT_ASSERT( camera->iZoomFactor > iLiveSession->iDefaultZoomFactor ); |
|
416 EUNIT_ASSERT( camera->iDigitalZoomFactor > 0 ); |
|
417 |
|
418 // back to default |
|
419 iLiveSession->ZoomDefaultL(); |
|
420 EUNIT_ASSERT( camera->iZoomFactor == iLiveSession->iDefaultZoomFactor ); |
|
421 EUNIT_ASSERT( camera->iDigitalZoomFactor == 0 ); |
|
422 } |
|
423 |
|
424 |
|
425 // ----------------------------------------------------------------------------- |
|
426 // |
|
427 // ----------------------------------------------------------------------------- |
|
428 // |
|
429 void UT_CMusEngLiveSession::UT_SetBrightnessLL() |
|
430 { |
|
431 // Check that setting brightness is not possible before invite |
|
432 EUNIT_ASSERT_SPECIFIC_LEAVE( |
|
433 iLiveSession->SetBrightnessL( KTestSomeBrightness ), |
|
434 KErrNotReady ) |
|
435 |
|
436 // simulate session establishment |
|
437 ESTABLISH_OUT_SESSION( iLiveSession ); |
|
438 |
|
439 CMceCameraSource* camera = |
|
440 MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); |
|
441 |
|
442 camera->iCameraInfo.iOptionsSupported = |
|
443 camera->iCameraInfo.iOptionsSupported | TCameraInfo::EBrightnessSupported; |
|
444 |
|
445 // Check that originally current and default brightness are the same |
|
446 EUNIT_ASSERT_EQUALS( iLiveSession->iDefaultBrightness, |
|
447 iLiveSession->CurrentBrightnessL() ) |
|
448 |
|
449 // Test setting brightness |
|
450 iLiveSession->SetBrightnessL( KTestSomeBrightness ); |
|
451 |
|
452 EUNIT_ASSERT_EQUALS( KTestSomeBrightness, |
|
453 iLiveSession->CurrentBrightnessL() ) |
|
454 } |
|
455 |
|
456 |
|
457 |
|
458 // ----------------------------------------------------------------------------- |
|
459 // |
|
460 // ----------------------------------------------------------------------------- |
|
461 // |
|
462 void UT_CMusEngLiveSession::UT_CurrentBrightnessLL() |
|
463 { |
|
464 // Check that checking current brightness is not possible before invite |
|
465 EUNIT_ASSERT_SPECIFIC_LEAVE( iLiveSession->CurrentBrightnessL(), |
|
466 KErrNotReady ) |
|
467 |
|
468 // All the other stuff checked in tests of SetBrightnessL |
|
469 } |
|
470 |
|
471 // ----------------------------------------------------------------------------- |
|
472 // |
|
473 // ----------------------------------------------------------------------------- |
|
474 // |
|
475 void UT_CMusEngLiveSession::UT_MaxBrightnessLL() |
|
476 { |
|
477 // MaxBrightness should return a constant |
|
478 |
|
479 EUNIT_ASSERT_EQUALS( KTestMaxBrightness, iLiveSession->MaxBrightnessL() ) |
|
480 } |
|
481 |
|
482 // ----------------------------------------------------------------------------- |
|
483 // |
|
484 // ----------------------------------------------------------------------------- |
|
485 // |
|
486 void UT_CMusEngLiveSession::UT_MinBrightnessLL() |
|
487 { |
|
488 // MinBrightness should return a constant |
|
489 |
|
490 EUNIT_ASSERT_EQUALS( KTestMinBrightness, iLiveSession->MinBrightnessL() ) |
|
491 } |
|
492 |
|
493 // ----------------------------------------------------------------------------- |
|
494 // |
|
495 // ----------------------------------------------------------------------------- |
|
496 // |
|
497 void UT_CMusEngLiveSession::UT_IncreaseBrightnessLL() |
|
498 { |
|
499 // Check that increasing brightness is not possible before invite |
|
500 EUNIT_ASSERT_SPECIFIC_LEAVE( iLiveSession->IncreaseBrightnessL(), |
|
501 KErrNotReady ) |
|
502 |
|
503 // simulate session establishment |
|
504 ESTABLISH_OUT_SESSION( iLiveSession ); |
|
505 |
|
506 CMceCameraSource* camera = |
|
507 MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); |
|
508 |
|
509 camera->iCameraInfo.iOptionsSupported = |
|
510 camera->iCameraInfo.iOptionsSupported | TCameraInfo::EBrightnessSupported; |
|
511 |
|
512 // Check that originally current and default brightness are the same |
|
513 EUNIT_ASSERT_EQUALS( iLiveSession->iDefaultBrightness, |
|
514 iLiveSession->CurrentBrightnessL() ) |
|
515 |
|
516 // Check that brightness can be increased... |
|
517 iLiveSession->IncreaseBrightnessL(); |
|
518 |
|
519 EUNIT_ASSERT_EQUALS( iLiveSession->iDefaultBrightness + KTestBrightnessStepSize, |
|
520 iLiveSession->CurrentBrightnessL() ) |
|
521 |
|
522 // ... but only to maximum |
|
523 |
|
524 iLiveSession->SetBrightnessL( KTestMaxBrightness ); |
|
525 |
|
526 iLiveSession->IncreaseBrightnessL(); |
|
527 |
|
528 EUNIT_ASSERT_EQUALS( KTestMaxBrightness, |
|
529 iLiveSession->CurrentBrightnessL() ) |
|
530 } |
|
531 |
|
532 // ----------------------------------------------------------------------------- |
|
533 // |
|
534 // ----------------------------------------------------------------------------- |
|
535 // |
|
536 void UT_CMusEngLiveSession::UT_DecreaseBrightnessLL() |
|
537 { |
|
538 // Check that decreasing brightness is not possible before invite |
|
539 EUNIT_ASSERT_SPECIFIC_LEAVE( iLiveSession->DecreaseBrightnessL(), |
|
540 KErrNotReady ) |
|
541 |
|
542 // simulate session establishment |
|
543 ESTABLISH_OUT_SESSION( iLiveSession ); |
|
544 |
|
545 CMceCameraSource* camera = |
|
546 MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); |
|
547 |
|
548 camera->iCameraInfo.iOptionsSupported = |
|
549 camera->iCameraInfo.iOptionsSupported | TCameraInfo::EBrightnessSupported; |
|
550 |
|
551 // Check that originally current and default brightness are the same |
|
552 EUNIT_ASSERT_EQUALS( iLiveSession->iDefaultBrightness, |
|
553 iLiveSession->CurrentBrightnessL() ) |
|
554 |
|
555 // Check that brightness can be decreased... |
|
556 iLiveSession->DecreaseBrightnessL(); |
|
557 |
|
558 EUNIT_ASSERT_EQUALS( iLiveSession->iDefaultBrightness - KTestBrightnessStepSize, |
|
559 iLiveSession->CurrentBrightnessL() ) |
|
560 |
|
561 // ... but only to minimum |
|
562 |
|
563 iLiveSession->SetBrightnessL( KTestMinBrightness ); |
|
564 |
|
565 iLiveSession->DecreaseBrightnessL(); |
|
566 |
|
567 EUNIT_ASSERT_EQUALS( KTestMinBrightness, |
|
568 iLiveSession->CurrentBrightnessL() ) |
|
569 } |
|
570 |
|
571 // ----------------------------------------------------------------------------- |
|
572 // |
|
573 // ----------------------------------------------------------------------------- |
|
574 // |
|
575 void UT_CMusEngLiveSession::UT_BrightnessDefaultLL() |
|
576 { |
|
577 // Check that setting default brightness is not possible before invite |
|
578 EUNIT_ASSERT_SPECIFIC_LEAVE( iLiveSession->BrightnessDefaultL(), |
|
579 KErrNotReady ) |
|
580 |
|
581 // simulate session establishment |
|
582 ESTABLISH_OUT_SESSION( iLiveSession ); |
|
583 |
|
584 CMceCameraSource* camera = |
|
585 MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); |
|
586 |
|
587 camera->iCameraInfo.iOptionsSupported = |
|
588 camera->iCameraInfo.iOptionsSupported | TCameraInfo::EBrightnessSupported; |
|
589 |
|
590 // Check that originally current and default brightness are the same |
|
591 EUNIT_ASSERT_EQUALS( iLiveSession->iDefaultBrightness, |
|
592 iLiveSession->CurrentBrightnessL() ) |
|
593 |
|
594 // set brightness to max |
|
595 iLiveSession->SetBrightnessL( KTestMaxBrightness ); |
|
596 EUNIT_ASSERT_NOT_EQUALS( iLiveSession->iDefaultBrightness, |
|
597 iLiveSession->CurrentBrightnessL() ) |
|
598 |
|
599 // set brightness to default and check it |
|
600 iLiveSession->BrightnessDefaultL(); |
|
601 |
|
602 EUNIT_ASSERT_EQUALS( iLiveSession->iDefaultBrightness, |
|
603 iLiveSession->CurrentBrightnessL() ) |
|
604 } |
|
605 |
|
606 // ----------------------------------------------------------------------------- |
|
607 // |
|
608 // ----------------------------------------------------------------------------- |
|
609 // |
|
610 void UT_CMusEngLiveSession::UT_BrightnessAutoLL() |
|
611 { |
|
612 // Check that setting brightness to auto is not possible before invite |
|
613 EUNIT_ASSERT_SPECIFIC_LEAVE( iLiveSession->BrightnessAutoL(), |
|
614 KErrNotReady ); |
|
615 |
|
616 // simulate session establishment |
|
617 ESTABLISH_OUT_SESSION( iLiveSession ); |
|
618 |
|
619 CMceCameraSource* camera = |
|
620 MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); |
|
621 |
|
622 camera->iCameraInfo.iOptionsSupported = |
|
623 camera->iCameraInfo.iOptionsSupported | TCameraInfo::EBrightnessSupported; |
|
624 |
|
625 // Check that originally brightness is not auto |
|
626 EUNIT_ASSERT_NOT_EQUALS( CCamera::EBrightnessAuto, |
|
627 iLiveSession->CurrentBrightnessL() ) |
|
628 |
|
629 // check that brightness is set to auto |
|
630 iLiveSession->BrightnessAutoL(); |
|
631 EUNIT_ASSERT_EQUALS( CCamera::EBrightnessAuto, |
|
632 iLiveSession->CurrentBrightnessL() ) |
|
633 } |
|
634 |
|
635 |
|
636 // ----------------------------------------------------------------------------- |
|
637 // |
|
638 // ----------------------------------------------------------------------------- |
|
639 // |
|
640 void UT_CMusEngLiveSession::UT_RecordL_and_IsRecordingLL() |
|
641 { |
|
642 // Check that recording is not possible before invite |
|
643 EUNIT_ASSERT_SPECIFIC_LEAVE( iRecordedLiveSession->RecordL( ETrue ), |
|
644 KErrNotReady ) |
|
645 |
|
646 // simulate session establishment |
|
647 ESTABLISH_OUT_SESSION( iLiveSession ); |
|
648 ESTABLISH_OUT_SESSION( iRecordedLiveSession ); |
|
649 |
|
650 // Check that recording is off by default |
|
651 EUNIT_ASSERT( !iRecordedLiveSession->IsRecording() ); |
|
652 |
|
653 // Check that recording can be set on |
|
654 iRecordedLiveSession->RecordL( ETrue ); |
|
655 EUNIT_ASSERT( iRecordedLiveSession->IsRecording() ); |
|
656 |
|
657 // Check that recording cannot be set on if recording stream does not exist |
|
658 EUNIT_ASSERT_SPECIFIC_LEAVE( iLiveSession->RecordL( ETrue ), |
|
659 KErrNotReady ) |
|
660 |
|
661 // Check that setting on the recording twice does not harm |
|
662 iRecordedLiveSession->RecordL( ETrue ); |
|
663 EUNIT_ASSERT( iRecordedLiveSession->IsRecording() ); |
|
664 |
|
665 // Check that recording can be set off again |
|
666 iRecordedLiveSession->RecordL( EFalse ); |
|
667 EUNIT_ASSERT( !iRecordedLiveSession->IsRecording() ); |
|
668 |
|
669 // Check that setting off the recording twice does not harm |
|
670 iRecordedLiveSession->RecordL( EFalse ); |
|
671 EUNIT_ASSERT( !iRecordedLiveSession->IsRecording() ); |
|
672 } |
|
673 |
|
674 |
|
675 // ----------------------------------------------------------------------------- |
|
676 // |
|
677 // ----------------------------------------------------------------------------- |
|
678 // |
|
679 void UT_CMusEngLiveSession::UT_PlayLL() |
|
680 { |
|
681 // Check that resuming is not possible before invite |
|
682 TRAPD( error, iLiveSession->PlayL() ); |
|
683 MUS_TEST_FORWARD_ALLOC_FAILURE( error ); |
|
684 EUNIT_ASSERT( error == KErrNotReady ); |
|
685 |
|
686 ESTABLISH_OUT_SESSION( iLiveSession ); |
|
687 |
|
688 iLiveSession->PauseL(); |
|
689 |
|
690 CMceCameraSource* camera = |
|
691 MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); |
|
692 |
|
693 iLiveSession->PlayL(); |
|
694 |
|
695 EUNIT_ASSERT( camera->IsEnabled() ); |
|
696 |
|
697 // Try to enable camera again, request should be ignored |
|
698 |
|
699 iLiveSession->PlayL(); |
|
700 |
|
701 EUNIT_ASSERT( camera->IsEnabled() ); |
|
702 |
|
703 } |
|
704 |
|
705 |
|
706 // ----------------------------------------------------------------------------- |
|
707 // |
|
708 // ----------------------------------------------------------------------------- |
|
709 // |
|
710 void UT_CMusEngLiveSession::UT_PauseLL() |
|
711 { |
|
712 // Check that pausing is not possible before invite |
|
713 TRAPD( error, iLiveSession->PauseL() ); |
|
714 MUS_TEST_FORWARD_ALLOC_FAILURE( error ); |
|
715 EUNIT_ASSERT( error == KErrNotReady ); |
|
716 |
|
717 ESTABLISH_OUT_SESSION( iLiveSession ); |
|
718 |
|
719 iLiveSession->PlayL(); |
|
720 |
|
721 CMceCameraSource* camera = |
|
722 MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); |
|
723 |
|
724 iLiveSession->PauseL(); |
|
725 |
|
726 EUNIT_ASSERT( !camera->IsEnabled() ); |
|
727 |
|
728 // Try to disable camera again, request should be ignored |
|
729 |
|
730 iLiveSession->PauseL(); |
|
731 |
|
732 EUNIT_ASSERT( !camera->IsEnabled() ); |
|
733 |
|
734 } |
|
735 |
|
736 |
|
737 // ----------------------------------------------------------------------------- |
|
738 // |
|
739 // ----------------------------------------------------------------------------- |
|
740 // |
|
741 void UT_CMusEngLiveSession::UT_IsPlayingLL() |
|
742 { |
|
743 // Try without a session |
|
744 EUNIT_ASSERT_SPECIFIC_LEAVE( iLiveSession->IsPlayingL(), KErrNotReady ); |
|
745 |
|
746 // Normal cases |
|
747 ESTABLISH_OUT_SESSION( iLiveSession ); |
|
748 |
|
749 iLiveSession->PlayL(); |
|
750 EUNIT_ASSERT( iLiveSession->IsPlayingL() ) |
|
751 |
|
752 iLiveSession->PauseL(); |
|
753 EUNIT_ASSERT( !iLiveSession->IsPlayingL() ) |
|
754 } |
|
755 |
|
756 |
|
757 // ----------------------------------------------------------------------------- |
|
758 // |
|
759 // ----------------------------------------------------------------------------- |
|
760 // |
|
761 void UT_CMusEngLiveSession::UT_CompleteSessionStructureLL() |
|
762 { |
|
763 |
|
764 CMceStreamBundle* localBundle = |
|
765 CMceStreamBundle::NewLC( CMceStreamBundle::ELS ); |
|
766 |
|
767 // Check that structure cannot be completed before creating the session |
|
768 TRAPD( error, iLiveSession->CompleteSessionStructureL( *localBundle ) ); |
|
769 MUS_TEST_FORWARD_ALLOC_FAILURE( error ); |
|
770 EUNIT_ASSERT( error == KErrNotReady ); |
|
771 |
|
772 // Normal case |
|
773 |
|
774 CSIPProfile* profile = iLiveSession->iSipProfileHandler->Profile(); |
|
775 |
|
776 iLiveSession->iSession = CMceOutSession::NewL( |
|
777 *(iLiveSession->iManager), |
|
778 *profile, |
|
779 KTestRecipientSipUri8() ); |
|
780 |
|
781 iLiveSession->CompleteSessionStructureL( *localBundle ); |
|
782 |
|
783 EUNIT_ASSERT( localBundle->Streams().Count() == 0 ) |
|
784 |
|
785 EUNIT_ASSERT( iLiveSession->iSession->Streams().Count() == 1 ); |
|
786 EUNIT_ASSERT( iLiveSession->iSession->Streams()[0]->Type() == KMceVideo ); |
|
787 EUNIT_ASSERT( iLiveSession->iSession->Streams()[0]->Source() ); |
|
788 EUNIT_ASSERT( iLiveSession->iSession->Streams()[0]->Source()->Type() == |
|
789 KMceCameraSource ); |
|
790 EUNIT_ASSERT( !iLiveSession->IsPlayingL() ) |
|
791 EUNIT_ASSERT( iLiveSession->iSession->Streams()[0]->Sinks().Count() == 1 ); |
|
792 EUNIT_ASSERT( iLiveSession->iSession->Streams()[0]->Sinks()[0]->Type() == |
|
793 KMceRTPSink ); |
|
794 |
|
795 // Test that also recording stream is constructed if needed |
|
796 |
|
797 iRecordedLiveSession->iSession = CMceOutSession::NewL( |
|
798 *(iLiveSession->iManager), |
|
799 *profile, |
|
800 KTestRecipientSipUri8() ); |
|
801 |
|
802 iRecordedLiveSession->CompleteSessionStructureL( *localBundle ); |
|
803 |
|
804 EUNIT_ASSERT( localBundle->Streams().Count() == 0 ) |
|
805 |
|
806 CMceCameraSource* camera = |
|
807 MusEngMceUtils::GetCameraL( *(iRecordedLiveSession->iSession) ); |
|
808 |
|
809 // Check that there is recorded stream and that source is same camera |
|
810 CMceMediaSink* file = NULL; |
|
811 const RPointerArray<CMceMediaStream>& streams = |
|
812 iRecordedLiveSession->iSession->Streams(); |
|
813 |
|
814 for ( TInt i = 0; i < streams.Count(); ++i ) |
|
815 { |
|
816 if ( streams[i]->Type() == KMceVideo ) |
|
817 { |
|
818 if ( streams[i]->Sinks()[0]->Type() == KMceFileSink ) |
|
819 { |
|
820 file = streams[i]->Sinks()[0]; |
|
821 } |
|
822 EUNIT_ASSERT( streams[i]->Source() == camera ) |
|
823 } |
|
824 } |
|
825 |
|
826 EUNIT_ASSERT( file ) |
|
827 |
|
828 CleanupStack::PopAndDestroy( localBundle ); |
|
829 |
|
830 } |
|
831 |
|
832 |
|
833 // ----------------------------------------------------------------------------- |
|
834 // |
|
835 // ----------------------------------------------------------------------------- |
|
836 // |
|
837 void UT_CMusEngLiveSession::UT_HandleSessionStateChangedL() |
|
838 { |
|
839 // Make Repository empty, config keys must be written |
|
840 CRepository::SetStubAvcConfigKeysL( KNullDesC8() ); |
|
841 |
|
842 // Invite |
|
843 iLiveSession->InviteL( KTestRecipientSipUri ); |
|
844 iLiveSession->iSession->iState = CMceSession::EEstablished; |
|
845 |
|
846 // Force failure on CenRep |
|
847 CRepository::iForceFailWithCode = KErrNoMemory; |
|
848 |
|
849 // Simulate session state transition notification |
|
850 iLiveSession->HandleSessionStateChanged( |
|
851 *iLiveSession->iSession, |
|
852 200, KNullDesC8() ); |
|
853 |
|
854 EUNIT_ASSERT( iObserver->iSessionFailedCalled ); |
|
855 |
|
856 // Normal case, something will be written to CenRep |
|
857 iRecordedLiveSession->InviteL( KTestRecipientSipUri ); |
|
858 iRecordedLiveSession->iSession->iState = CMceSession::EEstablished; |
|
859 iRecordedLiveSession->HandleSessionStateChanged( |
|
860 *iRecordedLiveSession->iSession, |
|
861 200, KNullDesC8() ); |
|
862 |
|
863 HBufC8* info = MultimediaSharingSettings::EncoderConfigInfoLC(); |
|
864 EUNIT_ASSERT_NOT_EQUALS( *info, KMusAvcBitrateLevel_1b_ConfigKey() ) |
|
865 CleanupStack::PopAndDestroy( info ); |
|
866 } |
|
867 |
|
868 |
|
869 // ----------------------------------------------------------------------------- |
|
870 // |
|
871 // ----------------------------------------------------------------------------- |
|
872 // |
|
873 void UT_CMusEngLiveSession::UT_AdjustVideoCodecLL() |
|
874 { |
|
875 CRepository::SetStubAvcConfigKeysL( KNullDesC8() ); |
|
876 |
|
877 CMceVideoCodec* codecH263 = CMceH263Codec::NewLC( KMceSDPNameH263() ); |
|
878 CMceVideoCodec* codecH2632000 = CMceH263Codec::NewLC( KMceSDPNameH2632000() ); |
|
879 CMceVideoCodec* codecAvc = CMceAvcCodec::NewLC( KMceSDPNameH264() ); |
|
880 CMceVideoCodec* codecUnknown = CMceH263Codec::NewLC( KNullDesC8() ); |
|
881 |
|
882 iLiveSession->AdjustVideoCodecL( *codecH263 ); |
|
883 iLiveSession->AdjustVideoCodecL( *codecH2632000 ); |
|
884 iLiveSession->AdjustVideoCodecL( *codecAvc ); |
|
885 iLiveSession->AdjustVideoCodecL( *codecUnknown ); |
|
886 |
|
887 // Test that bit rates has been set to H263 & AVC codecs |
|
888 EUNIT_ASSERT( codecH263->iAllowedBitrates == KMceAllowedH263BitrateAll ) |
|
889 EUNIT_ASSERT( codecH263->iMaxBitRate == KMceH263Level45Bitrate ) |
|
890 EUNIT_ASSERT( codecH263->iBitrate == 80000 ) |
|
891 |
|
892 EUNIT_ASSERT( codecH2632000->iAllowedBitrates == |
|
893 KMceAllowedH263BitrateAll ) |
|
894 EUNIT_ASSERT( codecH2632000->iMaxBitRate == KMceH263Level45Bitrate ) |
|
895 EUNIT_ASSERT( codecH2632000->iBitrate == 80000 ) |
|
896 |
|
897 EUNIT_ASSERT( codecAvc->iAllowedBitrates == |
|
898 KMceAvcCodecProfileIdBaseline | |
|
899 KMceAvcCodecProfileIopConstraintSet | |
|
900 KMceAvcBitrateLevel1b ) |
|
901 EUNIT_ASSERT( iLiveSession->iStoreEncoderConfigInfo ) |
|
902 |
|
903 |
|
904 // Test that bitrates has not been set to unknown codecs |
|
905 EUNIT_ASSERT( codecUnknown->iAllowedBitrates != |
|
906 KMceAllowedH263BitrateAll ) |
|
907 EUNIT_ASSERT( codecUnknown->iMaxBitRate != KMceH263Level45Bitrate ) |
|
908 EUNIT_ASSERT( codecUnknown->iBitrate != KMceH263Level10Bitrate ) |
|
909 |
|
910 // Test that base class has been called to all codecs |
|
911 EUNIT_ASSERT( codecH263->iPayloadType == 96 ) |
|
912 EUNIT_ASSERT( codecH2632000->iPayloadType == 96 ) |
|
913 EUNIT_ASSERT( codecAvc->iPayloadType == 98 ) |
|
914 EUNIT_ASSERT( codecUnknown->iPayloadType == 0 ) |
|
915 |
|
916 CleanupStack::PopAndDestroy( codecUnknown ); |
|
917 CleanupStack::PopAndDestroy( codecAvc ); |
|
918 CleanupStack::PopAndDestroy( codecH2632000 ); |
|
919 CleanupStack::PopAndDestroy( codecH263 ); |
|
920 |
|
921 } |
|
922 |
|
923 |
|
924 // ----------------------------------------------------------------------------- |
|
925 // |
|
926 // ----------------------------------------------------------------------------- |
|
927 // |
|
928 void UT_CMusEngLiveSession::UT_AdjustAudioCodecLL() |
|
929 { |
|
930 CMceAudioCodec* codec = |
|
931 iLiveSession->iManager->SupportedAudioCodecs()[0]->CloneL(); |
|
932 CleanupStack::PushL( codec ); |
|
933 iLiveSession->AdjustAudioCodecL( *codec ); |
|
934 |
|
935 // Does nothing so just test that base class has been called |
|
936 |
|
937 EUNIT_ASSERT( codec->iPayloadType == 97 ) |
|
938 |
|
939 CleanupStack::PopAndDestroy( codec ); |
|
940 } |
|
941 |
|
942 |
|
943 // ----------------------------------------------------------------------------- |
|
944 // |
|
945 // ----------------------------------------------------------------------------- |
|
946 // |
|
947 void UT_CMusEngLiveSession::UT_DoCodecSelectionLL() |
|
948 { |
|
949 CMceVideoStream* stream = CMceVideoStream::NewLC(); |
|
950 |
|
951 CMceVideoCodec* codecH263 = CMceH263Codec::NewLC( _L8( "Foo" ) ); |
|
952 stream->AddCodecL( codecH263 ); |
|
953 CleanupStack::Pop( codecH263 ); |
|
954 |
|
955 CMceVideoCodec* codecH2632000 = CMceH263Codec::NewLC( _L8( "Bar" ) ); |
|
956 stream->AddCodecL( codecH2632000 ); |
|
957 CleanupStack::Pop( codecH2632000 ); |
|
958 |
|
959 CMceVideoCodec* codecAvc = CMceAvcCodec::NewLC( KMceSDPNameH264() ); |
|
960 stream->AddCodecL( codecAvc ); |
|
961 CleanupStack::Pop( codecAvc ); |
|
962 |
|
963 // No assumptions so all the codecs are left to stream |
|
964 iLiveSession->DoCodecSelectionL( *stream ); |
|
965 EUNIT_ASSERT_EQUALS( stream->Codecs().Count(), 3 ) |
|
966 |
|
967 // Check that AVC codecs are removed if they are known to be not supported |
|
968 iLiveSession->SetSupportedVideoCodecListL( _L( "SomethingThatIsNotAVC" ) ); |
|
969 iLiveSession->DoCodecSelectionL( *stream ); |
|
970 EUNIT_ASSERT_EQUALS( stream->Codecs().Count(), 2 ) |
|
971 EUNIT_ASSERT( stream->Codecs()[0]->SdpName() != KMceSDPNameH264() ) |
|
972 EUNIT_ASSERT( stream->Codecs()[1]->SdpName() != KMceSDPNameH264() ) |
|
973 |
|
974 CleanupStack::PopAndDestroy( stream ); |
|
975 |
|
976 } |
|
977 |
|
978 |
|
979 // ----------------------------------------------------------------------------- |
|
980 // Although all states are not meaningfull for LiveSession, all states are |
|
981 // tested in order to force the updating of unit tests when behavior is changed |
|
982 // ----------------------------------------------------------------------------- |
|
983 // |
|
984 void UT_CMusEngLiveSession::UT_StreamStateChangedL() |
|
985 { |
|
986 // Try without a session, nothing happens |
|
987 CMceVideoStream* videoStream = CMceVideoStream::NewLC(); |
|
988 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
989 *videoStream ); |
|
990 CleanupStack::PopAndDestroy( videoStream ); |
|
991 |
|
992 // Simulate sending invite |
|
993 iLiveSession->InviteL( KTestRecipientSipUri() ); |
|
994 |
|
995 // Try all the stream states |
|
996 CMceMediaStream* changedStream = iLiveSession->iSession->Streams()[0]; |
|
997 |
|
998 // EUninitialized, stream is created, unexpected change, nothing happens |
|
999 changedStream->iState = CMceMediaStream::EUninitialized; |
|
1000 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1001 *changedStream ); |
|
1002 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1003 |
|
1004 // EInitialized, stream is initialized |
|
1005 changedStream->iState = CMceMediaStream::EInitialized; |
|
1006 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1007 *changedStream ); |
|
1008 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1009 |
|
1010 // EBuffering, stream is buffering |
|
1011 changedStream->iState = CMceMediaStream::EBuffering; |
|
1012 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1013 *changedStream ); |
|
1014 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1015 |
|
1016 // EIdle, stream is not receiving RTP |
|
1017 changedStream->iState = CMceMediaStream::EIdle; |
|
1018 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1019 *changedStream ); |
|
1020 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1021 |
|
1022 // EStreaming, stream is streaming |
|
1023 changedStream->iState = CMceMediaStream::EStreaming; |
|
1024 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1025 *changedStream ); |
|
1026 EUNIT_ASSERT( iObserver->iStreamStreamingCalled ); |
|
1027 iObserver->Reset(); |
|
1028 |
|
1029 // EDisabled, stream is explicitly disabled |
|
1030 changedStream->iState = CMceMediaStream::EDisabled; |
|
1031 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1032 *changedStream ); |
|
1033 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1034 |
|
1035 // ENoResources, stream has no needed resources to stream |
|
1036 changedStream->iState = CMceMediaStream::ENoResources; |
|
1037 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1038 *changedStream ); |
|
1039 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1040 |
|
1041 // ETranscodingRequired, stream requires non-realtime transcoding |
|
1042 changedStream->iState = CMceMediaStream::ETranscodingRequired; |
|
1043 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1044 *changedStream ); |
|
1045 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1046 |
|
1047 // ETranscoding, stream is transcoding in non-realtime |
|
1048 changedStream->iState = CMceMediaStream::ETranscoding; |
|
1049 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1050 *changedStream ); |
|
1051 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1052 } |
|
1053 |
|
1054 |
|
1055 // ----------------------------------------------------------------------------- |
|
1056 // Although all states are not meaningfull for LiveSession, all states are |
|
1057 // tested in order to force the updating of unit tests when behavior is changed |
|
1058 // ----------------------------------------------------------------------------- |
|
1059 // |
|
1060 void UT_CMusEngLiveSession::UT_StreamStateChangedWithSourceL() |
|
1061 { |
|
1062 // Try without a session, nothing happens |
|
1063 CMceVideoStream* videoStream = CMceVideoStream::NewLC(); |
|
1064 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1065 *videoStream, |
|
1066 *CMceCameraSource::NewLC( *iLiveSession->iManager ) ); |
|
1067 CleanupStack::PopAndDestroy(); // camera |
|
1068 CleanupStack::PopAndDestroy( videoStream ); |
|
1069 |
|
1070 // Simulate sending invite |
|
1071 iLiveSession->InviteL( KTestRecipientSipUri() ); |
|
1072 |
|
1073 // Try all the stream states |
|
1074 CMceMediaStream* changedStream = iLiveSession->iSession->Streams()[0]; |
|
1075 CMceMediaSource* changedSource = changedStream->Source(); |
|
1076 |
|
1077 // EUninitialized, stream is created, unexpected change, nothing happens |
|
1078 changedStream->iState = CMceMediaStream::EUninitialized; |
|
1079 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1080 *changedStream, *changedSource ); |
|
1081 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1082 |
|
1083 // EInitialized, stream is initialized |
|
1084 changedStream->iState = CMceMediaStream::EInitialized; |
|
1085 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1086 *changedStream, *changedSource );; |
|
1087 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1088 |
|
1089 // EBuffering, stream is buffering |
|
1090 changedStream->iState = CMceMediaStream::EBuffering; |
|
1091 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1092 *changedStream, *changedSource ); |
|
1093 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1094 |
|
1095 // EIdle, stream is not receiving RTP |
|
1096 changedStream->iState = CMceMediaStream::EIdle; |
|
1097 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1098 *changedStream, *changedSource ); |
|
1099 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1100 |
|
1101 // EStreaming, stream is streaming |
|
1102 changedStream->iState = CMceMediaStream::EStreaming; |
|
1103 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1104 *changedStream, *changedSource ); |
|
1105 EUNIT_ASSERT( iObserver->iStreamStreamingCalled ); |
|
1106 iObserver->Reset(); |
|
1107 |
|
1108 // EDisabled, stream is explicitly disabled |
|
1109 changedStream->iState = CMceMediaStream::EDisabled; |
|
1110 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1111 *changedStream, *changedSource ); |
|
1112 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1113 |
|
1114 // ENoResources, stream has no needed resources to stream |
|
1115 changedStream->iState = CMceMediaStream::ENoResources; |
|
1116 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1117 *changedStream, *changedSource ); |
|
1118 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1119 |
|
1120 // ETranscodingRequired, stream requires non-realtime transcoding |
|
1121 changedStream->iState = CMceMediaStream::ETranscodingRequired; |
|
1122 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1123 *changedStream, *changedSource ); |
|
1124 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1125 |
|
1126 // ETranscoding, stream is transcoding in non-realtime |
|
1127 changedStream->iState = CMceMediaStream::ETranscoding; |
|
1128 static_cast<MMceStreamObserver*>(iLiveSession)->StreamStateChanged( |
|
1129 *changedStream, *changedSource ); |
|
1130 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1131 } |
|
1132 |
|
1133 |
|
1134 // ----------------------------------------------------------------------------- |
|
1135 // Although all states are not meaningfull for LiveSession, all states are |
|
1136 // tested in order to force the updating of unit tests when behavior is changed |
|
1137 // ----------------------------------------------------------------------------- |
|
1138 // |
|
1139 void UT_CMusEngLiveSession::UT_StreamStateChangedWithSinkL() |
|
1140 { |
|
1141 // Try without a session, nothing happens |
|
1142 ESTABLISH_OUT_SESSION( iLiveSession ) |
|
1143 |
|
1144 iRecordedLiveSession->StreamStateChanged( |
|
1145 *iLiveSession->iSession->Streams()[0], |
|
1146 *iLiveSession->iSession->Streams()[0]->Sinks()[0] ); |
|
1147 |
|
1148 // Try with session |
|
1149 |
|
1150 ESTABLISH_OUT_SESSION( iRecordedLiveSession ) |
|
1151 iRecordedLiveSession->RecordL( ETrue ); |
|
1152 |
|
1153 // Test state CMceMediaStream::ENoResources |
|
1154 |
|
1155 // Try without recording stream, nothing happens |
|
1156 |
|
1157 iLiveSession->StreamStateChanged( |
|
1158 *iLiveSession->iSession->Streams()[0], |
|
1159 *iLiveSession->iSession->Streams()[0]->Sinks()[0] ); |
|
1160 EUNIT_ASSERT( iObserver->iStreamStreamingCalled ) |
|
1161 iObserver->Reset(); |
|
1162 |
|
1163 // Try again with recording stream, but indicate change in another stream, |
|
1164 // nothing happens |
|
1165 iRecordedLiveSession->StreamStateChanged( |
|
1166 *iLiveSession->iSession->Streams()[0], |
|
1167 *iLiveSession->iSession->Streams()[0]->Sinks()[0] ); |
|
1168 |
|
1169 // Try again with recording stream, but with stream state != ENoResources, |
|
1170 // nothing happens |
|
1171 CMceVideoStream* recordingStream = |
|
1172 MusEngMceUtils::GetRecordingStream( *iRecordedLiveSession->iSession ); |
|
1173 |
|
1174 EUNIT_ASSERT( recordingStream ) |
|
1175 EUNIT_ASSERT( recordingStream->State() != CMceMediaStream::ENoResources ) |
|
1176 |
|
1177 iRecordedLiveSession->StreamStateChanged( *recordingStream, |
|
1178 *recordingStream->Sinks()[0] ); |
|
1179 |
|
1180 // Try again with recording stream and stream state == ENoResources, |
|
1181 // but with enabled sink, nothing happens |
|
1182 |
|
1183 recordingStream->iState = CMceMediaStream::ENoResources; |
|
1184 EUNIT_ASSERT( recordingStream->Sinks()[0]->iIsEnabled ) |
|
1185 |
|
1186 iRecordedLiveSession->StreamStateChanged( *recordingStream, |
|
1187 *recordingStream->Sinks()[0] ); |
|
1188 |
|
1189 // Disk full case |
|
1190 |
|
1191 recordingStream->Sinks()[0]->iIsEnabled = EFalse; |
|
1192 |
|
1193 iRecordedLiveSession->StreamStateChanged( *recordingStream, |
|
1194 *recordingStream->Sinks()[0] ); |
|
1195 |
|
1196 EUNIT_ASSERT( iObserver->iDiskFullCalled ) |
|
1197 iObserver->Reset(); |
|
1198 |
|
1199 |
|
1200 // Test default stream state change behavior |
|
1201 |
|
1202 CMceMediaStream* changedStream = iLiveSession->iSession->Streams()[0]; |
|
1203 CMceMediaSink* changedSink = changedStream->Sinks()[0]; |
|
1204 |
|
1205 // EUninitialized, stream is created, unexpected change, nothing happens |
|
1206 changedStream->iState = CMceMediaStream::EUninitialized; |
|
1207 iLiveSession->StreamStateChanged( *changedStream, *changedSink ); |
|
1208 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1209 |
|
1210 // EInitialized, stream is initialized |
|
1211 changedStream->iState = CMceMediaStream::EInitialized; |
|
1212 iLiveSession->StreamStateChanged( *changedStream, *changedSink ); |
|
1213 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1214 |
|
1215 // EBuffering, stream is buffering |
|
1216 changedStream->iState = CMceMediaStream::EBuffering; |
|
1217 iLiveSession->StreamStateChanged( *changedStream, *changedSink ); |
|
1218 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1219 |
|
1220 // EIdle, stream is not receiving RTP |
|
1221 changedStream->iState = CMceMediaStream::EIdle; |
|
1222 iLiveSession->StreamStateChanged( *changedStream, *changedSink ); |
|
1223 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1224 |
|
1225 // EStreaming, stream is streaming |
|
1226 changedStream->iState = CMceMediaStream::EStreaming; |
|
1227 iLiveSession->StreamStateChanged( *changedStream, *changedSink ); |
|
1228 EUNIT_ASSERT( iObserver->iStreamStreamingCalled ); |
|
1229 iObserver->Reset(); |
|
1230 |
|
1231 // EDisabled, stream is explicitly disabled |
|
1232 changedStream->iState = CMceMediaStream::EDisabled; |
|
1233 iLiveSession->StreamStateChanged( *changedStream, *changedSink ); |
|
1234 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1235 |
|
1236 // ENoResources, stream has no needed resources to stream |
|
1237 // This state has non-default meaning, tested before defaults |
|
1238 |
|
1239 // ETranscodingRequired, stream requires non-realtime transcoding |
|
1240 changedStream->iState = CMceMediaStream::ETranscodingRequired; |
|
1241 iLiveSession->StreamStateChanged( *changedStream, *changedSink ); |
|
1242 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1243 |
|
1244 // ETranscoding, stream is transcoding in non-realtime |
|
1245 changedStream->iState = CMceMediaStream::ETranscoding; |
|
1246 iLiveSession->StreamStateChanged( *changedStream, *changedSink ); |
|
1247 EUNIT_ASSERT( iObserver->IsReseted() ); |
|
1248 |
|
1249 } |
|
1250 |
|
1251 |
|
1252 // ----------------------------------------------------------------------------- |
|
1253 // |
|
1254 // ----------------------------------------------------------------------------- |
|
1255 // |
|
1256 void UT_CMusEngLiveSession::UT_SetEncodingDeviceLL() |
|
1257 { |
|
1258 CMceAvcCodec* codec = CMceAvcCodec::NewLC( KMceSDPNameH264() ); |
|
1259 |
|
1260 // Generic error in CenRep, leave expected |
|
1261 CRepository::iForceFailWithCode = KErrNotReady; |
|
1262 EUNIT_ASSERT_LEAVE( iLiveSession->SetEncodingDeviceL( *codec ) ) |
|
1263 EUNIT_ASSERT_EQUALS( codec->iEncodingDecodingDevice, TUid::Uid( 0 ) ) |
|
1264 |
|
1265 // No entry in CenRep, default value expected |
|
1266 CRepository::iForceFailWithCode = KErrNotFound; |
|
1267 const TUid KDefaultEncodingDevice( TUid::Uid( 0x20001C13 ) ); |
|
1268 iLiveSession->SetEncodingDeviceL( *codec ); |
|
1269 EUNIT_ASSERT_EQUALS( codec->iEncodingDecodingDevice, |
|
1270 KDefaultEncodingDevice ) |
|
1271 |
|
1272 // Entry in CenRep |
|
1273 const TInt KSomeEncodingDevice( 0x20001C15 ); |
|
1274 CRepository::iStaticEncoderUid = KSomeEncodingDevice; |
|
1275 iLiveSession->SetEncodingDeviceL( *codec ); |
|
1276 EUNIT_ASSERT_EQUALS( codec->iEncodingDecodingDevice, |
|
1277 TUid::Uid( KSomeEncodingDevice ) ) |
|
1278 |
|
1279 CleanupStack::PopAndDestroy( codec ); |
|
1280 } |
|
1281 |
|
1282 |
|
1283 // ----------------------------------------------------------------------------- |
|
1284 // |
|
1285 // ----------------------------------------------------------------------------- |
|
1286 // |
|
1287 void UT_CMusEngLiveSession::UT_SetCodecConfigKeyLL() |
|
1288 { |
|
1289 CMceAvcCodec* codec = CMceAvcCodec::NewLC( KMceSDPNameH264() ); |
|
1290 codec->SetAllowedBitrates( KMceAvcBitrateLevel1b ); |
|
1291 |
|
1292 // Generic error in CenRep, leave expected |
|
1293 CRepository::iForceFailWithCode = KErrNotReady; |
|
1294 EUNIT_ASSERT_LEAVE( iLiveSession->SetCodecConfigKeyL( *codec ) ); |
|
1295 EUNIT_ASSERT( !codec->iConfigKey ) |
|
1296 EUNIT_ASSERT( !iLiveSession->iStoreEncoderConfigInfo ) |
|
1297 CRepository::iForceFailWithCode = KErrNone; |
|
1298 |
|
1299 // No entry in CenRep, nothing happens |
|
1300 iLiveSession->SetCodecConfigKeyL( *codec ); |
|
1301 EUNIT_ASSERT( !codec->iConfigKey ) |
|
1302 EUNIT_ASSERT( !iLiveSession->iStoreEncoderConfigInfo ) |
|
1303 |
|
1304 // Empty entry in CenRep |
|
1305 CRepository::SetStubAvcConfigKeysL( KNullDesC8() ); |
|
1306 iLiveSession->SetCodecConfigKeyL( *codec ); |
|
1307 EUNIT_ASSERT( !codec->iConfigKey ) |
|
1308 EUNIT_ASSERT( iLiveSession->iStoreEncoderConfigInfo ) |
|
1309 iLiveSession->iStoreEncoderConfigInfo = EFalse; // emulate original situation |
|
1310 |
|
1311 // Entry in CenRep |
|
1312 CRepository::SetStubAvcConfigKeysL( KMusAvcBitrateLevel_1b_ConfigKey ); |
|
1313 iLiveSession->SetCodecConfigKeyL( *codec ); |
|
1314 EUNIT_ASSERT( codec->iConfigKey ) |
|
1315 HBufC8* key = codec->ConfigKeyL(); |
|
1316 CleanupStack::PushL( key ); |
|
1317 EUNIT_ASSERT_EQUALS( *key, KMusAvcBitrateLevel1bTestText() ) |
|
1318 CleanupStack::PopAndDestroy( key ); |
|
1319 EUNIT_ASSERT( !iLiveSession->iStoreEncoderConfigInfo ) |
|
1320 |
|
1321 CleanupStack::PopAndDestroy( codec ); |
|
1322 } |
|
1323 |
|
1324 |
|
1325 // ----------------------------------------------------------------------------- |
|
1326 // |
|
1327 // ----------------------------------------------------------------------------- |
|
1328 // |
|
1329 void UT_CMusEngLiveSession::UT_ReadCodecConfigKeyLL() |
|
1330 { |
|
1331 HBufC8* key( NULL ); |
|
1332 |
|
1333 // Try with H263, leave expected |
|
1334 CMceVideoCodec* codecH263 = CMceH263Codec::NewLC( KMceSDPNameH263() ); |
|
1335 EUNIT_ASSERT_LEAVE( key = iLiveSession->ReadCodecConfigKeyL( *codecH263 ) ) |
|
1336 CleanupStack::PopAndDestroy( codecH263 ); |
|
1337 |
|
1338 // Try without an entry in CenRep, leave expected |
|
1339 CMceVideoCodec* codec = CMceAvcCodec::NewLC( KMceSDPNameH264() ); |
|
1340 codec->SetAllowedBitrates( 0 | KMceAvcBitrateLevel1 ); |
|
1341 EUNIT_ASSERT_LEAVE( key = iLiveSession->ReadCodecConfigKeyL( *codec ) ) |
|
1342 |
|
1343 // Create CenRep entry which does not include wanted bitrate, NULL value |
|
1344 // expected |
|
1345 CRepository::SetStubAvcConfigKeysL( KMusAvcBitrateLevel1bTestText() ); |
|
1346 key = iLiveSession->ReadCodecConfigKeyL( *codec ); |
|
1347 EUNIT_ASSERT( !key ) |
|
1348 |
|
1349 // Create entry with all AVC keys and try with all the values |
|
1350 CRepository::SetStubAvcConfigKeysL( KMusAvcAllLevelsConcatenation() ); |
|
1351 |
|
1352 // KMceAvcBitrateLevel1 |
|
1353 key = iLiveSession->ReadCodecConfigKeyL( *codec ); |
|
1354 EUNIT_ASSERT( key ); |
|
1355 CleanupStack::PushL( key ); |
|
1356 EUNIT_ASSERT_EQUALS( *key, KMusAvcBitrateLevel1TestText ); |
|
1357 CleanupStack::PopAndDestroy( key ); |
|
1358 |
|
1359 // KMceAvcBitrateLevel1b |
|
1360 codec->SetAllowedBitrates( KMceAvcBitrateLevel1b ); |
|
1361 key = iLiveSession->ReadCodecConfigKeyL( *codec ); |
|
1362 EUNIT_ASSERT( key ); |
|
1363 CleanupStack::PushL( key ); |
|
1364 EUNIT_ASSERT_EQUALS( *key, KMusAvcBitrateLevel1bTestText ); |
|
1365 CleanupStack::PopAndDestroy( key ); |
|
1366 |
|
1367 // KMceAvcBitrateLevel1_1 |
|
1368 codec->SetAllowedBitrates( KMceAvcBitrateLevel1_1 ); |
|
1369 key = iLiveSession->ReadCodecConfigKeyL( *codec ); |
|
1370 EUNIT_ASSERT( key ); |
|
1371 CleanupStack::PushL( key ); |
|
1372 EUNIT_ASSERT_EQUALS( *key, KMusAvcBitrateLevel1_1TestText ); |
|
1373 CleanupStack::PopAndDestroy( key ); |
|
1374 |
|
1375 // KMceAvcBitrateLevel1_2 |
|
1376 codec->SetAllowedBitrates( KMceAvcBitrateLevel1_2 ); |
|
1377 key = iLiveSession->ReadCodecConfigKeyL( *codec ); |
|
1378 EUNIT_ASSERT( key ); |
|
1379 CleanupStack::PushL( key ); |
|
1380 EUNIT_ASSERT_EQUALS( *key, KMusAvcBitrateLevel1_2TestText ); |
|
1381 CleanupStack::PopAndDestroy( key ); |
|
1382 |
|
1383 // KMceAvcBitrateLevel1_3 |
|
1384 codec->SetAllowedBitrates( KMceAvcBitrateLevel1_3 ); |
|
1385 key = iLiveSession->ReadCodecConfigKeyL( *codec ); |
|
1386 EUNIT_ASSERT( key ); |
|
1387 CleanupStack::PushL( key ); |
|
1388 EUNIT_ASSERT_EQUALS( *key, KMusAvcBitrateLevel1_3TestText ); |
|
1389 CleanupStack::PopAndDestroy( key ); |
|
1390 |
|
1391 // KMceAvcBitrateLevel2 |
|
1392 codec->SetAllowedBitrates( KMceAvcBitrateLevel2 ); |
|
1393 key = iLiveSession->ReadCodecConfigKeyL( *codec ); |
|
1394 EUNIT_ASSERT( key ); |
|
1395 CleanupStack::PushL( key ); |
|
1396 EUNIT_ASSERT_EQUALS( *key, KMusAvcBitrateLevel2TestText ); |
|
1397 CleanupStack::PopAndDestroy( key ); |
|
1398 |
|
1399 CleanupStack::PopAndDestroy( codec ); |
|
1400 |
|
1401 } |
|
1402 |
|
1403 |
|
1404 // ----------------------------------------------------------------------------- |
|
1405 // |
|
1406 // ----------------------------------------------------------------------------- |
|
1407 // |
|
1408 void UT_CMusEngLiveSession::UT_StoreEncoderConfigInfoLL() |
|
1409 { |
|
1410 CRepository::iStaticWriteAvcKeysToStaticData = ETrue; |
|
1411 |
|
1412 // Try with clean CenRep |
|
1413 MultimediaSharingSettings::SetEncoderConfigInfoL( KNullDesC8() ); |
|
1414 |
|
1415 ESTABLISH_OUT_SESSION( iLiveSession ) // calls StoreEncoderConfigInfoL |
|
1416 // If StoreEncoderConfigInfoL leaves with KErrNoMemory, |
|
1417 // MMusEngSessionObserver::SessionFailed will be called. |
|
1418 __ASSERT_ALWAYS( !iObserver->iSessionFailedCalled, |
|
1419 User::Leave( KErrNoMemory ) ); |
|
1420 |
|
1421 HBufC8* keys = MultimediaSharingSettings::EncoderConfigInfoLC(); |
|
1422 EUNIT_ASSERT_EQUALS( *keys, KMusAvcBitrateLevel_1b_ConfigKey() ) |
|
1423 CleanupStack::PopAndDestroy( keys ); |
|
1424 |
|
1425 // Try without a clean CenRep |
|
1426 MultimediaSharingSettings::SetEncoderConfigInfoL( |
|
1427 KMusAvcBitrateLevel_1_1_ConfigKey() ); |
|
1428 |
|
1429 ESTABLISH_OUT_SESSION( iRecordedLiveSession ) |
|
1430 // If StoreEncoderConfigInfoL leaves with KErrNoMemory, |
|
1431 // MMusEngSessionObserver::SessionFailed will be called. |
|
1432 __ASSERT_ALWAYS( !iObserver->iSessionFailedCalled, |
|
1433 User::Leave( KErrNoMemory ) ); |
|
1434 |
|
1435 keys = MultimediaSharingSettings::EncoderConfigInfoLC(); |
|
1436 EUNIT_ASSERT_EQUALS( *keys, |
|
1437 KMusAvcBitrateLevels_1_1_And_1b_ConfigKeys() ) |
|
1438 CleanupStack::PopAndDestroy( keys ); |
|
1439 } |
|
1440 |
|
1441 // ----------------------------------------------------------------------------- |
|
1442 // |
|
1443 // ----------------------------------------------------------------------------- |
|
1444 // |
|
1445 void UT_CMusEngLiveSession::UT_InitializeZoomStepSizeL() |
|
1446 { |
|
1447 //Check that zooming steps have defualt values before session establishment |
|
1448 iLiveSession->InitializeZoomStepSize(); |
|
1449 EUNIT_ASSERT( iLiveSession->iSmallZoomStep == KZoomStepMinSize ); |
|
1450 EUNIT_ASSERT( iLiveSession->iBigZoomStep == KZoomStepMinSize ); |
|
1451 |
|
1452 // simulate session establishment |
|
1453 ESTABLISH_OUT_SESSION( iLiveSession ); |
|
1454 |
|
1455 CMceCameraSource* camera = |
|
1456 MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); |
|
1457 |
|
1458 //Check that zooming step sizes have default value KZoomStepMinSize |
|
1459 //in case of zooming values range is smaller than KZoomBigStepCount |
|
1460 iLiveSession->iCameraInfo.iMinZoom = 0; |
|
1461 iLiveSession->iCameraInfo.iMaxZoom = 0; |
|
1462 iLiveSession->iCameraInfo.iMaxDigitalZoom = KZoomBigStepCount / 2; |
|
1463 iLiveSession->InitializeZoomStepSize(); |
|
1464 EUNIT_ASSERT( iLiveSession->iSmallZoomStep == KZoomStepMinSize ); |
|
1465 EUNIT_ASSERT( iLiveSession->iBigZoomStep == KZoomStepMinSize ); |
|
1466 |
|
1467 |
|
1468 //Check that zooming step sizes have default value KZoomStepMinSize |
|
1469 //in case of zooming values range is bigger than KZoomBigStepCount, |
|
1470 //but smaller than 2*KZoomBigStepCount (KZoomSmallStepCount) |
|
1471 iLiveSession->iCameraInfo.iMaxDigitalZoom = 2*KZoomBigStepCount - 1; |
|
1472 iLiveSession->InitializeZoomStepSize(); |
|
1473 EUNIT_ASSERT( iLiveSession->iSmallZoomStep == KZoomStepMinSize ); |
|
1474 EUNIT_ASSERT( iLiveSession->iBigZoomStep == KZoomStepMinSize ); |
|
1475 |
|
1476 |
|
1477 //Check zooming steps sizes in case of zooming values range is |
|
1478 //bigger than 2*KZoomBigStepCount and smaller than 2*KZoomSmallStepCount |
|
1479 iLiveSession->iCameraInfo.iMinZoom = - KZoomBigStepCount; |
|
1480 iLiveSession->iCameraInfo.iMaxZoom = KZoomBigStepCount; |
|
1481 iLiveSession->iCameraInfo.iMaxDigitalZoom = KZoomBigStepCount; |
|
1482 //zooming range is (-KZoomBigStepCount, 2*KZoomBigStepCount) |
|
1483 iLiveSession->InitializeZoomStepSize(); |
|
1484 EUNIT_ASSERT( iLiveSession->iSmallZoomStep == KZoomStepMinSize ); |
|
1485 EUNIT_ASSERT( iLiveSession->iBigZoomStep == 3 ); |
|
1486 |
|
1487 |
|
1488 //Check zooming steps sizes in case of zooming values range is |
|
1489 //bigger than 2*KZoomSmallStepCount |
|
1490 iLiveSession->iCameraInfo.iMaxZoom = KZoomSmallStepCount; |
|
1491 iLiveSession->iCameraInfo.iMaxDigitalZoom = KZoomSmallStepCount; |
|
1492 iLiveSession->iCameraInfo.iMinZoom = - KZoomSmallStepCount; |
|
1493 //zooming range is (-KZoomSmallStepCount, 2*KZoomSmallStepCount) |
|
1494 iLiveSession->InitializeZoomStepSize(); |
|
1495 EUNIT_ASSERT( iLiveSession->iSmallZoomStep == 3 ); |
|
1496 EUNIT_ASSERT( iLiveSession->iBigZoomStep == 6 ); |
|
1497 } |
|
1498 |
|
1499 |
|
1500 // TEST TABLE |
|
1501 |
|
1502 EUNIT_BEGIN_TEST_TABLE( |
|
1503 UT_CMusEngLiveSession, |
|
1504 "UT_CMusEngLiveSesssion", |
|
1505 "UNIT" ) |
|
1506 |
|
1507 EUNIT_TEST( |
|
1508 "NewL - test ", |
|
1509 "CMusEngLiveSession", |
|
1510 "NewL", |
|
1511 "FUNCTIONALITY", |
|
1512 SetupL, UT_NewLL, Teardown) |
|
1513 |
|
1514 EUNIT_TEST( |
|
1515 "CurrentZoomL - test ", |
|
1516 "CMusEngLiveSession", |
|
1517 "CurrentZoomL", |
|
1518 "FUNCTIONALITY", |
|
1519 SetupL, UT_CurrentZoomLL, Teardown) |
|
1520 |
|
1521 EUNIT_TEST( |
|
1522 "MaxZoomL - test ", |
|
1523 "CMusEngLiveSession", |
|
1524 "MaxZoomL", |
|
1525 "FUNCTIONALITY", |
|
1526 SetupL, UT_MaxZoomLL, Teardown) |
|
1527 |
|
1528 EUNIT_TEST( |
|
1529 "ZoomInL - test ", |
|
1530 "CMusEngLiveSession", |
|
1531 "ZoomInL", |
|
1532 "FUNCTIONALITY", |
|
1533 SetupL, UT_ZoomInLL, Teardown) |
|
1534 |
|
1535 EUNIT_TEST( |
|
1536 "ZoomOutL - test ", |
|
1537 "CMusEngLiveSession", |
|
1538 "ZoomOutL", |
|
1539 "FUNCTIONALITY", |
|
1540 SetupL, UT_ZoomOutLL, Teardown) |
|
1541 |
|
1542 EUNIT_TEST( |
|
1543 "ZoomDefaultL - test ", |
|
1544 "CMusEngLiveSession", |
|
1545 "ZoomDefaultL", |
|
1546 "FUNCTIONALITY", |
|
1547 SetupL, UT_ZoomDefaultLL, Teardown) |
|
1548 |
|
1549 EUNIT_TEST( |
|
1550 "SetBrightnessL - test ", |
|
1551 "CMusEngLiveSession", |
|
1552 "SetBrightnessL", |
|
1553 "FUNCTIONALITY", |
|
1554 SetupL, UT_SetBrightnessLL, Teardown) |
|
1555 |
|
1556 EUNIT_TEST( |
|
1557 "CurrentBrightnessL - test ", |
|
1558 "CMusEngLiveSession", |
|
1559 "CurrentBrightnessL", |
|
1560 "FUNCTIONALITY", |
|
1561 SetupL, UT_CurrentBrightnessLL, Teardown) |
|
1562 |
|
1563 EUNIT_TEST( |
|
1564 "MaxBrightnessL - test ", |
|
1565 "CMusEngLiveSession", |
|
1566 "MaxBrightnessL", |
|
1567 "FUNCTIONALITY", |
|
1568 SetupL, UT_MaxBrightnessLL, Teardown) |
|
1569 |
|
1570 EUNIT_TEST( |
|
1571 "MinBrightnessL - test ", |
|
1572 "CMusEngLiveSession", |
|
1573 "MinBrightnessL", |
|
1574 "FUNCTIONALITY", |
|
1575 SetupL, UT_MinBrightnessLL, Teardown) |
|
1576 |
|
1577 EUNIT_TEST( |
|
1578 "IncreaseBrightnessL - test ", |
|
1579 "CMusEngLiveSession", |
|
1580 "IncreaseBrightnessL", |
|
1581 "FUNCTIONALITY", |
|
1582 SetupL, UT_IncreaseBrightnessLL, Teardown) |
|
1583 |
|
1584 EUNIT_TEST( |
|
1585 "DecreaseBrightnessL - test ", |
|
1586 "CMusEngLiveSession", |
|
1587 "DecreaseBrightnessL", |
|
1588 "FUNCTIONALITY", |
|
1589 SetupL, UT_DecreaseBrightnessLL, Teardown) |
|
1590 |
|
1591 EUNIT_TEST( |
|
1592 "BrightnessDefaultL - test ", |
|
1593 "CMusEngLiveSession", |
|
1594 "BrightnessDefaultL", |
|
1595 "FUNCTIONALITY", |
|
1596 SetupL, UT_BrightnessDefaultLL, Teardown) |
|
1597 |
|
1598 EUNIT_TEST( |
|
1599 "BrightnessAutoL - test ", |
|
1600 "CMusEngLiveSession", |
|
1601 "BrightnessAutoL", |
|
1602 "FUNCTIONALITY", |
|
1603 SetupL, UT_BrightnessAutoLL, Teardown) |
|
1604 |
|
1605 EUNIT_TEST( |
|
1606 "RecordL_and_IsRecordingL - test ", |
|
1607 "CMusEngLiveSession", |
|
1608 "RecordL_and_IsRecordingL", |
|
1609 "FUNCTIONALITY", |
|
1610 SetupL, UT_RecordL_and_IsRecordingLL, Teardown) |
|
1611 |
|
1612 EUNIT_TEST( |
|
1613 "PlayL - test ", |
|
1614 "CMusEngLiveSession", |
|
1615 "PlayL", |
|
1616 "FUNCTIONALITY", |
|
1617 SetupL, UT_PlayLL, Teardown) |
|
1618 |
|
1619 EUNIT_TEST( |
|
1620 "PauseL - test ", |
|
1621 "CMusEngLiveSession", |
|
1622 "PauseL", |
|
1623 "FUNCTIONALITY", |
|
1624 SetupL, UT_PauseLL, Teardown) |
|
1625 |
|
1626 EUNIT_TEST( |
|
1627 "IsPlayingL - test ", |
|
1628 "CMusEngLiveSession", |
|
1629 "IsPlayingL", |
|
1630 "FUNCTIONALITY", |
|
1631 SetupL, UT_IsPlayingLL, Teardown) |
|
1632 |
|
1633 EUNIT_TEST( |
|
1634 "CompleteSessionStructureL - test ", |
|
1635 "CMusEngLiveSession", |
|
1636 "CompleteSessionStructureL", |
|
1637 "FUNCTIONALITY", |
|
1638 SetupL, UT_CompleteSessionStructureLL, Teardown) |
|
1639 |
|
1640 EUNIT_TEST( |
|
1641 "HandleSessionStateChanged - test ", |
|
1642 "CMusEngLiveSession", |
|
1643 "HandleSessionStateChanged", |
|
1644 "FUNCTIONALITY", |
|
1645 SetupL, UT_HandleSessionStateChangedL, Teardown) |
|
1646 |
|
1647 EUNIT_TEST( |
|
1648 "AdjustVideoCodecL - test ", |
|
1649 "CMusEngLiveSession", |
|
1650 "AdjustVideoCodecL", |
|
1651 "FUNCTIONALITY", |
|
1652 SetupL, UT_AdjustVideoCodecLL, Teardown) |
|
1653 |
|
1654 EUNIT_TEST( |
|
1655 "AdjustAudioCodecL - test ", |
|
1656 "CMusEngLiveSession", |
|
1657 "AdjustAudioCodecL", |
|
1658 "FUNCTIONALITY", |
|
1659 SetupL, UT_AdjustAudioCodecLL, Teardown) |
|
1660 |
|
1661 EUNIT_TEST( |
|
1662 "DoCodecSelectionL- test ", |
|
1663 "CMusEngLiveSession", |
|
1664 "DoCodecSelectionL", |
|
1665 "FUNCTIONALITY", |
|
1666 SetupL, UT_DoCodecSelectionLL, Teardown) |
|
1667 |
|
1668 EUNIT_TEST( |
|
1669 "StreamStateChangedL() - test ", |
|
1670 "CMusEngLiveSession", |
|
1671 "StreamStateChangedL()", |
|
1672 "FUNCTIONALITY", |
|
1673 SetupL, UT_StreamStateChangedL, Teardown) |
|
1674 |
|
1675 EUNIT_TEST( |
|
1676 "StreamStateChangedL( src ) - test ", |
|
1677 "CMusEngLiveSession", |
|
1678 "StreamStateChangedL( src )", |
|
1679 "FUNCTIONALITY", |
|
1680 SetupL, UT_StreamStateChangedWithSourceL, Teardown) |
|
1681 |
|
1682 EUNIT_TEST( |
|
1683 "StreamStateChangedL( sink ) - test ", |
|
1684 "CMusEngLiveSession", |
|
1685 "StreamStateChangedL( sink )", |
|
1686 "FUNCTIONALITY", |
|
1687 SetupL, UT_StreamStateChangedWithSinkL, Teardown) |
|
1688 |
|
1689 EUNIT_TEST( |
|
1690 "SetEncodingDeviceL - test ", |
|
1691 "CMusEngLiveSession", |
|
1692 "SetEncodingDeviceL", |
|
1693 "FUNCTIONALITY", |
|
1694 SetupL, UT_SetEncodingDeviceLL, Teardown) |
|
1695 |
|
1696 EUNIT_TEST( |
|
1697 "SetCodecConfigKeyL - test ", |
|
1698 "CMusEngLiveSession", |
|
1699 "SetCodecConfigKeyL", |
|
1700 "FUNCTIONALITY", |
|
1701 SetupL, UT_SetCodecConfigKeyLL, Teardown) |
|
1702 |
|
1703 EUNIT_TEST( |
|
1704 "ReadCodecConfigKeyL - test ", |
|
1705 "CMusEngLiveSession", |
|
1706 "ReadCodecConfigKeyL", |
|
1707 "FUNCTIONALITY", |
|
1708 SetupL, UT_ReadCodecConfigKeyLL, Teardown) |
|
1709 |
|
1710 EUNIT_TEST( |
|
1711 "StoreEncoderConfigInfoL - test ", |
|
1712 "CMusEngLiveSession", |
|
1713 "StoreEncoderConfigInfoL", |
|
1714 "FUNCTIONALITY", |
|
1715 SetupL, UT_StoreEncoderConfigInfoLL, Teardown) |
|
1716 |
|
1717 EUNIT_TEST( |
|
1718 "InitializeZoomStepSize - test ", |
|
1719 "CMusEngLiveSession", |
|
1720 "InitializeZoomStepSize", |
|
1721 "FUNCTIONALITY", |
|
1722 SetupL, UT_InitializeZoomStepSizeL, Teardown) |
|
1723 |
|
1724 |
|
1725 EUNIT_END_TEST_TABLE |
|
1726 |
|
1727 // END OF FILE |
|
1728 |
|
1729 |