TVerdict CTestStepCIG711EncoderConfig::DoTestStep0046L() { iTestStepResult = EFail; TInt result = KErrGeneral; INFO_PRINTF1(_L("G711EncoderIntfc - SetEncoderMode")); //Initialize - with the UID of our test HwDevice #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND TUid testUID = {KUidG711EncoderConfigTestDevice}; #else TFourCC testUID('T','0','1','6'); #endif iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); if (iTestStepResult != EPass) { INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); return EInconclusive; } // reset the value as previous test is pass iTestStepResult = EFail; // KUidG711EncoderIntfc MG711EncoderIntfc* ptr = static_cast <MG711EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc)); if (ptr) { MG711EncoderIntfc::TEncodeMode encodeMode = MG711EncoderIntfc::EEncULaw; TInt setEncodeMode = MG711EncoderIntfc::EEncALaw; result = ptr->SetEncoderMode(encodeMode) ; // call method if (result == KErrNone) { // This file is created by the test stub, the plugin device _LIT(KFileName, "c:\\temp\\g711EncoderConfig.txt"); ReadFileL(KFileName, setEncodeMode); if (static_cast<MG711EncoderIntfc::TEncodeMode>(setEncodeMode) == encodeMode) { INFO_PRINTF1(_L("MG711EncoderIntfc::SetEncoderMode finished successfully")); iTestStepResult = EPass; } else { ERR_PRINTF2(_L("MIlbcEncoderIntfc::SetEncoderMode failed with encodeMode %d"), encodeMode); } } else { ERR_PRINTF2(_L("MG711DecoderIntfc::SetEncoderMode failed with error %d"), result); } } else { INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface")); iTestStepResult = EInconclusive; } return iTestStepResult; }
/** @SYMTestCaseID APPFWK-APPARC-0015 @SYMPREQ PREQ1123 @SYMTestCaseDesc The Test determines that the Child dies when its Parent is terminated. @SYMTestPriority Critical @SYMTestStatus Implemented @SYMTestActions. Creates and launches a process (parent). Creates another process (child) passing the first(parent) process ID. Launches the child process. Terminates parent and checks the existance of child process. The child should die. API Calls:\n RProcess::Create(const TDesC &aFileName, const TDesC &aCommand, TOwnerType aType=EOwnerProcess);\n RProcess::Resume(); RProcess::ExitType() const; RProcess::ExitReason() const; RProcess::Id() const; CApaCommandLine::SetProcessEnvironmentL(RProcess &aProcess) const; CApaCommandLine::NewLC(); CApaCommandLine::SetParentProcessId(TProcessId); @SYMTestExpectedResults Termination of child process automatically.\n */ void CT_ProcStep::testChildSetToTerminateL(void) { TInt ret(0); //commandline for parent process CApaCommandLine* parentProcCmdln=CApaCommandLine::NewLC(); INFO_PRINTF1(_L(" CommandLine for Parent Process created ")); //parent process RProcess parentProc; ret = parentProc.Create(KParentExe,KNullDesC); TEST(ret == KErrNone); User::LeaveIfError(ret); CleanupClosePushL(parentProc); INFO_PRINTF2(_L(" Create Parent Process returned : %d"),ret); //attach commandline to parent process TRAP(ret,parentProcCmdln->SetProcessEnvironmentL(parentProc)); TEST(ret == KErrNone); User::LeaveIfError(ret); INFO_PRINTF1(_L(" Attach CommandLine to Process ")); INFO_PRINTF1(_L(" Run Parent Process ")); parentProc.Resume(); //Time for the parent process to launch itself User::After(500000); //commandline for child process //Get parent process ID here TUint64 parentProcId = parentProc.Id(); INFO_PRINTF2(_L(" Parent Process Id = 0x%lx "),parentProcId); CApaCommandLine* childProcCmdln=CApaCommandLine::NewLC(); INFO_PRINTF1(_L(" CommandLine for Child Process created ")); //setting the parent process ID to child childProcCmdln->SetParentProcessId(parentProcId); INFO_PRINTF1(_L(" Set ParentProcessId to Child ")); //child process RProcess childProc; ret = childProc.Create(KChildOneExe,KNullDesC); TEST(ret == KErrNone); User::LeaveIfError(ret); CleanupClosePushL(childProc); INFO_PRINTF2(_L(" Create Child Process returned : %d"),ret); //attach commandline to child process TRAP(ret,childProcCmdln->SetProcessEnvironmentL(childProc)); TEST(ret == KErrNone); User::LeaveIfError(ret); INFO_PRINTF1(_L(" Attach CommandLine to Process ")); INFO_PRINTF1(_L(" Run Child Process ")); childProc.Resume(); //Time for the child process to launch itself User::After(500000); //child process Id is reqd to monitor if it gets killed on its parent's termination TUint64 childProcId = childProc.Id(); INFO_PRINTF2(_L(" Child Process Id = 0x%lx "),childProcId); CChildProcess* childProcess=NULL; TRAP(ret, childProcess=CChildProcess::NewL(parentProc,childProcId)); TEST(ret == KErrNone); User::LeaveIfError(ret); CleanupStack::PushL(childProcess); TExitType exitType = parentProc.ExitType(); TEST(exitType == EExitTerminate); TInt exitReason = parentProc.ExitReason(); TEST(exitReason == 0); if(exitType==EExitTerminate && exitReason==0) { INFO_PRINTF1(_L(" Parent process is Terminated")); } exitType = childProc.ExitType(); TEST(exitType == EExitTerminate); exitReason = childProc.ExitReason(); TEST(exitReason == 0); if(exitType == EExitTerminate && exitReason==0) { INFO_PRINTF1(_L(" The child process is killed automatically ... ")); } CleanupStack::PopAndDestroy(childProcess); CleanupStack::PopAndDestroy(&childProc); CleanupStack::PopAndDestroy(childProcCmdln); CleanupStack::PopAndDestroy(&parentProc); CleanupStack::PopAndDestroy(parentProcCmdln); }
/** @SYMTestCaseID APPFWK-APPARC-0017 @SYMPREQ PREQ1123 @SYMTestCaseDesc Test determines that one Child remains and another terminates when their Parent terminates, based on their creation. @SYMTestPriority High @SYMTestStatus Implemented @SYMTestActions. Creates and launches a process (parent). Creates a process (child I) passing the first (parent) process ID. Creates a second process (child II) without passing the first (parent) process ID. Launches both the child processes. Terminates parent and checks the existance of both the child processes. Child I should die and Child II should remain alive. API Calls:\n RProcess::Create(const TDesC &aFileName, const TDesC &aCommand, TOwnerType aType=EOwnerProcess);\n RProcess::Resume(); RProcess::ExitType() const; RProcess::ExitReason() const; RProcess::Id() const; RProcess::Terminate(TInt aReason); CApaCommandLine::SetProcessEnvironmentL(RProcess &aProcess) const; CApaCommandLine::NewLC(); CApaCommandLine::SetParentProcessId(TProcessId); @SYMTestExpectedResults Termination of first child process and existence of the second.\n */ void CT_ProcStep::testTwoChildsOneToTerminateAndOtherToRemainL(void) { TInt ret(0); TExitType exitType; //commandline for parent process CApaCommandLine* parentProcCmdln=CApaCommandLine::NewLC(); INFO_PRINTF1(_L(" CommandLine for Parent Process created ")); //parent process RProcess parentProc; ret = parentProc.Create(KParentExe,KNullDesC); TEST(ret == KErrNone); User::LeaveIfError(ret); CleanupClosePushL(parentProc); INFO_PRINTF2(_L(" Create Parent Process returned : %d"),ret); //attach commandline to parent process TRAP(ret,parentProcCmdln->SetProcessEnvironmentL(parentProc)); TEST(ret == KErrNone); User::LeaveIfError(ret); INFO_PRINTF1(_L(" Attach CommandLine to Process ")); INFO_PRINTF1(_L(" Run Parent Process ")); parentProc.Resume(); //Time for the parent process to launch itself User::After(500000); //commandline for child process //Get parent process ID here TUint64 parentProcId = parentProc.Id(); INFO_PRINTF2(_L(" Parent Process Id = 0x%lx"),parentProcId); //For Child ONE CApaCommandLine* childProcOneCmdln=CApaCommandLine::NewLC(); INFO_PRINTF1(_L(" CommandLine for Child One created ")); //setting the parent process ID to child I childProcOneCmdln->SetParentProcessId(parentProcId); INFO_PRINTF1(_L(" Set ParentProcessId to Child One ")); //child process ONE RProcess childProcOne; ret = childProcOne.Create(KChildOneExe,KNullDesC); TEST(ret == KErrNone); User::LeaveIfError(ret); CleanupClosePushL(childProcOne); INFO_PRINTF2(_L(" Create Child One returned : %d"),ret); //attach commandline to child process TRAP(ret,childProcOneCmdln->SetProcessEnvironmentL(childProcOne)); TEST(ret == KErrNone); User::LeaveIfError(ret); INFO_PRINTF1(_L(" Attach CommandLine of Child One to its Process ")); INFO_PRINTF1(_L(" Run Child One ")); childProcOne.Resume(); //Time for the child one to launch itself User::After(500000); //child process Id is reqd to monitor if it gets killed on its parent's termination TUint64 childProcOneId = childProcOne.Id(); INFO_PRINTF2(_L(" Child One Id = 0x%lx "),childProcOneId); //For Child TWO CApaCommandLine* childProcTwoCmdln=CApaCommandLine::NewLC(); INFO_PRINTF1(_L(" CommandLine for Child Two created ")); //child process TWO RProcess childProcTwo; ret = childProcTwo.Create(KChildTwoExe,KNullDesC); TEST(ret == KErrNone); User::LeaveIfError(ret); CleanupClosePushL(childProcTwo); INFO_PRINTF2(_L(" Create Child Two returned : %d"),ret); //attach commandline to child process TRAP(ret,childProcTwoCmdln->SetProcessEnvironmentL(childProcTwo)); TEST(ret == KErrNone); User::LeaveIfError(ret); INFO_PRINTF1(_L(" Attach CommandLine of Child Two to its Process ")); INFO_PRINTF1(_L(" Run Child Two ")); childProcTwo.Resume(); //Time for the child one to launch itself User::After(500000); //child II process Id is reqd to monitor if it gets killed on its parent's termination TUint64 childProcTwoId = childProcTwo.Id(); INFO_PRINTF2(_L(" Child Two Id = 0x%lx "),childProcTwoId); CChildProcess* childProcess=NULL; TRAP(ret, childProcess=CChildProcess::NewL(parentProc,childProcOneId)); TEST(ret == KErrNone); User::LeaveIfError(ret); CleanupStack::PushL(childProcess); exitType = parentProc.ExitType(); TEST(exitType == EExitTerminate); TInt exitReason = parentProc.ExitReason(); TEST(exitReason == 0); if(exitType==EExitTerminate && exitReason==0) { INFO_PRINTF1(_L(" Parent process is Terminated")); } exitType = childProcOne.ExitType(); TEST(exitType == EExitTerminate); exitReason = childProcOne.ExitReason(); TEST(exitReason == 0); if(exitType==EExitTerminate && exitReason==0) { INFO_PRINTF1(_L(" Child I is killed automatically ... ")); } //Wait and see if child II terminates automatically... User::After(10000000); exitType = childProcTwo.ExitType(); TEST(exitType == EExitPending); if(exitType==EExitPending) { INFO_PRINTF1(_L(" Child II running successfully")); childProcTwo.Terminate(KTProcTerminatingChildII); exitType = childProcTwo.ExitType(); TEST(exitType==EExitTerminate); exitReason = childProcTwo.ExitReason(); TEST(exitReason == KTProcTerminatingChildII); INFO_PRINTF1(_L(" So Terminated it manually ...")); } CleanupStack::PopAndDestroy(childProcess); CleanupStack::PopAndDestroy(&childProcTwo); CleanupStack::PopAndDestroy(childProcTwoCmdln); CleanupStack::PopAndDestroy(&childProcOne); CleanupStack::PopAndDestroy(childProcOneCmdln); CleanupStack::PopAndDestroy(&parentProc); CleanupStack::PopAndDestroy(parentProcCmdln); }
/** * * Do the test step. * Each test step must supply an implementation for DoTestStepL. * * @return "TVerdict" * The result of the test step * * @xxxx * */ TVerdict CTestStepRecorderBitRate::DoTestStepL() { iTestStepResult = EPass; TInt err = KErrNone; TUint bitrate = 0; RArray<TUint> supBitRates; if (!iIsConverterTest) { // get the type of the openned file of known bitrate // (wav file 8KHz x 16 bit = 128 Kbps) // and check if type correct TRAP(err, bitrate = iRecorder->DestinationBitRateL()); if (err != KErrNone || bitrate != 128000) return EFail; // close this file and iRecorder->Close(); //open a new non-existing file for recording TRAP(err, iRecorder->OpenFileL(iFileName2)); if (err != KErrNone || iError != KErrNone) return EInconclusive; CActiveScheduler::Start(); if (iError != KErrNone) return EFail; // check the number of supported bitrates // just checking that there are some bitrates available TRAP(err, iRecorder->GetSupportedBitRatesL(supBitRates)); if ( err != KErrNotSupported ) // KErrNotSupported expected { if (err != KErrNone || supBitRates.Count() <= 0 ) return EFail; } // set the destination bitrate to a specific one of our choice TRAP(err, iRecorder->SetDestinationBitRateL(64000)); //NB KErrNotSupported is a valid response, the format used may not support this ability //If it is supported, read the value to confirm it was correctly set. if ( err != KErrNotSupported ) { if (err != KErrNone) return EFail; //get the newly set type //and check if it has been set correctly TRAP(err, bitrate = iRecorder->DestinationBitRateL()); if ( err != KErrNotSupported ) { if (err != KErrNone || bitrate != 64000) return EFail; } } TInt errorSetDestinationBitRate = err; //get the newly set type //and check if it has been set correctly TRAP(err, bitrate = iRecorder->DestinationBitRateL()); if ( err != KErrNotSupported ) { if (err != KErrNone || (errorSetDestinationBitRate == KErrNone && bitrate != 64000)) return EFail; } } else // IsConverterTest == ETrue { // get source file known bitrate // (wav file 8KHz x 16 bit = 128 Kbps) // and check if type correct TRAP(err, bitrate = iConvert->SourceBitRateL()); if (err != KErrNone || bitrate != 128000) return EFail; // check the number of supported bitrates // just checking that there are some bitrates available TRAP(err, iConvert->GetSupportedConversionBitRatesL(supBitRates)); if ( err != KErrNotSupported ) // KErrNotSupported expected { if (err != KErrNone || supBitRates.Count() <= 0 ) return EFail; } // set the destination bitrate to a specific one of our choice TRAP(err, iConvert->SetDestinationBitRateL(64000)); //NB KErrNotSupported is a valid response, the format used may not support this ability //If it is supported, read the value to confirm it was correctly set. if ( err != KErrNotSupported ) { if (err != KErrNone) return EFail; } TInt errSetDestinationBitRate = err; //get the newly set type //and check if it has been set correctly TRAP(err, bitrate = iConvert->DestinationBitRateL()); if ( err != KErrNotSupported ) { if ((err == KErrNone && errSetDestinationBitRate == KErrNone && bitrate != 64000) || (err != KErrNone)) return EFail; } } INFO_PRINTF1(_L("finished with this test step")); // test steps return a result return iTestStepResult; }
/** @SYMTestCaseID APPFWK-APPARC-0022 @SYMPREQ PREQ1123 @SYMTestCaseDesc The Test determines that the child doesn't receive its parent process ID correctly, when not set during its creation. @SYMTestPriority Medium @SYMTestStatus Implemented @SYMTestActions. Creates and launches a process (parent). Creates another process (child) without setting any parent. Parent Process Id is passed to child through SetParameter API. Launches the child process. Child obtains the parent process Id from within. Child compares both the Id's. The Id's should not match each other. API Calls:\n RProcess::Create(const TDesC &aFileName, const TDesC &aCommand, TOwnerType aType=EOwnerProcess);\n RProcess::Resume(); RProcess::ExitType() const; RProcess::ExitReason() const; RProcess::Id() const; RProcess::SetParameter(TInt aSlot, TInt aData); CApaCommandLine::SetProcessEnvironmentL(RProcess &aProcess) const; CApaCommandLine::NewLC(); RFile::Open(RFs &aFs, const TDesC &aName, TUint aFileMode); RFile::Read(TInt aPos, TDes8 &aDes) const; RFile::Close(); RFs::Connect(TInt aMessageSlots=KFileServerDefaultMessageSlots); RFs::Delete(const TDesC &aName); RFs::Close(); @SYMTestExpectedResults Id received by child process should not match its parent process Id.\n */ void CT_ProcStep::testIdNotAvailableToChildL(void) { TInt ret(0); TInt exitReason(0); //commandline for parent process CApaCommandLine* parentProcCmdln=CApaCommandLine::NewLC(); INFO_PRINTF1(_L(" CommandLine for Parent Process created ")); //parent process RProcess parentProc; ret = parentProc.Create(KParentExe,KNullDesC); TEST(ret == KErrNone); User::LeaveIfError(ret); CleanupClosePushL(parentProc); INFO_PRINTF2(_L(" Create Parent Process returned : %d"),ret); //attach commandline to parent process TRAP(ret,parentProcCmdln->SetProcessEnvironmentL(parentProc)); TEST(ret == KErrNone); User::LeaveIfError(ret); INFO_PRINTF1(_L(" Attach CommandLine to Process ")); INFO_PRINTF1(_L(" Run Parent Process ")); parentProc.Resume(); //Time for the parent process to launch itself User::After(500000); //commandline for child process //Get parent process ID here TUint64 parentProcId = parentProc.Id(); INFO_PRINTF2(_L(" Parent Process Id = 0x%lx "),parentProcId); CApaCommandLine* childProcCmdln=CApaCommandLine::NewLC(); INFO_PRINTF1(_L(" CommandLine for Child Process created ")); //child process RProcess childProc; ret = childProc.Create(KChildThreeExe,KNullDesC); TEST(ret == KErrNone); User::LeaveIfError(ret); CleanupClosePushL(childProc); INFO_PRINTF2(_L(" Create Child Process returned : %d"),ret); //attach commandline to child process TRAP(ret,childProcCmdln->SetProcessEnvironmentL(childProc)); TEST(ret == KErrNone); User::LeaveIfError(ret); INFO_PRINTF1(_L(" Attach CommandLine to Process ")); //Setting the parent process Id in an environment slot for the child to receive. ret = childProc.SetParameter(12,parentProcId); TEST(ret == KErrNone); INFO_PRINTF2(_L(" Set the Parent Process Id - 0x%lx to Child through SetParameter API in Slot 12 "),parentProcId); INFO_PRINTF1(_L(" Run Child Process ")); TRequestStatus status; childProc.Rendezvous(status); childProc.Resume(); //Wait for the child process to launch itself User::WaitForRequest(status); RFs fs; RFile file; ret = fs.Connect(); TEST(ret == KErrNone); User::LeaveIfError(ret); INFO_PRINTF1(_L(" Create File server session ")); ret = file.Open(fs,KFilePath,EFileWrite | EFileShareAny); TEST(ret == KErrNone); if(ret == KErrNone) { INFO_PRINTF1(_L(" File opened successfully ")); TBuf8<5> readData; file.Read(0,readData); TBuf8<5> result(KTResultFail); TEST(result==readData); if(result==readData) { INFO_PRINTF1(_L(" Child did not receive the parent process ID as intended...")); } else { INFO_PRINTF1(_L(" Child received the Wrong parent process ID ...")); } file.Close(); fs.Delete(KFilePath); fs.Close(); INFO_PRINTF1(_L(" File Close & Delete and Session Close ")); } TExitType exitType = parentProc.ExitType(); TEST(exitType == EExitPending); if(exitType == EExitPending) { INFO_PRINTF1(_L(" Parent is still running ")); INFO_PRINTF1(_L(" So Terminating it manually ... ")); parentProc.Terminate(KTProcTerminatingParent); exitType = parentProc.ExitType(); TEST(exitType==EExitTerminate); exitReason = parentProc.ExitReason(); TEST(exitReason == KTProcTerminatingParent); } exitType = childProc.ExitType(); TEST(exitType == EExitPending); if(exitType == EExitPending) { INFO_PRINTF1(_L(" Child is still running ")); INFO_PRINTF1(_L(" So Terminating it manually ... ")); childProc.Terminate(KTProcTerminatingChildIII); exitType = childProc.ExitType(); TEST(exitType==EExitTerminate); exitReason = childProc.ExitReason(); TEST(exitReason == KTProcTerminatingChildIII); } CleanupStack::PopAndDestroy(&childProc); CleanupStack::PopAndDestroy(childProcCmdln); CleanupStack::PopAndDestroy(&parentProc); CleanupStack::PopAndDestroy(parentProcCmdln); }
/** * * Do the test step. * Each test step must supply an implementation for DoTestStepL. * * @return "TVerdict" * The result of the test step * * @xxxx * */ TVerdict CTestStepRecorderFormat::DoTestStepL() { iTestStepResult = EPass; TInt err = KErrNone; TUid format = TUid::Null(); if (!iIsConverterTest) { // get the format of the openned file of known format // (wav file 8KHz) // and check if type correct TRAP(err, format = iRecorder->DestinationFormatL()); if (err != KErrNone || format != TUid::Uid(KMmfUidFormatWAVWrite) ) return EFail; // close this file and iRecorder->Close(); //open a new non-existing file for recording TRAP(err, iRecorder->OpenFileL(iFileName2)); if (err != KErrNone || iError != KErrNone) return EInconclusive; CActiveScheduler::Start(); // set the destination format to a specific one of our choice TRAP(err, iRecorder->SetDestinationFormatL(TUid::Uid(KMmfUidFormatAUWrite) ) ); if (err != KErrNone) return EFail; //get the newly set format //and check if it has been set correctly TRAP(err, format = iRecorder->DestinationFormatL()); if (err != KErrNone || format != TUid::Uid(KMmfUidFormatAUWrite) ) return EFail; } else // isConverterTest == ETrue { // get the format of the source file of known format // (wav file 8KHz) // and check if type correct TRAP(err, format = iConvert->SourceFormatL()); if (err != KErrNone || format != TUid::Uid(KMmfUidFormatWAVRead) ) return EFail; // set the destination format to a specific one of our choice TRAP(err, iConvert->SetDestinationFormatL(TUid::Uid(KMmfUidFormatAUWrite) ) ); if (err != KErrNone) return EFail; //get the newly set format //and check if it has been set correctly TRAP(err, format = iConvert->DestinationFormatL()); if (err != KErrNone || format != TUid::Uid(KMmfUidFormatAUWrite) ) return EFail; } INFO_PRINTF1(_L("finished with this test step")); // test steps return a result return iTestStepResult; }
/** * * Do the test step. * Each test step must supply an implementation for DoTestStepL. * * @return "TVerdict" * The result of the test step * * @xxxx * */ TVerdict CTestStepRecorderDestinDataType::DoTestStepL() { iTestStepResult = EPass; TInt err = KErrNone; TFourCC fourCC; RArray<TFourCC> supFourCC; if (!iIsConverterTest) { // check the number of supported audio types // just checking that there are some types available // since it's not known how many types are supported each time TRAP(err, iRecorder->GetSupportedDestinationDataTypesL(supFourCC)); if (err != KErrNone || supFourCC.Count() <= 0 || supFourCC.Find(TFourCC(KMMFFourCCCodeALAW)) < 0 || supFourCC.Find(TFourCC(KMMFFourCCCodePCM16)) < 0 ) return EFail; // get the type of the openned file of known type // and check if type correct TRAP(err, fourCC = iRecorder->DestinationDataTypeL()); if (err != KErrNone || fourCC != KMMFFourCCCodePCM16) return EFail; // close this file and iRecorder->Close(); //open a new non-existing file for recording TRAP(err, iRecorder->OpenFileL(iFileName2)); if (err != KErrNone || iError != KErrNone) return EInconclusive; CActiveScheduler::Start(); // set the destination type to a specific one of our choice TRAP(err, iRecorder->SetDestinationDataTypeL(KMMFFourCCCodeIMAD)); if (err != KErrNone) return EFail; //get the newly set type //and check if it has been set correctly TRAP(err, fourCC = iRecorder->DestinationDataTypeL()); if (err != KErrNone || fourCC != KMMFFourCCCodeIMAD) return EFail; } else // iIsConverterTest { TRAP(err, iConvert->GetSupportedDestinationDataTypesL(supFourCC)); if (err != KErrNone || supFourCC.Count() <= 0 || supFourCC.Find(TFourCC(KMMFFourCCCodeALAW)) < 0 || supFourCC.Find(TFourCC(KMMFFourCCCodePCM8)) < 0 ) return EFail; //TRAP(err, fourCC = iConvert->DestinationDataTypeL()); //if (err != KErrNone || // fourCC != KMMFFourCCCodePCM16) // return EFail; // set the destination type to a specific one of our choice TRAP(err, iConvert->SetDestinationDataTypeL(KMMFFourCCCodePCM8)); if (err != KErrNone) return EFail; //get the newly set type //and check if it has been set correctly TRAP(err, fourCC = iConvert->DestinationDataTypeL()); if (err != KErrNone || fourCC != KMMFFourCCCodePCM8) return EFail; } INFO_PRINTF1(_L("finished with this test step")); // test steps return a result return iTestStepResult; }
TBool CUISisAdaptor::DisplayUpgradeL(const CAppInfo& /*aAppInfo*/, const CAppInfo& /*aExistingAppInfo*/) { INFO_PRINTF1(_L("DisplayUpgradeL():")); return ETrue; }
void CUISisAdaptor::DisplayCannotOverwriteFileL(const CAppInfo& /*aAppInfo*/, const CAppInfo& /*aInstalledAppInfo*/, const TDesC& /*aFileName*/) { INFO_PRINTF1(_L("DisplayCannotOverwriteFileL():")); }
/** * Load and initialise an audio file. */ TVerdict CTestMmfAclntFileSource::DoTestStepL( void ) { INFO_PRINTF1( _L("TestPlayerUtils : File")); TVerdict ret = EFail; iError = KErrTimedOut; TBuf<KSizeBuf> filename; TPtrC filename1; if(!GetStringFromConfig(iSectName,iKeyName,filename1)) { return EInconclusive; } GetDriveName(filename); filename.Append(filename1); // Create CMdaAudioPlayerUtility Object CMdaAudioPlayerUtility* player = NULL; player = CMdaAudioPlayerUtility::NewL(*this); // Create TMMFileSource Object TMMFileSource filesource(filename); player->OpenFileL(filesource); // Wait for initialisation callback INFO_PRINTF1(_L("Initialise CMdaAudioPlayerUtility")); CActiveScheduler::Start(); // Check for expected errors. if(iError != KErrNone && (iExpectedError == iError)) { ret = EPass; // all other tests pass delete player; User::After(KOneSecond); // wait for deletion to shut down devsound ERR_PRINTF2( _L("CMdaAudioPlayerUtility failed with expected error %d"),iError ); return ret; } // Check for errors (after OPEN). if (iError == KErrNone && player != NULL) { if(iPlay) { iError = KErrTimedOut; player->Play(); // Wait for play complete callback INFO_PRINTF1(_L("Play CMdaAudioPlayerUtility")); CActiveScheduler::Start(); // Check for Callback errors if(iError == KErrNone) { ret = EPass; } } else { ret = EPass; } } // Clean up activities. delete player; User::After(KOneSecond); // wait for deletion to shut down devsound // Check for errors (final check). if(iError != KErrNone) { ERR_PRINTF2( _L("CMdaAudioPlayerUtility failed with error %d"),iError ); } return ret; }
TInt CUISisAdaptor::DisplayLanguageL(const CAppInfo& /*aAppInfo*/, const RArray<TLanguage>& /*aLanguages*/) { INFO_PRINTF1(_L("DisplayLanguageL():")); return 0; }
/** * MapcPlayComplete */ void CTestMmfAclntFileSource::MapcPlayComplete(TInt aError) { iError = aError; INFO_PRINTF1( _L("MMdaAudioPlayerCallback Play Complete")); CActiveScheduler::Stop(); }
/** * Load and initialise an audio file. */ TVerdict CTestMmfAclntFileHandleSource::DoTestStepL( void ) { INFO_PRINTF1( _L("TestPlayerUtils : File")); TVerdict ret = EFail; iError = KErrTimedOut; // Get the file name. TBuf<KSizeBuf> filename; TPtrC filename1; if(!GetStringFromConfig(iSectName,iKeyName,filename1)) { return EInconclusive; } GetDriveName(filename); filename.Append(filename1); // Create CMdaAudioPlayerUtility Object CMdaAudioPlayerUtility* player = NULL; player = CMdaAudioPlayerUtility::NewL(*this); // Create RFs and RFile Objects RFs fs; User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); User::LeaveIfError(fs.ShareProtected()); RFile file; User::LeaveIfError( file.Open( fs, filename, EFileRead ) ); CleanupClosePushL(file); // Create TMMFileSource Object TMMFileHandleSource filehandlesource(file); player->OpenFileL(filehandlesource); // Wait for initialisation callback INFO_PRINTF1(_L("CMdaAudioPlayerUtility->OpenFileL(TMMFileHandleSource)")); CActiveScheduler::Start(); // Check for expected errors. if((iError != KErrNone) && (iExpectedError == iError)) { ERR_PRINTF2(_L("CMdaAudioPlayerUtility->OpenFileL() Returned the Expected Error : %d"),iError); ret=EPass; } // Check for errors. if(iError != KErrNone) { ERR_PRINTF2(_L("CMdaAudioPlayerUtility->OpenFileL() Failed with Error : %d"),iError); ret=EFail; } // Check for No errors, so as to start Playback if (iError == KErrNone && player != NULL) { if(iPlay) { iError = KErrTimedOut; player->Play(); // Wait for play complete callback INFO_PRINTF1(_L("CMdaAudioPlayerUtility->Play()")); CActiveScheduler::Start(); // Check for Callback errors if(iError == KErrNone) { ERR_PRINTF2(_L("CMdaAudioPlayerUtility->Play() completed successfully with return code : %d"),iError); ret = EPass; } else { ERR_PRINTF2(_L("CMdaAudioPlayerUtility->Play() Failed with Error : %d"),iError ); ret = EFail; } } else { ret = EPass; } } // Clean up activities. delete player; User::After(KOneSecond); // wait for deletion to shut down devsound CleanupStack::PopAndDestroy(2); return ret; }
void CTestContactsPBAPExport::ExportContactsL() { TInt err = KErrNone; // Retrieve the file name to which contact item is to be exported RFs fsSession; RFileWriteStream writeStream; // connect to file system User::LeaveIfError(fsSession.Connect()); CleanupClosePushL(fsSession); GetInputFromIni(); // Makes one or more directories. fsSession.MkDirAll(iExportTo); // Replaces a single file with another User::LeaveIfError(writeStream.Replace(fsSession, iExportTo, EFileWrite)); INFO_PRINTF1(_L("Exporting Contact.....")); // Existing database TPtrC databaseFile(_L("C:contactDb.cdb")); CContactDatabase* dBase = NULL; CContactIdArray* idArray = NULL; // Open the existing database dBase = CContactDatabase::OpenL(databaseFile); CleanupStack::PushL(dBase); // Create Utility class object, to export the contact from database CTestStep* self = static_cast<CTestStep*>(this); iExportObj = new(ELeave) CContactsPBAPExportUtilityClass(self); SetFilterL(); CCntFilter* exportFilter = CCntFilter::NewL(); CleanupStack::PushL(exportFilter); // Get all the contacts from the database to export exportFilter->SetContactFilterTypeCard(ETrue); dBase->FilterDatabaseL(*exportFilter); idArray = exportFilter->iIds; CleanupStack::PushL(idArray); if(iDamageDb) { #ifdef _DEBUG #ifndef __SYMBIAN_CNTMODEL_USE_SQLITE__ TRAPD(err1,dBase->DamageDatabaseL(0x666)); if(err1 == KErrNone) { TRAPD(err,iExportObj->ExportvCardL(dBase, iStandard, idArray, writeStream, iContactFilter)); INFO_PRINTF2(_L("Err:%d"),err); if(err == KErrNotReady) { SetTestStepResult(EPass); } else { SetTestStepResult(EFail); } if(dBase->IsDamaged()) { dBase->RecoverL(); } } else { INFO_PRINTF2(_L("Could not damage database Err:"),err1); } #else SetTestStepResult(EPass); #endif #endif } else { if(iInvalidFileSystem) { #ifdef _DEBUG fsSession.SetErrorCondition(KErrNotReady); TRAPD(err,iExportObj->ExportvCardL(dBase, iStandard, idArray, writeStream, iContactFilter)); if(err == KErrNotReady) { SetTestStepResult(EPass); } else { SetTestStepResult(EFail); } fsSession.SetErrorCondition(KErrNone); #endif } else { if(!iSetOOM) { if(idArray->Count() > 0) { for(TInt i=0; i<idArray->Count() ; i++) { TInt dCount = dBase->CountL(); if(i>=dCount) { break; } // temporary array used to export one contact at a time CContactIdArray* tempIdArray = CContactIdArray::NewL(); CleanupStack::PushL(tempIdArray); tempIdArray->AddL((*idArray)[i]); TRAPD(err,iExportObj->ExportvCardL(dBase, iStandard, tempIdArray, writeStream, iContactFilter)); if(err != KErrNone ) { if(err != KErrNotFound) { SetTestStepError(err); } } CleanupStack::PopAndDestroy(tempIdArray); } } else { if(idArray->Count()==0) { TRAPD(err,iExportObj->ExportvCardL(dBase, iStandard, idArray, writeStream, iContactFilter)); if(err != KErrNone) { SetTestStepError(err); } } } } else { TInt tryCount = 1; for ( ;; ) { __UHEAP_SETFAIL(RHeap::EDeterministic, tryCount); TRAP(err, iExportObj->ExportvCardL(dBase, iStandard, idArray, writeStream, iContactFilter)); if ( err == KErrNone ) { __UHEAP_RESET; INFO_PRINTF1(_L("OOM testing of CContactDatabase::ExportSelectedContactsL Api is done")); break; } if ( err != KErrNoMemory ) { INFO_PRINTF2(_L("The unexpected error code is:%d"),err); SetTestStepResult(EFail); break; } __UHEAP_SETFAIL(RHeap::ENone, 0); tryCount++; } } } } CleanupStack::Pop(idArray); CleanupStack::PopAndDestroy(exportFilter); INFO_PRINTF1(_L("Exported Contact")); writeStream.CommitL(); writeStream.Close(); INFO_PRINTF2(_L("Total number of contacts in database %d "), dBase->CountL()); // Cleanup CleanupStack::PopAndDestroy(dBase); CleanupStack::PopAndDestroy(&fsSession); }
/** Function : doTestStepL Description : Reads the Imap account name from the ini file. It establishes connection with the IMAP server and performs a background synchronisation. @internalTechnology @param : @return : TVerdict - Test step result */ TVerdict CT_MsgConnectAndSyncImap4Server::doTestStepL() { INFO_PRINTF1(_L(" Test Step : ConnectAndSyncIMAP4Server")); TPtrC imapAccountName; if(!GetStringFromConfig( ConfigSection(), KImapAccountName, imapAccountName)) { ERR_PRINTF1(_L("Imap Account Name is not specified")); SetTestStepResult(EFail); } if( TestStepResult() == EPass ) { TInt time = 0; GetIntFromConfig( ConfigSection(),KTime,time); // Retrieving the Imap service Id for the given Imap account TMsvId imapServiceId = CT_MsgUtilsCentralRepository::GetImapServiceIdL((TDes&)imapAccountName); INFO_PRINTF2(_L("Imap service id is %d"),imapServiceId ); // Change the current context iSharedDataIMAP.iMtm->SwitchCurrentEntryL(imapServiceId); CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection; CleanupStack::PushL(selection); // Appends the imapServiceId onto the end of the array selection->AppendL(imapServiceId); TBuf8<1> param; // Attempts to connect and sync to the Imap4 Service CT_MsgActive& active=Active(); iOperation = iSharedDataIMAP.iMtm->InvokeAsyncFunctionL(KIMAP4MTMConnectAndSynchronise, *selection, param, active.iStatus); active.Activate(); CActiveScheduler::Start(); //Check result of connect and sync operation for errors TInt errConnection=active.Result(); if (errConnection<KErrNone) { ERR_PRINTF2(_L("Error connecting to service,, failed with %d error"),errConnection); SetTestStepResult(EFail); } //Reads Int flag to cancel from ini file if aCancelFlag is 1, //then cancel operation, otherwise ignore TInt aCancelFlag=0; GetIntFromConfig(ConfigSection(),KCancelSync,aCancelFlag); //do we want to cancel the synchronisation? if (aCancelFlag==1) { delete iOperation; iOperation=NULL; User::After(1000000); TBuf8<16> param2; CT_MsgActive& active2=Active(); iOperation = iSharedDataIMAP.iMtm->InvokeAsyncFunctionL(KIMAP4MTMCancelBackgroundSynchronise, *selection, param2, active2.iStatus); active2.Activate(); CActiveScheduler::Start(); TInt errCancel=active2.Result(); //check result of operation //If there is a background synchronisation in progress, //then stops it and completes with KErrCancel; //otherwise, completes with KErrNone if (errCancel!=KErrCancel && errCancel!=KErrNone) { ERR_PRINTF2(_L("Error during cancel background sync, failed with %d error"),errCancel); SetTestStepResult(EFail); } delete iOperation; iOperation=NULL; } else //Wait for background synchronisation to finish { TBuf8<16> param3; CT_MsgActive& active3=Active(); delete iOperation; iOperation=NULL; //Completes (with KErrNone) only when the background synchronisation has finished. iOperation =iSharedDataIMAP.iMtm->InvokeAsyncFunctionL(KIMAP4MTMWaitForBackground,*selection,param3,active3.iStatus); INFO_PRINTF1(_L("we are waiting for bk sync to complete now...")); active3.Activate(); CActiveScheduler::Start(); //Check result of wait for bkground operation for errors TInt errSync=active3.Result(); //if result of operation is not KErrNone then fail if (errSync!=KErrNone) { ERR_PRINTF2(_L("Error during background sync, failed with %d error"),errSync); SetTestStepResult(EFail); } delete iOperation; iOperation=NULL; } CleanupStack::PopAndDestroy(selection); //selection } return TestStepResult(); }
TBool CUISisAdaptor::DisplayUninstallL(const CAppInfo& /*aAppInfo*/) { INFO_PRINTF1(_L("DisplayUninstallL():")); return ETrue; }
TVerdict CTestLtsySmsDelete::doTestStepPostambleL() { INFO_PRINTF1(_L("CTestLtsySmsDelete::doTestStepPostambleL called")); return TestStepResult(); }
TBool CUISisAdaptor::DisplayTextL(const CAppInfo& /*aAppInfo*/, TFileTextOption /*aOption*/, const TDesC& /*aText*/) { INFO_PRINTF1(_L("DisplayTextL():")); return ETrue; }
/** * * Do the test step. * Each test step must supply an implementation for DoTestStepL. * * @return "TVerdict" * The result of the test step * * @xxxx * */ TVerdict CTestStepRecorderChannels::DoTestStepL() { iTestStepResult = EPass; TInt err = KErrNone; TUint channels = 0; RArray<TUint> supChannels; if (!iIsConverterTest) { // get the number of channels of the openned file of known channels number // (wav mono file 8KHz) // and check if channels correct TRAP(err, channels = iRecorder->DestinationNumberOfChannelsL()); if (err != KErrNone || channels != 1) return EFail; // close this file iRecorder->Close(); //open a new non-existing file for recording TRAP(err, iRecorder->OpenFileL(iFileName2)); if (err != KErrNone || iError != KErrNone) return EInconclusive; CActiveScheduler::Start(); // get the supported num of channels TRAP(err, iRecorder->GetSupportedNumberOfChannelsL(supChannels)); if (err != KErrNone || supChannels.Count() <= 0 ) return EFail; // set the destination number of channels to a specific one of our choice TRAP(err, iRecorder->SetDestinationNumberOfChannelsL(2)); if (err != KErrNone) return EFail; //get the newly set number of channels //and check if it has been set correctly TRAP(err, channels = iRecorder->DestinationNumberOfChannelsL()); if (err != KErrNone || channels != 2) return EFail; } else // isConverterTest == ETrue { // get the number of channels of the source file of known channels number // (wav mono file 8KHz) // and check if channels correct TRAP(err, channels = iConvert->SourceNumberOfChannelsL()); if (err != KErrNone || channels != 1) return EFail; // get the supported num of channels TRAP(err, iConvert->GetSupportedConversionNumberOfChannelsL(supChannels)); if (err != KErrNone || supChannels.Count() <= 0 ) return EFail; // set the destination number of channels to a specific one of our choice TRAP(err, iConvert->SetDestinationNumberOfChannelsL(2)); if (err != KErrNone) return EFail; //get the newly set number of channels //and check if it has been set correctly TRAP(err, channels = iConvert->DestinationNumberOfChannelsL()); if (err != KErrNone || channels != 2) return EFail; } INFO_PRINTF1(_L("finished with this test step")); // test steps return a result return iTestStepResult; }
void CUISisAdaptor::DisplayErrorL(const CAppInfo& /*aAppInfo*/, TErrorDialog /*aType*/, const TDesC& /*aDes*/) { INFO_PRINTF1(_L("DisplayErrorL():")); }
/** * * Test step Preamble. * * @xxxx * */ enum TVerdict CTestStepRecorderBitRate::DoTestStepPreambleL(void) { enum TVerdict verdict; // this installs the scheduler verdict = CTestStepUnitMMFAudClient::DoTestStepPreambleL(); // Printing to the console and log file INFO_PRINTF1(iTestStepName); if (!iIsConverterTest) { INFO_PRINTF1(_L("this is a test of CMdaAudioRecorderUtility::xxxBitRatexx() functions")); } else { INFO_PRINTF1(_L("this is a test of CMdaAudioConvertUtility::xxxBitRatexx() functions")); } if(!(GetStringFromConfig(_L("SectionOne"), _L("AudioPlayFName1"), iFileName) && // wav GetStringFromConfig(_L("SectionOne"), _L("AudioFNameToRecord4"), iFileName2) && // wav GetStringFromConfig(_L("SectionOne"), _L("AudioFNameToConvert"), iFileName3) // au )) { //INFO_PRINTF2(_L("file name %s not found..."), fileptr); return EInconclusive; } //delete files that should not be there iFs.Connect(); iFileMan = CFileMan::NewL(iFs); iFileMan->Delete(iFileName2); iFileMan->Delete(iFileName3); iFs.Close(); delete iFileMan; iFileMan = NULL; if (!iIsConverterTest) { // create the Recorder utility if ( (iRecorder = CMMFMdaAudioRecorderUtility::NewL(*this)) == NULL ) return EInconclusive; TInt err; TRAP( err, OpenAndStartSchedulerL() ); if (iRecorder == NULL || err != KErrNone || iError != KErrNone || iRecorder->State() != CMdaAudioRecorderUtility::EOpen) return EInconclusive; } else { // create the Converter utility if ( (iConvert = CMdaAudioConvertUtility::NewL(*this)) == NULL ) return EInconclusive; TInt err; TRAP( err, OpenAndStartSchedulerL() ); if (iConvert == NULL || err != KErrNone || iError != KErrNone || iConvert->State() != CMdaAudioConvertUtility::EOpen) return EInconclusive; } return verdict; }
TBool CUISisAdaptor::DisplayDependencyBreakL(const CAppInfo& /*aAppInfo*/, const RPointerArray<TDesC>& /*aComponents*/) { INFO_PRINTF1(_L("DisplayDependencyBreakL():")); return ETrue; }
/** * * Do the test step. * Each test step must supply an implementation for DoTestStepL. * * @return "TVerdict" * The result of the test step * * @xxxx * */ TVerdict CTestStepRecorderSampleRate::DoTestStepL() { iTestStepResult = EPass; TInt err = KErrNone; TUint samplerate = 0; RArray<TUint> supSampleRates; if (!iIsConverterTest) { // get the type of the openned file of known bitrate // (wav file 8KHz) // and check if type correct TRAP(err, samplerate = iRecorder->DestinationSampleRateL()); if (err != KErrNone || samplerate != 8000) { INFO_PRINTF3(_L("iRecorder->DestinationSampleRateL() test failed (err=%d, samplerate=%d)"), err, samplerate); return EFail; } // close this file and iRecorder->Close(); //open a new non-existing file for recording TRAP(err, iRecorder->OpenFileL(iFileName2)); if (err != KErrNone || iError != KErrNone) { INFO_PRINTF3(_L("iRecorder->OpenFileL() test failed (err=%d, iError=%d)"), err, iError); return EInconclusive; } CActiveScheduler::Start(); // check the number of supported bitrates // just checking that there are some sample rates available TRAP(err, iRecorder->GetSupportedSampleRatesL(supSampleRates)); if (err != KErrNone || supSampleRates.Count() <= 0 ) { INFO_PRINTF3(_L("iRecorder->GetSupportedSampleRatesL() test failed (err=%d, count=%d)"), err, supSampleRates.Count()); return EFail; } // set the destination samplerate to a specific one of our choice TRAP(err, iRecorder->SetDestinationSampleRateL(supSampleRates[0]) ); //4000)); if (err != KErrNone) { INFO_PRINTF2(_L("iRecorder->SetDestinationSampleRateL() test failed (err=%d)"), err); return EFail; } //get the newly set sample rate //and check if it has been set correctly TRAP(err, samplerate = iRecorder->DestinationSampleRateL()); if (err != KErrNone || samplerate != supSampleRates[0]) { INFO_PRINTF3(_L("iRecorder->DestinationSampleRateL() test failed (err=%d, samplerate=%d)"), err, supSampleRates[0]); return EFail; } } else // isConverterTest == ETrue { // get the known sample rate of the source file // (wav file 8KHz) // and check if type correct TRAP(err, samplerate = iConvert->SourceSampleRateL()); if (err != KErrNone || samplerate != 8000) { INFO_PRINTF3(_L("iConvert->SourceSampleRateL() test failed (err=%d, samplerate=%d)"), err, samplerate); return EFail; } // check the number of supported bitrates // just checking that there are some sample rates available TRAP(err, iConvert->GetSupportedConversionSampleRatesL(supSampleRates)); if (err != KErrNone || supSampleRates.Count() <= 0 ) { INFO_PRINTF3(_L("iConvert->GetSupportedConversionSampleRatesL() test failed (err=%d, count=%d)"), err, supSampleRates.Count()); return EFail; } // set the destination samplerate to a specific one of our choice TRAP(err, iConvert->SetDestinationSampleRateL(supSampleRates[0]) ); //4000)); if (err != KErrNone) { INFO_PRINTF2(_L("iConvert->SetDestinationSampleRateL() test failed (err=%d)"), err); return EFail; } //get the newly set sample rate //and check if it has been set correctly TRAP(err, samplerate = iConvert->DestinationSampleRateL()); if (err != KErrNone || samplerate != supSampleRates[0]) { INFO_PRINTF3(_L("iConvert->DestinationSampleRateL() test failed (err=%d, samplerate=%d)"), err, supSampleRates[0]); return EFail; } } INFO_PRINTF1(_L("finished with this test step")); // test steps return a result return iTestStepResult; }
TBool CUISisAdaptor::DisplayApplicationsInUseL(const CAppInfo& /*aAppInfo*/, const RPointerArray<TDesC>& /*aAppNames*/) { INFO_PRINTF1(_L("DisplayApplicationsInUseL():")); return ETrue; }
void CT_ProcStep::testChildExistsL(void) /** * Calls other functions which implement the test cases. */ { INFO_PRINTF1(_L("Begin - testChildSetToTerminateL ----------- ")); TRAPD(ret,testChildSetToTerminateL()); TEST(ret==KErrNone); INFO_PRINTF1(_L("End - testChildSetToTerminateL ----------- \n")); INFO_PRINTF1(_L("Begin - testChildSetToRemainL ----------- ")); TRAP(ret,testChildSetToRemainL()); TEST(ret==KErrNone); INFO_PRINTF1(_L("End - testChildSetToRemainL ----------- \n")); INFO_PRINTF1(_L("Begin - testTwoChildsOneToTerminateAndOtherToRemainL ----------- ")); TRAP(ret,testTwoChildsOneToTerminateAndOtherToRemainL()); TEST(ret==KErrNone); INFO_PRINTF1(_L("End - testTwoChildsOneToTerminateAndOtherToRemainL ----------- \n")); INFO_PRINTF1(_L("Begin - testParentWithoutAChildL ----------- ")); TRAP(ret,testParentWithoutAChildL()); TEST(ret==KErrNone); INFO_PRINTF1(_L("End - testParentWithoutAChildL ----------- \n")); INFO_PRINTF1(_L("Begin - testAllChildsSetToTerminateL ----------- ")); TRAP(ret,testAllChildsSetToTerminateL()); TEST(ret==KErrNone); INFO_PRINTF1(_L("End - testAllChildsSetToTerminateL ----------- \n")); INFO_PRINTF1(_L("Begin - testNoChildSetToTerminateL ----------- ")); TRAP(ret,testNoChildSetToTerminateL()); TEST(ret==KErrNone); INFO_PRINTF1(_L("End - testNoChildSetToTerminateL ----------- \n")); INFO_PRINTF1(_L("Begin - testIdAvailableToChildL ----------- ")); TRAP(ret,testIdAvailableToChildL()); TEST(ret==KErrNone); INFO_PRINTF1(_L("End - testIdAvailableToChildL ----------- \n")); INFO_PRINTF1(_L("Begin - testIdNotAvailableToChildL ----------- ")); TRAP(ret,testIdNotAvailableToChildL()); TEST(ret==KErrNone); INFO_PRINTF1(_L("End - testIdNotAvailableToChildL ----------- \n")); }
TBool CUISisAdaptor::DisplayQuestionL(const CAppInfo& /*aAppInfo*/, TQuestionDialog /*aQuestion*/, const TDesC& /*aDes*/) { INFO_PRINTF1(_L("DisplayQuestionL():")); return ETrue; }
/** @SYMTestCaseID APPFWK-APPARC-0016 @SYMPREQ PREQ1123 @SYMTestCaseDesc Test determines that the Child remains when its Parent is terminated. @SYMTestPriority Critical @SYMTestStatus Implemented @SYMTestActions. Creates and launches a process (parent). Creates another process (child) without passing the first(parent) process ID. Launches the child process. Terminates parent and checks the existance of child process. The child process should be alive. API Calls:\n RProcess::Create(const TDesC &aFileName, const TDesC &aCommand, TOwnerType aType=EOwnerProcess);\n RProcess::Resume(); RProcess::ExitType() const; RProcess::ExitReason() const; RProcess::Id() const; RProcess::Terminate(TInt aReason); CApaCommandLine::SetProcessEnvironmentL(RProcess &aProcess) const; CApaCommandLine::NewLC(); @SYMTestExpectedResults Existence of child process.\n */ void CT_ProcStep::testChildSetToRemainL(void) { TInt ret(0); //commandline for parent process CApaCommandLine* parentProcCmdln=CApaCommandLine::NewLC(); INFO_PRINTF1(_L(" CommandLine for Parent Process created ")); //parent process RProcess parentProc; ret = parentProc.Create(KParentExe,KNullDesC); TEST(ret == KErrNone); User::LeaveIfError(ret); CleanupClosePushL(parentProc); INFO_PRINTF2(_L(" Create Parent Process returned : %d"),ret); //attach commandline to parent process TRAP(ret,parentProcCmdln->SetProcessEnvironmentL(parentProc)); TEST(ret == KErrNone); User::LeaveIfError(ret); INFO_PRINTF1(_L(" Attach CommandLine to Process ")); INFO_PRINTF1(_L(" Run Parent Process ")); parentProc.Resume(); //Time for the parent process to launch itself User::After(500000); //commandline for child process //Get parent process ID here TUint64 parentProcId = parentProc.Id(); INFO_PRINTF2(_L(" Parent Process Id = 0x%lx "),parentProcId); CApaCommandLine* childProcCmdln=CApaCommandLine::NewLC(); INFO_PRINTF1(_L(" CommandLine for Child Process created ")); //child process RProcess childProc; ret = childProc.Create(KChildOneExe,KNullDesC); TEST(ret == KErrNone); User::LeaveIfError(ret); CleanupClosePushL(childProc); INFO_PRINTF2(_L(" Create Child Process returned : %d"),ret); //attach commandline to child process TRAP(ret,childProcCmdln->SetProcessEnvironmentL(childProc)); TEST(ret == KErrNone); User::LeaveIfError(ret); INFO_PRINTF1(_L(" Attach CommandLine to Process ")); INFO_PRINTF1(_L(" Run Child Process ")); childProc.Resume(); //Time for the child process to launch itself User::After(500000); parentProc.Terminate(KTProcTerminatingParent); INFO_PRINTF1(_L(" Kill Parent Process ... ")); TExitType exitType = parentProc.ExitType(); TEST(exitType == EExitTerminate); TInt exitReason = parentProc.ExitReason(); TEST(exitReason == KTProcTerminatingParent); //child process Id is reqd to monitor if it gets killed on its parent's termination TUint64 childProcId = childProc.Id(); INFO_PRINTF2(_L(" Child Process Id = 0x%lx "),childProcId); //Wait for child to terminate ... if it really does User::After(10000000); exitType = childProc.ExitType(); TEST(exitType == EExitPending); if(exitType == EExitPending) { INFO_PRINTF1(_L(" Child process is still running ")); INFO_PRINTF1(_L(" so terminating it manually ...")); childProc.Terminate(KTProcTerminatingChildI); exitType = childProc.ExitType(); TEST(exitType == EExitTerminate); exitReason = childProc.ExitReason(); TEST(exitReason == KTProcTerminatingChildI); } CleanupStack::PopAndDestroy(&childProc); CleanupStack::PopAndDestroy(childProcCmdln); CleanupStack::PopAndDestroy(&parentProc); CleanupStack::PopAndDestroy(parentProcCmdln); }
void CUISisAdaptor::DisplayIntReturn(TInt aReturn) { INFO_PRINTF1(_L("DisplayIntReturn():")); INFO_PRINTF2(_L("\tReturning %d"), aReturn); }
/** @SYMTestCaseID APPFWK-APPARC-0019 @SYMPREQ PREQ1123 @SYMTestCaseDesc The Test determines that more than one Child for a parent terminate on their Parent's termination. @SYMTestPriority Medium @SYMTestStatus Implemented @SYMTestActions. Creates and launches a process (parent). Creates 3 processes (child I,II,III) passing the first (parent) process ID. Launches all the 3 processes. Terminates parent and checks the existance of the child processes. All 3 children should die. API Calls:\n RProcess::Create(const TDesC &aFileName, const TDesC &aCommand, TOwnerType aType=EOwnerProcess);\n RProcess::Resume(); RProcess::ExitType() const; RProcess::ExitReason() const; RProcess::Id() const; RProcess::Terminate(TInt aReason); CApaCommandLine::SetProcessEnvironmentL(RProcess &aProcess) const; CApaCommandLine::NewLC(); CApaCommandLine::SetParentProcessId(TProcessId); @SYMTestExpectedResults Termination of all child processes automatically.\n */ void CT_ProcStep::testAllChildsSetToTerminateL(void) { TInt ret(0); //commandline for parent process CApaCommandLine* parentProcCmdln=CApaCommandLine::NewLC(); INFO_PRINTF1(_L(" CommandLine for Parent Process created ")); //parent process RProcess parentProc; ret = parentProc.Create(KParentExe,KNullDesC); TEST(ret == KErrNone); User::LeaveIfError(ret); CleanupClosePushL(parentProc); INFO_PRINTF2(_L(" Create Parent Process returned : %d"),ret); //attach commandline to parent process TRAP(ret,parentProcCmdln->SetProcessEnvironmentL(parentProc)); TEST(ret == KErrNone); User::LeaveIfError(ret); INFO_PRINTF1(_L(" Attach CommandLine to Process ")); INFO_PRINTF1(_L(" Run Parent Process ")); parentProc.Resume(); //Time for the parent process to launch itself User::After(500000); //Get parent process ID here TUint64 parentProcId = parentProc.Id(); INFO_PRINTF2(_L(" Parent Process Id = 0x%lx "),parentProcId); //Child I CApaCommandLine* childProcOneCmdln=CApaCommandLine::NewLC(); INFO_PRINTF1(_L(" CommandLine for Child One created ")); //setting the parent process ID to child childProcOneCmdln->SetParentProcessId(parentProcId); INFO_PRINTF1(_L(" Set ParentProcessId to Child One ")); //Child process I RProcess childProcOne; ret = childProcOne.Create(KChildOneExe,KNullDesC); TEST(ret == KErrNone); User::LeaveIfError(ret); CleanupClosePushL(childProcOne); INFO_PRINTF2(_L(" Create Child One returned : %d"),ret); //attach commandline to child process TRAP(ret,childProcOneCmdln->SetProcessEnvironmentL(childProcOne)); TEST(ret == KErrNone); User::LeaveIfError(ret); INFO_PRINTF1(_L(" Attach CommandLine of Child One to its Process ")); INFO_PRINTF1(_L(" Run Child One ")); TRequestStatus childOnestatus; childProcOne.Rendezvous(childOnestatus); childProcOne.Resume(); //Wait for the child process to launch itself User::WaitForRequest(childOnestatus); //child process Id is reqd to monitor if it gets killed on its parent's termination TUint64 childProcOneId = childProcOne.Id(); INFO_PRINTF2(_L(" Child One Id = 0x%lx "),childProcOneId); //Child II CApaCommandLine* childProcTwoCmdln=CApaCommandLine::NewLC(); INFO_PRINTF1(_L(" CommandLine for Child Two created ")); //setting the parent process ID to child childProcTwoCmdln->SetParentProcessId(parentProcId); INFO_PRINTF1(_L(" Set ParentProcessId to Child Two ")); //child process II RProcess childProcTwo; ret = childProcTwo.Create(KChildTwoExe,KNullDesC); TEST(ret == KErrNone); User::LeaveIfError(ret); CleanupClosePushL(childProcTwo); INFO_PRINTF2(_L(" Create Child Two returned : %d"),ret); //attach commandline to child process TRAP(ret,childProcTwoCmdln->SetProcessEnvironmentL(childProcTwo)); TEST(ret == KErrNone); User::LeaveIfError(ret); INFO_PRINTF1(_L(" Attach CommandLine of Child Two to its Process ")); INFO_PRINTF1(_L(" Run Child Two ")); TRequestStatus childTwostatus; childProcTwo.Rendezvous(childTwostatus); childProcTwo.Resume(); //Wait for the child process to launch itself User::WaitForRequest(childTwostatus); //child process Id is reqd to monitor if it gets killed on its parent's termination TUint64 childProcTwoId = childProcTwo.Id(); INFO_PRINTF2(_L(" Child Two Id = 0x%lx "),childProcTwoId); //Child III CApaCommandLine* childProcThreeCmdln=CApaCommandLine::NewLC(); INFO_PRINTF1(_L(" CommandLine for Child Three created ")); //setting the parent process ID to child childProcThreeCmdln->SetParentProcessId(parentProcId); INFO_PRINTF1(_L(" Set ParentProcessId to Child Three ")); //child process III RProcess childProcThree; ret = childProcThree.Create(KChildThreeExe,KNullDesC); TEST(ret == KErrNone); User::LeaveIfError(ret); CleanupClosePushL(childProcThree); INFO_PRINTF2(_L(" Create Child Three returned : %d"),ret); //attach commandline to child process TRAP(ret,childProcThreeCmdln->SetProcessEnvironmentL(childProcThree)); TEST(ret == KErrNone); User::LeaveIfError(ret); INFO_PRINTF1(_L(" Attach CommandLine of Child Three to its Process ")); TRequestStatus childThreestatus; childProcThree.Rendezvous(childThreestatus); childProcThree.Resume(); //Wait for the child process to launch itself User::WaitForRequest(childThreestatus); //child process Id is reqd to monitor if it gets killed on its parent's termination TUint64 childProcThreeId = childProcThree.Id(); INFO_PRINTF2(_L(" Child Three Id = 0x%lx "),childProcThreeId); CChildProcess* childProcess=NULL; TRAP(ret, childProcess=CChildProcess::NewL(parentProc,childProcOneId)); TEST(ret == KErrNone); User::LeaveIfError(ret); CleanupStack::PushL(childProcess); TExitType exitType = parentProc.ExitType(); TEST(exitType == EExitTerminate); TInt exitReason = parentProc.ExitReason(); TEST(exitReason == 0); INFO_PRINTF3(_L(" Parent process - Exit Type = %d, Exit Reason = %d"), exitType, exitReason); if(exitType == EExitTerminate && exitReason == 0) { INFO_PRINTF1(_L(" Parent process is Terminated ")); } exitType = childProcOne.ExitType(); TEST(exitType == EExitTerminate); exitReason = childProcOne.ExitReason(); TEST(exitReason == 0); INFO_PRINTF3(_L(" Child I process - Exit Type = %d, Exit Reason = %d"), exitType, exitReason); if(exitType == EExitTerminate && exitReason == 0) { INFO_PRINTF1(_L(" Child I is killed ")); } childProcTwo.Logon(childTwostatus); User::WaitForRequest(childTwostatus); exitType = childProcTwo.ExitType(); TEST(exitType == EExitTerminate); exitReason = childProcTwo.ExitReason(); TEST(exitReason == 0); INFO_PRINTF3(_L(" Child II process - Exit Type = %d, Exit Reason = %d"), exitType, exitReason); if(exitType == EExitTerminate && exitReason == 0) { INFO_PRINTF1(_L(" Child II is killed ")); } //Wait to close the child process childProcThree.Logon(childThreestatus); User::WaitForRequest(childThreestatus); exitType = childProcThree.ExitType(); TEST(exitType == EExitTerminate); exitReason = childProcThree.ExitReason(); TEST(exitReason == 0); INFO_PRINTF3(_L(" Child III process - Exit Type = %d, Exit Reason = %d"), exitType, exitReason); if(exitType == EExitTerminate && exitReason == 0) { INFO_PRINTF1(_L(" Child III is killed ")); } CleanupStack::PopAndDestroy(childProcess); CleanupStack::PopAndDestroy(&childProcThree); CleanupStack::PopAndDestroy(childProcThreeCmdln); CleanupStack::PopAndDestroy(&childProcTwo); CleanupStack::PopAndDestroy(childProcTwoCmdln); CleanupStack::PopAndDestroy(&childProcOne); CleanupStack::PopAndDestroy(childProcOneCmdln); CleanupStack::PopAndDestroy(&parentProc); CleanupStack::PopAndDestroy(parentProcCmdln); }
TVerdict CTestStepCIG711EncoderConfig::DoTestStep0048L() { iTestStepResult = EFail; TInt result = KErrGeneral; INFO_PRINTF1(_L("G711EncoderIntfc - GetVadMode")); //Initialize - with the UID of our test HwDevice #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND TUid testUID = {KUidG711EncoderConfigTestDevice}; #else TFourCC testUID('T','0','1','6'); #endif iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); if (iTestStepResult != EPass) { INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); return EInconclusive; } // reset the value as previous test is pass iTestStepResult = EFail; // KUidG711EncoderIntfc MG711EncoderIntfc* ptr = static_cast <MG711EncoderIntfc*> (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc)); if (ptr) { TBool vadModeOn = EFalse; result = ptr->SetVadMode(ETrue); // call method if (result == KErrNone) { INFO_PRINTF1(_L("MG711EncoderIntfc::SetVadMode finished successfully")); result = ptr->GetVadMode(vadModeOn); if ( (result == KErrNone) && vadModeOn) { INFO_PRINTF1(_L("MG711EncoderIntfc::GetVadMode finished successfully")); result = ptr->SetVadMode(EFalse); if (result == KErrNone) { INFO_PRINTF1(_L("MG711EncoderIntfc::SetVadMode finished successfully")); result = ptr->GetVadMode(vadModeOn); if ( (result == KErrNone) && !vadModeOn) { INFO_PRINTF1(_L("MG711EncoderIntfc::GetVadMode finished successfully")); iTestStepResult = EPass; } else { ERR_PRINTF3(_L("MG711EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn); } } else { ERR_PRINTF2(_L("MG711EncoderIntfc::SetVadMode failed with result %d"), result); } } else { ERR_PRINTF3(_L("MG711EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn); } } else { ERR_PRINTF2(_L("MG711EncoderIntfc::SetVadMode failed with result %d"), result); } } else { INFO_PRINTF1(_L("MG711EncoderIntfc failed to retrieve the interface")); iTestStepResult = EInconclusive; } return iTestStepResult; }