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