sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: // User includes sl@0: #include "char_a3f_devsound_initializationtest.h" sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0001 sl@0: */ sl@0: RA3FDevSoundToneInitializationTest::RA3FDevSoundToneInitializationTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundToneInitializationTest* RA3FDevSoundToneInitializationTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundToneInitializationTest* self = new (ELeave) RA3FDevSoundToneInitializationTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundToneInitializationTest::DoKickoffTestL() sl@0: { sl@0: } sl@0: sl@0: void RA3FDevSoundToneInitializationTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundToneInitializationTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: INFO_PRINTF1(_L("========== Test Case Successfully Completed ==========")); sl@0: StopTest(); sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0002 sl@0: */ sl@0: RA3FDevSoundToneCancelInitializeTest::RA3FDevSoundToneCancelInitializeTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName),iInitCompleteReceived(EFalse), sl@0: iSampleRate(0), iChannels(0) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundToneCancelInitializeTest* RA3FDevSoundToneCancelInitializeTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundToneCancelInitializeTest* self = new (ELeave) RA3FDevSoundToneCancelInitializeTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundToneCancelInitializeTest::DoKickoffTestL() sl@0: { sl@0: if (!GetIntFromConfig(iTestStepName, KSampleRate, iSampleRate)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KSampleRate); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: if (!GetIntFromConfig(iTestStepName, KChannel, iChannels)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KChannel); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: iTimer = CPeriodic::NewL(CActive::EPriorityHigh); sl@0: } sl@0: sl@0: void RA3FDevSoundToneCancelInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundToneCancelInitializeTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: StartTimer(KMicroSecsTwoSec); sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::CancelInitialize")); sl@0: err = iMMFDevSound->CancelInitialize(); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected error on CancelInitialize = %d"), err); sl@0: StopTest(err); sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete) sl@0: { sl@0: iInitCompleteReceived = ETrue; sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: void RA3FDevSoundToneCancelInitializeTest::DoTimerCallback() sl@0: { sl@0: if(!iInitCompleteReceived) sl@0: { sl@0: INFO_PRINTF1(_L("Waiting for InitializeComplete event")); sl@0: iInitCompleteReceived = ETrue; sl@0: } sl@0: else sl@0: { sl@0: iTimer->Cancel(); sl@0: TMMFCapabilities capabilitiesSet; sl@0: TBuf stringSampleRateSet; sl@0: TBuf stringChannelsSet; sl@0: SampleRateFromTIntToTMMFSampleRate (iSampleRate, iESampleRate); sl@0: capabilitiesSet.iRate = iESampleRate; sl@0: capabilitiesSet.iChannels = iChannels; sl@0: SampleRateFromTUintToString (capabilitiesSet.iRate, stringSampleRateSet); sl@0: ChannelsFromTUintToString (capabilitiesSet.iChannels, stringChannelsSet); sl@0: INFO_PRINTF3(_L("Settings for Sample rate an channel mode. %S %S"), &stringSampleRateSet, &stringChannelsSet); sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::SetConfigL")); sl@0: TRAPD(err, iMMFDevSound->SetConfigL(capabilitiesSet)); sl@0: if (err == KErrNotReady) sl@0: { sl@0: INFO_PRINTF2(_L("CMMFDevSound::SetConfigL left with the expected error = %d"), err); sl@0: StopTest(); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("CMMFDevSound::SetConfigL left with error = %d"), err); sl@0: ERR_PRINTF2(_L("Expected error value = %d"), KErrNotReady); sl@0: StopTest(err, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: void RA3FDevSoundToneCancelInitializeTest::InitializeComplete(TInt aError) sl@0: { sl@0: ERR_PRINTF1(_L("DevSound called InitializeComplete after calling CMMFDevSound::CancelInitialize")); sl@0: StopTest(aError, EFail); sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0003 sl@0: */ sl@0: RA3FDevSoundToneInitializeToPlayTonesTwiceTest::RA3FDevSoundToneInitializeToPlayTonesTwiceTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName), iReinitialized(EFalse) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundToneInitializeToPlayTonesTwiceTest* RA3FDevSoundToneInitializeToPlayTonesTwiceTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundToneInitializeToPlayTonesTwiceTest* self = new (ELeave) RA3FDevSoundToneInitializeToPlayTonesTwiceTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundToneInitializeToPlayTonesTwiceTest::DoKickoffTestL() sl@0: { sl@0: } sl@0: sl@0: void RA3FDevSoundToneInitializeToPlayTonesTwiceTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundToneInitializeTwiceToPlayTonesTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: if(!iReinitialized) sl@0: { sl@0: INFO_PRINTF1(_L("========== First initialization successfully completed ==========")); sl@0: iReinitialized = ETrue; sl@0: INFO_PRINTF1(_L("Again calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this,EMMFStateTonePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("========== Second initialization successfully completed ==========")); sl@0: StopTest(); sl@0: } sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0004 sl@0: */ sl@0: RA3FDevSoundToneInitializeToPlayTonesThenAudioTest::RA3FDevSoundToneInitializeToPlayTonesThenAudioTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName), iReinitialized(EFalse) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundToneInitializeToPlayTonesThenAudioTest* RA3FDevSoundToneInitializeToPlayTonesThenAudioTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundToneInitializeToPlayTonesThenAudioTest* self = new (ELeave) RA3FDevSoundToneInitializeToPlayTonesThenAudioTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundToneInitializeToPlayTonesThenAudioTest::DoKickoffTestL() sl@0: { sl@0: } sl@0: sl@0: void RA3FDevSoundToneInitializeToPlayTonesThenAudioTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundToneInitializeToPlayTonesThenAudioTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: if(!iReinitialized) sl@0: { sl@0: INFO_PRINTF1(_L("========== First initialization successfully completed ==========")); sl@0: iReinitialized = ETrue; sl@0: INFO_PRINTF1(_L("Again calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStatePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("========== Second initialization successfully completed ==========")); sl@0: StopTest(); sl@0: } sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0005 sl@0: */ sl@0: RA3FDevSoundToneInitializeToPlayTonesThenRecordAudioTest::RA3FDevSoundToneInitializeToPlayTonesThenRecordAudioTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName), iReinitialized(EFalse) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundToneInitializeToPlayTonesThenRecordAudioTest* RA3FDevSoundToneInitializeToPlayTonesThenRecordAudioTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundToneInitializeToPlayTonesThenRecordAudioTest* self = new (ELeave) RA3FDevSoundToneInitializeToPlayTonesThenRecordAudioTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundToneInitializeToPlayTonesThenRecordAudioTest::DoKickoffTestL() sl@0: { sl@0: } sl@0: sl@0: void RA3FDevSoundToneInitializeToPlayTonesThenRecordAudioTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundToneInitializeToPlayTonesThenRecordAudioTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: if(!iReinitialized) sl@0: { sl@0: INFO_PRINTF1(_L("========== First initialization successfully completed==========")); sl@0: iReinitialized = ETrue; sl@0: INFO_PRINTF1(_L("Again calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateRecording)); sl@0: if(err != KErrNone) sl@0: { sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("========== Second initialization successfully completed ==========")); sl@0: StopTest(); sl@0: } sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0006 sl@0: */ sl@0: RA3FDevSoundToneInitializeTFourCCTest::RA3FDevSoundToneInitializeTFourCCTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundToneInitializeTFourCCTest* RA3FDevSoundToneInitializeTFourCCTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundToneInitializeTFourCCTest* self = new (ELeave) RA3FDevSoundToneInitializeTFourCCTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundToneInitializeTFourCCTest::DoKickoffTestL() sl@0: { sl@0: TPtrC fourccCode; sl@0: if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: EncodingFromStringToTFourCC(fourccCode); sl@0: } sl@0: sl@0: void RA3FDevSoundToneInitializeTFourCCTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundToneInitializeTFourCCTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateTonePlaying)); sl@0: if(err == KErrNotSupported) sl@0: { sl@0: ERR_PRINTF2(_L("Calling CMMFDevSound::InitializeL to play tones using a FourCC code left with expected error = %d"), err); sl@0: StopTest(err, EPass); sl@0: break; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: INFO_PRINTF2(_L("Expected error = %d"), KErrNotSupported); sl@0: StopTest(err, EFail); sl@0: } sl@0: } sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0007 sl@0: */ sl@0: RA3FDevSoundInitializeInvalidModeTest::RA3FDevSoundInitializeInvalidModeTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundInitializeInvalidModeTest* RA3FDevSoundInitializeInvalidModeTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundInitializeInvalidModeTest* self = new (ELeave) RA3FDevSoundInitializeInvalidModeTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundInitializeInvalidModeTest::DoKickoffTestL() sl@0: { sl@0: } sl@0: sl@0: void RA3FDevSoundInitializeInvalidModeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundInitializeInvalidModeTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateConverting)); sl@0: if(err == KErrNotSupported) sl@0: { sl@0: ERR_PRINTF2(_L("Calling CMMFDevSound::InitializeL using an invalid TMMFState argument left with expected error code = %d"), err); sl@0: StopTest(err, EPass); sl@0: break; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("Calling CMMFDevSound::InitializeL using an invalid TMMFState argument left with unexpected error code = %d"), err); sl@0: INFO_PRINTF2(_L("Expected error = %d"), KErrNotSupported); sl@0: StopTest(err, EFail); sl@0: } sl@0: } sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0008 sl@0: */ sl@0: RA3FDevSoundPlayInitializationTest::RA3FDevSoundPlayInitializationTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundPlayInitializationTest* RA3FDevSoundPlayInitializationTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundPlayInitializationTest* self = new (ELeave) RA3FDevSoundPlayInitializationTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundPlayInitializationTest::DoKickoffTestL() sl@0: { sl@0: TPtrC fourccCode; sl@0: if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: EncodingFromStringToTFourCC(fourccCode); sl@0: } sl@0: sl@0: void RA3FDevSoundPlayInitializationTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayInitializationTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: INFO_PRINTF1(_L("CMMFDevSound::InitializeL succeeded")); sl@0: StopTest(); sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0009 sl@0: */ sl@0: RA3FDevSoundPlayCancelInitializeTest::RA3FDevSoundPlayCancelInitializeTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName),iInitCompleteReceived(EFalse), sl@0: iSampleRate(0), iChannels(0) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundPlayCancelInitializeTest* RA3FDevSoundPlayCancelInitializeTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundPlayCancelInitializeTest* self = new (ELeave) RA3FDevSoundPlayCancelInitializeTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundPlayCancelInitializeTest::DoKickoffTestL() sl@0: { sl@0: if (!GetIntFromConfig(iTestStepName, KSampleRate, iSampleRate)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KSampleRate); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: if (!GetIntFromConfig(iTestStepName, KChannel, iChannels)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KChannel); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: TPtrC fourccCode; sl@0: if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: EncodingFromStringToTFourCC(fourccCode); sl@0: iTimer = CPeriodic::NewL(CActive::EPriorityHigh); sl@0: } sl@0: sl@0: void RA3FDevSoundPlayCancelInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayCancelInitializeTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: StartTimer(KMicroSecsTwoSec); sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::CancelInitialize")); sl@0: err = iMMFDevSound->CancelInitialize(); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected error on CancelInitialize = %d"), err); sl@0: StopTest(err); sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete) sl@0: { sl@0: iInitCompleteReceived = ETrue; sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: void RA3FDevSoundPlayCancelInitializeTest::DoTimerCallback() sl@0: { sl@0: if(!iInitCompleteReceived) sl@0: { sl@0: INFO_PRINTF1(_L("Waiting for InitializeComplete event")); sl@0: iInitCompleteReceived = ETrue; sl@0: } sl@0: else sl@0: { sl@0: iTimer->Cancel(); sl@0: TMMFCapabilities capabilitiesSet; sl@0: TBuf stringSampleRateSet; sl@0: TBuf stringChannelsSet; sl@0: SampleRateFromTIntToTMMFSampleRate (iSampleRate, iESampleRate); sl@0: capabilitiesSet.iRate = iESampleRate; sl@0: capabilitiesSet.iChannels = iChannels; sl@0: SampleRateFromTUintToString (capabilitiesSet.iRate, stringSampleRateSet); sl@0: ChannelsFromTUintToString (capabilitiesSet.iChannels, stringChannelsSet); sl@0: INFO_PRINTF3(_L("Settings for Sample rate an channel mode. %S %S"), &stringSampleRateSet, &stringChannelsSet); sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::SetConfigL")); sl@0: TRAPD(err, iMMFDevSound->SetConfigL(capabilitiesSet)); sl@0: if (err == KErrNotReady) sl@0: { sl@0: INFO_PRINTF2(_L("CMMFDevSound::SetConfigL left with the expected error = %d"), err); sl@0: StopTest(); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("CMMFDevSound::SetConfigL left with error = %d"), err); sl@0: ERR_PRINTF2(_L("Expected error value = %d"), KErrNotReady); sl@0: StopTest(err, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: void RA3FDevSoundPlayCancelInitializeTest::InitializeComplete(TInt aError) sl@0: { sl@0: ERR_PRINTF1(_L("DevSound called InitializeComplete after calling CMMFDevSound::CancelInitialize")); sl@0: StopTest(aError, EFail); sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0010 sl@0: */ sl@0: RA3FDevSoundPlayInitializeToPlayAudioThenTonesTest::RA3FDevSoundPlayInitializeToPlayAudioThenTonesTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName), iReinitialized(EFalse) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundPlayInitializeToPlayAudioThenTonesTest* RA3FDevSoundPlayInitializeToPlayAudioThenTonesTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundPlayInitializeToPlayAudioThenTonesTest* self = new (ELeave) RA3FDevSoundPlayInitializeToPlayAudioThenTonesTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundPlayInitializeToPlayAudioThenTonesTest::DoKickoffTestL() sl@0: { sl@0: TPtrC fourccCode; sl@0: if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: EncodingFromStringToTFourCC(fourccCode); sl@0: } sl@0: sl@0: void RA3FDevSoundPlayInitializeToPlayAudioThenTonesTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayInitializeToPlayAudioThenTonesTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: if(!iReinitialized) sl@0: { sl@0: INFO_PRINTF1(_L("========== First initialization successfully completed ==========")); sl@0: iReinitialized = ETrue; sl@0: INFO_PRINTF1(_L("Again calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("========== Second initialization successfully completed ==========")); sl@0: StopTest(); sl@0: } sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0011 sl@0: */ sl@0: RA3FDevSoundPlayInitializeToPlayAudioTwiceTest::RA3FDevSoundPlayInitializeToPlayAudioTwiceTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName), iReinitialized(EFalse) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundPlayInitializeToPlayAudioTwiceTest* RA3FDevSoundPlayInitializeToPlayAudioTwiceTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundPlayInitializeToPlayAudioTwiceTest* self = new (ELeave) RA3FDevSoundPlayInitializeToPlayAudioTwiceTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundPlayInitializeToPlayAudioTwiceTest::DoKickoffTestL() sl@0: { sl@0: TPtrC fourccCode; sl@0: if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: EncodingFromStringToTFourCC(fourccCode); sl@0: } sl@0: sl@0: void RA3FDevSoundPlayInitializeToPlayAudioTwiceTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayInitializeTwiceToPlayAudioTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: if(!iReinitialized) sl@0: { sl@0: INFO_PRINTF1(_L("========== First initialization successfully completed ==========")); sl@0: iReinitialized = ETrue; sl@0: INFO_PRINTF1(_L("Again calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("========== Second initialization successfully completed ==========")); sl@0: StopTest(); sl@0: } sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0012 sl@0: */ sl@0: RA3FDevSoundPlayInitializeToPlayAudioThenRecordTest::RA3FDevSoundPlayInitializeToPlayAudioThenRecordTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName), iReinitialized(EFalse) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundPlayInitializeToPlayAudioThenRecordTest* RA3FDevSoundPlayInitializeToPlayAudioThenRecordTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundPlayInitializeToPlayAudioThenRecordTest* self = new (ELeave) RA3FDevSoundPlayInitializeToPlayAudioThenRecordTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundPlayInitializeToPlayAudioThenRecordTest::DoKickoffTestL() sl@0: { sl@0: TPtrC fourccCode; sl@0: if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: EncodingFromStringToTFourCC(fourccCode); sl@0: } sl@0: sl@0: void RA3FDevSoundPlayInitializeToPlayAudioThenRecordTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayInitializeToPlayAudioThenRecordTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: if(!iReinitialized) sl@0: { sl@0: INFO_PRINTF1(_L("========== First initialization successfully completed ==========")); sl@0: iReinitialized = ETrue; sl@0: INFO_PRINTF1(_L("Again calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording)); sl@0: if(err != KErrNone) sl@0: { sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("========== Second initialization successfully completed ==========")); sl@0: StopTest(); sl@0: } sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0013 sl@0: */ sl@0: RA3FDevSoundPlayInitializeInvalidTFourCCTest::RA3FDevSoundPlayInitializeInvalidTFourCCTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundPlayInitializeInvalidTFourCCTest* RA3FDevSoundPlayInitializeInvalidTFourCCTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundPlayInitializeInvalidTFourCCTest* self = new (ELeave) RA3FDevSoundPlayInitializeInvalidTFourCCTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundPlayInitializeInvalidTFourCCTest::DoKickoffTestL() sl@0: { sl@0: } sl@0: sl@0: void RA3FDevSoundPlayInitializeInvalidTFourCCTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayInitializeInvalidTFourCCTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, 0x00000000, EMMFStatePlaying)); sl@0: if(err == KErrNotSupported) sl@0: { sl@0: INFO_PRINTF2(_L("Calling CMMFDevSound::InitializeL using an invalid TFourCC argument left with expected error = %d"), err); sl@0: StopTest(err, EPass); sl@0: break; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("Calling CMMFDevSound::InitializeL using an invalid TFourCC argument left with expected error = %d"), err); sl@0: ERR_PRINTF2(_L("Expected error = %d"), KErrNotSupported); sl@0: StopTest(err, EFail); sl@0: } sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0014 sl@0: */ sl@0: RA3FDevSoundRecordInitializationTest::RA3FDevSoundRecordInitializationTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundRecordInitializationTest* RA3FDevSoundRecordInitializationTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundRecordInitializationTest* self = new (ELeave) RA3FDevSoundRecordInitializationTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundRecordInitializationTest::DoKickoffTestL() sl@0: { sl@0: TPtrC fourccCode; sl@0: if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: EncodingFromStringToTFourCC(fourccCode); sl@0: } sl@0: sl@0: void RA3FDevSoundRecordInitializationTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundRecordInitializationTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: INFO_PRINTF1(_L("========== Test Case Successfully Completed ==========")); sl@0: StopTest(); sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0015 sl@0: */ sl@0: RA3FDevSoundRecordCancelInitializeTest::RA3FDevSoundRecordCancelInitializeTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName),iInitCompleteReceived(EFalse), sl@0: iSampleRate(0), iChannels(0) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundRecordCancelInitializeTest* RA3FDevSoundRecordCancelInitializeTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundRecordCancelInitializeTest* self = new (ELeave) RA3FDevSoundRecordCancelInitializeTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundRecordCancelInitializeTest::DoKickoffTestL() sl@0: { sl@0: if (!GetIntFromConfig(iTestStepName, KSampleRate, iSampleRate)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KSampleRate); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: if (!GetIntFromConfig(iTestStepName, KChannel, iChannels)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KChannel); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: TPtrC fourccCode; sl@0: if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: EncodingFromStringToTFourCC(fourccCode); sl@0: iTimer = CPeriodic::NewL(CActive::EPriorityHigh); sl@0: } sl@0: sl@0: void RA3FDevSoundRecordCancelInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundRecordCancelInitializeTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: StartTimer(KMicroSecsTwoSec); sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::CancelInitialize")); sl@0: err = iMMFDevSound->CancelInitialize(); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("Unexpected error on CancelInitialize = %d"), err); sl@0: StopTest(err); sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete) sl@0: { sl@0: iInitCompleteReceived = ETrue; sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: void RA3FDevSoundRecordCancelInitializeTest::DoTimerCallback() sl@0: { sl@0: if(!iInitCompleteReceived) sl@0: { sl@0: INFO_PRINTF1(_L("Waiting for InitializeComplete event")); sl@0: iInitCompleteReceived = ETrue; sl@0: } sl@0: else sl@0: { sl@0: iTimer->Cancel(); sl@0: TMMFCapabilities capabilitiesSet; sl@0: TBuf stringSampleRateSet; sl@0: TBuf stringChannelsSet; sl@0: SampleRateFromTIntToTMMFSampleRate (iSampleRate, iESampleRate); sl@0: capabilitiesSet.iRate = iESampleRate; sl@0: capabilitiesSet.iChannels = iChannels; sl@0: SampleRateFromTUintToString (capabilitiesSet.iRate, stringSampleRateSet); sl@0: ChannelsFromTUintToString (capabilitiesSet.iChannels, stringChannelsSet); sl@0: INFO_PRINTF3(_L("Settings for Sample rate an channel mode. %S %S"), &stringSampleRateSet, &stringChannelsSet); sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::SetConfigL")); sl@0: TRAPD(err, iMMFDevSound->SetConfigL(capabilitiesSet)); sl@0: if (err == KErrNotReady) sl@0: { sl@0: INFO_PRINTF2(_L("CMMFDevSound::SetConfigL left with the expected error = %d"), err); sl@0: StopTest(); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("CMMFDevSound::SetConfigL left with error = %d"), err); sl@0: ERR_PRINTF2(_L("Expected error value = %d"), KErrNotReady); sl@0: StopTest(err, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: void RA3FDevSoundRecordCancelInitializeTest::InitializeComplete(TInt aError) sl@0: { sl@0: ERR_PRINTF1(_L("DevSound called InitializeComplete after calling CMMFDevSound::CancelInitialize")); sl@0: StopTest(aError, EFail); sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0016 sl@0: */ sl@0: RA3FDevSoundRecordInitializeThenPlayToneInitializeTest::RA3FDevSoundRecordInitializeThenPlayToneInitializeTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName), iReinitialized(EFalse) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundRecordInitializeThenPlayToneInitializeTest* RA3FDevSoundRecordInitializeThenPlayToneInitializeTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundRecordInitializeThenPlayToneInitializeTest* self = new (ELeave) RA3FDevSoundRecordInitializeThenPlayToneInitializeTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundRecordInitializeThenPlayToneInitializeTest::DoKickoffTestL() sl@0: { sl@0: TPtrC fourccCode; sl@0: if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: EncodingFromStringToTFourCC(fourccCode); sl@0: } sl@0: sl@0: void RA3FDevSoundRecordInitializeThenPlayToneInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundRecordInitializeThenPlayToneInitializeTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: if(!iReinitialized) sl@0: { sl@0: INFO_PRINTF1(_L("========== First initialization successfully completed ==========")); sl@0: iReinitialized = ETrue; sl@0: INFO_PRINTF1(_L("Again calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("========== Second initialization successfully completed ==========")); sl@0: StopTest(); sl@0: } sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0017 sl@0: */ sl@0: RA3FDevSoundRecordInitializeThenPlayAudioInitializeTest::RA3FDevSoundRecordInitializeThenPlayAudioInitializeTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName), iReinitialized(EFalse) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundRecordInitializeThenPlayAudioInitializeTest* RA3FDevSoundRecordInitializeThenPlayAudioInitializeTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundRecordInitializeThenPlayAudioInitializeTest* self = new (ELeave) RA3FDevSoundRecordInitializeThenPlayAudioInitializeTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundRecordInitializeThenPlayAudioInitializeTest::DoKickoffTestL() sl@0: { sl@0: TPtrC fourccCode; sl@0: if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: EncodingFromStringToTFourCC(fourccCode); sl@0: } sl@0: sl@0: void RA3FDevSoundRecordInitializeThenPlayAudioInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundRecordInitializeThenPlayAudioInitializeTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: if(!iReinitialized) sl@0: { sl@0: INFO_PRINTF1(_L("========== First initialization successfully completed ==========")); sl@0: iReinitialized = ETrue; sl@0: INFO_PRINTF1(_L("Again calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("========== Second initialization successfully completed ==========")); sl@0: StopTest(); sl@0: } sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0018 sl@0: */ sl@0: RA3FDevSoundRecordInitializeToRecordAudioTwiceTest::RA3FDevSoundRecordInitializeToRecordAudioTwiceTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName), iReinitialized(EFalse) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundRecordInitializeToRecordAudioTwiceTest* RA3FDevSoundRecordInitializeToRecordAudioTwiceTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundRecordInitializeToRecordAudioTwiceTest* self = new (ELeave) RA3FDevSoundRecordInitializeToRecordAudioTwiceTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundRecordInitializeToRecordAudioTwiceTest::DoKickoffTestL() sl@0: { sl@0: TPtrC fourccCode; sl@0: if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: EncodingFromStringToTFourCC(fourccCode); sl@0: } sl@0: sl@0: void RA3FDevSoundRecordInitializeToRecordAudioTwiceTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundRecordInitializeToRecordAudioTwiceTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: if(!iReinitialized) sl@0: { sl@0: INFO_PRINTF1(_L("========== First initialization successfully completed ==========")); sl@0: iReinitialized = ETrue; sl@0: INFO_PRINTF1(_L("Again calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording)); sl@0: if(err != KErrNone) sl@0: { sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("========== Second initialization successfully completed ==========")); sl@0: StopTest(); sl@0: } sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0019 sl@0: */ sl@0: RA3FDevSoundRecordInitializeNoFormatSpecificationPresentedTest::RA3FDevSoundRecordInitializeNoFormatSpecificationPresentedTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundRecordInitializeNoFormatSpecificationPresentedTest* RA3FDevSoundRecordInitializeNoFormatSpecificationPresentedTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundRecordInitializeNoFormatSpecificationPresentedTest* self = new (ELeave) RA3FDevSoundRecordInitializeNoFormatSpecificationPresentedTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundRecordInitializeNoFormatSpecificationPresentedTest::DoKickoffTestL() sl@0: { sl@0: } sl@0: sl@0: void RA3FDevSoundRecordInitializeNoFormatSpecificationPresentedTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundReocordCancelInitializeNoFormatSpecificationPresentedTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateRecording)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: INFO_PRINTF1(_L("========== Test Case Successfully Completed ==========")); sl@0: StopTest(); sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0020 sl@0: */ sl@0: RA3FDevSoundPlayDataWithoutInitializeTest::RA3FDevSoundPlayDataWithoutInitializeTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundPlayDataWithoutInitializeTest* RA3FDevSoundPlayDataWithoutInitializeTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundPlayDataWithoutInitializeTest* self = new (ELeave) RA3FDevSoundPlayDataWithoutInitializeTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundPlayDataWithoutInitializeTest::DoKickoffTestL() sl@0: { sl@0: iTimer = CPeriodic::NewL(CActive::EPriorityHigh); sl@0: } sl@0: sl@0: void RA3FDevSoundPlayDataWithoutInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayDataWithoutInitializeTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Call CMMFDevSound::PlayData without calling CMMFDevSound::InitializeL...")); sl@0: iMMFDevSound->PlayData(); sl@0: StartTimer(KMicroSecsTwoSec); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: void RA3FDevSoundPlayDataWithoutInitializeTest::DoTimerCallback() sl@0: { sl@0: iTimer->Cancel(); sl@0: ERR_PRINTF1(_L("Panic did not occur as expected when calling PlayData().")); sl@0: StopTest(KErrNone, EFail); sl@0: } sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0021 sl@0: */ sl@0: RA3FDevSoundPlayDTMFStringWithoutInitializeTest::RA3FDevSoundPlayDTMFStringWithoutInitializeTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName), iDTMFString(KNullDesC) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundPlayDTMFStringWithoutInitializeTest* RA3FDevSoundPlayDTMFStringWithoutInitializeTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundPlayDTMFStringWithoutInitializeTest* self = new (ELeave) RA3FDevSoundPlayDTMFStringWithoutInitializeTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundPlayDTMFStringWithoutInitializeTest::DoKickoffTestL() sl@0: { sl@0: TPtrC DTMF; sl@0: if(!GetStringFromConfig(iTestStepName, KDTMFString, DTMF)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KDTMFString); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: iDTMFString.Copy(DTMF); sl@0: } sl@0: sl@0: void RA3FDevSoundPlayDTMFStringWithoutInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayDTMFStringWithoutInitializeTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Call CMMFDevSound::PlayDTMFStringL...")); sl@0: TRAPD(err, iMMFDevSound->PlayDTMFStringL(iDTMFString)); sl@0: if(err == KErrNotReady) sl@0: { sl@0: ERR_PRINTF2(_L("Calling CMMFDevSound::PlayDTMFStringL without calling CMMFDevSound::InitializeL left with expected error = %d"), err); sl@0: StopTest(err, EPass); sl@0: break; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::PlayDTMFStringL without calling CMMFDevSound::InitializeL left with error = %d"), err); sl@0: ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady); sl@0: StopTest(err, EFail); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0022 sl@0: */ sl@0: RA3FDevSoundPlayDualToneWithoutInitializeTest::RA3FDevSoundPlayDualToneWithoutInitializeTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName), iFrequencyTone1(0), iFrequencyTone2(0) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundPlayDualToneWithoutInitializeTest* RA3FDevSoundPlayDualToneWithoutInitializeTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundPlayDualToneWithoutInitializeTest* self = new (ELeave) RA3FDevSoundPlayDualToneWithoutInitializeTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundPlayDualToneWithoutInitializeTest::DoKickoffTestL() sl@0: { sl@0: if(!GetIntFromConfig(iTestStepName, KDuration, iDuration)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KDuration); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: if(!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: if(!GetIntFromConfig(iTestStepName, KFrequencyTone2, iFrequencyTone2)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone2); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: } sl@0: sl@0: void RA3FDevSoundPlayDualToneWithoutInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayDualToneWithoutInitializeTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Call CMMFDevSound::PlayDualToneL...")); sl@0: TRAPD(err, iMMFDevSound->PlayDualToneL(iFrequencyTone1,iFrequencyTone2,iDuration)); sl@0: if(err == KErrNotReady) sl@0: { sl@0: ERR_PRINTF2(_L("Calling CMMFDevSound::PlayDualToneL without calling CMMFDevSound::InitializeL left with expected error = %d"), err); sl@0: StopTest(err, EPass); sl@0: break; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::PlayDualToneL without calling CMMFDevSound::InitializeL left with error = %d"), err); sl@0: ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady); sl@0: StopTest(err, EFail); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0023 sl@0: */ sl@0: RA3FDevSoundPlayFixedSequenceWithoutInitializeTest::RA3FDevSoundPlayFixedSequenceWithoutInitializeTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundPlayFixedSequenceWithoutInitializeTest* RA3FDevSoundPlayFixedSequenceWithoutInitializeTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundPlayFixedSequenceWithoutInitializeTest* self = new (ELeave) RA3FDevSoundPlayFixedSequenceWithoutInitializeTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundPlayFixedSequenceWithoutInitializeTest::DoKickoffTestL() sl@0: { sl@0: } sl@0: sl@0: void RA3FDevSoundPlayFixedSequenceWithoutInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayFixedSequenceWithoutInitializeTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Call CMMFDevSound::PlayFixedSequenceL...")); sl@0: TRAPD(err, iMMFDevSound->PlayFixedSequenceL(0)); sl@0: if(err == KErrNotSupported) sl@0: { sl@0: ERR_PRINTF2(_L("Calling CMMFDevSound::PlayFixedSequenceL without calling CMMFDevSound::InitializeL left with expected error = %d"), err); sl@0: StopTest(err, EPass); sl@0: break; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::PlayFixedSequenceL without calling CMMFDevSound::InitializeL left with error = %d"), err); sl@0: ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady); sl@0: StopTest(err, EFail); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0024 sl@0: */ sl@0: RA3FDevSoundPlayInitWithoutInitializeTest::RA3FDevSoundPlayInitWithoutInitializeTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundPlayInitWithoutInitializeTest* RA3FDevSoundPlayInitWithoutInitializeTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundPlayInitWithoutInitializeTest* self = new (ELeave) RA3FDevSoundPlayInitWithoutInitializeTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundPlayInitWithoutInitializeTest::DoKickoffTestL() sl@0: { sl@0: } sl@0: sl@0: void RA3FDevSoundPlayInitWithoutInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayInitWithoutInitializeTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Call CMMFDevSound::PlayInitL without calling CMMFDevSound::InitializeL...")); sl@0: TRAPD(err,iMMFDevSound->PlayInitL()); sl@0: if(err == KErrNotReady) sl@0: { sl@0: ERR_PRINTF2(_L("Calling CMMFDevSound::PlayInitL without calling CMMFDevSound::InitializeL left with expected error = %d"), err); sl@0: StopTest(err, EPass); sl@0: break; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::PlayInitL without calling CMMFDevSound::InitializeL left with error = %d"), err); sl@0: ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady); sl@0: StopTest(err, EFail); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0025 sl@0: */ sl@0: RA3FDevSoundPlayToneWithoutInitializeTest::RA3FDevSoundPlayToneWithoutInitializeTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName), iFrequencyTone1(0) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundPlayToneWithoutInitializeTest* RA3FDevSoundPlayToneWithoutInitializeTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundPlayToneWithoutInitializeTest* self = new (ELeave) RA3FDevSoundPlayToneWithoutInitializeTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundPlayToneWithoutInitializeTest::DoKickoffTestL() sl@0: { sl@0: if(!GetIntFromConfig(iTestStepName, KDuration, iDuration)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KDuration); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: if(!GetIntFromConfig(iTestStepName, KFrequencyTone1, iFrequencyTone1)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KFrequencyTone1); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: } sl@0: sl@0: void RA3FDevSoundPlayToneWithoutInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayToneWithoutInitializeTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Call CMMFDevSound::PlayToneL...")); sl@0: TRAPD(err, iMMFDevSound->PlayToneL(iFrequencyTone1, iDuration)); sl@0: if(err == KErrNotReady) sl@0: { sl@0: ERR_PRINTF2(_L("Calling CMMFDevSound::PlayToneL without calling CMMFDevSound::InitializeL left with expected error = %d"), err); sl@0: StopTest(err, EPass); sl@0: break; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::PlayToneL without calling CMMFDevSound::InitializeL left with error = %d"), err); sl@0: ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady); sl@0: StopTest(err, EFail); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0026 sl@0: */ sl@0: RA3FDevSoundPlayToneSequenceWithoutInitializeTest::RA3FDevSoundPlayToneSequenceWithoutInitializeTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundPlayToneSequenceWithoutInitializeTest* RA3FDevSoundPlayToneSequenceWithoutInitializeTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundPlayToneSequenceWithoutInitializeTest* self = new (ELeave) RA3FDevSoundPlayToneSequenceWithoutInitializeTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundPlayToneSequenceWithoutInitializeTest::DoKickoffTestL() sl@0: { sl@0: } sl@0: sl@0: void RA3FDevSoundPlayToneSequenceWithoutInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayToneSequenceWithoutInitializeTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: TUint8* tablePointer = const_cast( &(KFixedSequenceTestSequenceDataX[0] )); sl@0: TPtrC8 KFixedSequenceData(tablePointer, sizeof(KFixedSequenceTestSequenceDataX)); sl@0: INFO_PRINTF1(_L("Call CMMFDevSound::PlayToneSequenceL...")); sl@0: TRAPD(err, iMMFDevSound->PlayToneSequenceL(KFixedSequenceData)); sl@0: if(err == KErrNotReady) sl@0: { sl@0: ERR_PRINTF2(_L("Calling CMMFDevSound::PlayToneSequenceL without calling CMMFDevSound::InitializeL left with expected error = %d"), err); sl@0: StopTest(err, EPass); sl@0: break; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::PlayToneSequenceL without calling CMMFDevSound::InitializeL left with error = %d"), err); sl@0: ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady); sl@0: StopTest(err, EFail); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0027 sl@0: */ sl@0: RA3FDevSoundRecordDataWithoutInitializeTest::RA3FDevSoundRecordDataWithoutInitializeTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundRecordDataWithoutInitializeTest* RA3FDevSoundRecordDataWithoutInitializeTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundRecordDataWithoutInitializeTest* self = new (ELeave) RA3FDevSoundRecordDataWithoutInitializeTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundRecordDataWithoutInitializeTest::DoKickoffTestL() sl@0: { sl@0: iTimer = CPeriodic::NewL(CActive::EPriorityHigh); sl@0: } sl@0: sl@0: void RA3FDevSoundRecordDataWithoutInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundRecordDataWithoutInitializeTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Call CMMFDevSound::RecordData without calling CMMFDevSound::InitializeL...")); sl@0: iMMFDevSound->RecordData(); sl@0: StartTimer(KMicroSecsTwoSec); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: void RA3FDevSoundRecordDataWithoutInitializeTest::DoTimerCallback() sl@0: { sl@0: iTimer->Cancel(); sl@0: ERR_PRINTF1(_L("Panic did not occur as expected when calling RecordData().")); sl@0: StopTest(KErrNone, EFail); sl@0: } sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0028 sl@0: */ sl@0: RA3FDevSoundRecordInitWithoutInitializeTest::RA3FDevSoundRecordInitWithoutInitializeTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundRecordInitWithoutInitializeTest* RA3FDevSoundRecordInitWithoutInitializeTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundRecordInitWithoutInitializeTest* self = new (ELeave) RA3FDevSoundRecordInitWithoutInitializeTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundRecordInitWithoutInitializeTest::DoKickoffTestL() sl@0: { sl@0: } sl@0: sl@0: void RA3FDevSoundRecordInitWithoutInitializeTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundRecordInitWithoutInitializeTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Call CMMFDevSound::RecordInitL without calling CMMFDevSound::InitializeL...")); sl@0: TRAPD(err,iMMFDevSound->RecordInitL()); sl@0: if(err == KErrNotReady) sl@0: { sl@0: ERR_PRINTF2(_L("Calling CMMFDevSound::RecordInitL without calling CMMFDevSound::InitializeL left with expected error = %d"), err); sl@0: StopTest(err, EPass); sl@0: break; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::RecordInitL without calling CMMFDevSound::InitializeL left with error = %d"), err); sl@0: ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady); sl@0: StopTest(err, EFail); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0029 sl@0: */ sl@0: RA3FDevSoundToneInitializationMoreThanOnceBeforeInitCompleteTest::RA3FDevSoundToneInitializationMoreThanOnceBeforeInitCompleteTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundToneInitializationMoreThanOnceBeforeInitCompleteTest* RA3FDevSoundToneInitializationMoreThanOnceBeforeInitCompleteTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundToneInitializationMoreThanOnceBeforeInitCompleteTest* self = new (ELeave) RA3FDevSoundToneInitializationMoreThanOnceBeforeInitCompleteTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundToneInitializationMoreThanOnceBeforeInitCompleteTest::DoKickoffTestL() sl@0: { sl@0: } sl@0: sl@0: void RA3FDevSoundToneInitializationMoreThanOnceBeforeInitCompleteTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundToneInitializationMoreThanOnceBeforeInitCompleteTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("CMMFDevSound::InitializeL called twice before init complete")); sl@0: TRAP(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying)); sl@0: if(err != KErrNotReady) sl@0: { sl@0: ERR_PRINTF2(_L("Calling CMMFDevSound::InitializeL more than once before init complete left with error = %d"), err); sl@0: ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady); sl@0: StopTest(err, EFail); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("Second call to CMMFDevSound::InitializeL leaves with KErrNotReady as expected")); sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: INFO_PRINTF1(_L("========== Test Case Successfully Completed ==========")); sl@0: StopTest(); sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0030 sl@0: */ sl@0: RA3FDevSoundPlayInitializationMoreThanOnceBeforeInitCompleteTest::RA3FDevSoundPlayInitializationMoreThanOnceBeforeInitCompleteTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundPlayInitializationMoreThanOnceBeforeInitCompleteTest* RA3FDevSoundPlayInitializationMoreThanOnceBeforeInitCompleteTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundPlayInitializationMoreThanOnceBeforeInitCompleteTest* self = new (ELeave) RA3FDevSoundPlayInitializationMoreThanOnceBeforeInitCompleteTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundPlayInitializationMoreThanOnceBeforeInitCompleteTest::DoKickoffTestL() sl@0: { sl@0: TPtrC fourccCode; sl@0: if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: EncodingFromStringToTFourCC(fourccCode); sl@0: } sl@0: sl@0: void RA3FDevSoundPlayInitializationMoreThanOnceBeforeInitCompleteTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayInitializationMoreThanOnceBeforeInitCompleteTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("CMMFDevSound::InitializeL called twice before init complete")); sl@0: TRAP(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); sl@0: if(err != KErrNotReady) sl@0: { sl@0: ERR_PRINTF2(_L("Calling CMMFDevSound::InitializeL more than once before init complete left with error = %d"), err); sl@0: ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady); sl@0: StopTest(err, EFail); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("Second call to CMMFDevSound::InitializeL leaves with KErrNotReady as expected")); sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: INFO_PRINTF1(_L("========== Test Case Successfully Completed ==========")); sl@0: StopTest(); sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0031 sl@0: */ sl@0: RA3FDevSoundRecordInitializationMoreThanOnceBeforeInitCompleteTest::RA3FDevSoundRecordInitializationMoreThanOnceBeforeInitCompleteTest(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundRecordInitializationMoreThanOnceBeforeInitCompleteTest* RA3FDevSoundRecordInitializationMoreThanOnceBeforeInitCompleteTest::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundRecordInitializationMoreThanOnceBeforeInitCompleteTest* self = new (ELeave) RA3FDevSoundRecordInitializationMoreThanOnceBeforeInitCompleteTest(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundRecordInitializationMoreThanOnceBeforeInitCompleteTest::DoKickoffTestL() sl@0: { sl@0: TPtrC fourccCode; sl@0: if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: EncodingFromStringToTFourCC(fourccCode); sl@0: } sl@0: sl@0: void RA3FDevSoundRecordInitializationMoreThanOnceBeforeInitCompleteTest::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundRecordInitializationMoreThanOnceBeforeInitCompleteTest"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording)); sl@0: if(err != KErrNone) sl@0: { sl@0: INFO_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("CMMFDevSound::InitializeL called twice before init complete")); sl@0: TRAP(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording)); sl@0: if(err != KErrNotReady) sl@0: { sl@0: ERR_PRINTF2(_L("Calling MMFDevSound::InitializeL more than once before init complete left with error = %d"), err); sl@0: ERR_PRINTF2(_L("Expected error = %d"), KErrNotReady); sl@0: StopTest(err, EFail); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("Second call to CMMFDevSound::InitializeL leaves with KErrNotReady as expected")); sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: INFO_PRINTF1(_L("========== Test Case Successfully Completed ==========")); sl@0: StopTest(); sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0032 sl@0: */ sl@0: RA3FDevSoundToneFirstInitializationLeavesThenSecondSucceeds::RA3FDevSoundToneFirstInitializationLeavesThenSecondSucceeds(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundToneFirstInitializationLeavesThenSecondSucceeds* RA3FDevSoundToneFirstInitializationLeavesThenSecondSucceeds::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundToneFirstInitializationLeavesThenSecondSucceeds* self = new (ELeave) RA3FDevSoundToneFirstInitializationLeavesThenSecondSucceeds(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundToneFirstInitializationLeavesThenSecondSucceeds::DoKickoffTestL() sl@0: { sl@0: } sl@0: sl@0: void RA3FDevSoundToneFirstInitializationLeavesThenSecondSucceeds::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundToneFirstInitializationLeavesThenSecondSucceed"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL to make it leave")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, EMMFStateConverting)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF1(_L("CMMFDevSound::InitializeL did not leave as expected")); sl@0: StopTest(err, EFail); sl@0: } sl@0: INFO_PRINTF1(_L("CMMFDevSound::InitializeL called twice, but now using right parameters")); sl@0: TRAP(err, iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: INFO_PRINTF1(_L("========== Test Case Successfully Completed ==========")); sl@0: StopTest(); sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0033 sl@0: */ sl@0: RA3FDevSoundPlayFirstInitializationLeavesThenSecondSucceeds::RA3FDevSoundPlayFirstInitializationLeavesThenSecondSucceeds(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundPlayFirstInitializationLeavesThenSecondSucceeds* RA3FDevSoundPlayFirstInitializationLeavesThenSecondSucceeds::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundPlayFirstInitializationLeavesThenSecondSucceeds* self = new (ELeave) RA3FDevSoundPlayFirstInitializationLeavesThenSecondSucceeds(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundPlayFirstInitializationLeavesThenSecondSucceeds::DoKickoffTestL() sl@0: { sl@0: TPtrC fourccCode; sl@0: if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: EncodingFromStringToTFourCC(fourccCode); sl@0: } sl@0: sl@0: void RA3FDevSoundPlayFirstInitializationLeavesThenSecondSucceeds::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundPlayFirstInitializationLeavesThenSecondSucceed"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL to make it leave")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateConverting)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF1(_L("CMMFDevSound::InitializeL did not leave as expected")); sl@0: StopTest(err, EFail); sl@0: } sl@0: INFO_PRINTF1(_L("CMMFDevSound::InitializeL called twice, but now using right parameters")); sl@0: TRAP(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStatePlaying)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: INFO_PRINTF1(_L("========== Test Case Successfully Completed ==========")); sl@0: StopTest(); sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /* sl@0: *======================================================================================================== sl@0: * MM-A3F-DEVSOUND-CHRTZ-INIT-0034 sl@0: */ sl@0: RA3FDevSoundRecordFirstInitializationLeavesThenSecondSucceeds::RA3FDevSoundRecordFirstInitializationLeavesThenSecondSucceeds(const TDesC& aTestName) sl@0: : RA3FDevSoundTestBase(aTestName) sl@0: { sl@0: } sl@0: sl@0: RA3FDevSoundRecordFirstInitializationLeavesThenSecondSucceeds* RA3FDevSoundRecordFirstInitializationLeavesThenSecondSucceeds::NewL(const TDesC& aTestName) sl@0: { sl@0: RA3FDevSoundRecordFirstInitializationLeavesThenSecondSucceeds* self = new (ELeave) RA3FDevSoundRecordFirstInitializationLeavesThenSecondSucceeds(aTestName); sl@0: return self; sl@0: } sl@0: sl@0: void RA3FDevSoundRecordFirstInitializationLeavesThenSecondSucceeds::DoKickoffTestL() sl@0: { sl@0: TPtrC fourccCode; sl@0: if(!GetStringFromConfig(iTestStepName, KFourccCode, fourccCode)) sl@0: { sl@0: ERR_PRINTF2(KMsgErrorGetParameter, &KFourccCode); sl@0: StopTest(KErrNotFound); sl@0: return; sl@0: } sl@0: EncodingFromStringToTFourCC(fourccCode); sl@0: } sl@0: sl@0: void RA3FDevSoundRecordFirstInitializationLeavesThenSecondSucceeds::Fsm(TMmfDevSoundEvent aDevSoundEvent, TInt aError) sl@0: { sl@0: switch(iDevSoundState) sl@0: { sl@0: case EStateCreated: sl@0: { sl@0: __ASSERT_ALWAYS((aError == KErrNone),Panic(_L("RA3FDevSoundRecordFirstInitializationLeavesThenSecondSucceed"),EFsmIncorrectErrorPassed)); sl@0: if(aDevSoundEvent == EEventInitialize) sl@0: { sl@0: INFO_PRINTF1(_L("Calling CMMFDevSound::InitializeL to make it leave")); sl@0: TRAPD(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateConverting)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF1(_L("CMMFDevSound::InitializeL did not leave as expected")); sl@0: StopTest(err, EFail); sl@0: } sl@0: INFO_PRINTF1(_L("CMMFDevSound::InitializeL called twice, but now using right parameters")); sl@0: TRAP(err, iMMFDevSound->InitializeL(*this, iFourCCCode, EMMFStateRecording)); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("CMMFDevSound::InitializeL left with error = %d"), err); sl@0: StopTest(err); sl@0: break; sl@0: } sl@0: INFO_PRINTF1(_L("DevSound State: EStateInitializing")); sl@0: iDevSoundState = EStateInitializing; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitialize not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: case EStateInitializing: sl@0: { sl@0: if(aDevSoundEvent == EEventInitComplete && aError == KErrNone) sl@0: { sl@0: INFO_PRINTF1(_L("========== Test Case Successfully Completed ==========")); sl@0: StopTest(); sl@0: } sl@0: else if(aDevSoundEvent == EEventInitComplete && aError != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DevSound called CMMFDevSound::InitializeComplete with error = %d"), aError); sl@0: StopTest(aError); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("DevSound EEventInitComplete not received as expected. Received event: %d"), aDevSoundEvent); sl@0: StopTest(aError, EFail); sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: { sl@0: ERR_PRINTF2(_L("Invalid DevSound state received: %d"), iDevSoundState); sl@0: StopTest(aError, EFail); sl@0: } sl@0: } sl@0: }