mmsharing/mmshengine/tsrc/ut_engine/src/ut_musengmceutils.cpp
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
    95     // The ConstructL from the base class CEUnitTestSuiteClass must be called.
    95     // The ConstructL from the base class CEUnitTestSuiteClass must be called.
    96     // It generates the test case table.
    96     // It generates the test case table.
    97     CEUnitTestSuiteClass::ConstructL();
    97     CEUnitTestSuiteClass::ConstructL();
    98     }
    98     }
    99 
    99 
       
   100     
       
   101 // -----------------------------------------------------------------------------
       
   102 // From MMusSipProfileUser
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 TBool UT_MusEngMceUtils::IsRoamingBetweenAPsAllowed()
       
   106     {
       
   107     return ETrue; // Dummy implementation
       
   108     }
       
   109 
   100 
   110 
   101 // -----------------------------------------------------------------------------
   111 // -----------------------------------------------------------------------------
   102 //
   112 //
   103 // -----------------------------------------------------------------------------
   113 // -----------------------------------------------------------------------------
   104 //
   114 //
   105 void UT_MusEngMceUtils::SetupL()
   115 void UT_MusEngMceUtils::SetupL()
   106     {
   116     {
   107     iManager = CMceManager::NewL( TUid::Null(), NULL );
   117     iManager = CMceManager::NewL( TUid::Null(), NULL );
   108     iObserver = new( ELeave ) CMusEngObserverStub;
   118     iProfileHandler = CMusSipProfileHandler::NewL( *this );
   109     iObserver->iRoamingBetweenAPsAllowed = ETrue;
       
   110     iProfileHandler = CMusSipProfileHandler::NewL( *iObserver );
       
   111     
   119     
   112     iProfileHandler->CreateProfileL( KSipProfileId );
   120     iProfileHandler->CreateProfileL( KSipProfileId );
   113     iEmptySession = CMceOutSession::NewL( *iManager, 
   121     iEmptySession = CMceOutSession::NewL( *iManager, 
   114                                           *iProfileHandler->Profile(),
   122                                           *iProfileHandler->Profile(),
   115                                           KTestRecipientSipUri8() );
   123                                           KTestRecipientSipUri8() );
   152     CleanupStack::Pop( audioIn );
   160     CleanupStack::Pop( audioIn );
   153     
   161     
   154     // Video part
   162     // Video part
   155     CMceVideoStream* videoIn  = CMceVideoStream::NewLC();
   163     CMceVideoStream* videoIn  = CMceVideoStream::NewLC();
   156     
   164     
   157     CMceDisplaySink* receivingDisplay = CMceDisplaySink::NewLC( *iManager );
   165     videoIn->AddSinkL( CMceDisplaySink::NewLC( *iManager ) );
   158     videoIn->AddSinkL( receivingDisplay );
   166     CleanupStack::Pop();
   159     CleanupStack::Pop();
       
   160     iReceivingDisplay = receivingDisplay;
       
   161     
   167     
   162     videoIn->SetSourceL( CMceRtpSource::NewLC() );
   168     videoIn->SetSourceL( CMceRtpSource::NewLC() );
   163     CleanupStack::Pop();
   169     CleanupStack::Pop();
   164     
   170     
   165     iVideoInSession->AddStreamL( videoIn );
   171     iVideoInSession->AddStreamL( videoIn );
   166     CleanupStack::Pop( videoIn );
   172     CleanupStack::Pop( videoIn );
   167     }
   173     }
   168 
   174 
   169 // -----------------------------------------------------------------------------
       
   170 //
       
   171 // -----------------------------------------------------------------------------
       
   172 //
       
   173 void UT_MusEngMceUtils::Setup2L()
       
   174     {
       
   175     iManager = CMceManager::NewL( TUid::Null(), NULL );
       
   176     iObserver = new( ELeave ) CMusEngObserverStub;
       
   177     iObserver->iRoamingBetweenAPsAllowed = ETrue;
       
   178     iProfileHandler = CMusSipProfileHandler::NewL( *iObserver );
       
   179     
       
   180     iProfileHandler->CreateProfileL( KSipProfileId );
       
   181     iEmptySession = CMceOutSession::NewL( *iManager, 
       
   182                                           *iProfileHandler->Profile(),
       
   183                                           KTestRecipientSipUri8() );
       
   184     
       
   185     // Contruct an outgoing video sesssion                                 
       
   186     iVideoOutSession = CMceOutSession::NewL( *iManager,
       
   187                                              *iProfileHandler->Profile(),
       
   188                                              KTestRecipientSipUri8() );
       
   189     
       
   190     
       
   191     CMceVideoStream* videoOut = CMceVideoStream::NewLC();
       
   192     
       
   193     videoOut->AddSinkL( CMceRtpSink::NewLC() );
       
   194     CleanupStack::Pop();
       
   195     
       
   196     videoOut->AddSinkL( CMceDisplaySink::NewLC( *iManager ) );
       
   197     CleanupStack::Pop();
       
   198     
       
   199     videoOut->SetSourceL( CMceCameraSource::NewLC( *iManager ) );
       
   200     CleanupStack::Pop();
       
   201     
       
   202     // Video part
       
   203     CMceVideoStream* videoIn  = CMceVideoStream::NewLC();
       
   204     
       
   205     CMceDisplaySink* receivingDisplay = CMceDisplaySink::NewLC( *iManager );
       
   206     videoIn->AddSinkL( receivingDisplay );
       
   207     CleanupStack::Pop();
       
   208     iReceivingDisplay = receivingDisplay;
       
   209     
       
   210     videoIn->SetSourceL( CMceRtpSource::NewLC() );
       
   211     CleanupStack::Pop();
       
   212     
       
   213     videoOut->BindL( videoIn );
       
   214     CleanupStack::Pop( videoIn );
       
   215     
       
   216     iVideoOutSession->AddStreamL( videoOut );
       
   217     CleanupStack::Pop( videoOut );
       
   218     }
       
   219 
   175 
   220 // -----------------------------------------------------------------------------
   176 // -----------------------------------------------------------------------------
   221 //
   177 //
   222 // -----------------------------------------------------------------------------
   178 // -----------------------------------------------------------------------------
   223 //
   179 //
   224 void UT_MusEngMceUtils::Teardown()
   180 void UT_MusEngMceUtils::Teardown()
   225     {
   181     {
   226     delete iEmptySession;
   182     delete iEmptySession;
   227     delete iVideoOutSession;
   183     delete iVideoOutSession;
   228     delete iVideoInSession;
   184     delete iVideoInSession;
   229     iVideoInSession = NULL;
       
   230     delete iProfileHandler;
   185     delete iProfileHandler;
   231     delete iObserver;
       
   232     delete iManager;
   186     delete iManager;
   233     iReceivingDisplay = NULL; // Not owned
       
   234     }
   187     }
   235 
   188 
   236 
   189 
   237 
   190 
   238 // TEST CASES
   191 // TEST CASES
   241 
   194 
   242 // -----------------------------------------------------------------------------
   195 // -----------------------------------------------------------------------------
   243 //
   196 //
   244 // -----------------------------------------------------------------------------
   197 // -----------------------------------------------------------------------------
   245 //
   198 //
   246 void UT_MusEngMceUtils::UT_IsVideoInStreamL()
   199 void UT_MusEngMceUtils::UT_MusEngMceUtils_IsVideoInStreamL()
   247     {
   200     {
   248     // Stream 0 is audio stream
   201     // Stream 0 is audio stream
   249     EUNIT_ASSERT( !MusEngMceUtils::IsVideoInStream( 
   202     EUNIT_ASSERT( !MusEngMceUtils::IsVideoInStream( 
   250                                         *iVideoInSession->Streams()[0] ) )
   203                                         *iVideoInSession->Streams()[0] ) )
   251     
   204     
   266 
   219 
   267 // -----------------------------------------------------------------------------
   220 // -----------------------------------------------------------------------------
   268 //
   221 //
   269 // -----------------------------------------------------------------------------
   222 // -----------------------------------------------------------------------------
   270 //
   223 //
   271 void UT_MusEngMceUtils::UT_IsVideoOutStreamL()
   224 void UT_MusEngMceUtils::UT_MusEngMceUtils_IsAudioInStreamL()
   272     {
       
   273     // Stream 0 is audio stream
       
   274     EUNIT_ASSERT( !MusEngMceUtils::IsVideoOutStream( 
       
   275                                         *iVideoInSession->Streams()[0] ) )
       
   276     
       
   277     // No sink
       
   278     CMceVideoStream* videoStream = CMceVideoStream::NewLC();
       
   279     EUNIT_ASSERT( !MusEngMceUtils::IsVideoOutStream( *videoStream ) )
       
   280     CleanupStack::PopAndDestroy( videoStream );
       
   281     
       
   282     // display sink
       
   283     EUNIT_ASSERT( !MusEngMceUtils::IsVideoOutStream( 
       
   284                                         *iVideoInSession->Streams()[1] ) )
       
   285                                         
       
   286     // Video outstream
       
   287     EUNIT_ASSERT( MusEngMceUtils::IsVideoOutStream( 
       
   288                                         *iVideoOutSession->Streams()[0] ) )
       
   289     }
       
   290 
       
   291 // -----------------------------------------------------------------------------
       
   292 //
       
   293 // -----------------------------------------------------------------------------
       
   294 //
       
   295 void UT_MusEngMceUtils::UT_IsAudioInStreamL()
       
   296     {
   225     {
   297     // Stream 0 is video stream
   226     // Stream 0 is video stream
   298     EUNIT_ASSERT( !MusEngMceUtils::IsAudioInStream( 
   227     EUNIT_ASSERT( !MusEngMceUtils::IsAudioInStream( 
   299                                         *iVideoOutSession->Streams()[0] ) )
   228                                         *iVideoOutSession->Streams()[0] ) )
   300     
   229     
   317         
   246         
   318 // -----------------------------------------------------------------------------
   247 // -----------------------------------------------------------------------------
   319 //
   248 //
   320 // -----------------------------------------------------------------------------
   249 // -----------------------------------------------------------------------------
   321 //
   250 //
   322 void UT_MusEngMceUtils::UT_GetVideoOutStreamLL()
   251 void UT_MusEngMceUtils::UT_MusEngMceUtils_GetVideoOutStreamLL()
   323     {
   252     {
   324     // No streams, must fail
   253     // No streams, must fail
   325     EUNIT_ASSERT_SPECIFIC_LEAVE(
   254     EUNIT_ASSERT_SPECIFIC_LEAVE(
   326                 MusEngMceUtils::GetVideoOutStreamL( *iEmptySession ),
   255                 MusEngMceUtils::GetVideoOutStreamL( *iEmptySession ),
   327                 KErrNotFound )
   256                 KErrNotFound )
   342     // Incoming video stream, fails
   271     // Incoming video stream, fails
   343     EUNIT_ASSERT_SPECIFIC_LEAVE( 
   272     EUNIT_ASSERT_SPECIFIC_LEAVE( 
   344                 MusEngMceUtils::GetVideoOutStreamL( *iVideoInSession ),
   273                 MusEngMceUtils::GetVideoOutStreamL( *iVideoInSession ),
   345                 KErrNotFound )
   274                 KErrNotFound )
   346     
   275     
   347     // One incoming video stream with bound outstream, must find bound stream
   276     // One outgoing video stream, succeeds
   348     CMceVideoStream* boundVideoOut = CMceVideoStream::NewLC();
       
   349     boundVideoOut->AddSinkL( CMceRtpSink::NewLC() );
       
   350     CleanupStack::Pop();
       
   351     boundVideoOut->SetSourceL( CMceCameraSource::NewLC( *iManager ) );
       
   352     CleanupStack::Pop();
       
   353     reinterpret_cast<CMceVideoStream*>( 
       
   354             iVideoInSession->Streams()[ 1 ] )->BindL( boundVideoOut );
       
   355     CleanupStack::Pop( boundVideoOut );
       
   356     CMceVideoStream* videoStream = MusEngMceUtils::GetVideoOutStreamL( 
   277     CMceVideoStream* videoStream = MusEngMceUtils::GetVideoOutStreamL( 
   357                                                     *iVideoInSession );
   278                                                         *iVideoOutSession );
   358     EUNIT_ASSERT( videoStream )
       
   359     EUNIT_ASSERT( videoStream->Type() == KMceVideo )
       
   360     EUNIT_ASSERT( videoStream->Sinks().Count() == 1 ) // Rtp
       
   361     EUNIT_ASSERT( videoStream->Sinks()[0]->Type() == KMceRTPSink )
       
   362 
       
   363     // One outgoing video stream, succeeds
       
   364     videoStream = MusEngMceUtils::GetVideoOutStreamL( *iVideoOutSession );
       
   365     EUNIT_ASSERT( videoStream )
   279     EUNIT_ASSERT( videoStream )
   366     EUNIT_ASSERT( videoStream->Type() == KMceVideo )
   280     EUNIT_ASSERT( videoStream->Type() == KMceVideo )
   367     EUNIT_ASSERT( videoStream->Sinks().Count() == 2 ) // Rtp, Display
   281     EUNIT_ASSERT( videoStream->Sinks().Count() == 2 ) // Rtp, Display
   368     EUNIT_ASSERT( videoStream->Sinks()[0]->Type() == KMceRTPSink )
   282     EUNIT_ASSERT( videoStream->Sinks()[0]->Type() == KMceRTPSink )
   369     EUNIT_ASSERT( videoStream->Sinks()[1]->Type() == KMceDisplaySink )
   283     EUNIT_ASSERT( videoStream->Sinks()[1]->Type() == KMceDisplaySink )
   370         
   284     
   371     // Add another stream
   285     // Add another stream
   372     CMceVideoStream* videoOut = CMceVideoStream::NewLC();
   286     CMceVideoStream* videoOut = CMceVideoStream::NewLC();
   373     
   287     
   374     videoOut->AddSinkL( CMceRtpSink::NewLC() );
   288     videoOut->AddSinkL( CMceRtpSink::NewLC() );
   375     CleanupStack::Pop();
   289     CleanupStack::Pop();
   390 
   304 
   391 // -----------------------------------------------------------------------------
   305 // -----------------------------------------------------------------------------
   392 //
   306 //
   393 // -----------------------------------------------------------------------------
   307 // -----------------------------------------------------------------------------
   394 //
   308 //
   395 void UT_MusEngMceUtils::UT_GetVideoInStreamLL()
   309 void UT_MusEngMceUtils::UT_MusEngMceUtils_GetVideoInStreamLL()
   396     {
   310     {
   397     // No streams, must fail
   311     // No streams, must fail
   398     EUNIT_ASSERT_SPECIFIC_LEAVE( 
   312     EUNIT_ASSERT_SPECIFIC_LEAVE( 
   399                 MusEngMceUtils::GetVideoInStreamL( *iEmptySession ),
   313                 MusEngMceUtils::GetVideoInStreamL( *iEmptySession ),
   400                 KErrNotFound )
   314                 KErrNotFound )
   446 
   360 
   447 // -----------------------------------------------------------------------------
   361 // -----------------------------------------------------------------------------
   448 //
   362 //
   449 // -----------------------------------------------------------------------------
   363 // -----------------------------------------------------------------------------
   450 //
   364 //
   451 void UT_MusEngMceUtils::UT_GetRecordingStreamL()
   365 void UT_MusEngMceUtils::UT_MusEngMceUtils_GetRecordingStreamL()
   452     {
   366     {
   453     CMceVideoStream* recordingStream = 
   367     CMceVideoStream* recordingStream = 
   454                         MusEngMceUtils::GetRecordingStream( *iVideoInSession );
   368                         MusEngMceUtils::GetRecordingStream( *iVideoInSession );
   455     EUNIT_ASSERT( !recordingStream )
   369     EUNIT_ASSERT( !recordingStream )
   456     
   370     
   476 
   390 
   477 // -----------------------------------------------------------------------------
   391 // -----------------------------------------------------------------------------
   478 // From stream
   392 // From stream
   479 // -----------------------------------------------------------------------------
   393 // -----------------------------------------------------------------------------
   480 //
   394 //
   481 void UT_MusEngMceUtils::UT_GetMediaSinkFromStreamL()
   395 void UT_MusEngMceUtils::UT_MusEngMceUtils_GetMediaSinkL()
   482     {    
   396     {    
   483     CMceMediaSink* sink = MusEngMceUtils::GetMediaSink( 
   397     CMceMediaSink* sink = MusEngMceUtils::GetMediaSink( 
   484                                             *(iVideoInSession->Streams()[0]), 
   398                                             *(iVideoInSession->Streams()[0]), 
   485                                             KMceRTPSink );
   399                                             KMceRTPSink );
   486     EUNIT_ASSERT( !sink )
   400     EUNIT_ASSERT( !sink )
   496 
   410 
   497 // -----------------------------------------------------------------------------
   411 // -----------------------------------------------------------------------------
   498 // From stream
   412 // From stream
   499 // -----------------------------------------------------------------------------
   413 // -----------------------------------------------------------------------------
   500 //
   414 //
   501 void UT_MusEngMceUtils::UT_GetMediaSinkLFromStreamL()
   415 void UT_MusEngMceUtils::UT_MusEngMceUtils_GetMediaSinkLL()
   502     {                                                      
   416     {                                                      
   503     CMceMediaSink* sink = NULL;
   417     CMceMediaSink* sink = NULL;
   504     EUNIT_ASSERT_SPECIFIC_LEAVE(
   418     EUNIT_ASSERT_SPECIFIC_LEAVE(
   505             MusEngMceUtils::GetMediaSinkL( *(iVideoInSession->Streams()[0]), 
   419             MusEngMceUtils::GetMediaSinkL( *(iVideoInSession->Streams()[0]), 
   506                                            KMceRTPSink ),
   420                                            KMceRTPSink ),
   514     
   428     
   515 // -----------------------------------------------------------------------------
   429 // -----------------------------------------------------------------------------
   516 // From session
   430 // From session
   517 // -----------------------------------------------------------------------------
   431 // -----------------------------------------------------------------------------
   518 //
   432 //
   519 void UT_MusEngMceUtils::UT_GetMediaSinkFromSessionL()
   433 void UT_MusEngMceUtils::UT_MusEngMceUtils_GetMediaSink2L()
   520     {
   434     {
   521     CMceMediaSink* sink = MusEngMceUtils::GetMediaSink( *iEmptySession, 
   435     CMceMediaSink* sink = MusEngMceUtils::GetMediaSink( *iEmptySession, 
   522                                                         KMceRTPSink );
   436                                                         KMceRTPSink );
   523     EUNIT_ASSERT( !sink )
   437     EUNIT_ASSERT( !sink )
   524     
   438     
   531 
   445 
   532 // -----------------------------------------------------------------------------
   446 // -----------------------------------------------------------------------------
   533 // From session
   447 // From session
   534 // -----------------------------------------------------------------------------
   448 // -----------------------------------------------------------------------------
   535 //
   449 //
   536 void UT_MusEngMceUtils::UT_GetMediaSinkLFromSessionL()
   450 void UT_MusEngMceUtils::UT_MusEngMceUtils_GetMediaSinkL2L()
   537     {
   451     {
   538     CMceMediaSink* sink = NULL;
   452     CMceMediaSink* sink = NULL;
   539     EUNIT_ASSERT_SPECIFIC_LEAVE( MusEngMceUtils::GetMediaSinkL( *iEmptySession, 
   453     EUNIT_ASSERT_SPECIFIC_LEAVE( MusEngMceUtils::GetMediaSinkL( *iEmptySession, 
   540                                                                 KMceRTPSink ),
   454                                                                 KMceRTPSink ),
   541                                  KErrNotFound )
   455                                  KErrNotFound )
   547     
   461     
   548 // -----------------------------------------------------------------------------
   462 // -----------------------------------------------------------------------------
   549 //
   463 //
   550 // -----------------------------------------------------------------------------
   464 // -----------------------------------------------------------------------------
   551 //
   465 //
   552 void UT_MusEngMceUtils::UT_GetCameraLL()
   466 void UT_MusEngMceUtils::UT_MusEngMceUtils_GetCameraLL()
   553     {
   467     {
   554     // empty session fails
   468     // empty session fails
   555     EUNIT_ASSERT_SPECIFIC_LEAVE( MusEngMceUtils::GetCameraL( *iEmptySession ),
   469     EUNIT_ASSERT_SPECIFIC_LEAVE( MusEngMceUtils::GetCameraL( *iEmptySession ),
   556                                  KErrNotFound )
   470                                  KErrNotFound )
   557     
   471     
   581 
   495 
   582 // -----------------------------------------------------------------------------
   496 // -----------------------------------------------------------------------------
   583 //
   497 //
   584 // -----------------------------------------------------------------------------
   498 // -----------------------------------------------------------------------------
   585 //
   499 //
   586 void UT_MusEngMceUtils::UT_GetFileSourceLL()
   500 void UT_MusEngMceUtils::UT_MusEngMceUtils_GetFileSourceLL()
   587     {
   501     {
   588     // empty session fails
   502     // empty session fails
   589     EUNIT_ASSERT_SPECIFIC_LEAVE( 
   503     EUNIT_ASSERT_SPECIFIC_LEAVE( 
   590                 MusEngMceUtils::GetFileSourceL( *iEmptySession ),
   504                 MusEngMceUtils::GetFileSourceL( *iEmptySession ),
   591                 KErrNotFound )
   505                 KErrNotFound )
   622 
   536 
   623 // -----------------------------------------------------------------------------
   537 // -----------------------------------------------------------------------------
   624 //
   538 //
   625 // -----------------------------------------------------------------------------
   539 // -----------------------------------------------------------------------------
   626 //
   540 //
   627 void UT_MusEngMceUtils::UT_GetDisplayL()
   541 void UT_MusEngMceUtils::UT_MusEngMceUtils_GetDisplayL()
   628     {
   542     {
   629     CMceDisplaySink* display = MusEngMceUtils::GetDisplay( *iEmptySession );
   543     CMceDisplaySink* display = MusEngMceUtils::GetDisplay( *iEmptySession );
   630     
   544     
   631     EUNIT_ASSERT( !display )
   545     EUNIT_ASSERT( !display )
   632     
   546     
   639 
   553 
   640 // -----------------------------------------------------------------------------
   554 // -----------------------------------------------------------------------------
   641 //
   555 //
   642 // -----------------------------------------------------------------------------
   556 // -----------------------------------------------------------------------------
   643 //
   557 //
   644 void UT_MusEngMceUtils::UT_GetDisplayLL()
   558 void UT_MusEngMceUtils::UT_MusEngMceUtils_GetDisplayLL()
   645     {
   559     {
   646     CMceDisplaySink* display = NULL;
   560     CMceDisplaySink* display = NULL;
   647     
   561     
   648     EUNIT_ASSERT_SPECIFIC_LEAVE( MusEngMceUtils::GetDisplayL( *iEmptySession ),
   562     EUNIT_ASSERT_SPECIFIC_LEAVE( MusEngMceUtils::GetDisplayL( *iEmptySession ),
   649                                  KErrNotFound )
   563                                  KErrNotFound )
   657 
   571 
   658 // -----------------------------------------------------------------------------
   572 // -----------------------------------------------------------------------------
   659 //
   573 //
   660 // -----------------------------------------------------------------------------
   574 // -----------------------------------------------------------------------------
   661 //
   575 //
   662 void UT_MusEngMceUtils::UT_AddDisplayLL()
   576 void UT_MusEngMceUtils::UT_MusEngMceUtils_AddDisplayLL()
   663     {
   577     {
   664    
   578    
   665     TRect rect( 110, 111, 112, 113 );
   579     TRect rect( 110, 111, 112, 113 );
   666     
   580     
   667     // Check that display cannot be added to audio stream
   581     // Check that display cannot be added to audio stream
   701     
   615     
   702     // Check that rect is still changed
   616     // Check that rect is still changed
   703     EUNIT_ASSERT_EQUALS( display->DisplayRectL(), newRect );
   617     EUNIT_ASSERT_EQUALS( display->DisplayRectL(), newRect );
   704     
   618     
   705     CleanupStack::PopAndDestroy( videoStream );
   619     CleanupStack::PopAndDestroy( videoStream );
   706     
   620     }
   707     // Add disabled display
   621 
   708     CMceVideoStream* videoStream2 = CMceVideoStream::NewLC();
   622 
   709     MusEngMceUtils::AddDisplayL( *videoStream2, *iManager, rect, ETrue );
   623 // -----------------------------------------------------------------------------
   710     EUNIT_ASSERT_EQUALS( videoStream2->Sinks().Count(), 1 )
   624 //
   711     EUNIT_ASSERT_EQUALS( videoStream2->Sinks()[0]->Type(), KMceDisplaySink )
   625 // -----------------------------------------------------------------------------
   712     EUNIT_ASSERT( !videoStream2->Sinks()[0]->IsEnabled() );
   626 //
   713     CleanupStack::PopAndDestroy( videoStream2 );
   627 void UT_MusEngMceUtils::UT_MusEngMceUtils_AddSpeakerLL()
   714     }
       
   715 
       
   716 
       
   717 // -----------------------------------------------------------------------------
       
   718 //
       
   719 // -----------------------------------------------------------------------------
       
   720 //
       
   721 void UT_MusEngMceUtils::UT_AddSpeakerLL()
       
   722     {
   628     {
   723     // Check that speaker cannot be added to video stream
   629     // Check that speaker cannot be added to video stream
   724     
   630     
   725     CMceVideoStream* videoStream = CMceVideoStream::NewLC();
   631     CMceVideoStream* videoStream = CMceVideoStream::NewLC();
   726     EUNIT_ASSERT_SPECIFIC_LEAVE (
   632     EUNIT_ASSERT_SPECIFIC_LEAVE (
   758 
   664 
   759 // -----------------------------------------------------------------------------
   665 // -----------------------------------------------------------------------------
   760 //
   666 //
   761 // -----------------------------------------------------------------------------
   667 // -----------------------------------------------------------------------------
   762 //
   668 //
   763 void UT_MusEngMceUtils::UT_DisableStreamLL()
   669 void UT_MusEngMceUtils::UT_MusEngMceUtils_DisableStreamLL()
   764     {
   670     {
   765     CMceAudioStream* audioStream = CMceAudioStream::NewLC();
   671     CMceAudioStream* audioStream = CMceAudioStream::NewLC();
   766 
   672 
   767     // Disable only stream
   673     // Disable only stream
   768     EUNIT_ASSERT( audioStream->IsEnabled() )
   674     EUNIT_ASSERT( audioStream->IsEnabled() )
   799     EUNIT_ASSERT( !speaker->IsEnabled() )
   705     EUNIT_ASSERT( !speaker->IsEnabled() )
   800     
   706     
   801     CleanupStack::PopAndDestroy( audioStream );
   707     CleanupStack::PopAndDestroy( audioStream );
   802     }
   708     }
   803 
   709 
   804 // -----------------------------------------------------------------------------
   710 
   805 //
       
   806 // -----------------------------------------------------------------------------
       
   807 //
       
   808 void UT_MusEngMceUtils::UT_GetReceivingDisplayL()
       
   809     {
       
   810     CMceDisplaySink* display = MusEngMceUtils::GetReceivingDisplay( *iEmptySession );
       
   811     
       
   812     EUNIT_ASSERT( !display )
       
   813     
       
   814     display = MusEngMceUtils::GetReceivingDisplay( *iVideoOutSession );
       
   815     
       
   816     EUNIT_ASSERT( display )
       
   817     EUNIT_ASSERT( display->Type() == KMceDisplaySink )
       
   818     EUNIT_ASSERT( display == iReceivingDisplay )
       
   819     }  
       
   820 
       
   821 
       
   822 // -----------------------------------------------------------------------------
       
   823 //
       
   824 // -----------------------------------------------------------------------------
       
   825 //
       
   826 void UT_MusEngMceUtils::UT_GetReceivingDisplayLL()
       
   827     {
       
   828     CMceDisplaySink* display = NULL;
       
   829     
       
   830     EUNIT_ASSERT_SPECIFIC_LEAVE( MusEngMceUtils::GetReceivingDisplayL( *iEmptySession ),
       
   831                                  KErrNotFound )
       
   832     
       
   833     display = MusEngMceUtils::GetReceivingDisplayL( *iVideoOutSession );
       
   834     
       
   835     EUNIT_ASSERT( display )
       
   836     EUNIT_ASSERT( display->Type() == KMceDisplaySink )
       
   837     EUNIT_ASSERT( display == iReceivingDisplay )
       
   838     }  
       
   839 
       
   840 // -----------------------------------------------------------------------------
       
   841 //
       
   842 // -----------------------------------------------------------------------------
       
   843 //
       
   844 void UT_MusEngMceUtils::UT_GetVfDisplayL()
       
   845     {
       
   846     CMceDisplaySink* display = MusEngMceUtils::GetVfDisplay( *iEmptySession );
       
   847     
       
   848     EUNIT_ASSERT( !display )
       
   849     
       
   850     display = MusEngMceUtils::GetVfDisplay( *iVideoOutSession );
       
   851     
       
   852     EUNIT_ASSERT( display )
       
   853     EUNIT_ASSERT( display->Type() == KMceDisplaySink )
       
   854     EUNIT_ASSERT( display != iReceivingDisplay )
       
   855     } 
       
   856 
       
   857 // -----------------------------------------------------------------------------
       
   858 //
       
   859 // -----------------------------------------------------------------------------
       
   860 //
       
   861 void UT_MusEngMceUtils::UT_EnableInactivityTimerL()
       
   862     {
       
   863     // Instream not found, nothing is done
       
   864     EUNIT_ASSERT_EQUALS( MusEngMceUtils::EnableInactivityTimer( *iEmptySession, 1000 ), KErrNotFound );
       
   865 
       
   866     // In stream found
       
   867     EUNIT_ASSERT_EQUALS( MusEngMceUtils::EnableInactivityTimer( *iVideoOutSession, 1000 ), KErrNone );
       
   868     } 
       
   869 
   711 
   870 //  TEST TABLE
   712 //  TEST TABLE
   871 
   713 
   872 EUNIT_BEGIN_TEST_TABLE(
   714 EUNIT_BEGIN_TEST_TABLE(
   873     UT_MusEngMceUtils,
   715     UT_MusEngMceUtils,
   877 EUNIT_TEST(
   719 EUNIT_TEST(
   878     "IsVideoInStream - test ",
   720     "IsVideoInStream - test ",
   879     "MusEngMceUtils",
   721     "MusEngMceUtils",
   880     "IsVideoInStream",
   722     "IsVideoInStream",
   881     "FUNCTIONALITY",
   723     "FUNCTIONALITY",
   882     SetupL, UT_IsVideoInStreamL, Teardown)
   724     SetupL, UT_MusEngMceUtils_IsVideoInStreamL, Teardown)
   883 
   725 
   884 EUNIT_TEST(
       
   885     "IsVideoOutStream - test ",
       
   886     "MusEngMceUtils",
       
   887     "IsVideoOutStream",
       
   888     "FUNCTIONALITY",
       
   889     SetupL, UT_IsVideoOutStreamL, Teardown)
       
   890     
       
   891 EUNIT_TEST(
   726 EUNIT_TEST(
   892     "IsAudioInStream - test ",
   727     "IsAudioInStream - test ",
   893     "MusEngMceUtils",
   728     "MusEngMceUtils",
   894     "IsAudioInStream",
   729     "IsAudioInStream",
   895     "FUNCTIONALITY",
   730     "FUNCTIONALITY",
   896     SetupL, UT_IsAudioInStreamL, Teardown)
   731     SetupL, UT_MusEngMceUtils_IsAudioInStreamL, Teardown)
   897 
   732 
   898 EUNIT_TEST(
   733 EUNIT_TEST(
   899     "GetVideoOutStreamL - test ",
   734     "GetVideoOutStreamL - test ",
   900     "MusEngMceUtils",
   735     "MusEngMceUtils",
   901     "GetVideoOutStreamL",
   736     "GetVideoOutStreamL",
   902     "FUNCTIONALITY",
   737     "FUNCTIONALITY",
   903     SetupL, UT_GetVideoOutStreamLL, Teardown)
   738     SetupL, UT_MusEngMceUtils_GetVideoOutStreamLL, Teardown)
   904 
   739 
   905 EUNIT_TEST(
   740 EUNIT_TEST(
   906     "GetVideoInStreamL - test ",
   741     "GetVideoInStreamL - test ",
   907     "MusEngMceUtils",
   742     "MusEngMceUtils",
   908     "GetVideoInStreamL",
   743     "GetVideoInStreamL",
   909     "FUNCTIONALITY",
   744     "FUNCTIONALITY",
   910     SetupL, UT_GetVideoInStreamLL, Teardown)
   745     SetupL, UT_MusEngMceUtils_GetVideoInStreamLL, Teardown)
   911 
   746 
   912 EUNIT_TEST(
   747 EUNIT_TEST(
   913     "GetRecordingStream - test ",
   748     "GetRecordingStream - test ",
   914     "MusEngMceUtils",
   749     "MusEngMceUtils",
   915     "GetRecordingStream",
   750     "GetRecordingStream",
   916     "FUNCTIONALITY",
   751     "FUNCTIONALITY",
   917     SetupL, UT_GetRecordingStreamL, Teardown)
   752     SetupL, UT_MusEngMceUtils_GetRecordingStreamL, Teardown)
   918 
   753 
   919 EUNIT_TEST(
   754 EUNIT_TEST(
   920     "GetMediaSink - test ",
   755     "GetMediaSink - test ",
   921     "MusEngMceUtils",
   756     "MusEngMceUtils",
   922     "GetMediaSink",
   757     "GetMediaSink",
   923     "FUNCTIONALITY",
   758     "FUNCTIONALITY",
   924     SetupL, UT_GetMediaSinkFromStreamL, Teardown)
   759     SetupL, UT_MusEngMceUtils_GetMediaSinkL, Teardown)
   925 
   760 
   926 EUNIT_TEST(
   761 EUNIT_TEST(
   927     "GetMediaSinkL - test ",
   762     "GetMediaSinkL - test ",
   928     "MusEngMceUtils",
   763     "MusEngMceUtils",
   929     "GetMediaSinkL",
   764     "GetMediaSinkL",
   930     "FUNCTIONALITY",
   765     "FUNCTIONALITY",
   931     SetupL, UT_GetMediaSinkLFromStreamL, Teardown)
   766     SetupL, UT_MusEngMceUtils_GetMediaSinkLL, Teardown)
   932 
   767 
   933 EUNIT_TEST(
   768 EUNIT_TEST(
   934     "GetMediaSink2 - test ",
   769     "GetMediaSink2 - test ",
   935     "MusEngMceUtils",
   770     "MusEngMceUtils",
   936     "GetMediaSink2",
   771     "GetMediaSink2",
   937     "FUNCTIONALITY",
   772     "FUNCTIONALITY",
   938     SetupL, UT_GetMediaSinkFromSessionL, Teardown)
   773     SetupL, UT_MusEngMceUtils_GetMediaSink2L, Teardown)
   939 
   774 
   940 EUNIT_TEST(
   775 EUNIT_TEST(
   941     "GetMediaSinkL2 - test ",
   776     "GetMediaSinkL2 - test ",
   942     "MusEngMceUtils",
   777     "MusEngMceUtils",
   943     "GetMediaSinkL2",
   778     "GetMediaSinkL2",
   944     "FUNCTIONALITY",
   779     "FUNCTIONALITY",
   945     SetupL, UT_GetMediaSinkLFromSessionL, Teardown)
   780     SetupL, UT_MusEngMceUtils_GetMediaSinkL2L, Teardown)
   946 
   781 
   947 EUNIT_TEST(
   782 EUNIT_TEST(
   948     "GetCameraL - test ",
   783     "GetCameraL - test ",
   949     "MusEngMceUtils",
   784     "MusEngMceUtils",
   950     "GetCameraL",
   785     "GetCameraL",
   951     "FUNCTIONALITY",
   786     "FUNCTIONALITY",
   952     SetupL, UT_GetCameraLL, Teardown)
   787     SetupL, UT_MusEngMceUtils_GetCameraLL, Teardown)
   953 
   788 
   954 EUNIT_TEST(
   789 EUNIT_TEST(
   955     "GetFileSourceL - test ",
   790     "GetFileSourceL - test ",
   956     "MusEngMceUtils",
   791     "MusEngMceUtils",
   957     "GetFileSourceL",
   792     "GetFileSourceL",
   958     "FUNCTIONALITY",
   793     "FUNCTIONALITY",
   959     SetupL, UT_GetFileSourceLL, Teardown)
   794     SetupL, UT_MusEngMceUtils_GetFileSourceLL, Teardown)
   960 
   795 
   961 EUNIT_TEST(
   796 EUNIT_TEST(
   962     "GetDisplay - test ",
   797     "GetDisplay - test ",
   963     "MusEngMceUtils",
   798     "MusEngMceUtils",
   964     "GetDisplay",
   799     "GetDisplay",
   965     "FUNCTIONALITY",
   800     "FUNCTIONALITY",
   966     SetupL, UT_GetDisplayL, Teardown)
   801     SetupL, UT_MusEngMceUtils_GetDisplayL, Teardown)
   967 
   802 
   968 EUNIT_TEST(
   803 EUNIT_TEST(
   969     "GetDisplayL - test ",
   804     "GetDisplayL - test ",
   970     "MusEngMceUtils",
   805     "MusEngMceUtils",
   971     "GetDisplayL",
   806     "GetDisplayL",
   972     "FUNCTIONALITY",
   807     "FUNCTIONALITY",
   973     SetupL, UT_GetDisplayLL, Teardown)
   808     SetupL, UT_MusEngMceUtils_GetDisplayLL, Teardown)
   974 
   809 
   975 EUNIT_TEST(
   810 EUNIT_TEST(
   976     "AddDisplayL - test ",
   811     "AddDisplayL - test ",
   977     "MusEngMceUtils",
   812     "MusEngMceUtils",
   978     "AddDisplayL",
   813     "AddDisplayL",
   979     "FUNCTIONALITY",
   814     "FUNCTIONALITY",
   980     SetupL, UT_AddDisplayLL, Teardown)
   815     SetupL, UT_MusEngMceUtils_AddDisplayLL, Teardown)
   981 
   816 
   982 EUNIT_TEST(
   817 EUNIT_TEST(
   983     "AddSpeakerL - test ",
   818     "AddSpeakerL - test ",
   984     "MusEngMceUtils",
   819     "MusEngMceUtils",
   985     "AddSpeakerL",
   820     "AddSpeakerL",
   986     "FUNCTIONALITY",
   821     "FUNCTIONALITY",
   987     SetupL, UT_AddSpeakerLL, Teardown)    
   822     SetupL, UT_MusEngMceUtils_AddSpeakerLL, Teardown)    
   988 
   823 
   989 EUNIT_TEST(
   824 EUNIT_TEST(
   990     "DisableStreamL - test ",
   825     "DisableStreamL - test ",
   991     "MusEngMceUtils",
   826     "MusEngMceUtils",
   992     "DisableStreamL",
   827     "DisableStreamL",
   993     "FUNCTIONALITY",
   828     "FUNCTIONALITY",
   994     SetupL, UT_DisableStreamLL, Teardown)        
   829     SetupL, UT_MusEngMceUtils_DisableStreamLL, Teardown)        
   995 
   830 
   996 EUNIT_TEST(
       
   997     "GetReceivingDisplay - test ",
       
   998     "MusEngMceUtils",
       
   999     "GetReceivingDisplay",
       
  1000     "FUNCTIONALITY",
       
  1001     Setup2L, UT_GetReceivingDisplayL, Teardown)
       
  1002 
       
  1003 EUNIT_TEST(
       
  1004     "GetReceivingDisplayL - test ",
       
  1005     "MusEngMceUtils",
       
  1006     "GetReceivingDisplayL",
       
  1007     "FUNCTIONALITY",
       
  1008     Setup2L, UT_GetReceivingDisplayLL, Teardown)
       
  1009     
       
  1010 EUNIT_TEST(
       
  1011     "GetVfDisplay - test ",
       
  1012     "MusEngMceUtils",
       
  1013     "GetVfDisplay",
       
  1014     "FUNCTIONALITY",
       
  1015     Setup2L, UT_GetVfDisplayL, Teardown)
       
  1016 
       
  1017 EUNIT_TEST(
       
  1018     "EnableInactivityTimer - test ",
       
  1019     "MusEngMceUtils",
       
  1020     "EnableInactivityTimer",
       
  1021     "FUNCTIONALITY",
       
  1022     Setup2L, UT_EnableInactivityTimerL, Teardown)
       
  1023     
   831     
  1024 EUNIT_END_TEST_TABLE
   832 EUNIT_END_TEST_TABLE
  1025 
   833 
  1026 //  END OF FILE
   834 //  END OF FILE
  1027 
   835