diff -r 33a5d2bbf6fc -r 73a1feb507fb mmsharing/mmshengine/tsrc/ut_engine/src/ut_musenglivesession.cpp --- a/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musenglivesession.cpp Thu Aug 19 09:51:39 2010 +0300 +++ b/mmsharing/mmshengine/tsrc/ut_engine/src/ut_musenglivesession.cpp Tue Aug 31 15:12:07 2010 +0300 @@ -24,6 +24,8 @@ #include "mussipprofilehandler.h" #include "musengmceutils.h" #include "mussettings.h" +#include "mussessionproperties.h" +#include "musenglivevideoplayer.h" // SYSTEM INCLUDES #include @@ -38,31 +40,6 @@ #include -_LIT8( KMusAvcBitrateLevel1TestText, "TestTextForAvcBrL1Level" ); -_LIT8( KMusAvcBitrateLevel1bTestText, "TestTextForAvcBrL1bLevel" ); -_LIT8( KMusAvcBitrateLevel1_1TestText, "TestTextForAvcBrL1_1Level" ); -_LIT8( KMusAvcBitrateLevel1_2TestText, "TestTextForAvcBrL1_2Level" ); -_LIT8( KMusAvcBitrateLevel1_3TestText, "TestTextForAvcBrL1_3Level" ); -_LIT8( KMusAvcBitrateLevel2TestText, "TestTextForAvcBrL2Level" ); - -_LIT8( KMusAvcBitrateLevel_1b_ConfigKey, "AvcBrL1b=TestTextForAvcBrL1bLevel;" ); - -_LIT8( KMusAvcBitrateLevel_1_1_ConfigKey, -"AvcBrL1_1=TestTextForAvcBrL1_1Level;"); - -_LIT8( KMusAvcBitrateLevels_1_1_And_1b_ConfigKeys, -"AvcBrL1_1=TestTextForAvcBrL1_1Level;\ -AvcBrL1b=TestTextForAvcBrL1bLevel;" ); - -_LIT8( KMusAvcAllLevelsConcatenation, -"AvcBrL1=TestTextForAvcBrL1Level;\ -AvcBrL1b=TestTextForAvcBrL1bLevel;\ -AvcBrL1_1=TestTextForAvcBrL1_1Level;\ -AvcBrL1_2=TestTextForAvcBrL1_2Level;\ -AvcBrL1_3=TestTextForAvcBrL1_3Level;\ -AvcBrL2=TestTextForAvcBrL2Level;" ); - - //use step in different time period const TInt KZoomBigStepCount = 15; @@ -139,20 +116,25 @@ // ----------------------------------------------------------------------------- // void UT_CMusEngLiveSession::SetupL() - { - iObserver = new( ELeave ) CMusEngObserverStub; + { + iLcSessionObserver = new( ELeave )CLcSessionObserverStub; + iLcUiProvider = new( ELeave )CLcUiProviderStub; + iAudioRoutingObserver = new( ELeave )CMusEngObserverStub; - iLiveSession = CMusEngLiveSession::NewL( TRect(0, 0, 100, 100), - *iObserver, - *iObserver, - *iObserver ); + iLiveSession = CMusEngLiveSession::NewL(); + iLiveSession->SetLcSessionObserver( iLcSessionObserver ); + iLiveSession->SetLcUiProvider( iLcUiProvider ); - iRecordedLiveSession = CMusEngLiveSession::NewL( KTestVideoFileName(), - TRect(0, 0, 100, 100), - *iObserver, - *iObserver, - *iObserver ); - + iRecordedLiveSession = CMusEngLiveSession::NewL(); + iRecordedLiveSession->SetLcSessionObserver( iLcSessionObserver ); + iRecordedLiveSession->SetLcUiProvider( iLcUiProvider ); + MLcDestinationFileControl* destinationFileControl = + iRecordedLiveSession->LocalVideoPlayer()->LcDestinationFileControl(); + destinationFileControl->SetLcFileNameL( KTestVideoFileName() ); + + User::LeaveIfError( RProperty::Set( NMusSessionApi::KCategoryUid, + NMusSessionApi::KRemoteSipAddress, + KTestRecipientSipUri ) ); } @@ -164,11 +146,14 @@ { delete iLiveSession; delete iRecordedLiveSession; - delete iObserver; - + delete iLcSessionObserver; + delete iLcUiProvider; + delete iAudioRoutingObserver; + PropertyHelper::Close(); // Delete static data from CenRep stub CRepository::iStaticWriteAvcKeysToStaticData = EFalse; CRepository::DeleteStubAvcConfigKeys(); + CRepository::ResetStubGlobal(); CRepository::iForceFailWithCode = KErrNone; } @@ -176,602 +161,37 @@ // TEST CASES - // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // void UT_CMusEngLiveSession::UT_NewLL() { - EUNIT_ASSERT( iLiveSession ); - EUNIT_ASSERT( iLiveSession->iRecordedFile == KNullDesC() ); - EUNIT_ASSERT( iRecordedLiveSession ); - EUNIT_ASSERT( iRecordedLiveSession->iRecordedFile == KTestVideoFileName() ); - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_CurrentZoomLL() - { - // Check that checking current zoom is not possible before invite - TRAPD( error, iLiveSession->CurrentZoomL() ); - MUS_TEST_FORWARD_ALLOC_FAILURE( error ); - EUNIT_ASSERT( error == KErrNotReady ); - - // simulate session establishment - ESTABLISH_OUT_SESSION( iLiveSession ); - - CMceCameraSource* camera = - MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); - - // Check that originally current and default zoom are the same - EUNIT_ASSERT( iLiveSession->iDefaultZoomFactor == - iLiveSession->CurrentZoomL() ); - - // Zoom to maximum optical value - while ( camera->iZoomFactor < iLiveSession->iCameraInfo.iMaxZoom ) - { - iLiveSession->ZoomInL(); - } - - EUNIT_ASSERT( iLiveSession->iCameraInfo.iMaxZoom == - iLiveSession->CurrentZoomL() ); - - // Zoom using digital zoom - - iLiveSession->ZoomInL(); - - EUNIT_ASSERT( iLiveSession->CurrentZoomL() == - iLiveSession->iCameraInfo.iMaxZoom + - camera->iDigitalZoomFactor ) - - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_CMusEngLiveSession_SetZoomLL() - { - TRAPD( error, iLiveSession->SetZoomL(2) ); - MUS_TEST_FORWARD_ALLOC_FAILURE( error ); - EUNIT_ASSERT( error == KErrNotReady ); - ESTABLISH_OUT_SESSION( iLiveSession ); - CMceCameraSource* camera = - MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); - EUNIT_ASSERT( camera->iZoomFactor == 1 ); - EUNIT_ASSERT( camera->iDigitalZoomFactor == 0 ); - TRAPD( err, iLiveSession->SetZoomL(0) ); - EUNIT_ASSERT( err == KErrArgument ); - iLiveSession->SetZoomL(2); - EUNIT_ASSERT( camera->iZoomFactor == 2 ); - TRAPD( err1, iLiveSession->SetZoomL(14) ); - EUNIT_ASSERT( err1 == KErrArgument ); - iLiveSession->SetZoomL( 5 ); - EUNIT_ASSERT( camera->iDigitalZoomFactor == 2 ); - } -void UT_CMusEngLiveSession::UT_MaxZoomLL() - { - // Check that checking maximum zoom is not possible before invite - TRAPD( error, iLiveSession->MaxZoomL() ); - MUS_TEST_FORWARD_ALLOC_FAILURE( error ); - EUNIT_ASSERT( error == KErrNotReady ); - - // simulate session establishment - ESTABLISH_OUT_SESSION( iLiveSession ); - - EUNIT_ASSERT( iLiveSession->MaxZoomL() == - iLiveSession->iCameraInfo.iMaxZoom + - iLiveSession->iCameraInfo.iMaxDigitalZoom ); - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_ZoomInLL() - { - // Check that zooming is not possible before invite - TRAPD( error, iLiveSession->ZoomInL() ); - MUS_TEST_FORWARD_ALLOC_FAILURE( error ); - EUNIT_ASSERT( error == KErrNotReady ); - - // simulate session establishment - ESTABLISH_OUT_SESSION( iLiveSession ); - - CMceCameraSource* camera = - MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); - - // Check the default value - EUNIT_ASSERT( iLiveSession->iDefaultZoomFactor == camera->iZoomFactor ); - - // Check that zoom factor can be increased - USER_SLEEP; //insure that small step is used - iLiveSession->ZoomInL(); - EUNIT_ASSERT( camera->iZoomFactor == iLiveSession->iDefaultZoomFactor + - iLiveSession->iSmallZoomStep ); - - //Check the "burst" mode (immediate second ZoomIn), big step should be used - TInt nZoom = camera->iZoomFactor + camera->iDigitalZoomFactor; - iLiveSession->ZoomInL(); - TInt nStep = camera->iZoomFactor + camera->iDigitalZoomFactor - nZoom; - EUNIT_ASSERT( nStep == iLiveSession->iBigZoomStep ); + EUNIT_ASSERT( iLiveSession ) + EUNIT_ASSERT( iRecordedLiveSession ) + EUNIT_ASSERT( iLiveSession->iCameraHandler.iCameraUsage == MusSettingsKeys::EUseCameraSwapping ); + EUNIT_ASSERT( iLiveSession->iMceManagerUid == TUid::Uid( KMusUiUid ) ); - // Zoom to maximum optical value - while ( camera->iZoomFactor < iLiveSession->iCameraInfo.iMaxZoom ) - { - iLiveSession->ZoomInL(); - } - - TInt maxOpticalZoomFactor = camera->ZoomFactorL(); - - // Check that digital zoom is used instead of optical - iLiveSession->ZoomInL(); - EUNIT_ASSERT( camera->iZoomFactor == maxOpticalZoomFactor ); - EUNIT_ASSERT( camera->iDigitalZoomFactor > 0 ); - - // Zoom to maximum digital value - while ( camera->iDigitalZoomFactor < - iLiveSession->iCameraInfo.iMaxDigitalZoom ) - { - iLiveSession->ZoomInL(); - } - - TInt maxDigitalZoomFactor = camera->DigitalZoomFactorL(); - - // Check that further zooming is impossible - iLiveSession->ZoomInL(); - EUNIT_ASSERT( camera->iZoomFactor == maxOpticalZoomFactor ); - EUNIT_ASSERT( camera->iDigitalZoomFactor == maxDigitalZoomFactor ); - - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_ZoomOutLL() - { - // Check that zooming is not possible before invite - TRAPD( error, iLiveSession->ZoomOutL() ); - MUS_TEST_FORWARD_ALLOC_FAILURE( error ); - EUNIT_ASSERT( error == KErrNotReady ); - - // simulate session establishment - ESTABLISH_OUT_SESSION( iLiveSession ); - - CMceCameraSource* camera = - MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); - - // Check the default value - EUNIT_ASSERT( iLiveSession->iDefaultZoomFactor == camera->iZoomFactor ); - - // Simulate maximum zoom - camera->iZoomFactor = iLiveSession->iCameraInfo.iMaxZoom; - camera->iDigitalZoomFactor = iLiveSession->iCameraInfo.iMaxDigitalZoom; - - // Check that digital zoom factor can be decreased - USER_SLEEP; //insure that small step is used - iLiveSession->ZoomOutL(); - EUNIT_ASSERT( camera->iZoomFactor == iLiveSession->iCameraInfo.iMaxZoom ); - EUNIT_ASSERT( camera->iDigitalZoomFactor == - iLiveSession->iCameraInfo.iMaxDigitalZoom - - iLiveSession->iSmallZoomStep ); - - //Check the "burst" mode (immediate second ZoomOut), big step should be used - TInt nZoom = camera->iZoomFactor + camera->iDigitalZoomFactor; - iLiveSession->ZoomOutL(); - TInt nStep; - nStep = nZoom - (camera->iZoomFactor + camera->iDigitalZoomFactor ); - EUNIT_ASSERT( nStep == iLiveSession->iBigZoomStep ); - - // Simulate maximum zoom again - camera->iZoomFactor = iLiveSession->iCameraInfo.iMaxZoom; - camera->iDigitalZoomFactor = iLiveSession->iCameraInfo.iMaxDigitalZoom; - - // Zoom to minimum digital zoom - while ( camera->iDigitalZoomFactor > 0 ) - { - iLiveSession->ZoomOutL(); - } - - EUNIT_ASSERT( camera->iZoomFactor == iLiveSession->iCameraInfo.iMaxZoom ); - EUNIT_ASSERT( camera->iDigitalZoomFactor == 0 ); - - // Check that optical zoom is decreased instead of digital - USER_SLEEP; //insure that step is the small one - iLiveSession->ZoomOutL(); - EUNIT_ASSERT( camera->iZoomFactor == - iLiveSession->iCameraInfo.iMaxZoom - - iLiveSession->iSmallZoomStep ); - EUNIT_ASSERT( camera->iDigitalZoomFactor == 0 ); - - // Zoom to minimum optical zoom - while ( camera->iZoomFactor > iLiveSession->iCameraInfo.iMinZoom ) - { - iLiveSession->ZoomOutL(); - } - - // Check that further zooming is impossible - iLiveSession->ZoomOutL(); - EUNIT_ASSERT( camera->iZoomFactor == iLiveSession->iCameraInfo.iMinZoom ); - EUNIT_ASSERT( camera->iDigitalZoomFactor == 0 ); - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_ZoomDefaultLL() - { - // Check that zooming is not possible before invite - TRAPD( error, iLiveSession->ZoomDefaultL() ); - MUS_TEST_FORWARD_ALLOC_FAILURE( error ); - EUNIT_ASSERT( error == KErrNotReady ); - - // simulate session establishment - ESTABLISH_OUT_SESSION( iLiveSession ); - - CMceCameraSource* camera = - MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); - - // Check the default value - EUNIT_ASSERT( iLiveSession->iDefaultZoomFactor == camera->iZoomFactor ); - - // increase zoom factor so much that optical zoom is in maximum value - // and digital zoom is in use - while ( camera->iDigitalZoomFactor == 0 ) - { - iLiveSession->ZoomInL(); - } - EUNIT_ASSERT( camera->iZoomFactor > iLiveSession->iDefaultZoomFactor ); - EUNIT_ASSERT( camera->iDigitalZoomFactor > 0 ); - - // back to default - iLiveSession->ZoomDefaultL(); - EUNIT_ASSERT( camera->iZoomFactor == iLiveSession->iDefaultZoomFactor ); - EUNIT_ASSERT( camera->iDigitalZoomFactor == 0 ); - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_SetBrightnessLL() - { - // Check that setting brightness is not possible before invite - EUNIT_ASSERT_SPECIFIC_LEAVE( - iLiveSession->SetBrightnessL( KTestSomeBrightness ), - KErrNotReady ) - - // simulate session establishment - ESTABLISH_OUT_SESSION( iLiveSession ); - - CMceCameraSource* camera = - MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); - - camera->iCameraInfo.iOptionsSupported = - camera->iCameraInfo.iOptionsSupported | TCameraInfo::EBrightnessSupported; - - // Check that originally current and default brightness are the same - EUNIT_ASSERT_EQUALS( iLiveSession->iDefaultBrightness, - iLiveSession->CurrentBrightnessL() ) - - // Test setting brightness - iLiveSession->SetBrightnessL( KTestSomeBrightness ); - - EUNIT_ASSERT_EQUALS( KTestSomeBrightness, - iLiveSession->CurrentBrightnessL() ) - } - - + delete iLiveSession; + iLiveSession = NULL; + CRepository::SetStubGlobal( MusSettingsKeys::KCameraUsage, + MusSettingsKeys::EUseOnlySecondaryCamera ); -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_CurrentBrightnessLL() - { - // Check that checking current brightness is not possible before invite - EUNIT_ASSERT_SPECIFIC_LEAVE( iLiveSession->CurrentBrightnessL(), - KErrNotReady ) + iLiveSession = CMusEngLiveSession::NewL(); - // All the other stuff checked in tests of SetBrightnessL - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_MaxBrightnessLL() - { - // MaxBrightness should return a constant - - EUNIT_ASSERT_EQUALS( KTestMaxBrightness, iLiveSession->MaxBrightnessL() ) - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_MinBrightnessLL() - { - // MinBrightness should return a constant - - EUNIT_ASSERT_EQUALS( KTestMinBrightness, iLiveSession->MinBrightnessL() ) - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_IncreaseBrightnessLL() - { - // Check that increasing brightness is not possible before invite - EUNIT_ASSERT_SPECIFIC_LEAVE( iLiveSession->IncreaseBrightnessL(), - KErrNotReady ) - - // simulate session establishment - ESTABLISH_OUT_SESSION( iLiveSession ); - - CMceCameraSource* camera = - MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); - - camera->iCameraInfo.iOptionsSupported = - camera->iCameraInfo.iOptionsSupported | TCameraInfo::EBrightnessSupported; - - // Check that originally current and default brightness are the same - EUNIT_ASSERT_EQUALS( iLiveSession->iDefaultBrightness, - iLiveSession->CurrentBrightnessL() ) - - // Check that brightness can be increased... - iLiveSession->IncreaseBrightnessL(); - - EUNIT_ASSERT_EQUALS( iLiveSession->iDefaultBrightness + KTestBrightnessStepSize, - iLiveSession->CurrentBrightnessL() ) - - // ... but only to maximum - - iLiveSession->SetBrightnessL( KTestMaxBrightness ); - - iLiveSession->IncreaseBrightnessL(); + EUNIT_ASSERT_EQUALS( TInt( iLiveSession->iCameraHandler.iCameraUsage ), + TInt( MusSettingsKeys::EUseOnlySecondaryCamera ) ); - EUNIT_ASSERT_EQUALS( KTestMaxBrightness, - iLiveSession->CurrentBrightnessL() ) - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_DecreaseBrightnessLL() - { - // Check that decreasing brightness is not possible before invite - EUNIT_ASSERT_SPECIFIC_LEAVE( iLiveSession->DecreaseBrightnessL(), - KErrNotReady ) - - // simulate session establishment - ESTABLISH_OUT_SESSION( iLiveSession ); - - CMceCameraSource* camera = - MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); - - camera->iCameraInfo.iOptionsSupported = - camera->iCameraInfo.iOptionsSupported | TCameraInfo::EBrightnessSupported; - - // Check that originally current and default brightness are the same - EUNIT_ASSERT_EQUALS( iLiveSession->iDefaultBrightness, - iLiveSession->CurrentBrightnessL() ) - - // Check that brightness can be decreased... - iLiveSession->DecreaseBrightnessL(); - - EUNIT_ASSERT_EQUALS( iLiveSession->iDefaultBrightness - KTestBrightnessStepSize, - iLiveSession->CurrentBrightnessL() ) - - // ... but only to minimum - - iLiveSession->SetBrightnessL( KTestMinBrightness ); - - iLiveSession->DecreaseBrightnessL(); - - EUNIT_ASSERT_EQUALS( KTestMinBrightness, - iLiveSession->CurrentBrightnessL() ) - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_BrightnessDefaultLL() - { - // Check that setting default brightness is not possible before invite - EUNIT_ASSERT_SPECIFIC_LEAVE( iLiveSession->BrightnessDefaultL(), - KErrNotReady ) - - // simulate session establishment - ESTABLISH_OUT_SESSION( iLiveSession ); - - CMceCameraSource* camera = - MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); - - camera->iCameraInfo.iOptionsSupported = - camera->iCameraInfo.iOptionsSupported | TCameraInfo::EBrightnessSupported; - - // Check that originally current and default brightness are the same - EUNIT_ASSERT_EQUALS( iLiveSession->iDefaultBrightness, - iLiveSession->CurrentBrightnessL() ) - - // set brightness to max - iLiveSession->SetBrightnessL( KTestMaxBrightness ); - EUNIT_ASSERT_NOT_EQUALS( iLiveSession->iDefaultBrightness, - iLiveSession->CurrentBrightnessL() ) - - // set brightness to default and check it - iLiveSession->BrightnessDefaultL(); - - EUNIT_ASSERT_EQUALS( iLiveSession->iDefaultBrightness, - iLiveSession->CurrentBrightnessL() ) - } + delete iLiveSession; + iLiveSession = NULL; + CRepository::SetStubGlobal( MusSettingsKeys::KCameraUsage, + MusSettingsKeys::EUseOnlyMainCamera ); -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_BrightnessAutoLL() - { - // Check that setting brightness to auto is not possible before invite - EUNIT_ASSERT_SPECIFIC_LEAVE( iLiveSession->BrightnessAutoL(), - KErrNotReady ); - - // simulate session establishment - ESTABLISH_OUT_SESSION( iLiveSession ); - - CMceCameraSource* camera = - MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); - - camera->iCameraInfo.iOptionsSupported = - camera->iCameraInfo.iOptionsSupported | TCameraInfo::EBrightnessSupported; - - // Check that originally brightness is not auto - EUNIT_ASSERT_NOT_EQUALS( CCamera::EBrightnessAuto, - iLiveSession->CurrentBrightnessL() ) - - // check that brightness is set to auto - iLiveSession->BrightnessAutoL(); - EUNIT_ASSERT_EQUALS( CCamera::EBrightnessAuto, - iLiveSession->CurrentBrightnessL() ) - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_RecordL_and_IsRecordingLL() - { - // Check that recording is not possible before invite - EUNIT_ASSERT_SPECIFIC_LEAVE( iRecordedLiveSession->RecordL( ETrue ), - KErrNotReady ) - - // simulate session establishment - ESTABLISH_OUT_SESSION( iLiveSession ); - ESTABLISH_OUT_SESSION( iRecordedLiveSession ); - - // Check that recording is off by default - EUNIT_ASSERT( !iRecordedLiveSession->IsRecording() ); - - // Check that recording can be set on - iRecordedLiveSession->RecordL( ETrue ); - EUNIT_ASSERT( iRecordedLiveSession->IsRecording() ); - - // Check that recording cannot be set on if recording stream does not exist - EUNIT_ASSERT_SPECIFIC_LEAVE( iLiveSession->RecordL( ETrue ), - KErrNotReady ) - - // Check that setting on the recording twice does not harm - iRecordedLiveSession->RecordL( ETrue ); - EUNIT_ASSERT( iRecordedLiveSession->IsRecording() ); - - // Check that recording can be set off again - iRecordedLiveSession->RecordL( EFalse ); - EUNIT_ASSERT( !iRecordedLiveSession->IsRecording() ); - - // Check that setting off the recording twice does not harm - iRecordedLiveSession->RecordL( EFalse ); - EUNIT_ASSERT( !iRecordedLiveSession->IsRecording() ); - } + iLiveSession = CMusEngLiveSession::NewL(); - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_PlayLL() - { - // Check that resuming is not possible before invite - TRAPD( error, iLiveSession->PlayL() ); - MUS_TEST_FORWARD_ALLOC_FAILURE( error ); - EUNIT_ASSERT( error == KErrNotReady ); - - ESTABLISH_OUT_SESSION( iLiveSession ); - - iLiveSession->PauseL(); - - CMceCameraSource* camera = - MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); - - iLiveSession->PlayL(); - - EUNIT_ASSERT( camera->IsEnabled() ); - - // Try to enable camera again, request should be ignored - - iLiveSession->PlayL(); - - EUNIT_ASSERT( camera->IsEnabled() ); - + EUNIT_ASSERT_EQUALS( TInt( iLiveSession->iCameraHandler.iCameraUsage ), + TInt( MusSettingsKeys::EUseOnlyMainCamera ) ); } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_PauseLL() - { - // Check that pausing is not possible before invite - TRAPD( error, iLiveSession->PauseL() ); - MUS_TEST_FORWARD_ALLOC_FAILURE( error ); - EUNIT_ASSERT( error == KErrNotReady ); - - ESTABLISH_OUT_SESSION( iLiveSession ); - - iLiveSession->PlayL(); - - CMceCameraSource* camera = - MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); - - iLiveSession->PauseL(); - - EUNIT_ASSERT( !camera->IsEnabled() ); - - // Try to disable camera again, request should be ignored - - iLiveSession->PauseL(); - - EUNIT_ASSERT( !camera->IsEnabled() ); - - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_IsPlayingLL() - { - // Try without a session - EUNIT_ASSERT_SPECIFIC_LEAVE( iLiveSession->IsPlayingL(), KErrNotReady ); - - // Normal cases - ESTABLISH_OUT_SESSION( iLiveSession ); - - iLiveSession->PlayL(); - EUNIT_ASSERT( iLiveSession->IsPlayingL() ) - - iLiveSession->PauseL(); - EUNIT_ASSERT( !iLiveSession->IsPlayingL() ) - } - // ----------------------------------------------------------------------------- // @@ -779,9 +199,8 @@ // void UT_CMusEngLiveSession::UT_CompleteSessionStructureLL() { - CMceStreamBundle* localBundle = - CMceStreamBundle::NewLC( CMceStreamBundle::ELS ); + CMceStreamBundle::NewLC( CMceStreamBundle::ELS ); // Check that structure cannot be completed before creating the session TRAPD( error, iLiveSession->CompleteSessionStructureL( *localBundle ) ); @@ -806,7 +225,6 @@ EUNIT_ASSERT( iLiveSession->iSession->Streams()[0]->Source() ); EUNIT_ASSERT( iLiveSession->iSession->Streams()[0]->Source()->Type() == KMceCameraSource ); - EUNIT_ASSERT( !iLiveSession->IsPlayingL() ) EUNIT_ASSERT( iLiveSession->iSession->Streams()[0]->Sinks().Count() == 1 ); EUNIT_ASSERT( iLiveSession->iSession->Streams()[0]->Sinks()[0]->Type() == KMceRTPSink ); @@ -844,46 +262,28 @@ EUNIT_ASSERT( file ) - CleanupStack::PopAndDestroy( localBundle ); - - } - + -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_HandleSessionStateChangedL() - { - // Make Repository empty, config keys must be written - CRepository::SetStubAvcConfigKeysL( KNullDesC8() ); + EUNIT_ASSERT( iLiveSession->iCameraHandler.iCurrentCamera == + TMusEngCameraHandler::EBackCamera ); - // Invite - iLiveSession->InviteL( KTestRecipientSipUri ); - iLiveSession->iSession->iState = CMceSession::EEstablished; + delete iLiveSession->iSession; + iLiveSession->iSession = NULL; - // Force failure on CenRep - CRepository::iForceFailWithCode = KErrNoMemory; - - // Simulate session state transition notification - iLiveSession->HandleSessionStateChanged( - *iLiveSession->iSession, - 200, KNullDesC8() ); - - EUNIT_ASSERT( iObserver->iSessionFailedCalled ); + iLiveSession->iSession = CMceOutSession::NewL( + *(iLiveSession->iManager), + *profile, + KTestRecipientSipUri8() ); - // Normal case, something will be written to CenRep - iRecordedLiveSession->InviteL( KTestRecipientSipUri ); - iRecordedLiveSession->iSession->iState = CMceSession::EEstablished; - iRecordedLiveSession->HandleSessionStateChanged( - *iRecordedLiveSession->iSession, - 200, KNullDesC8() ); + iLiveSession->iCameraHandler.iCameraUsage = MusSettingsKeys::EUseOnlySecondaryCamera; + iLiveSession->CompleteSessionStructureL( *localBundle ); - HBufC8* info = MultimediaSharingSettings::EncoderConfigInfoLC(); - EUNIT_ASSERT_NOT_EQUALS( *info, KMusAvcBitrateLevel_1b_ConfigKey() ) - CleanupStack::PopAndDestroy( info ); + EUNIT_ASSERT( iLiveSession->iCameraHandler.iCurrentCamera == + TMusEngCameraHandler::EFrontCamera ); + + + CleanupStack::PopAndDestroy( localBundle ); } - // ----------------------------------------------------------------------------- // @@ -898,10 +298,10 @@ CMceVideoCodec* codecAvc = CMceAvcCodec::NewLC( KMceSDPNameH264() ); CMceVideoCodec* codecUnknown = CMceH263Codec::NewLC( KNullDesC8() ); - iLiveSession->AdjustVideoCodecL( *codecH263 ); - iLiveSession->AdjustVideoCodecL( *codecH2632000 ); - iLiveSession->AdjustVideoCodecL( *codecAvc ); - iLiveSession->AdjustVideoCodecL( *codecUnknown ); + iLiveSession->AdjustVideoCodecL( *codecH263, KMceCameraSource ); + iLiveSession->AdjustVideoCodecL( *codecH2632000, KMceCameraSource ); + iLiveSession->AdjustVideoCodecL( *codecAvc, KMceCameraSource ); + iLiveSession->AdjustVideoCodecL( *codecUnknown, KMceCameraSource ); // Test that bit rates has been set to H263 & AVC codecs EUNIT_ASSERT( codecH263->iAllowedBitrates == KMceAllowedH263BitrateAll ) @@ -936,10 +336,8 @@ CleanupStack::PopAndDestroy( codecAvc ); CleanupStack::PopAndDestroy( codecH2632000 ); CleanupStack::PopAndDestroy( codecH263 ); - } - // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -958,7 +356,6 @@ CleanupStack::PopAndDestroy( codec ); } - // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- @@ -984,16 +381,16 @@ EUNIT_ASSERT_EQUALS( stream->Codecs().Count(), 3 ) // Check that AVC codecs are removed if they are known to be not supported - iLiveSession->SetSupportedVideoCodecListL( _L( "SomethingThatIsNotAVC" ) ); + delete iLiveSession->iVideoCodecList; + iLiveSession->iVideoCodecList = NULL; + iLiveSession->iVideoCodecList = _L8("SomethingThatIsNotAVC").AllocL(); iLiveSession->DoCodecSelectionL( *stream ); EUNIT_ASSERT_EQUALS( stream->Codecs().Count(), 2 ) EUNIT_ASSERT( stream->Codecs()[0]->SdpName() != KMceSDPNameH264() ) EUNIT_ASSERT( stream->Codecs()[1]->SdpName() != KMceSDPNameH264() ) CleanupStack::PopAndDestroy( stream ); - } - // ----------------------------------------------------------------------------- // Although all states are not meaningfull for LiveSession, all states are @@ -1009,7 +406,7 @@ CleanupStack::PopAndDestroy( videoStream ); // Simulate sending invite - iLiveSession->InviteL( KTestRecipientSipUri() ); + iLiveSession->EstablishLcSessionL(); // Try all the stream states CMceMediaStream* changedStream = iLiveSession->iSession->Streams()[0]; @@ -1018,59 +415,58 @@ changedStream->iState = CMceMediaStream::EUninitialized; static_cast(iLiveSession)->StreamStateChanged( *changedStream ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ); // EInitialized, stream is initialized changedStream->iState = CMceMediaStream::EInitialized; static_cast(iLiveSession)->StreamStateChanged( *changedStream ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ); // EBuffering, stream is buffering changedStream->iState = CMceMediaStream::EBuffering; static_cast(iLiveSession)->StreamStateChanged( *changedStream ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ); // EIdle, stream is not receiving RTP changedStream->iState = CMceMediaStream::EIdle; static_cast(iLiveSession)->StreamStateChanged( *changedStream ); - EUNIT_ASSERT( iObserver->iStreamIdleCalled ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ); // EStreaming, stream is streaming changedStream->iState = CMceMediaStream::EStreaming; - static_cast(iLiveSession)->StreamStateChanged( - *changedStream ); - EUNIT_ASSERT( iObserver->iStreamStreamingCalled ); - iObserver->Reset(); + static_cast(iLiveSession)->StreamStateChanged( *changedStream ); + EUNIT_ASSERT_EQUALS( TInt( iLcSessionObserver->iCalledFunction ), + TInt( CLcSessionObserverStub::EPlayerStateChanged ) ) + iLcSessionObserver->Reset(); // EDisabled, stream is explicitly disabled changedStream->iState = CMceMediaStream::EDisabled; static_cast(iLiveSession)->StreamStateChanged( *changedStream ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ); // ENoResources, stream has no needed resources to stream changedStream->iState = CMceMediaStream::ENoResources; static_cast(iLiveSession)->StreamStateChanged( *changedStream ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ); // ETranscodingRequired, stream requires non-realtime transcoding changedStream->iState = CMceMediaStream::ETranscodingRequired; static_cast(iLiveSession)->StreamStateChanged( *changedStream ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ); // ETranscoding, stream is transcoding in non-realtime changedStream->iState = CMceMediaStream::ETranscoding; static_cast(iLiveSession)->StreamStateChanged( *changedStream ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ); } - // ----------------------------------------------------------------------------- // Although all states are not meaningfull for LiveSession, all states are // tested in order to force the updating of unit tests when behavior is changed @@ -1087,7 +483,7 @@ CleanupStack::PopAndDestroy( videoStream ); // Simulate sending invite - iLiveSession->InviteL( KTestRecipientSipUri() ); + iLiveSession->EstablishLcSessionL(); // Try all the stream states CMceMediaStream* changedStream = iLiveSession->iSession->Streams()[0]; @@ -1097,59 +493,59 @@ changedStream->iState = CMceMediaStream::EUninitialized; static_cast(iLiveSession)->StreamStateChanged( *changedStream, *changedSource ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ); // EInitialized, stream is initialized changedStream->iState = CMceMediaStream::EInitialized; static_cast(iLiveSession)->StreamStateChanged( *changedStream, *changedSource );; - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ); // EBuffering, stream is buffering changedStream->iState = CMceMediaStream::EBuffering; static_cast(iLiveSession)->StreamStateChanged( *changedStream, *changedSource ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ); // EIdle, stream is not receiving RTP changedStream->iState = CMceMediaStream::EIdle; static_cast(iLiveSession)->StreamStateChanged( *changedStream, *changedSource ); - EUNIT_ASSERT( iObserver->iStreamIdleCalled ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ); // EStreaming, stream is streaming changedStream->iState = CMceMediaStream::EStreaming; static_cast(iLiveSession)->StreamStateChanged( *changedStream, *changedSource ); - EUNIT_ASSERT( iObserver->iStreamStreamingCalled ); - iObserver->Reset(); + EUNIT_ASSERT_EQUALS( TInt( iLcSessionObserver->iCalledFunction ), + TInt( CLcSessionObserverStub::EPlayerStateChanged ) ) + iLcSessionObserver->Reset(); // EDisabled, stream is explicitly disabled changedStream->iState = CMceMediaStream::EDisabled; static_cast(iLiveSession)->StreamStateChanged( *changedStream, *changedSource ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ); // ENoResources, stream has no needed resources to stream changedStream->iState = CMceMediaStream::ENoResources; static_cast(iLiveSession)->StreamStateChanged( *changedStream, *changedSource ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ); // ETranscodingRequired, stream requires non-realtime transcoding changedStream->iState = CMceMediaStream::ETranscodingRequired; static_cast(iLiveSession)->StreamStateChanged( *changedStream, *changedSource ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ); // ETranscoding, stream is transcoding in non-realtime changedStream->iState = CMceMediaStream::ETranscoding; static_cast(iLiveSession)->StreamStateChanged( *changedStream, *changedSource ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ); } - // ----------------------------------------------------------------------------- // Although all states are not meaningfull for LiveSession, all states are // tested in order to force the updating of unit tests when behavior is changed @@ -1167,7 +563,9 @@ // Try with session ESTABLISH_OUT_SESSION( iRecordedLiveSession ) - iRecordedLiveSession->RecordL( ETrue ); + MLcDestinationFileControl* destinationFileControl = + iRecordedLiveSession->LocalVideoPlayer()->LcDestinationFileControl(); + destinationFileControl->LcRecordL( ETrue ); // Test state CMceMediaStream::ENoResources @@ -1176,8 +574,9 @@ iLiveSession->StreamStateChanged( *iLiveSession->iSession->Streams()[0], *iLiveSession->iSession->Streams()[0]->Sinks()[0] ); - EUNIT_ASSERT( iObserver->iStreamStreamingCalled ) - iObserver->Reset(); + EUNIT_ASSERT_EQUALS( TInt( iLcSessionObserver->iCalledFunction ), + TInt( CLcSessionObserverStub::EPlayerStateChanged ) ) + iLcSessionObserver->Reset(); // Try again with recording stream, but indicate change in another stream, // nothing happens @@ -1212,8 +611,11 @@ iRecordedLiveSession->StreamStateChanged( *recordingStream, *recordingStream->Sinks()[0] ); - EUNIT_ASSERT( iObserver->iDiskFullCalled ) - iObserver->Reset(); + EUNIT_ASSERT_EQUALS( TInt( iLcSessionObserver->iCalledFunction ), + TInt( CLcSessionObserverStub::ESessionFailed ) ) + EUNIT_ASSERT_EQUALS( iLcSessionObserver->iError, + TInt( MLcSession::EDiskFull ) ) + iLcSessionObserver->Reset(); // Test default stream state change behavior @@ -1224,33 +626,34 @@ // EUninitialized, stream is created, unexpected change, nothing happens changedStream->iState = CMceMediaStream::EUninitialized; iLiveSession->StreamStateChanged( *changedStream, *changedSink ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ) // EInitialized, stream is initialized changedStream->iState = CMceMediaStream::EInitialized; iLiveSession->StreamStateChanged( *changedStream, *changedSink ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ) // EBuffering, stream is buffering changedStream->iState = CMceMediaStream::EBuffering; iLiveSession->StreamStateChanged( *changedStream, *changedSink ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ) // EIdle, stream is not receiving RTP changedStream->iState = CMceMediaStream::EIdle; iLiveSession->StreamStateChanged( *changedStream, *changedSink ); - EUNIT_ASSERT( iObserver->iStreamIdleCalled ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ) // EStreaming, stream is streaming changedStream->iState = CMceMediaStream::EStreaming; iLiveSession->StreamStateChanged( *changedStream, *changedSink ); - EUNIT_ASSERT( iObserver->iStreamStreamingCalled ); - iObserver->Reset(); + EUNIT_ASSERT_EQUALS( TInt( iLcSessionObserver->iCalledFunction ), + TInt( CLcSessionObserverStub::EPlayerStateChanged ) ) + iLcSessionObserver->Reset(); // EDisabled, stream is explicitly disabled changedStream->iState = CMceMediaStream::EDisabled; iLiveSession->StreamStateChanged( *changedStream, *changedSink ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ) // ENoResources, stream has no needed resources to stream // This state has non-default meaning, tested before defaults @@ -1258,12 +661,12 @@ // ETranscodingRequired, stream requires non-realtime transcoding changedStream->iState = CMceMediaStream::ETranscodingRequired; iLiveSession->StreamStateChanged( *changedStream, *changedSink ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ) // ETranscoding, stream is transcoding in non-realtime changedStream->iState = CMceMediaStream::ETranscoding; iLiveSession->StreamStateChanged( *changedStream, *changedSink ); - EUNIT_ASSERT( iObserver->IsReseted() ); + EUNIT_ASSERT( iLcSessionObserver->IsReseted() ) } @@ -1272,252 +675,24 @@ // // ----------------------------------------------------------------------------- // -void UT_CMusEngLiveSession::UT_SetEncodingDeviceLL() - { - CMceAvcCodec* codec = CMceAvcCodec::NewLC( KMceSDPNameH264() ); - - // Generic error in CenRep, leave expected - CRepository::iForceFailWithCode = KErrNotReady; - EUNIT_ASSERT_LEAVE( iLiveSession->SetEncodingDeviceL( *codec ) ) - EUNIT_ASSERT_EQUALS( codec->iEncodingDecodingDevice, TUid::Uid( 0 ) ) - - // No entry in CenRep, default value expected - CRepository::iForceFailWithCode = KErrNotFound; - const TUid KDefaultEncodingDevice( TUid::Uid( 0x20001C13 ) ); - iLiveSession->SetEncodingDeviceL( *codec ); - EUNIT_ASSERT_EQUALS( codec->iEncodingDecodingDevice, - KDefaultEncodingDevice ) - - // Entry in CenRep - const TInt KSomeEncodingDevice( 0x20001C15 ); - CRepository::iStaticEncoderUid = KSomeEncodingDevice; - iLiveSession->SetEncodingDeviceL( *codec ); - EUNIT_ASSERT_EQUALS( codec->iEncodingDecodingDevice, - TUid::Uid( KSomeEncodingDevice ) ) - - CleanupStack::PopAndDestroy( codec ); - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_SetCodecConfigKeyLL() +void UT_CMusEngLiveSession::UT_EstablishLcSessionL() { - CMceAvcCodec* codec = CMceAvcCodec::NewLC( KMceSDPNameH264() ); - codec->SetAllowedBitrates( KMceAvcBitrateLevel1b ); - - // Generic error in CenRep, leave expected - CRepository::iForceFailWithCode = KErrNotReady; - EUNIT_ASSERT_LEAVE( iLiveSession->SetCodecConfigKeyL( *codec ) ); - EUNIT_ASSERT( !codec->iConfigKey ) - EUNIT_ASSERT( !iLiveSession->iStoreEncoderConfigInfo ) - CRepository::iForceFailWithCode = KErrNone; - - // No entry in CenRep, nothing happens - iLiveSession->SetCodecConfigKeyL( *codec ); - EUNIT_ASSERT( !codec->iConfigKey ) - EUNIT_ASSERT( !iLiveSession->iStoreEncoderConfigInfo ) - - // Empty entry in CenRep - CRepository::SetStubAvcConfigKeysL( KNullDesC8() ); - iLiveSession->SetCodecConfigKeyL( *codec ); - EUNIT_ASSERT( !codec->iConfigKey ) - EUNIT_ASSERT( iLiveSession->iStoreEncoderConfigInfo ) - iLiveSession->iStoreEncoderConfigInfo = EFalse; // emulate original situation - - // Entry in CenRep - CRepository::SetStubAvcConfigKeysL( KMusAvcBitrateLevel_1b_ConfigKey ); - iLiveSession->SetCodecConfigKeyL( *codec ); - EUNIT_ASSERT( codec->iConfigKey ) - HBufC8* key = codec->ConfigKeyL(); - CleanupStack::PushL( key ); - EUNIT_ASSERT_EQUALS( *key, KMusAvcBitrateLevel1bTestText() ) - CleanupStack::PopAndDestroy( key ); - EUNIT_ASSERT( !iLiveSession->iStoreEncoderConfigInfo ) - - CleanupStack::PopAndDestroy( codec ); + iLiveSession->EstablishLcSessionL(); + EUNIT_ASSERT_EQUALS( TInt( CMceSession::EOffering ), + TInt( iLiveSession->iSession->iState ) ) } - // ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- // -void UT_CMusEngLiveSession::UT_ReadCodecConfigKeyLL() +void UT_CMusEngLiveSession::UT_LocalVideoPlayerL() { - HBufC8* key( NULL ); - - // Try with H263, leave expected - CMceVideoCodec* codecH263 = CMceH263Codec::NewLC( KMceSDPNameH263() ); - EUNIT_ASSERT_LEAVE( key = iLiveSession->ReadCodecConfigKeyL( *codecH263 ) ) - CleanupStack::PopAndDestroy( codecH263 ); - - // Try without an entry in CenRep, leave expected - CMceVideoCodec* codec = CMceAvcCodec::NewLC( KMceSDPNameH264() ); - codec->SetAllowedBitrates( 0 | KMceAvcBitrateLevel1 ); - EUNIT_ASSERT_LEAVE( key = iLiveSession->ReadCodecConfigKeyL( *codec ) ) - - // Create CenRep entry which does not include wanted bitrate, NULL value - // expected - CRepository::SetStubAvcConfigKeysL( KMusAvcBitrateLevel1bTestText() ); - key = iLiveSession->ReadCodecConfigKeyL( *codec ); - EUNIT_ASSERT( !key ) - - // Create entry with all AVC keys and try with all the values - CRepository::SetStubAvcConfigKeysL( KMusAvcAllLevelsConcatenation() ); - - // KMceAvcBitrateLevel1 - key = iLiveSession->ReadCodecConfigKeyL( *codec ); - EUNIT_ASSERT( key ); - CleanupStack::PushL( key ); - EUNIT_ASSERT_EQUALS( *key, KMusAvcBitrateLevel1TestText ); - CleanupStack::PopAndDestroy( key ); - - // KMceAvcBitrateLevel1b - codec->SetAllowedBitrates( KMceAvcBitrateLevel1b ); - key = iLiveSession->ReadCodecConfigKeyL( *codec ); - EUNIT_ASSERT( key ); - CleanupStack::PushL( key ); - EUNIT_ASSERT_EQUALS( *key, KMusAvcBitrateLevel1bTestText ); - CleanupStack::PopAndDestroy( key ); - - // KMceAvcBitrateLevel1_1 - codec->SetAllowedBitrates( KMceAvcBitrateLevel1_1 ); - key = iLiveSession->ReadCodecConfigKeyL( *codec ); - EUNIT_ASSERT( key ); - CleanupStack::PushL( key ); - EUNIT_ASSERT_EQUALS( *key, KMusAvcBitrateLevel1_1TestText ); - CleanupStack::PopAndDestroy( key ); - - // KMceAvcBitrateLevel1_2 - codec->SetAllowedBitrates( KMceAvcBitrateLevel1_2 ); - key = iLiveSession->ReadCodecConfigKeyL( *codec ); - EUNIT_ASSERT( key ); - CleanupStack::PushL( key ); - EUNIT_ASSERT_EQUALS( *key, KMusAvcBitrateLevel1_2TestText ); - CleanupStack::PopAndDestroy( key ); - - // KMceAvcBitrateLevel1_3 - codec->SetAllowedBitrates( KMceAvcBitrateLevel1_3 ); - key = iLiveSession->ReadCodecConfigKeyL( *codec ); - EUNIT_ASSERT( key ); - CleanupStack::PushL( key ); - EUNIT_ASSERT_EQUALS( *key, KMusAvcBitrateLevel1_3TestText ); - CleanupStack::PopAndDestroy( key ); - - // KMceAvcBitrateLevel2 - codec->SetAllowedBitrates( KMceAvcBitrateLevel2 ); - key = iLiveSession->ReadCodecConfigKeyL( *codec ); - EUNIT_ASSERT( key ); - CleanupStack::PushL( key ); - EUNIT_ASSERT_EQUALS( *key, KMusAvcBitrateLevel2TestText ); - CleanupStack::PopAndDestroy( key ); - - CleanupStack::PopAndDestroy( codec ); - + EUNIT_ASSERT( iLiveSession->LocalVideoPlayer() == + iLiveSession->iLiveVideoPlayer ) } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_StoreEncoderConfigInfoLL() - { - CRepository::iStaticWriteAvcKeysToStaticData = ETrue; - - // Try with clean CenRep - MultimediaSharingSettings::SetEncoderConfigInfoL( KNullDesC8() ); - - ESTABLISH_OUT_SESSION( iLiveSession ) // calls StoreEncoderConfigInfoL - // If StoreEncoderConfigInfoL leaves with KErrNoMemory, - // MMusEngSessionObserver::SessionFailed will be called. - __ASSERT_ALWAYS( !iObserver->iSessionFailedCalled, - User::Leave( KErrNoMemory ) ); - - HBufC8* keys = MultimediaSharingSettings::EncoderConfigInfoLC(); - EUNIT_ASSERT_EQUALS( *keys, KMusAvcBitrateLevel_1b_ConfigKey() ) - CleanupStack::PopAndDestroy( keys ); - - // Try without a clean CenRep - MultimediaSharingSettings::SetEncoderConfigInfoL( - KMusAvcBitrateLevel_1_1_ConfigKey() ); - - ESTABLISH_OUT_SESSION( iRecordedLiveSession ) - // If StoreEncoderConfigInfoL leaves with KErrNoMemory, - // MMusEngSessionObserver::SessionFailed will be called. - __ASSERT_ALWAYS( !iObserver->iSessionFailedCalled, - User::Leave( KErrNoMemory ) ); - - keys = MultimediaSharingSettings::EncoderConfigInfoLC(); - EUNIT_ASSERT_EQUALS( *keys, - KMusAvcBitrateLevels_1_1_And_1b_ConfigKeys() ) - CleanupStack::PopAndDestroy( keys ); - } - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -void UT_CMusEngLiveSession::UT_InitializeZoomStepSizeL() - { - //Check that zooming steps have defualt values before session establishment - iLiveSession->InitializeZoomStepSize(); - EUNIT_ASSERT( iLiveSession->iSmallZoomStep == KZoomStepMinSize ); - EUNIT_ASSERT( iLiveSession->iBigZoomStep == KZoomStepMinSize ); - - // simulate session establishment - ESTABLISH_OUT_SESSION( iLiveSession ); - - CMceCameraSource* camera = - MusEngMceUtils::GetCameraL( *(iLiveSession->iSession) ); - - //Check that zooming step sizes have default value KZoomStepMinSize - //in case of zooming values range is smaller than KZoomBigStepCount - iLiveSession->iCameraInfo.iMinZoom = 0; - iLiveSession->iCameraInfo.iMaxZoom = 0; - iLiveSession->iCameraInfo.iMaxDigitalZoom = KZoomBigStepCount / 2; - iLiveSession->InitializeZoomStepSize(); - EUNIT_ASSERT( iLiveSession->iSmallZoomStep == KZoomStepMinSize ); - EUNIT_ASSERT( iLiveSession->iBigZoomStep == KZoomStepMinSize ); - - - //Check that zooming step sizes have default value KZoomStepMinSize - //in case of zooming values range is bigger than KZoomBigStepCount, - //but smaller than 2*KZoomBigStepCount (KZoomSmallStepCount) - iLiveSession->iCameraInfo.iMaxDigitalZoom = 2*KZoomBigStepCount - 1; - iLiveSession->InitializeZoomStepSize(); - EUNIT_ASSERT( iLiveSession->iSmallZoomStep == KZoomStepMinSize ); - EUNIT_ASSERT( iLiveSession->iBigZoomStep == KZoomStepMinSize ); - - - //Check zooming steps sizes in case of zooming values range is - //bigger than 2*KZoomBigStepCount and smaller than 2*KZoomSmallStepCount - iLiveSession->iCameraInfo.iMinZoom = - KZoomBigStepCount; - iLiveSession->iCameraInfo.iMaxZoom = KZoomBigStepCount; - iLiveSession->iCameraInfo.iMaxDigitalZoom = KZoomBigStepCount; - //zooming range is (-KZoomBigStepCount, 2*KZoomBigStepCount) - iLiveSession->InitializeZoomStepSize(); - EUNIT_ASSERT( iLiveSession->iSmallZoomStep == KZoomStepMinSize ); - EUNIT_ASSERT( iLiveSession->iBigZoomStep == 3 ); - - - //Check zooming steps sizes in case of zooming values range is - //bigger than 2*KZoomSmallStepCount - iLiveSession->iCameraInfo.iMaxZoom = KZoomSmallStepCount; - iLiveSession->iCameraInfo.iMaxDigitalZoom = KZoomSmallStepCount; - iLiveSession->iCameraInfo.iMinZoom = - KZoomSmallStepCount; - //zooming range is (-KZoomSmallStepCount, 2*KZoomSmallStepCount) - iLiveSession->InitializeZoomStepSize(); - EUNIT_ASSERT( iLiveSession->iSmallZoomStep == 3 ); - EUNIT_ASSERT( iLiveSession->iBigZoomStep == 6 ); - } - - // TEST TABLE - EUNIT_BEGIN_TEST_TABLE( UT_CMusEngLiveSession, "UT_CMusEngLiveSesssion", @@ -1531,125 +706,6 @@ SetupL, UT_NewLL, Teardown) EUNIT_TEST( - "CurrentZoomL - test ", - "CMusEngLiveSession", - "CurrentZoomL", - "FUNCTIONALITY", - SetupL, UT_CurrentZoomLL, Teardown) - -EUNIT_TEST( - "MaxZoomL - test ", - "CMusEngLiveSession", - "MaxZoomL", - "FUNCTIONALITY", - SetupL, UT_MaxZoomLL, Teardown) - -EUNIT_TEST( - "ZoomInL - test ", - "CMusEngLiveSession", - "ZoomInL", - "FUNCTIONALITY", - SetupL, UT_ZoomInLL, Teardown) - -EUNIT_TEST( - "ZoomOutL - test ", - "CMusEngLiveSession", - "ZoomOutL", - "FUNCTIONALITY", - SetupL, UT_ZoomOutLL, Teardown) - -EUNIT_TEST( - "ZoomDefaultL - test ", - "CMusEngLiveSession", - "ZoomDefaultL", - "FUNCTIONALITY", - SetupL, UT_ZoomDefaultLL, Teardown) - -EUNIT_TEST( - "SetBrightnessL - test ", - "CMusEngLiveSession", - "SetBrightnessL", - "FUNCTIONALITY", - SetupL, UT_SetBrightnessLL, Teardown) - -EUNIT_TEST( - "CurrentBrightnessL - test ", - "CMusEngLiveSession", - "CurrentBrightnessL", - "FUNCTIONALITY", - SetupL, UT_CurrentBrightnessLL, Teardown) - -EUNIT_TEST( - "MaxBrightnessL - test ", - "CMusEngLiveSession", - "MaxBrightnessL", - "FUNCTIONALITY", - SetupL, UT_MaxBrightnessLL, Teardown) - -EUNIT_TEST( - "MinBrightnessL - test ", - "CMusEngLiveSession", - "MinBrightnessL", - "FUNCTIONALITY", - SetupL, UT_MinBrightnessLL, Teardown) - -EUNIT_TEST( - "IncreaseBrightnessL - test ", - "CMusEngLiveSession", - "IncreaseBrightnessL", - "FUNCTIONALITY", - SetupL, UT_IncreaseBrightnessLL, Teardown) - -EUNIT_TEST( - "DecreaseBrightnessL - test ", - "CMusEngLiveSession", - "DecreaseBrightnessL", - "FUNCTIONALITY", - SetupL, UT_DecreaseBrightnessLL, Teardown) - -EUNIT_TEST( - "BrightnessDefaultL - test ", - "CMusEngLiveSession", - "BrightnessDefaultL", - "FUNCTIONALITY", - SetupL, UT_BrightnessDefaultLL, Teardown) - -EUNIT_TEST( - "BrightnessAutoL - test ", - "CMusEngLiveSession", - "BrightnessAutoL", - "FUNCTIONALITY", - SetupL, UT_BrightnessAutoLL, Teardown) - -EUNIT_TEST( - "RecordL_and_IsRecordingL - test ", - "CMusEngLiveSession", - "RecordL_and_IsRecordingL", - "FUNCTIONALITY", - SetupL, UT_RecordL_and_IsRecordingLL, Teardown) - -EUNIT_TEST( - "PlayL - test ", - "CMusEngLiveSession", - "PlayL", - "FUNCTIONALITY", - SetupL, UT_PlayLL, Teardown) - -EUNIT_TEST( - "PauseL - test ", - "CMusEngLiveSession", - "PauseL", - "FUNCTIONALITY", - SetupL, UT_PauseLL, Teardown) - -EUNIT_TEST( - "IsPlayingL - test ", - "CMusEngLiveSession", - "IsPlayingL", - "FUNCTIONALITY", - SetupL, UT_IsPlayingLL, Teardown) - -EUNIT_TEST( "CompleteSessionStructureL - test ", "CMusEngLiveSession", "CompleteSessionStructureL", @@ -1657,13 +713,6 @@ SetupL, UT_CompleteSessionStructureLL, Teardown) EUNIT_TEST( - "HandleSessionStateChanged - test ", - "CMusEngLiveSession", - "HandleSessionStateChanged", - "FUNCTIONALITY", - SetupL, UT_HandleSessionStateChangedL, Teardown) - -EUNIT_TEST( "AdjustVideoCodecL - test ", "CMusEngLiveSession", "AdjustVideoCodecL", @@ -1703,44 +752,22 @@ "CMusEngLiveSession", "StreamStateChangedL( sink )", "FUNCTIONALITY", - SetupL, UT_StreamStateChangedWithSinkL, Teardown) - -EUNIT_TEST( - "SetEncodingDeviceL - test ", - "CMusEngLiveSession", - "SetEncodingDeviceL", - "FUNCTIONALITY", - SetupL, UT_SetEncodingDeviceLL, Teardown) - -EUNIT_TEST( - "SetCodecConfigKeyL - test ", - "CMusEngLiveSession", - "SetCodecConfigKeyL", - "FUNCTIONALITY", - SetupL, UT_SetCodecConfigKeyLL, Teardown) + SetupL, UT_StreamStateChangedWithSinkL, Teardown) EUNIT_TEST( - "ReadCodecConfigKeyL - test ", + "EstablishLcSessionL - test ", "CMusEngLiveSession", - "ReadCodecConfigKeyL", + "EstablishLcSessionL", "FUNCTIONALITY", - SetupL, UT_ReadCodecConfigKeyLL, Teardown) - -EUNIT_TEST( - "StoreEncoderConfigInfoL - test ", - "CMusEngLiveSession", - "StoreEncoderConfigInfoL", - "FUNCTIONALITY", - SetupL, UT_StoreEncoderConfigInfoLL, Teardown) + SetupL, UT_EstablishLcSessionL, Teardown) EUNIT_TEST( - "InitializeZoomStepSize - test ", + "LocalVideoPlayer - test ", "CMusEngLiveSession", - "InitializeZoomStepSize", + "LocalVideoPlayer", "FUNCTIONALITY", - SetupL, UT_InitializeZoomStepSizeL, Teardown) - - + SetupL, UT_LocalVideoPlayerL, Teardown) + EUNIT_END_TEST_TABLE // END OF FILE