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_musengtwowayrecvsession.h" |
|
21 #include "musengstubs.h" |
|
22 #include "musengtestdefs.h" |
|
23 #include "musengtwowayrecvsession.h" |
|
24 #include "musengmceutils.h" |
|
25 #include "mussessionproperties.h" |
|
26 #include "contactenginestub.h" |
|
27 #include "musenglivevideoplayer.h" |
|
28 |
|
29 // SYSTEM INCLUDES |
|
30 #include <eunitmacros.h> |
|
31 |
|
32 #include <mceinsession.h> |
|
33 #include <mcestreambundle.h> |
|
34 #include <mcevideostream.h> |
|
35 #include <mceaudiostream.h> |
|
36 #include <mcertpsource.h> |
|
37 #include <mcedisplaysink.h> |
|
38 #include <mcespeakersink.h> |
|
39 #include <mcecamerasource.h> |
|
40 #include <mcefilesource.h> |
|
41 #include <mcertpsink.h> |
|
42 #include <mceaudiocodec.h> |
|
43 #include <mceh263codec.h> |
|
44 #include <mceavccodec.h> |
|
45 #include <musmanager.h> |
|
46 |
|
47 #include <audiopreference.h> |
|
48 |
|
49 // Incoming session may be rejected silently due memory running out. Ensure that |
|
50 // incoming session was handled fully by using this macro. |
|
51 #define MUSENG_TEST_ASSERT_INCOMING_SESSION_ALLOC_FAILURE_L \ |
|
52 __ASSERT_ALWAYS( iReceiveSession->iSession && \ |
|
53 iReceiveSession->iSession->iState != CMceSession::ETerminated, User::Leave( KErrNoMemory ) ); |
|
54 |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 UT_CMusEngTwoWayRecvSession* UT_CMusEngTwoWayRecvSession::NewL() |
|
61 { |
|
62 UT_CMusEngTwoWayRecvSession* self = UT_CMusEngTwoWayRecvSession::NewLC(); |
|
63 CleanupStack::Pop( self ); |
|
64 return self; |
|
65 } |
|
66 |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 UT_CMusEngTwoWayRecvSession* UT_CMusEngTwoWayRecvSession::NewLC() |
|
73 { |
|
74 UT_CMusEngTwoWayRecvSession* self = new( ELeave ) UT_CMusEngTwoWayRecvSession(); |
|
75 CleanupStack::PushL( self ); |
|
76 self->ConstructL(); |
|
77 return self; |
|
78 } |
|
79 |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 // ----------------------------------------------------------------------------- |
|
84 // |
|
85 UT_CMusEngTwoWayRecvSession::~UT_CMusEngTwoWayRecvSession() |
|
86 { |
|
87 // NOP |
|
88 } |
|
89 |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // Default constructor |
|
93 // ----------------------------------------------------------------------------- |
|
94 // |
|
95 UT_CMusEngTwoWayRecvSession::UT_CMusEngTwoWayRecvSession() |
|
96 { |
|
97 // NOP |
|
98 } |
|
99 |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // Second phase construct |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 void UT_CMusEngTwoWayRecvSession::ConstructL() |
|
106 { |
|
107 // The ConstructL from the base class CEUnitTestSuiteClass must be called. |
|
108 // It generates the test case table. |
|
109 CEUnitTestSuiteClass::ConstructL(); |
|
110 } |
|
111 |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 void UT_CMusEngTwoWayRecvSession::SetupL( ) |
|
118 { |
|
119 iLcSessionObserver = new( ELeave )CLcSessionObserverStub; |
|
120 iReceiveSession = CMusEngTwoWayRecvSession::NewL(); |
|
121 iReceiveSession->SetLcSessionObserver( iLcSessionObserver ); |
|
122 } |
|
123 |
|
124 // ----------------------------------------------------------------------------- |
|
125 // |
|
126 // ----------------------------------------------------------------------------- |
|
127 // |
|
128 void UT_CMusEngTwoWayRecvSession::Teardown( ) |
|
129 { |
|
130 delete iReceiveSession; |
|
131 delete iLcSessionObserver; |
|
132 PropertyHelper::Close(); |
|
133 } |
|
134 |
|
135 |
|
136 // TEST HELPERS |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 CMceVideoStream* UT_CMusEngTwoWayRecvSession::ConstructVideoInStreamLC() |
|
143 { |
|
144 CMceVideoStream* videoStream = CMceVideoStream::NewLC(); |
|
145 |
|
146 videoStream->SetSourceL( CMceRtpSource::NewLC() ); |
|
147 CleanupStack::Pop(); |
|
148 |
|
149 videoStream->AddSinkL( |
|
150 CMceDisplaySink::NewLC( *iReceiveSession->iManager ) ); |
|
151 CleanupStack::Pop(); |
|
152 |
|
153 return videoStream; |
|
154 } |
|
155 |
|
156 |
|
157 // ----------------------------------------------------------------------------- |
|
158 // |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 CMceVideoStream* UT_CMusEngTwoWayRecvSession::ConstructVideoOutStreamLC() |
|
162 { |
|
163 CMceVideoStream* videoStream = CMceVideoStream::NewLC(); |
|
164 |
|
165 videoStream->SetSourceL( |
|
166 CMceCameraSource::NewLC( *iReceiveSession->iManager ) ); |
|
167 CleanupStack::Pop(); |
|
168 |
|
169 videoStream->AddSinkL( CMceRtpSink::NewLC() ); |
|
170 CleanupStack::Pop(); |
|
171 |
|
172 return videoStream; |
|
173 } |
|
174 |
|
175 |
|
176 // ----------------------------------------------------------------------------- |
|
177 // |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 CMceAudioStream* UT_CMusEngTwoWayRecvSession::ConstructAudioInStreamLC() |
|
181 { |
|
182 CMceAudioStream* audioStream = CMceAudioStream::NewLC(); |
|
183 |
|
184 audioStream->SetSourceL( CMceRtpSource::NewLC() ); |
|
185 CleanupStack::Pop(); |
|
186 |
|
187 audioStream->AddSinkL( CMceSpeakerSink::NewLC() ); |
|
188 CleanupStack::Pop(); |
|
189 |
|
190 return audioStream; |
|
191 } |
|
192 |
|
193 |
|
194 // ----------------------------------------------------------------------------- |
|
195 // |
|
196 // ----------------------------------------------------------------------------- |
|
197 // |
|
198 CMceAudioStream* UT_CMusEngTwoWayRecvSession::ConstructAudioOutStreamLC() |
|
199 { |
|
200 CMceAudioStream* audioStream = CMceAudioStream::NewLC(); |
|
201 |
|
202 audioStream->SetSourceL( |
|
203 CMceFileSource::NewLC( *iReceiveSession->iManager, KNullDesC() ) ); |
|
204 CleanupStack::Pop(); |
|
205 |
|
206 audioStream->AddSinkL( CMceRtpSink::NewLC() ); |
|
207 CleanupStack::Pop(); |
|
208 |
|
209 return audioStream; |
|
210 |
|
211 } |
|
212 |
|
213 |
|
214 // ----------------------------------------------------------------------------- |
|
215 // Helper to construct incoming sessions. |
|
216 // ----------------------------------------------------------------------------- |
|
217 // |
|
218 CMceInSession* UT_CMusEngTwoWayRecvSession::ConstructInSessionLC( |
|
219 TInt aVideoStreamCount, |
|
220 TInt aAudioStreamCount, |
|
221 TBool aConstructSinks ) |
|
222 { |
|
223 CMceInSession* inSession = CMceInSession::NewL( |
|
224 *(iReceiveSession->iManager), |
|
225 KTestOriginator() ); |
|
226 CleanupStack::PushL( inSession ); |
|
227 |
|
228 for ( TInt i = 0; i < aVideoStreamCount; ++i ) |
|
229 { |
|
230 CMceVideoStream* videoStream = CMceVideoStream::NewLC(); |
|
231 |
|
232 CMceRtpSource* rtpSource = CMceRtpSource::NewLC(); |
|
233 videoStream->SetSourceL( rtpSource ); |
|
234 CleanupStack::Pop( rtpSource ); |
|
235 |
|
236 if ( aConstructSinks ) |
|
237 { |
|
238 CMceDisplaySink* display = CMceDisplaySink::NewLC( |
|
239 *(iReceiveSession->iManager) ); |
|
240 videoStream->AddSinkL( display ); |
|
241 CleanupStack::Pop( display ); |
|
242 } |
|
243 |
|
244 inSession->AddStreamL( videoStream ); |
|
245 CleanupStack::Pop( videoStream ); |
|
246 } |
|
247 |
|
248 for ( TInt i = 0; i < aAudioStreamCount; ++i ) |
|
249 { |
|
250 CMceAudioStream* audioStream = CMceAudioStream::NewLC(); |
|
251 |
|
252 CMceRtpSource* rtpSource = CMceRtpSource::NewLC(); |
|
253 audioStream->SetSourceL( rtpSource ); |
|
254 CleanupStack::Pop( rtpSource ); |
|
255 |
|
256 if ( aConstructSinks ) |
|
257 { |
|
258 CMceSpeakerSink* speaker = CMceSpeakerSink::NewLC(); |
|
259 audioStream->AddSinkL( speaker ); |
|
260 CleanupStack::Pop( speaker ); |
|
261 } |
|
262 |
|
263 inSession->AddStreamL( audioStream ); |
|
264 CleanupStack::Pop( audioStream ); |
|
265 } |
|
266 |
|
267 return inSession; |
|
268 } |
|
269 |
|
270 // ----------------------------------------------------------------------------- |
|
271 // Helper to construct incoming two-way video session. |
|
272 // ----------------------------------------------------------------------------- |
|
273 // |
|
274 CMceInSession* UT_CMusEngTwoWayRecvSession::ConstructTwoWayInSessionLC( TBool aConstructSinks ) |
|
275 { |
|
276 CMceInSession* inSession = CMceInSession::NewL( |
|
277 *(iReceiveSession->iManager), |
|
278 KTestOriginator() ); |
|
279 CleanupStack::PushL( inSession ); |
|
280 |
|
281 CMceVideoStream* videoStream = CMceVideoStream::NewLC(); |
|
282 |
|
283 CMceRtpSource* rtpSource = CMceRtpSource::NewLC(); |
|
284 videoStream->SetSourceL( rtpSource ); |
|
285 CleanupStack::Pop( rtpSource ); |
|
286 |
|
287 if ( aConstructSinks ) |
|
288 { |
|
289 CMceDisplaySink* display = CMceDisplaySink::NewLC( |
|
290 *(iReceiveSession->iManager) ); |
|
291 videoStream->AddSinkL( display ); |
|
292 CleanupStack::Pop( display ); |
|
293 } |
|
294 |
|
295 CMceVideoStream* videoOutStream = CMceVideoStream::NewLC(); |
|
296 |
|
297 CMceCameraSource* cameraSource = CMceCameraSource::NewLC( *(iReceiveSession->iManager) ); |
|
298 videoOutStream->SetSourceL( cameraSource ); |
|
299 CleanupStack::Pop( cameraSource ); |
|
300 |
|
301 if ( aConstructSinks ) |
|
302 { |
|
303 CMceRtpSink* rtpSink = CMceRtpSink::NewLC(); |
|
304 videoOutStream->AddSinkL( rtpSink ); |
|
305 CleanupStack::Pop( rtpSink ); |
|
306 } |
|
307 videoStream->BindL( videoOutStream ); |
|
308 CleanupStack::Pop( videoOutStream ); |
|
309 |
|
310 inSession->AddStreamL( videoStream ); |
|
311 CleanupStack::Pop( videoStream ); |
|
312 |
|
313 return inSession; |
|
314 } |
|
315 |
|
316 |
|
317 // TEST CASES |
|
318 |
|
319 |
|
320 // ----------------------------------------------------------------------------- |
|
321 // |
|
322 // ----------------------------------------------------------------------------- |
|
323 // |
|
324 void UT_CMusEngTwoWayRecvSession::UT_NewLL( ) |
|
325 { |
|
326 EUNIT_ASSERT( iReceiveSession ); |
|
327 EUNIT_ASSERT( !iReceiveSession->iSession ); |
|
328 EUNIT_ASSERT( iReceiveSession->iMceManagerUid == |
|
329 TUid::Uid(CMusManager::ESipInviteDesired2WayVideo) ); |
|
330 } |
|
331 |
|
332 |
|
333 |
|
334 // ----------------------------------------------------------------------------- |
|
335 // |
|
336 // ----------------------------------------------------------------------------- |
|
337 // |
|
338 void UT_CMusEngTwoWayRecvSession::UT_EnableDisplayLL() |
|
339 { |
|
340 TRAPD( error, iReceiveSession->EnableDisplayL( ETrue ) ); |
|
341 MUS_TEST_FORWARD_ALLOC_FAILURE( error ); |
|
342 EUNIT_ASSERT( error == KErrNotReady ); |
|
343 |
|
344 TMceTransactionDataContainer container; |
|
345 CMceInSession* inSession = ConstructTwoWayInSessionLC(); |
|
346 iReceiveSession->IncomingSession( inSession, &container ); |
|
347 CleanupStack::Pop( inSession ); |
|
348 MUSENG_TEST_ASSERT_INCOMING_SESSION_ALLOC_FAILURE_L |
|
349 |
|
350 CMceDisplaySink* display = |
|
351 MusEngMceUtils::GetDisplayL( *(iReceiveSession->iSession) ); |
|
352 |
|
353 CMceDisplaySink* receivingDisplay = |
|
354 MusEngMceUtils::GetReceivingDisplayL( *iReceiveSession->iSession ); |
|
355 |
|
356 // Disable |
|
357 iReceiveSession->EnableDisplayL( EFalse ); |
|
358 |
|
359 EUNIT_ASSERT( !display->iIsEnabled ); |
|
360 EUNIT_ASSERT( !receivingDisplay->iIsEnabled ); |
|
361 |
|
362 // Try to disable again, request should be ignored |
|
363 |
|
364 iReceiveSession->EnableDisplayL( EFalse ); |
|
365 |
|
366 EUNIT_ASSERT( !display->iIsEnabled ); |
|
367 EUNIT_ASSERT( !receivingDisplay->iIsEnabled ); |
|
368 |
|
369 // Enable |
|
370 |
|
371 iReceiveSession->EnableDisplayL( ETrue ); |
|
372 |
|
373 EUNIT_ASSERT( display->iIsEnabled ); |
|
374 EUNIT_ASSERT( receivingDisplay->iIsEnabled ); |
|
375 |
|
376 // Try to enable again, request should be ignored |
|
377 |
|
378 iReceiveSession->EnableDisplayL( ETrue ); |
|
379 |
|
380 EUNIT_ASSERT( display->iIsEnabled ); |
|
381 EUNIT_ASSERT( receivingDisplay->iIsEnabled ); |
|
382 |
|
383 // Session does not have sending stream (viewfinder does not exist) |
|
384 // |
|
385 delete iReceiveSession->iSession; |
|
386 iReceiveSession->iSession = NULL; |
|
387 inSession = ConstructInSessionLC( 1, 0 ); |
|
388 iReceiveSession->IncomingSession( inSession, &container ); |
|
389 CleanupStack::Pop( inSession ); |
|
390 display = MusEngMceUtils::GetVfDisplay( *(iReceiveSession->iSession) ); |
|
391 EUNIT_ASSERT( display == NULL ); |
|
392 receivingDisplay = MusEngMceUtils::GetReceivingDisplayL( *iReceiveSession->iSession ); |
|
393 iReceiveSession->EnableDisplayL( EFalse ); |
|
394 EUNIT_ASSERT( !receivingDisplay->iIsEnabled ); |
|
395 |
|
396 } |
|
397 |
|
398 // ----------------------------------------------------------------------------- |
|
399 // |
|
400 // ----------------------------------------------------------------------------- |
|
401 // |
|
402 void UT_CMusEngTwoWayRecvSession::UT_SetOrientationLL() |
|
403 { |
|
404 // Try without session, fails |
|
405 EUNIT_ASSERT_SPECIFIC_LEAVE( iReceiveSession->SetOrientationL( |
|
406 CMusEngMceSession::EPortrait ), |
|
407 KErrNotReady ) |
|
408 |
|
409 TMceTransactionDataContainer container; |
|
410 CMceInSession* inSession = ConstructTwoWayInSessionLC(); |
|
411 iReceiveSession->IncomingSession( inSession, &container ); |
|
412 CleanupStack::Pop( inSession ); |
|
413 MUSENG_TEST_ASSERT_INCOMING_SESSION_ALLOC_FAILURE_L |
|
414 |
|
415 CMceDisplaySink* display = |
|
416 MusEngMceUtils::GetDisplayL( *iReceiveSession->iSession ); |
|
417 |
|
418 CMceDisplaySink* receivingDisplay = |
|
419 MusEngMceUtils::GetReceivingDisplayL( *iReceiveSession->iSession ); |
|
420 |
|
421 |
|
422 // Check the initial state |
|
423 display->iRotation = CMceDisplaySink::ENone; |
|
424 receivingDisplay->iRotation = CMceDisplaySink::ENone; |
|
425 EUNIT_ASSERT_EQUALS( iReceiveSession->OrientationL(), |
|
426 CMusEngMceSession::EPortrait ) |
|
427 |
|
428 // Successfully change orientation |
|
429 |
|
430 iReceiveSession->SetOrientationL( CMusEngMceSession::ELandscape ); |
|
431 EUNIT_ASSERT_EQUALS( iReceiveSession->OrientationL(), |
|
432 CMusEngMceSession::ELandscape ) |
|
433 |
|
434 EUNIT_ASSERT_EQUALS( display->iRotation, CMceDisplaySink::EClockwise90Degree ); |
|
435 EUNIT_ASSERT_EQUALS( receivingDisplay->iRotation, CMceDisplaySink::EClockwise90Degree ); |
|
436 |
|
437 iReceiveSession->SetOrientationL( CMusEngMceSession::EPortrait ); |
|
438 EUNIT_ASSERT_EQUALS( iReceiveSession->OrientationL(), |
|
439 CMusEngMceSession::EPortrait ) |
|
440 |
|
441 EUNIT_ASSERT_EQUALS( display->iRotation, CMceDisplaySink::ENone ); |
|
442 EUNIT_ASSERT_EQUALS( receivingDisplay->iRotation, CMceDisplaySink::ENone ); |
|
443 |
|
444 // Session does not have sending stream (viewfinder does not exist) |
|
445 delete iReceiveSession->iSession; |
|
446 iReceiveSession->iSession = NULL; |
|
447 inSession = ConstructInSessionLC( 1, 0 ); |
|
448 iReceiveSession->IncomingSession( inSession, &container ); |
|
449 CleanupStack::Pop( inSession ); |
|
450 MUSENG_TEST_ASSERT_INCOMING_SESSION_ALLOC_FAILURE_L |
|
451 display = MusEngMceUtils::GetVfDisplay( *(iReceiveSession->iSession) ); |
|
452 EUNIT_ASSERT( display == NULL ); |
|
453 receivingDisplay = MusEngMceUtils::GetReceivingDisplayL( *iReceiveSession->iSession ); |
|
454 iReceiveSession->SetOrientationL( CMusEngMceSession::ELandscape ); |
|
455 EUNIT_ASSERT_EQUALS( receivingDisplay->iRotation, CMceDisplaySink::EClockwise90Degree ); |
|
456 } |
|
457 |
|
458 // ----------------------------------------------------------------------------- |
|
459 // |
|
460 // ----------------------------------------------------------------------------- |
|
461 // |
|
462 void UT_CMusEngTwoWayRecvSession::UT_OrientationLL() |
|
463 { |
|
464 // Try without session, fails |
|
465 EUNIT_ASSERT_SPECIFIC_LEAVE( iReceiveSession->OrientationL(), |
|
466 KErrNotReady ) |
|
467 |
|
468 TMceTransactionDataContainer container; |
|
469 CMceInSession* inSession = ConstructTwoWayInSessionLC(); |
|
470 iReceiveSession->IncomingSession( inSession, &container ); |
|
471 CleanupStack::Pop( inSession ); |
|
472 MUSENG_TEST_ASSERT_INCOMING_SESSION_ALLOC_FAILURE_L |
|
473 |
|
474 CMceDisplaySink* receivingDisplay = |
|
475 MusEngMceUtils::GetReceivingDisplayL( *iReceiveSession->iSession ); |
|
476 receivingDisplay->iRotation = CMceDisplaySink::ENone; |
|
477 |
|
478 EUNIT_ASSERT_EQUALS( iReceiveSession->OrientationL(), |
|
479 CMusEngMceSession::EPortrait ) |
|
480 |
|
481 receivingDisplay->iRotation = CMceDisplaySink::EClockwise90Degree; |
|
482 |
|
483 EUNIT_ASSERT_EQUALS( iReceiveSession->OrientationL(), |
|
484 CMusEngMceSession::ELandscape ) |
|
485 } |
|
486 |
|
487 // ----------------------------------------------------------------------------- |
|
488 // |
|
489 // ----------------------------------------------------------------------------- |
|
490 // |
|
491 void UT_CMusEngTwoWayRecvSession::UT_SetLocalRectLL() |
|
492 { |
|
493 // Does nothing real before session establishment |
|
494 TRect rect1( 100, 200, 300, 500 ); |
|
495 iReceiveSession->SetSecondaryRectL( rect1 ); |
|
496 |
|
497 EUNIT_ASSERT( rect1 == iReceiveSession->iLocalRect ); |
|
498 |
|
499 // Local rect changing affects to viewfinder display sink not to receiving video |
|
500 // |
|
501 TMceTransactionDataContainer container; |
|
502 CMceInSession* inSession = ConstructTwoWayInSessionLC(); |
|
503 iReceiveSession->IncomingSession( inSession, &container ); |
|
504 CleanupStack::Pop( inSession ); |
|
505 MUSENG_TEST_ASSERT_INCOMING_SESSION_ALLOC_FAILURE_L |
|
506 |
|
507 CMceDisplaySink* vfDisplay = |
|
508 MusEngMceUtils::GetDisplayL( *( iReceiveSession->iSession ) ); |
|
509 CMceDisplaySink* receivingDisplay = |
|
510 MusEngMceUtils::GetReceivingDisplayL( *( iReceiveSession->iSession ) ); |
|
511 |
|
512 EUNIT_ASSERT( vfDisplay->DisplayRectL() == iReceiveSession->iLocalRect ); |
|
513 EUNIT_ASSERT( receivingDisplay->DisplayRectL() != iReceiveSession->iLocalRect ); |
|
514 |
|
515 TRect rect2( 200, 200, 300, 500 ); |
|
516 iReceiveSession->SetSecondaryRectL( rect2 ); |
|
517 EUNIT_ASSERT( rect2 == iReceiveSession->iLocalRect ); |
|
518 EUNIT_ASSERT( vfDisplay->DisplayRectL() == iReceiveSession->iLocalRect ); |
|
519 EUNIT_ASSERT( receivingDisplay->DisplayRectL() != iReceiveSession->iLocalRect ); |
|
520 |
|
521 // Terminate session and try again, rect must not be changed |
|
522 |
|
523 iReceiveSession->iSession->iState = CMceSession::ETerminated; |
|
524 |
|
525 TRect rect3( 300, 300, 400, 600 ); |
|
526 |
|
527 iReceiveSession->SetSecondaryRectL( rect3 ); |
|
528 |
|
529 EUNIT_ASSERT( vfDisplay->DisplayRectL() != rect3 ) |
|
530 } |
|
531 |
|
532 // ----------------------------------------------------------------------------- |
|
533 // |
|
534 // ----------------------------------------------------------------------------- |
|
535 // |
|
536 void UT_CMusEngTwoWayRecvSession::UT_SetRectsLL() |
|
537 { |
|
538 // Does nothing real before session establishment |
|
539 TRect localrect1( 100, 200, 300, 400 ); |
|
540 TRect remoterect1( 100, 200, 300, 500 ); |
|
541 iReceiveSession->SetRectsL( remoterect1, localrect1 ); |
|
542 |
|
543 EUNIT_ASSERT( localrect1 == iReceiveSession->iLocalRect ); |
|
544 EUNIT_ASSERT( remoterect1 == iReceiveSession->iRect ); |
|
545 |
|
546 // Local rect changing affects to viewfinder display sink and remote rect to |
|
547 // receiving video display sink |
|
548 // |
|
549 TMceTransactionDataContainer container; |
|
550 CMceInSession* inSession = ConstructTwoWayInSessionLC(); |
|
551 iReceiveSession->IncomingSession( inSession, &container ); |
|
552 CleanupStack::Pop( inSession ); |
|
553 MUSENG_TEST_ASSERT_INCOMING_SESSION_ALLOC_FAILURE_L |
|
554 |
|
555 CMceDisplaySink* vfDisplay = |
|
556 MusEngMceUtils::GetDisplayL( *( iReceiveSession->iSession ) ); |
|
557 CMceDisplaySink* receivingDisplay = |
|
558 MusEngMceUtils::GetReceivingDisplayL( *( iReceiveSession->iSession ) ); |
|
559 |
|
560 TRect localrect2( 200, 200, 300, 400 ); |
|
561 TRect remoterect2( 200, 200, 300, 500 ); |
|
562 EUNIT_ASSERT( vfDisplay->DisplayRectL() != localrect2 ); |
|
563 EUNIT_ASSERT( receivingDisplay->DisplayRectL() != remoterect2 ); |
|
564 |
|
565 iReceiveSession->SetRectsL( remoterect2, localrect2 ); |
|
566 EUNIT_ASSERT( localrect2 == iReceiveSession->iLocalRect ); |
|
567 EUNIT_ASSERT( remoterect2 == iReceiveSession->iRect ); |
|
568 EUNIT_ASSERT( vfDisplay->DisplayRectL() == iReceiveSession->iLocalRect ); |
|
569 EUNIT_ASSERT( receivingDisplay->DisplayRectL() == iReceiveSession->iRect ); |
|
570 |
|
571 // Terminate session and try again, rect must not be changed |
|
572 |
|
573 iReceiveSession->iSession->iState = CMceSession::ETerminated; |
|
574 |
|
575 TRect localrect3( 300, 200, 300, 400 ); |
|
576 TRect remoterect3( 300, 200, 300, 500 ); |
|
577 |
|
578 iReceiveSession->SetRectsL( remoterect3, localrect3 ); |
|
579 |
|
580 EUNIT_ASSERT( vfDisplay->DisplayRectL() != localrect3 ) |
|
581 EUNIT_ASSERT( receivingDisplay->DisplayRectL() != remoterect3 ); |
|
582 |
|
583 // Session does not have sending stream (viewfinder does not exist) |
|
584 |
|
585 TRect localrect4( 400, 200, 300, 400 ); |
|
586 TRect remoterect4( 400, 200, 300, 500 ); |
|
587 delete iReceiveSession->iSession; |
|
588 iReceiveSession->iSession = NULL; |
|
589 inSession = ConstructInSessionLC( 1, 0 ); |
|
590 iReceiveSession->IncomingSession( inSession, &container ); |
|
591 CleanupStack::Pop( inSession ); |
|
592 MUSENG_TEST_ASSERT_INCOMING_SESSION_ALLOC_FAILURE_L |
|
593 vfDisplay = MusEngMceUtils::GetVfDisplay( *(iReceiveSession->iSession) ); |
|
594 EUNIT_ASSERT( vfDisplay == NULL ); |
|
595 receivingDisplay = MusEngMceUtils::GetReceivingDisplayL( *iReceiveSession->iSession ); |
|
596 iReceiveSession->SetRectsL( remoterect4, localrect4 ); |
|
597 EUNIT_ASSERT( localrect4 == iReceiveSession->iLocalRect ); |
|
598 EUNIT_ASSERT( remoterect4 == iReceiveSession->iRect ); |
|
599 EUNIT_ASSERT( receivingDisplay->DisplayRectL() == iReceiveSession->iRect ); |
|
600 } |
|
601 |
|
602 // ----------------------------------------------------------------------------- |
|
603 // |
|
604 // ----------------------------------------------------------------------------- |
|
605 // |
|
606 void UT_CMusEngTwoWayRecvSession::UT_CameraL() |
|
607 { |
|
608 // Camera cannot be used without MCE session |
|
609 // |
|
610 EUNIT_ASSERT_LEAVE( iReceiveSession->Camera().ChangeCameraL( |
|
611 TMusEngCameraHandler::EFrontCamera ) ); |
|
612 |
|
613 // Camera cannot be used without video out stream |
|
614 // |
|
615 TMceTransactionDataContainer container; |
|
616 CMceInSession* inSession = ConstructInSessionLC( 1, 0 ); |
|
617 iReceiveSession->IncomingSession( inSession, &container ); |
|
618 CleanupStack::Pop( inSession ); |
|
619 MUSENG_TEST_ASSERT_INCOMING_SESSION_ALLOC_FAILURE_L |
|
620 EUNIT_ASSERT_LEAVE( iReceiveSession->Camera().ChangeCameraL( |
|
621 TMusEngCameraHandler::EFrontCamera ) ); |
|
622 |
|
623 // Camera can be used when video out stream exists |
|
624 // |
|
625 delete iReceiveSession->iSession; |
|
626 iReceiveSession->iSession = NULL; |
|
627 inSession = ConstructTwoWayInSessionLC(); |
|
628 iReceiveSession->IncomingSession( inSession, &container ); |
|
629 CleanupStack::Pop( inSession ); |
|
630 MUSENG_TEST_ASSERT_INCOMING_SESSION_ALLOC_FAILURE_L |
|
631 iReceiveSession->Camera().ChangeCameraL( |
|
632 TMusEngCameraHandler::EFrontCamera ); |
|
633 } |
|
634 |
|
635 // ----------------------------------------------------------------------------- |
|
636 // |
|
637 // ----------------------------------------------------------------------------- |
|
638 // |
|
639 void UT_CMusEngTwoWayRecvSession::UT_LocalVideoPlayerL() |
|
640 { |
|
641 EUNIT_ASSERT( iReceiveSession->LocalVideoPlayer() == |
|
642 iReceiveSession->iLiveVideoPlayer ) |
|
643 } |
|
644 |
|
645 // ----------------------------------------------------------------------------- |
|
646 // |
|
647 // ----------------------------------------------------------------------------- |
|
648 // |
|
649 void UT_CMusEngTwoWayRecvSession::UT_HandleSessionStateChangedL() |
|
650 { |
|
651 // Unknown session, let the base class handle |
|
652 CMceInSession* inSession = ConstructInSessionLC( 1, 1 ); |
|
653 |
|
654 iReceiveSession->HandleSessionStateChanged( *inSession, 0, KNullDesC8() ); |
|
655 |
|
656 // Simulate incoming session |
|
657 TMceTransactionDataContainer container; |
|
658 |
|
659 iReceiveSession->IncomingSession( inSession, &container ); |
|
660 CleanupStack::Pop( inSession ); |
|
661 |
|
662 // Session is in state EReserving, let the base class handle |
|
663 iReceiveSession->HandleSessionStateChanged( *inSession, 0, KNullDesC8() ); |
|
664 |
|
665 // The normal cases: |
|
666 |
|
667 // 1 ) First transition to state EProceeding, user and remote end should |
|
668 // be notified |
|
669 inSession->iState = CMceSession::EProceeding; |
|
670 iReceiveSession->HandleSessionStateChanged( *inSession, 0, KNullDesC8() ); |
|
671 EUNIT_ASSERT_EQUALS( TInt( iLcSessionObserver->iCalledFunction ), |
|
672 TInt( CLcSessionObserverStub::ESessionStateChanged ) ) |
|
673 EUNIT_ASSERT( iReceiveSession->iRingLCalled ) |
|
674 iLcSessionObserver->Reset(); |
|
675 |
|
676 // 2 ) Now simulate second transition to EProceeding state which can happen |
|
677 // if we force 100rel to be used. User and remote end should not be |
|
678 // notified anymore but change should be ignored. |
|
679 inSession->iState = CMceSession::EProceeding; |
|
680 iReceiveSession->HandleSessionStateChanged( *inSession, 0, KNullDesC8() ); |
|
681 EUNIT_ASSERT_EQUALS( TInt( CLcSessionObserverStub::EUnknown ), |
|
682 TInt( iLcSessionObserver->iCalledFunction ) ) |
|
683 } |
|
684 |
|
685 |
|
686 // ----------------------------------------------------------------------------- |
|
687 // |
|
688 // ----------------------------------------------------------------------------- |
|
689 // |
|
690 void UT_CMusEngTwoWayRecvSession::UT_AdjustVideoCodecLL() |
|
691 { |
|
692 CMceVideoCodec* codecH263 = CMceH263Codec::NewLC( KMceSDPNameH263() ); |
|
693 CMceVideoCodec* codecH2632000 = CMceH263Codec::NewLC( KMceSDPNameH2632000() ); |
|
694 CMceVideoCodec* codecAvc = CMceAvcCodec::NewLC( KMceSDPNameH264() ); |
|
695 CMceVideoCodec* codecUnknown = CMceH263Codec::NewLC( KNullDesC8() ); |
|
696 |
|
697 iReceiveSession->AdjustVideoCodecL( *codecH263, KMceRTPSource ); |
|
698 iReceiveSession->AdjustVideoCodecL( *codecH2632000, KMceRTPSource ); |
|
699 iReceiveSession->AdjustVideoCodecL( *codecAvc, KMceRTPSource ); |
|
700 iReceiveSession->AdjustVideoCodecL( *codecUnknown, KMceRTPSource ); |
|
701 |
|
702 EUNIT_ASSERT_EQUALS( codecH263->KeepAliveTimer(), 6 ) |
|
703 EUNIT_ASSERT_EQUALS( codecH263->KeepAlivePayloadType(), 96 ) |
|
704 EUNIT_ASSERT_EQUALS( codecH263->KeepAliveData(), KNullDesC8() ) |
|
705 |
|
706 EUNIT_ASSERT_EQUALS( codecH2632000->KeepAliveTimer(), 6 ) |
|
707 EUNIT_ASSERT_EQUALS( codecH2632000->KeepAlivePayloadType(), 96 ) |
|
708 EUNIT_ASSERT_EQUALS( codecH2632000->KeepAliveData(), KNullDesC8() ) |
|
709 |
|
710 EUNIT_ASSERT_EQUALS( codecAvc->KeepAliveTimer(), 6 ) |
|
711 EUNIT_ASSERT_EQUALS( codecAvc->KeepAlivePayloadType(), 98 ) |
|
712 EUNIT_ASSERT_EQUALS( codecAvc->KeepAliveData(), KNullDesC8() ) |
|
713 |
|
714 EUNIT_ASSERT_EQUALS( codecUnknown->KeepAliveTimer(), 6 ) |
|
715 EUNIT_ASSERT_EQUALS( codecUnknown->KeepAlivePayloadType(), 0 ) |
|
716 EUNIT_ASSERT_EQUALS( codecUnknown->KeepAliveData(), KNullDesC8() ) |
|
717 |
|
718 CleanupStack::PopAndDestroy( codecUnknown ); |
|
719 CleanupStack::PopAndDestroy( codecAvc ); |
|
720 CleanupStack::PopAndDestroy( codecH2632000 ); |
|
721 CleanupStack::PopAndDestroy( codecH263 ); |
|
722 } |
|
723 |
|
724 |
|
725 // ----------------------------------------------------------------------------- |
|
726 // |
|
727 // ----------------------------------------------------------------------------- |
|
728 // |
|
729 void UT_CMusEngTwoWayRecvSession::UT_AdjustAudioCodecLL() |
|
730 { |
|
731 CMceAudioCodec* codec = |
|
732 iReceiveSession->iManager->SupportedAudioCodecs()[0]->CloneL(); |
|
733 CleanupStack::PushL( codec ); |
|
734 iReceiveSession->AdjustAudioCodecL( *codec ); |
|
735 |
|
736 // Test keepalive timer |
|
737 |
|
738 TUint8 keepAliveTimer = codec->KeepAliveTimer(); |
|
739 EUNIT_ASSERT( codec->KeepAliveTimer() == 6 ) |
|
740 EUNIT_ASSERT( codec->KeepAlivePayloadType() == 97 ) |
|
741 EUNIT_ASSERT( codec->KeepAliveData() == KNullDesC8() ) |
|
742 |
|
743 // Test that base class has been called |
|
744 |
|
745 EUNIT_ASSERT( codec->iMMFPriority == KAudioPrioritySwisPlayback ) |
|
746 EUNIT_ASSERT( codec->iMMFPriorityPreference == KAudioPrefSwisPlayback ) |
|
747 |
|
748 CleanupStack::PopAndDestroy( codec ); |
|
749 } |
|
750 |
|
751 |
|
752 // ----------------------------------------------------------------------------- |
|
753 // |
|
754 // ----------------------------------------------------------------------------- |
|
755 // |
|
756 void UT_CMusEngTwoWayRecvSession::UT_DoCodecSelectionLL() |
|
757 { |
|
758 // Check that Non-Interleaved AVC is preferred over single NAL |
|
759 CMceVideoStream* videoStream = CMceVideoStream::NewLC(); |
|
760 |
|
761 CMceVideoCodec* codecAvcSingleNal = CMceAvcCodec::NewLC( KMceSDPNameH264() ); |
|
762 codecAvcSingleNal->iCodecMode = KMceAvcModeSingleNal; |
|
763 videoStream->AddCodecL( codecAvcSingleNal ); |
|
764 CleanupStack::Pop( codecAvcSingleNal ); |
|
765 |
|
766 CMceVideoCodec* codecAvcNonInterleaved = CMceAvcCodec::NewLC( KMceSDPNameH264() ); |
|
767 codecAvcNonInterleaved->iCodecMode = KMceAvcModeNonInterleaved; |
|
768 videoStream->AddCodecL( codecAvcNonInterleaved ); |
|
769 CleanupStack::Pop( codecAvcNonInterleaved ); |
|
770 |
|
771 iReceiveSession->DoCodecSelectionL( *videoStream ); |
|
772 |
|
773 EUNIT_ASSERT_EQUALS( videoStream->Codecs().Count(), 1 ) |
|
774 EUNIT_ASSERT_EQUALS( videoStream->Codecs()[0]->SdpName(), KMceSDPNameH264() ) |
|
775 EUNIT_ASSERT_EQUALS( videoStream->Codecs()[0]->CodecMode(), |
|
776 KMceAvcModeNonInterleaved ) |
|
777 |
|
778 CleanupStack::PopAndDestroy( videoStream ); |
|
779 |
|
780 // Check that Single NAL AVC is preferred over H263 |
|
781 videoStream = CMceVideoStream::NewLC(); |
|
782 |
|
783 CMceVideoCodec* codecH263 = CMceH263Codec::NewLC( KMceSDPNameH263() ); |
|
784 videoStream->AddCodecL( codecH263 ); |
|
785 CleanupStack::Pop( codecH263 ); |
|
786 |
|
787 codecAvcSingleNal = CMceAvcCodec::NewLC( KMceSDPNameH264() ); |
|
788 codecAvcSingleNal->iCodecMode = KMceAvcModeSingleNal; |
|
789 videoStream->AddCodecL( codecAvcSingleNal ); |
|
790 CleanupStack::Pop( codecAvcSingleNal ); |
|
791 |
|
792 iReceiveSession->DoCodecSelectionL( *videoStream ); |
|
793 |
|
794 EUNIT_ASSERT_EQUALS( videoStream->Codecs().Count(), 1 ) |
|
795 EUNIT_ASSERT_EQUALS( videoStream->Codecs()[0]->SdpName(), KMceSDPNameH264() ) |
|
796 EUNIT_ASSERT_EQUALS( videoStream->Codecs()[0]->CodecMode(), |
|
797 KMceAvcModeSingleNal ) |
|
798 |
|
799 CleanupStack::PopAndDestroy( videoStream ); |
|
800 |
|
801 // Check that H263 codecs without AVC are handled correctly (in base class) |
|
802 videoStream = CMceVideoStream::NewLC(); |
|
803 |
|
804 codecH263 = CMceH263Codec::NewLC( KMceSDPNameH263() ); |
|
805 videoStream->AddCodecL( codecH263 ); |
|
806 CleanupStack::Pop( codecH263 ); |
|
807 |
|
808 CMceVideoCodec* codecH2632000 = CMceH263Codec::NewLC( KMceSDPNameH2632000() ); |
|
809 videoStream->AddCodecL( codecH2632000 ); |
|
810 CleanupStack::Pop( codecH2632000 ); |
|
811 |
|
812 iReceiveSession->DoCodecSelectionL( *videoStream ); |
|
813 |
|
814 EUNIT_ASSERT_EQUALS( videoStream->Codecs().Count(), 1 ) |
|
815 |
|
816 CleanupStack::PopAndDestroy( videoStream ); |
|
817 |
|
818 // Check that AVC non-interleaved with best bitrate is preferred |
|
819 videoStream = CMceVideoStream::NewLC(); |
|
820 |
|
821 codecAvcNonInterleaved = CMceAvcCodec::NewLC( KMceSDPNameH264() ); |
|
822 codecAvcNonInterleaved->iCodecMode = KMceAvcModeNonInterleaved; |
|
823 codecAvcNonInterleaved->SetMaxBitrateL( 80000 ); |
|
824 videoStream->AddCodecL( codecAvcNonInterleaved ); |
|
825 CleanupStack::Pop( codecAvcNonInterleaved ); |
|
826 |
|
827 CMceVideoCodec* codecAvcNonInterleaved128 = CMceAvcCodec::NewLC( KMceSDPNameH264() ); |
|
828 codecAvcNonInterleaved128->iCodecMode = KMceAvcModeNonInterleaved; |
|
829 codecAvcNonInterleaved128->SetMaxBitrateL( 128000 ); |
|
830 videoStream->AddCodecL( codecAvcNonInterleaved128 ); |
|
831 CleanupStack::Pop( codecAvcNonInterleaved128 ); |
|
832 |
|
833 iReceiveSession->DoCodecSelectionL( *videoStream ); |
|
834 |
|
835 EUNIT_ASSERT_EQUALS( videoStream->Codecs().Count(), 1 ) |
|
836 EUNIT_ASSERT( videoStream->Codecs()[0] == codecAvcNonInterleaved128 ) |
|
837 |
|
838 CleanupStack::PopAndDestroy( videoStream ); |
|
839 |
|
840 // Check that in case of several AVC single NALs, the best bitrate is preferred |
|
841 videoStream = CMceVideoStream::NewLC(); |
|
842 |
|
843 codecAvcSingleNal = CMceAvcCodec::NewLC( KMceSDPNameH264() ); |
|
844 codecAvcSingleNal->iCodecMode = KMceAvcModeSingleNal; |
|
845 codecAvcSingleNal->SetMaxBitrateL( 80000 ); |
|
846 videoStream->AddCodecL( codecAvcSingleNal ); |
|
847 CleanupStack::Pop( codecAvcSingleNal ); |
|
848 |
|
849 CMceVideoCodec* codecAvcSingleNal128 = CMceAvcCodec::NewLC( KMceSDPNameH264() ); |
|
850 codecAvcSingleNal128->iCodecMode = KMceAvcModeSingleNal; |
|
851 codecAvcSingleNal128->SetMaxBitrateL( 128000 ); |
|
852 videoStream->AddCodecL( codecAvcSingleNal128 ); |
|
853 CleanupStack::Pop( codecAvcSingleNal128 ); |
|
854 |
|
855 iReceiveSession->DoCodecSelectionL( *videoStream ); |
|
856 |
|
857 EUNIT_ASSERT_EQUALS( videoStream->Codecs().Count(), 1 ) |
|
858 EUNIT_ASSERT( videoStream->Codecs()[0] == codecAvcSingleNal128 ) |
|
859 |
|
860 CleanupStack::PopAndDestroy( videoStream ); |
|
861 |
|
862 } |
|
863 |
|
864 |
|
865 // ----------------------------------------------------------------------------- |
|
866 // |
|
867 // ----------------------------------------------------------------------------- |
|
868 // |
|
869 void UT_CMusEngTwoWayRecvSession::UT_IncomingSessionL() |
|
870 { |
|
871 _LIT8( KMusEngSwisTestIdentifier, "Require: precondition" ); |
|
872 _LIT8( KMusEngTestHeader, "Some header" ); |
|
873 |
|
874 TMceTransactionDataContainer container; |
|
875 |
|
876 // Simulate SWIS 2.2 invite. There are no streams, so completion fails and |
|
877 // session gets rejected. Still prenotification has been given. |
|
878 CMceInSession* inSession = ConstructInSessionLC( 0, 0 ); |
|
879 CDesC8Array* headers = new ( ELeave ) CDesC8ArrayFlat( 2 ); |
|
880 CleanupStack::PushL( headers ); |
|
881 headers->AppendL( KMusEngTestHeader() ); |
|
882 headers->AppendL( KMusEngSwisTestIdentifier() ); |
|
883 container.SetHeaders( headers ); |
|
884 CleanupStack::Pop( headers ); |
|
885 iReceiveSession->IncomingSession( inSession, &container ); |
|
886 CleanupStack::Pop( inSession ); |
|
887 container.Clear(); |
|
888 |
|
889 EUNIT_ASSERT( iReceiveSession->iSession ); |
|
890 EUNIT_ASSERT( iReceiveSession->iSession->iState == |
|
891 CMceSession::ETerminated ); |
|
892 |
|
893 EUNIT_ASSERT( iReceiveSession->iSession->i100RelUsage == |
|
894 KMce100RelRequired ) |
|
895 EUNIT_ASSERT( !iReceiveSession->iRingLCalled ) |
|
896 |
|
897 // Try again with valid session, normal case |
|
898 inSession = ConstructInSessionLC( 1, 0 ); |
|
899 iReceiveSession->IncomingSession( inSession, &container ); |
|
900 CleanupStack::Pop( inSession ); |
|
901 |
|
902 EUNIT_ASSERT( iReceiveSession->iSession ); |
|
903 // Next state depends on success of completion of session structure. |
|
904 // When using alloc failure state is ETerminated, in succesfull case it is |
|
905 // EReserving. However it is set to "normal" state EReserving after |
|
906 // assertion |
|
907 EUNIT_ASSERT( iReceiveSession->iSession->iState == |
|
908 CMceSession::EReserving || |
|
909 iReceiveSession->iSession->iState == |
|
910 CMceSession::ETerminated ); |
|
911 iReceiveSession->iSession->iState = CMceSession::EReserving; |
|
912 |
|
913 // Try again without container, new session gets terminated and deleted |
|
914 inSession = ConstructInSessionLC( 1, 0 ); |
|
915 iReceiveSession->IncomingSession( inSession, NULL ); |
|
916 CleanupStack::Pop( inSession ); |
|
917 |
|
918 EUNIT_ASSERT( iReceiveSession->iSession ); |
|
919 EUNIT_ASSERT( iReceiveSession->iSession != inSession ); |
|
920 EUNIT_ASSERT( iReceiveSession->iSession->iState == |
|
921 CMceSession::EReserving ); |
|
922 |
|
923 // Try again when there is session pending, new session gets terminated |
|
924 // and deleted |
|
925 inSession = ConstructInSessionLC( 1, 0 ); |
|
926 iReceiveSession->IncomingSession( inSession, &container ); |
|
927 CleanupStack::Pop( inSession ); |
|
928 |
|
929 EUNIT_ASSERT( iReceiveSession->iSession ); |
|
930 EUNIT_ASSERT( iReceiveSession->iSession != inSession ); |
|
931 EUNIT_ASSERT( iReceiveSession->iSession->iState == |
|
932 CMceSession::EReserving ); |
|
933 } |
|
934 |
|
935 // ----------------------------------------------------------------------------- |
|
936 // |
|
937 // ----------------------------------------------------------------------------- |
|
938 // |
|
939 void UT_CMusEngTwoWayRecvSession::UT_CompleteSessionStructureL_WithoutSessionL() |
|
940 { |
|
941 TRAPD( error, iReceiveSession->CompleteSessionStructureL() ); |
|
942 MUS_TEST_FORWARD_ALLOC_FAILURE( error ); |
|
943 EUNIT_ASSERT( error == KErrNotReady ); |
|
944 } |
|
945 |
|
946 |
|
947 // ----------------------------------------------------------------------------- |
|
948 // |
|
949 // ----------------------------------------------------------------------------- |
|
950 // |
|
951 void UT_CMusEngTwoWayRecvSession::UT_CompleteSessionStructureL_WithoutStreamsL() |
|
952 { |
|
953 CMceInSession* inSession = ConstructInSessionLC( 0, 0 ); |
|
954 iReceiveSession->iSession = inSession; // Transfers ownership |
|
955 CleanupStack::Pop( inSession ); |
|
956 |
|
957 TRAPD( error, iReceiveSession->CompleteSessionStructureL() ); |
|
958 MUS_TEST_FORWARD_ALLOC_FAILURE( error ); |
|
959 EUNIT_ASSERT( error == KErrCorrupt ); |
|
960 } |
|
961 |
|
962 |
|
963 // ----------------------------------------------------------------------------- |
|
964 // |
|
965 // ----------------------------------------------------------------------------- |
|
966 // |
|
967 void UT_CMusEngTwoWayRecvSession::UT_CompleteSessionStructureL_WithOutgoingStreamL() |
|
968 { |
|
969 // Stream will be removed. |
|
970 CMceInSession* inSession = ConstructInSessionLC( 0, 0 ); |
|
971 |
|
972 inSession->AddStreamL( ConstructVideoOutStreamLC() ); |
|
973 CleanupStack::Pop(); |
|
974 |
|
975 iReceiveSession->iSession = inSession; // Transfers ownership |
|
976 CleanupStack::Pop( inSession ); |
|
977 |
|
978 TRAPD( error, iReceiveSession->CompleteSessionStructureL() ) |
|
979 MUS_TEST_FORWARD_ALLOC_FAILURE( error ); |
|
980 EUNIT_ASSERT( error == KErrCorrupt ); |
|
981 EUNIT_ASSERT( inSession->Streams().Count() == 0 ); |
|
982 EUNIT_ASSERT( inSession->Bundles().Count() == 0 ); |
|
983 } |
|
984 |
|
985 |
|
986 // ----------------------------------------------------------------------------- |
|
987 // |
|
988 // ----------------------------------------------------------------------------- |
|
989 // |
|
990 void UT_CMusEngTwoWayRecvSession::UT_CompleteSessionStructureL_WithVideoInL() |
|
991 { |
|
992 CMceInSession* inSession = ConstructInSessionLC( 1, 0 ); |
|
993 |
|
994 iReceiveSession->iSession = inSession; // Transfers ownership |
|
995 CleanupStack::Pop( inSession ); |
|
996 |
|
997 iReceiveSession->CompleteSessionStructureL(); |
|
998 |
|
999 EUNIT_ASSERT( inSession->Streams().Count() == 1 ); |
|
1000 EUNIT_ASSERT( inSession->Streams()[0]->IsEnabled() ) |
|
1001 EUNIT_ASSERT( inSession->Streams()[0]->Type() == KMceVideo ) |
|
1002 EUNIT_ASSERT( inSession->Streams()[0]->Sinks().Count() == 1 ) |
|
1003 EUNIT_ASSERT( inSession->Streams()[0]->Sinks()[0]->Type() == |
|
1004 KMceDisplaySink ) |
|
1005 |
|
1006 // No audio, bundle is not constructed |
|
1007 EUNIT_ASSERT( inSession->Bundles().Count() == 0 ) |
|
1008 |
|
1009 } |
|
1010 |
|
1011 |
|
1012 // ----------------------------------------------------------------------------- |
|
1013 // Two-way video in incoming session. Incoming stream is the main stream. |
|
1014 // Both directions are enabled. Local viewfinder stream is added to display |
|
1015 // outgoing video locally |
|
1016 // ----------------------------------------------------------------------------- |
|
1017 // |
|
1018 void UT_CMusEngTwoWayRecvSession::UT_CompleteSessionStructureL_WithVideoOutBoundToVideoInL() |
|
1019 { |
|
1020 CMceInSession* inSession = ConstructInSessionLC( 1, 0 ); |
|
1021 |
|
1022 CMceVideoStream* videoOut = ConstructVideoOutStreamLC(); |
|
1023 inSession->Streams()[0]->BindL( videoOut ); |
|
1024 CleanupStack::Pop( videoOut ); |
|
1025 |
|
1026 iReceiveSession->iSession = inSession; // Transfers ownership |
|
1027 CleanupStack::Pop( inSession ); |
|
1028 |
|
1029 iReceiveSession->CompleteSessionStructureL(); |
|
1030 |
|
1031 EUNIT_ASSERT( inSession->Streams().Count() == 2 ); |
|
1032 |
|
1033 CMceMediaStream* videoIn = inSession->Streams()[0]; |
|
1034 |
|
1035 EUNIT_ASSERT( videoIn->IsEnabled() ) |
|
1036 EUNIT_ASSERT( videoIn->Type() == KMceVideo ) |
|
1037 EUNIT_ASSERT( videoIn->Sinks().Count() == 1 ) |
|
1038 EUNIT_ASSERT( videoIn->Sinks()[0]->Type() == KMceDisplaySink ) |
|
1039 |
|
1040 EUNIT_ASSERT( videoIn->BoundStream() ) |
|
1041 EUNIT_ASSERT( videoIn->BoundStreamL().IsEnabled() ) |
|
1042 |
|
1043 CMceMediaStream* videoVf = inSession->Streams()[1]; |
|
1044 EUNIT_ASSERT( videoVf->IsEnabled() ) |
|
1045 EUNIT_ASSERT( videoVf->Type() == KMceVideo ) |
|
1046 EUNIT_ASSERT( videoVf->Sinks().Count() == 1 ) |
|
1047 EUNIT_ASSERT( videoVf->Sinks()[0]->Type() == KMceDisplaySink ) |
|
1048 EUNIT_ASSERT( videoVf->Source()->Type() == KMceCameraSource ) |
|
1049 |
|
1050 // No audio, bundle is not constructed |
|
1051 EUNIT_ASSERT( inSession->Bundles().Count() == 0 ) |
|
1052 } |
|
1053 |
|
1054 |
|
1055 // ----------------------------------------------------------------------------- |
|
1056 // Two-way video in incoming session. Incoming stream is the bound stream. |
|
1057 // Both directions are enabled. Local viewfinder stream is added to display |
|
1058 // outgoing video locally |
|
1059 // ----------------------------------------------------------------------------- |
|
1060 // |
|
1061 void UT_CMusEngTwoWayRecvSession::UT_CompleteSessionStructureL_WithVideoInBoundToVideoOutL() |
|
1062 { |
|
1063 CMceInSession* inSession = ConstructInSessionLC( 0, 0 ); |
|
1064 |
|
1065 CMceVideoStream* videoOut = ConstructVideoOutStreamLC(); |
|
1066 |
|
1067 CMceVideoStream* videoIn = ConstructVideoInStreamLC(); |
|
1068 videoOut->BindL( videoIn ); |
|
1069 CleanupStack::Pop( videoIn ); |
|
1070 |
|
1071 inSession->AddStreamL( videoOut ); |
|
1072 CleanupStack::Pop( videoOut ); |
|
1073 |
|
1074 iReceiveSession->iSession = inSession; // Transfers ownership |
|
1075 CleanupStack::Pop( inSession ); |
|
1076 |
|
1077 iReceiveSession->CompleteSessionStructureL(); |
|
1078 |
|
1079 EUNIT_ASSERT( inSession->Streams().Count() == 2 ); |
|
1080 EUNIT_ASSERT( videoOut->IsEnabled() ) |
|
1081 EUNIT_ASSERT( videoOut->Type() == KMceVideo ) |
|
1082 EUNIT_ASSERT( videoOut->Sinks().Count() == 1 ) |
|
1083 EUNIT_ASSERT( videoOut->Sinks()[0]->Type() == KMceRTPSink ) |
|
1084 EUNIT_ASSERT( videoOut->Sinks()[0]->IsEnabled() ) |
|
1085 |
|
1086 EUNIT_ASSERT( videoOut->BoundStream() ) |
|
1087 EUNIT_ASSERT( videoOut->BoundStreamL().IsEnabled() ) |
|
1088 EUNIT_ASSERT( videoOut->BoundStreamL().Type() == KMceVideo ) |
|
1089 EUNIT_ASSERT( videoOut->BoundStreamL().Sinks().Count() == 1 ) |
|
1090 EUNIT_ASSERT( videoOut->BoundStreamL().Sinks()[0]->Type() == |
|
1091 KMceDisplaySink ) |
|
1092 EUNIT_ASSERT( videoOut->BoundStreamL().Sinks()[0]->IsEnabled() ) |
|
1093 |
|
1094 CMceMediaStream* videoVf = inSession->Streams()[1]; |
|
1095 EUNIT_ASSERT( videoVf->IsEnabled() ) |
|
1096 EUNIT_ASSERT( videoVf->Type() == KMceVideo ) |
|
1097 EUNIT_ASSERT( videoVf->Sinks().Count() == 1 ) |
|
1098 EUNIT_ASSERT( videoVf->Sinks()[0]->Type() == KMceDisplaySink ) |
|
1099 EUNIT_ASSERT( videoVf->Source()->Type() == KMceCameraSource ) |
|
1100 |
|
1101 // No audio, bundle is not constructed |
|
1102 EUNIT_ASSERT( inSession->Bundles().Count() == 0 ) |
|
1103 } |
|
1104 |
|
1105 |
|
1106 // ----------------------------------------------------------------------------- |
|
1107 // Construct 3 video instreams: |
|
1108 // 0. Without bound stream |
|
1109 // 1. Bounds video out stream |
|
1110 // 2. Bounded by video out stream |
|
1111 // Bound stream should be selected and vf stream is added |
|
1112 // ----------------------------------------------------------------------------- |
|
1113 // |
|
1114 void UT_CMusEngTwoWayRecvSession::UT_CompleteSessionStructureL_WithMultipleVideoInsL() |
|
1115 { |
|
1116 // construct session and stream 0 |
|
1117 CMceInSession* inSession = ConstructInSessionLC( 2, 0 ); |
|
1118 |
|
1119 // finish constructing stream 1 |
|
1120 CMceVideoStream* videoOut = ConstructVideoOutStreamLC(); |
|
1121 inSession->Streams()[1]->BindL( videoOut ); |
|
1122 CleanupStack::Pop( videoOut ); |
|
1123 |
|
1124 // finish constructing stream 2 |
|
1125 videoOut = ConstructVideoOutStreamLC(); |
|
1126 |
|
1127 CMceVideoStream* videoIn = ConstructVideoInStreamLC(); |
|
1128 videoOut->BindL( videoIn ); |
|
1129 CleanupStack::Pop( videoIn ); |
|
1130 |
|
1131 inSession->AddStreamL( videoOut ); |
|
1132 CleanupStack::Pop( videoOut ); |
|
1133 |
|
1134 // Transfers ownership |
|
1135 iReceiveSession->iSession = inSession; |
|
1136 CleanupStack::Pop( inSession ); |
|
1137 |
|
1138 // complete |
|
1139 iReceiveSession->CompleteSessionStructureL(); |
|
1140 |
|
1141 // Bound stream should be used, other original streams should be deleted |
|
1142 // but vf stream is added |
|
1143 EUNIT_ASSERT( inSession->Streams().Count() == 2 ); |
|
1144 |
|
1145 // First stream |
|
1146 EUNIT_ASSERT( inSession->Streams()[0]->IsEnabled() ) |
|
1147 EUNIT_ASSERT( inSession->Streams()[0]->Type() == KMceVideo ) |
|
1148 EUNIT_ASSERT( inSession->Streams()[0]->Sinks().Count() == 1 ) |
|
1149 EUNIT_ASSERT( inSession->Streams()[0]->Sinks()[0]->Type() == KMceDisplaySink ) |
|
1150 EUNIT_ASSERT( inSession->Streams()[0]->Sinks()[0]->IsEnabled() ) |
|
1151 EUNIT_ASSERT( inSession->Streams()[0]->BoundStream() ) |
|
1152 EUNIT_ASSERT( inSession->Streams()[0]->BoundStreamL().Type() == KMceVideo ) |
|
1153 |
|
1154 CMceMediaStream* videoVf = inSession->Streams()[1]; |
|
1155 EUNIT_ASSERT( videoVf->IsEnabled() ) |
|
1156 EUNIT_ASSERT( videoVf->Type() == KMceVideo ) |
|
1157 EUNIT_ASSERT( videoVf->Sinks().Count() == 1 ) |
|
1158 EUNIT_ASSERT( videoVf->Sinks()[0]->Type() == KMceDisplaySink ) |
|
1159 EUNIT_ASSERT( videoVf->Source()->Type() == KMceCameraSource ) |
|
1160 |
|
1161 // No audio, bundle is not constructed |
|
1162 EUNIT_ASSERT( inSession->Bundles().Count() == 0 ) |
|
1163 } |
|
1164 |
|
1165 |
|
1166 // ----------------------------------------------------------------------------- |
|
1167 // Streams in this test case |
|
1168 // 0. Video in |
|
1169 // 1. Audio in |
|
1170 // 2. Audio out bound to audio in |
|
1171 // 3. Audio in bound to audio out |
|
1172 // ----------------------------------------------------------------------------- |
|
1173 // |
|
1174 void UT_CMusEngTwoWayRecvSession:: |
|
1175 UT_CompleteSessionStructureL_WithVideoAndMultipleAudioInsL() |
|
1176 { |
|
1177 // Construct session and streams 0 and 1 |
|
1178 CMceInSession* inSession = inSession = ConstructInSessionLC( 1, 2 ); |
|
1179 |
|
1180 // Construct stream 2 |
|
1181 CMceAudioStream* audioOut = ConstructAudioOutStreamLC(); |
|
1182 inSession->Streams()[2]->BindL( audioOut ); |
|
1183 CleanupStack::Pop( audioOut ); |
|
1184 |
|
1185 // Construct stream 3 |
|
1186 |
|
1187 audioOut = ConstructAudioOutStreamLC(); |
|
1188 |
|
1189 CMceAudioStream* audioIn = ConstructAudioInStreamLC(); |
|
1190 audioOut->BindL( audioIn ); |
|
1191 CleanupStack::Pop( audioIn ); |
|
1192 |
|
1193 inSession->AddStreamL( audioOut ); |
|
1194 CleanupStack::Pop( audioOut ); |
|
1195 |
|
1196 // Transfers ownership |
|
1197 iReceiveSession->iSession = inSession; |
|
1198 CleanupStack::Pop( inSession ); |
|
1199 |
|
1200 // Complete |
|
1201 iReceiveSession->CompleteSessionStructureL(); |
|
1202 EUNIT_ASSERT( inSession->Streams().Count() == 4 ); |
|
1203 |
|
1204 // Stream 0 |
|
1205 EUNIT_ASSERT( inSession->Streams()[0]->Type() == KMceVideo ) |
|
1206 EUNIT_ASSERT( inSession->Streams()[0]->IsEnabled() ) |
|
1207 EUNIT_ASSERT( inSession->Streams()[0]->Sinks().Count() == 1 ) |
|
1208 EUNIT_ASSERT( inSession->Streams()[0]->Sinks()[0]->Type() == |
|
1209 KMceDisplaySink ) |
|
1210 |
|
1211 // Stream 1 |
|
1212 EUNIT_ASSERT( inSession->Streams()[1]->Type() == KMceAudio ) |
|
1213 EUNIT_ASSERT( inSession->Streams()[1]->IsEnabled() ) |
|
1214 EUNIT_ASSERT( inSession->Streams()[1]->Sinks().Count() == 1 ) |
|
1215 EUNIT_ASSERT( inSession->Streams()[1]->Sinks()[0]->Type() == |
|
1216 KMceSpeakerSink ); |
|
1217 CMceSpeakerSink* speaker = |
|
1218 static_cast<CMceSpeakerSink*>(inSession->Streams()[1]->Sinks()[0]); |
|
1219 EUNIT_ASSERT( speaker->VolumeL() == iReceiveSession->LcVolumeL() ) |
|
1220 |
|
1221 // Stream 2 and bound stream |
|
1222 EUNIT_ASSERT( inSession->Streams()[2]->Type() == KMceAudio ) |
|
1223 EUNIT_ASSERT( inSession->Streams()[2]->IsEnabled() ) |
|
1224 EUNIT_ASSERT( inSession->Streams()[2]->Sinks().Count() == 1 ) |
|
1225 EUNIT_ASSERT( inSession->Streams()[2]->Sinks()[0]->Type() == |
|
1226 KMceSpeakerSink ); |
|
1227 speaker = static_cast<CMceSpeakerSink*>(inSession->Streams()[2]->Sinks()[0]); |
|
1228 EUNIT_ASSERT( speaker->VolumeL() == iReceiveSession->LcVolumeL() ) |
|
1229 |
|
1230 EUNIT_ASSERT( inSession->Streams()[2]->BoundStream() ) |
|
1231 EUNIT_ASSERT( !inSession->Streams()[2]->BoundStreamL().IsEnabled() ) |
|
1232 EUNIT_ASSERT( inSession->Streams()[2]->BoundStreamL().Type() == KMceAudio ) |
|
1233 |
|
1234 EUNIT_ASSERT( inSession->Streams()[2]->BoundStreamL().Sinks().Count() == 1 ) |
|
1235 EUNIT_ASSERT( inSession->Streams()[2]->BoundStreamL().Sinks()[0]->Type() == |
|
1236 KMceRTPSink ); |
|
1237 |
|
1238 // Stream 3 and bound stream |
|
1239 EUNIT_ASSERT( inSession->Streams()[3]->Type() == KMceAudio ) |
|
1240 EUNIT_ASSERT( !inSession->Streams()[3]->IsEnabled() ) |
|
1241 EUNIT_ASSERT( inSession->Streams()[3]->Sinks().Count() == 1 ) |
|
1242 EUNIT_ASSERT( inSession->Streams()[3]->Sinks()[0]->Type() == KMceRTPSink ) |
|
1243 EUNIT_ASSERT( !inSession->Streams()[3]->Sinks()[0]->IsEnabled() ) |
|
1244 |
|
1245 EUNIT_ASSERT( inSession->Streams()[3]->BoundStream() ) |
|
1246 EUNIT_ASSERT( inSession->Streams()[3]->BoundStreamL().IsEnabled() ) |
|
1247 EUNIT_ASSERT( inSession->Streams()[3]->BoundStreamL().Type() == KMceAudio ) |
|
1248 EUNIT_ASSERT( inSession->Streams()[3]->BoundStreamL().Sinks().Count() == 1 ) |
|
1249 EUNIT_ASSERT( inSession->Streams()[3]->BoundStreamL().Sinks()[0]->Type() == |
|
1250 KMceSpeakerSink ) |
|
1251 speaker = static_cast<CMceSpeakerSink*> |
|
1252 (inSession->Streams()[3]->BoundStreamL().Sinks()[0]); |
|
1253 EUNIT_ASSERT( speaker->VolumeL() == iReceiveSession->LcVolumeL() ) |
|
1254 |
|
1255 // Check for bundles |
|
1256 EUNIT_ASSERT( inSession->Bundles().Count() == 1 ) |
|
1257 EUNIT_ASSERT( inSession->Bundles()[0]->Streams().Count() == 4 ) |
|
1258 EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[0]->Type() == KMceAudio ) |
|
1259 EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[0]->Sinks()[0]->Type() == |
|
1260 KMceSpeakerSink ) |
|
1261 EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[1]->Type() == KMceAudio ) |
|
1262 EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[1]->Sinks()[0]->Type() == |
|
1263 KMceSpeakerSink ) |
|
1264 EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[2]->Type() == KMceAudio ) |
|
1265 EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[2]->Sinks()[0]->Type() == |
|
1266 KMceSpeakerSink ) |
|
1267 EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[3]->Type() == KMceVideo ) |
|
1268 EUNIT_ASSERT( inSession->Bundles()[0]->Streams()[3]->Sinks()[0]->Type() == |
|
1269 KMceDisplaySink ) |
|
1270 } |
|
1271 |
|
1272 |
|
1273 // ----------------------------------------------------------------------------- |
|
1274 // Streams in this test case |
|
1275 // 0. Video in |
|
1276 // 1. Audio in |
|
1277 // 2. Audio out bound to audio in |
|
1278 // 3. Audio in bound to audio out |
|
1279 // All audio will be removed because of operator variant |
|
1280 // ----------------------------------------------------------------------------- |
|
1281 // |
|
1282 void UT_CMusEngTwoWayRecvSession::UT_CompleteSessionStructureL_OperatorVariant() |
|
1283 { |
|
1284 iReceiveSession->iOperatorVariant = ETrue; |
|
1285 |
|
1286 // Construct session and streams 0 and 1 |
|
1287 CMceInSession* inSession = inSession = ConstructInSessionLC( 1, 2 ); |
|
1288 |
|
1289 // Construct stream 2 |
|
1290 CMceAudioStream* audioOut = ConstructAudioOutStreamLC(); |
|
1291 inSession->Streams()[2]->BindL( audioOut ); |
|
1292 CleanupStack::Pop( audioOut ); |
|
1293 |
|
1294 // Construct stream 3 |
|
1295 |
|
1296 audioOut = ConstructAudioOutStreamLC(); |
|
1297 |
|
1298 CMceAudioStream* audioIn = ConstructAudioInStreamLC(); |
|
1299 audioOut->BindL( audioIn ); |
|
1300 CleanupStack::Pop( audioIn ); |
|
1301 |
|
1302 inSession->AddStreamL( audioOut ); |
|
1303 CleanupStack::Pop( audioOut ); |
|
1304 |
|
1305 // Transfers ownership |
|
1306 iReceiveSession->iSession = inSession; |
|
1307 CleanupStack::Pop( inSession ); |
|
1308 |
|
1309 // Complete |
|
1310 iReceiveSession->CompleteSessionStructureL(); |
|
1311 |
|
1312 // Check that all audio has been removed and no bundles has been |
|
1313 // constructed |
|
1314 EUNIT_ASSERT_EQUALS( inSession->Streams().Count(), 1 ) |
|
1315 EUNIT_ASSERT_EQUALS( inSession->Streams()[0]->Type(), KMceVideo ) |
|
1316 EUNIT_ASSERT_EQUALS( inSession->Bundles().Count(), 0 ) |
|
1317 |
|
1318 |
|
1319 // Session with bandwidth attribute at sessionlevel |
|
1320 // -> bandwidth is taken in use at session level |
|
1321 // |
|
1322 delete iReceiveSession->iSession; |
|
1323 iReceiveSession->iSession = NULL; |
|
1324 |
|
1325 inSession = ConstructInSessionLC( 1, 0 ); |
|
1326 CDesC8Array* sdpLines = new ( ELeave ) CDesC8ArrayFlat( 1 ); |
|
1327 CleanupStack::PushL( sdpLines ); |
|
1328 sdpLines->AppendL( KMusEngSessionSdpLineBandwidthField() ); |
|
1329 inSession->SetSessionSDPLinesL( sdpLines ); |
|
1330 CleanupStack::Pop( sdpLines ); |
|
1331 |
|
1332 // Transfers ownership |
|
1333 iReceiveSession->iSession = inSession; |
|
1334 CleanupStack::Pop( inSession ); |
|
1335 |
|
1336 iReceiveSession->CompleteSessionStructureL(); |
|
1337 |
|
1338 MDesC8Array* newSdpLines = iReceiveSession->iSession->SessionSDPLinesL(); |
|
1339 CleanupDeletePushL( newSdpLines ); |
|
1340 TBool bandwidthFoundFromSessionLevel( EFalse ); |
|
1341 for ( TInt i = 0; newSdpLines && i < newSdpLines->MdcaCount(); i++ ) |
|
1342 { |
|
1343 if ( newSdpLines->MdcaPoint( i ).Compare( |
|
1344 KMusEngSessionSdpLineBandwidthField() ) == 0 ) |
|
1345 { |
|
1346 bandwidthFoundFromSessionLevel = ETrue; |
|
1347 } |
|
1348 } |
|
1349 EUNIT_ASSERT( bandwidthFoundFromSessionLevel ); |
|
1350 CleanupStack::PopAndDestroy( newSdpLines ); |
|
1351 |
|
1352 newSdpLines = iReceiveSession->iSession->Streams()[ 0 ]->MediaAttributeLinesL(); |
|
1353 CleanupDeletePushL( newSdpLines ); |
|
1354 TBool bandwidthFoundFromMediaLevel( EFalse ); |
|
1355 for ( TInt i = 0; newSdpLines && i < newSdpLines->MdcaCount(); i++ ) |
|
1356 { |
|
1357 if ( newSdpLines->MdcaPoint( i ).Compare( |
|
1358 KMusEngSessionSdpLineBandwidthField() ) == 0 ) |
|
1359 { |
|
1360 bandwidthFoundFromMediaLevel = ETrue; |
|
1361 } |
|
1362 } |
|
1363 EUNIT_ASSERT( !bandwidthFoundFromMediaLevel ); |
|
1364 CleanupStack::PopAndDestroy( newSdpLines ); |
|
1365 |
|
1366 // Session with bandwidth attribute at media level |
|
1367 // -> bandwidth is taken in use at media level |
|
1368 // |
|
1369 delete iReceiveSession->iSession; |
|
1370 iReceiveSession->iSession = NULL; |
|
1371 |
|
1372 inSession = ConstructInSessionLC( 1, 0 ); |
|
1373 |
|
1374 sdpLines = new ( ELeave ) CDesC8ArrayFlat( 1 ); |
|
1375 CleanupStack::PushL( sdpLines ); |
|
1376 sdpLines->AppendL( KMusEngSessionSdpLineBandwidthField() ); |
|
1377 inSession->Streams()[ 0 ]->SetMediaAttributeLinesL( sdpLines ); |
|
1378 CleanupStack::Pop( sdpLines ); |
|
1379 |
|
1380 // Transfers ownership |
|
1381 iReceiveSession->iSession = inSession; |
|
1382 CleanupStack::Pop( inSession ); |
|
1383 |
|
1384 iReceiveSession->CompleteSessionStructureL(); |
|
1385 |
|
1386 newSdpLines = iReceiveSession->iSession->SessionSDPLinesL(); |
|
1387 CleanupDeletePushL( newSdpLines ); |
|
1388 bandwidthFoundFromSessionLevel = EFalse; |
|
1389 for ( TInt i = 0; newSdpLines && i < newSdpLines->MdcaCount(); i++ ) |
|
1390 { |
|
1391 if ( newSdpLines->MdcaPoint( i ).Compare( |
|
1392 KMusEngSessionSdpLineBandwidthField() ) == 0 ) |
|
1393 { |
|
1394 bandwidthFoundFromSessionLevel = ETrue; |
|
1395 } |
|
1396 } |
|
1397 EUNIT_ASSERT( !bandwidthFoundFromSessionLevel ); |
|
1398 CleanupStack::PopAndDestroy( newSdpLines ); |
|
1399 |
|
1400 newSdpLines = iReceiveSession->iSession->Streams()[ 0 ]->MediaAttributeLinesL(); |
|
1401 CleanupDeletePushL( newSdpLines ); |
|
1402 bandwidthFoundFromMediaLevel = EFalse; |
|
1403 for ( TInt i = 0; newSdpLines && i < newSdpLines->MdcaCount(); i++ ) |
|
1404 { |
|
1405 if ( newSdpLines->MdcaPoint( i ).Compare( |
|
1406 KMusEngSessionSdpLineBandwidthField() ) == 0 ) |
|
1407 { |
|
1408 bandwidthFoundFromMediaLevel = ETrue; |
|
1409 } |
|
1410 } |
|
1411 EUNIT_ASSERT( bandwidthFoundFromMediaLevel ); |
|
1412 CleanupStack::PopAndDestroy( newSdpLines ); |
|
1413 } |
|
1414 |
|
1415 |
|
1416 // TEST TABLE |
|
1417 |
|
1418 EUNIT_BEGIN_TEST_TABLE( |
|
1419 UT_CMusEngTwoWayRecvSession, |
|
1420 "UT_CMusEngTwoWayRecvSession", |
|
1421 "UNIT" ) |
|
1422 |
|
1423 |
|
1424 EUNIT_TEST( |
|
1425 "NewL - test ", |
|
1426 "CMusEngTwoWayRecvSession", |
|
1427 "NewL", |
|
1428 "FUNCTIONALITY", |
|
1429 SetupL, UT_NewLL, Teardown) |
|
1430 |
|
1431 EUNIT_TEST( |
|
1432 "EnableDisplayL - test ", |
|
1433 "CMusEngTwoWayRecvSession", |
|
1434 "EnableDisplayL", |
|
1435 "FUNCTIONALITY", |
|
1436 SetupL, UT_EnableDisplayLL, Teardown) |
|
1437 |
|
1438 EUNIT_TEST( |
|
1439 "SetOrientationL - test ", |
|
1440 "CMusEngTwoWayRecvSession", |
|
1441 "SetOrientationL", |
|
1442 "FUNCTIONALITY", |
|
1443 SetupL, UT_SetOrientationLL, Teardown) |
|
1444 |
|
1445 EUNIT_TEST( |
|
1446 "OrientationL - test ", |
|
1447 "CMusEngTwoWayRecvSession", |
|
1448 "OrientationL", |
|
1449 "FUNCTIONALITY", |
|
1450 SetupL, UT_OrientationLL, Teardown) |
|
1451 |
|
1452 EUNIT_TEST( |
|
1453 "SetLocalRectL - test ", |
|
1454 "CMusEngTwoWayRecvSession", |
|
1455 "SetLocalRectL", |
|
1456 "FUNCTIONALITY", |
|
1457 SetupL, UT_SetLocalRectLL, Teardown) |
|
1458 |
|
1459 EUNIT_TEST( |
|
1460 "SetRectsL - test ", |
|
1461 "CMusEngTwoWayRecvSession", |
|
1462 "SetRectsL", |
|
1463 "FUNCTIONALITY", |
|
1464 SetupL, UT_SetRectsLL, Teardown) |
|
1465 |
|
1466 EUNIT_TEST( |
|
1467 "Camera - test ", |
|
1468 "CMusEngTwoWayRecvSession", |
|
1469 "Camera", |
|
1470 "FUNCTIONALITY", |
|
1471 SetupL, UT_CameraL, Teardown) |
|
1472 |
|
1473 EUNIT_TEST( |
|
1474 "LocalVideoPlayer - test ", |
|
1475 "CMusEngTwoWayRecvSession", |
|
1476 "LocalVideoPlayer", |
|
1477 "FUNCTIONALITY", |
|
1478 SetupL, UT_LocalVideoPlayerL, Teardown) |
|
1479 |
|
1480 EUNIT_TEST( |
|
1481 "HandleSessionStateChanged - test ", |
|
1482 "CMusEngTwoWayRecvSession", |
|
1483 "HandleSessionStateChanged", |
|
1484 "FUNCTIONALITY", |
|
1485 SetupL, UT_HandleSessionStateChangedL, Teardown) |
|
1486 |
|
1487 EUNIT_TEST( |
|
1488 "AdjustVideoCodecL - test ", |
|
1489 "CMusEngTwoWayRecvSession", |
|
1490 "AdjustVideoCodecL", |
|
1491 "FUNCTIONALITY", |
|
1492 SetupL, UT_AdjustVideoCodecLL, Teardown) |
|
1493 |
|
1494 EUNIT_TEST( |
|
1495 "AdjustAudioCodecL - test ", |
|
1496 "CMusEngTwoWayRecvSession", |
|
1497 "AdjustAudioCodecL", |
|
1498 "FUNCTIONALITY", |
|
1499 SetupL, UT_AdjustAudioCodecLL, Teardown) |
|
1500 |
|
1501 EUNIT_TEST( |
|
1502 "DoCodecSelectionL - test ", |
|
1503 "CMusEngTwoWayRecvSession", |
|
1504 "DoCodecSelectionL", |
|
1505 "FUNCTIONALITY", |
|
1506 SetupL, UT_DoCodecSelectionLL, Teardown) |
|
1507 |
|
1508 EUNIT_TEST( |
|
1509 "IncomingSession - test ", |
|
1510 "CMusEngTwoWayRecvSession", |
|
1511 "IncomingSession", |
|
1512 "FUNCTIONALITY", |
|
1513 SetupL, UT_IncomingSessionL, Teardown) |
|
1514 |
|
1515 EUNIT_TEST( |
|
1516 "UT_CompleteSessionStructureL_WithoutSessionL - test without a session", |
|
1517 "CMusEngTwoWayRecvSession", |
|
1518 "CompleteSessionStructureL", |
|
1519 "FUNCTIONALITY", |
|
1520 SetupL, UT_CompleteSessionStructureL_WithoutSessionL, Teardown) |
|
1521 |
|
1522 EUNIT_TEST( |
|
1523 "UT_CompleteSessionStructureL_WithoutStreamsL - without streams", |
|
1524 "CMusEngTwoWayRecvSession", |
|
1525 "CompleteSessionStructureL", |
|
1526 "FUNCTIONALITY", |
|
1527 SetupL, UT_CompleteSessionStructureL_WithoutStreamsL, Teardown) |
|
1528 |
|
1529 EUNIT_TEST( |
|
1530 "UT_CompleteSessionStructureL_WithOutgoingStreamL - with outgoing stream", |
|
1531 "CMusEngTwoWayRecvSession", |
|
1532 "CompleteSessionStructureL", |
|
1533 "FUNCTIONALITY", |
|
1534 SetupL, UT_CompleteSessionStructureL_WithOutgoingStreamL, Teardown) |
|
1535 |
|
1536 EUNIT_TEST( |
|
1537 "UT_CompleteSessionStructureL_WithVideoInL - with video in stream", |
|
1538 "CMusEngTwoWayRecvSession", |
|
1539 "CompleteSessionStructureL", |
|
1540 "FUNCTIONALITY", |
|
1541 SetupL, UT_CompleteSessionStructureL_WithVideoInL, Teardown) |
|
1542 |
|
1543 EUNIT_TEST( |
|
1544 "UT_CompleteSessionStructureL_WithVideoOutBoundToVideoInL - with sendrecv video, video out bound to video in", |
|
1545 "CMusEngTwoWayRecvSession", |
|
1546 "CompleteSessionStructureL", |
|
1547 "FUNCTIONALITY", |
|
1548 SetupL, UT_CompleteSessionStructureL_WithVideoOutBoundToVideoInL, Teardown) |
|
1549 |
|
1550 EUNIT_TEST( |
|
1551 "UT_CompleteSessionStructureL_WithVideoInBoundToVideoOutL - with sendrecv video, video in bound to video out", |
|
1552 "CMusEngTwoWayRecvSession", |
|
1553 "CompleteSessionStructureL", |
|
1554 "FUNCTIONALITY", |
|
1555 SetupL, UT_CompleteSessionStructureL_WithVideoInBoundToVideoOutL, Teardown) |
|
1556 |
|
1557 EUNIT_TEST( |
|
1558 "UT_CompleteSessionStructureL_WithMultipleVideoInsL - with multiple video in streams", |
|
1559 "CMusEngTwoWayRecvSession", |
|
1560 "CompleteSessionStructureL", |
|
1561 "FUNCTIONALITY", |
|
1562 SetupL, UT_CompleteSessionStructureL_WithMultipleVideoInsL, Teardown) |
|
1563 |
|
1564 EUNIT_TEST( |
|
1565 "CompleteSessionStructureL - test one video and multiple audio streams", |
|
1566 "CMusEngTwoWayRecvSession", |
|
1567 "CompleteSessionStructureL", |
|
1568 "FUNCTIONALITY", |
|
1569 SetupL, UT_CompleteSessionStructureL_WithVideoAndMultipleAudioInsL, Teardown) |
|
1570 |
|
1571 EUNIT_TEST( |
|
1572 "CompleteSessionStructureL - test operator variant", |
|
1573 "CMusEngTwoWayRecvSession", |
|
1574 "CompleteSessionStructureL", |
|
1575 "FUNCTIONALITY", |
|
1576 SetupL, UT_CompleteSessionStructureL_OperatorVariant, Teardown) |
|
1577 |
|
1578 EUNIT_END_TEST_TABLE |
|
1579 |
|
1580 // END OF FILE |
|
1581 |
|
1582 |
|