void CTe_locsrvSuiteStepBase::CheckExpectedResult(TInt aResult, TInt aExpectedResult, const TDesC& aLabel) { if (aResult!=aExpectedResult) { ERR_PRINTF1(aLabel); ERR_PRINTF2(KValueReturned, aResult); ERR_PRINTF2(KValueExpected, aExpectedResult); SetTestStepResult(EFail); } }
TVerdict CSysUtilsGetLangSWVersionNoNewLinesStep::doTestStepL() { TInt err = SetTestPath(ETrue); if( err != KErrNone ) { ERR_PRINTF2(_L("Could not turn test path on. Error = %d"), err); SetTestStepResult(EAbort); return TestStepResult(); } INFO_PRINTF1(_L("Test path turned on.")); err = DeletePSProperties(); if( err != KErrNone ) { ERR_PRINTF2(_L("Could not delete P&S properties. Error = %d"), err); SetTestStepResult(EAbort); return TestStepResult(); } INFO_PRINTF1(_L("Deleted P&S properties successfully.")); _LIT16(KDummy,"xxxxx"); TBuf16<KSysUtilVersionTextLength> version; version.Insert(0,KDummy); err = SysUtil::GetLangSWVersion( version ); if ( err == KErrNone) { _LIT(KLangSw, "LangSW"); TPtrC16 line; TESTL( GetStringFromConfig(ConfigSection(), KLangSw, line) ); TBuf16<KSysUtilVersionTextLength> testBuf(line); if (version.Compare(testBuf)==0) { INFO_PRINTF1(_L("Got version ")); INFO_PRINTF1(version); } else { ERR_PRINTF1(_L("Version not correct")); INFO_PRINTF1(version); SetTestStepResult(EFail); } } else { ERR_PRINTF2(_L("Error code = %d"), err); SetTestStepResult(EFail); } return TestStepResult(); }
/** * * DoTestStepL * @result TVerdict * */ TVerdict CTestStepSDevSoundPlayDTMFTones::DoTestStepL() { INFO_PRINTF1(_L("Testing DTMF Playback")); TPtrC dtmfString = (_L("0123456789,abcdef,*#")); //Initialize TVerdict initializeOK = InitializeDevSound(EMMFStateTonePlaying); if (initializeOK != EPass) { return EInconclusive; } iMMFDevSound->SetVolume(iMMFDevSound->MaxVolume()); iExpectedValue = KErrUnderflow; iCallbackError = KErrNone; iCallbackArray.Reset(); // Set request active iAL->InitialiseActiveListener(); INFO_PRINTF1(_L("Playing DTMF String")); TRAPD(err, iMMFDevSound->PlayDTMFStringL(dtmfString)); // Start the active scheduler and catch the callback CActiveScheduler::Start(); if (err) { WARN_PRINTF2 (_L("DevSound PlayDTMFStringL left with error = %d"), err); return EInconclusive; } else { if (iCallbackError != iExpectedValue) { ERR_PRINTF3 (_L("DevSound ToneFinished returned %d, expected %d"), iCallbackError, iExpectedValue); return EFail; } if (iCallbackArray[EToneFinished] != 1) { ERR_PRINTF2 (_L("DevSound ToneFinished was called %d times, expected 1"), iCallbackArray[EToneFinished]); return EFail; } TInt total = 0; for (TInt i = EInitComplete; i < EDeviceMsg; i++) { total += iCallbackArray[i]; } if (total > 1) { ERR_PRINTF2 (_L("DevSound called %d callbacks, expected 1"), total); return EFail; } } return EPass; }
TVerdict COomTestStep::ImplOomTestL() /** Runs the test step under OOM Conditions checking that each heap allocation is fail safe. */ { // Pre and Post test heap cell allocation counts TInt cellCountAfter = 0; TInt cellCountBefore = 0; // The loop tests each heap allocation under out of memory conditions to determine whether // the test framework cleans up correctly without leaking memory. // // The 'for' loop terminates as soon as any of the following events occur: // a) The pre and post heap cell counts mismatch signalling a memory leakage // b) Any leave with an error code other than 'KErrNoMemory' // c) All heap allocations have been tested and the test returns 'KErrNone' for (TInt testCount = 0; ; ++testCount) { __UHEAP_MARK; __UHEAP_SETFAIL(RHeap::EDeterministic, testCount+1); cellCountBefore = User::CountAllocCells(); TRAPD(err, ImplTestStepL()); cellCountAfter = User::CountAllocCells(); __UHEAP_MARKEND; INFO_PRINTF3(_L("OOM Test %d: Status = %d"),testCount,err); if (err == KErrNone) { INFO_PRINTF1(_L("OOM Test Finished")); break; } else if(err == KErrNoMemory) { if (cellCountBefore != cellCountAfter) { ERR_PRINTF2(_L("OOM Test Result: Failed - Memory leakage on iteration %d"), testCount); ERR_PRINTF2(_L("Pre-Test Heap Cell Count: %d"), cellCountBefore); ERR_PRINTF2(_L("Post-Test Heap Cell Count: %d"), cellCountAfter); SetTestStepResult(EFail); break; } } else { User::Leave(err); break; } } return TestStepResult(); }
/** * * DigitalPlayback * @param aNumSamples * @param aFilename * @param aDataType * @result TVerdict * */ TVerdict CTestStepSDevSoundPlayEOFPCM16::DigitalPlayback(TInt aNumSamples, TDesC& aFilename, TFourCC& aDataType) { TVerdict initializeOK = InitializeDevSound(aDataType, EMMFStatePlaying); if (initializeOK != EPass) { return EInconclusive; } SetVolume(iMMFDevSound->MaxVolume()); //Get a buffer to fill initializeOK = PlayInit(); if (initializeOK != EPass) { return EInconclusive; } TInt error = iFs.Connect(); if (error != KErrNone) { ERR_PRINTF2 (_L("Could not connect to Filesystem. Error is %d"), error); return EInconclusive; } TInt err = iFile.Open(iFs, aFilename, EFileRead); if (err != KErrNone) { ERR_PRINTF2 (_L("Could not open input file. Error is %d"), err); return EInconclusive; } TInt bufferCount = 0; if (aNumSamples < 0) {// Play to EOF while (initializeOK == KErrNone && iCallbackError == KErrNone) { //read sizeof buffer from file CMMFDataBuffer* buffer = STATIC_CAST (CMMFDataBuffer*, iBuffer); iFile.Read(buffer->Data()); if (buffer->Data().Length()!= buffer->RequestSize()) { INFO_PRINTF3(_L("Data length copied from file = %d. Expected %d. Must be EOF"), buffer->Data().Length(), buffer->RequestSize()); iBuffer->SetLastBuffer(ETrue); } //DevSound Play initializeOK = PlayData(); bufferCount ++; } } else { while (bufferCount < aNumSamples && initializeOK == KErrNone && iCallbackError == KErrNone)
// Perform some random value checks // // TVerdict CGpsUtcModelFinalCheckAndCleanupStep::doTestStepL() /** * @return - TVerdict code * Override of base class pure virtual * Our implementation only gets called if the base class doTestStepPreambleL() did * not leave. That being the case, the current test result value will be EPass. */ { // Check that all the fieds exists and their values are correct TUEPositioningGpsUtcModel::TFieldId* fieldIdPtr; TUint value; // From EA1 to EDeltaLSF there are 8 field ids // for (TUint ii = 0; ii < 8; ii++) { fieldIdPtr = reinterpret_cast<TUEPositioningGpsUtcModel::TFieldId*>(&ii); if(!iGpsUtcModelReader.FieldExists(*fieldIdPtr)) { ERR_PRINTF2(_L("Missing field number %D ."),ii); SetTestStepResult(EFail); } else { iGpsUtcModelReader.GetField(*fieldIdPtr,value); if(value != (ii+1)) { ERR_PRINTF2(_L("Wrong value in field number %D ."),ii); SetTestStepResult(EFail); } else { //Clear this field from the builder and get the data // again back in the reader. // iGpsUtcModelBuilder.ClearField(*fieldIdPtr); iGpsUtcModelReader.DataBuffer() = iGpsUtcModelBuilder.DataBuffer(); // Check that this field no longer exists // if(iGpsUtcModelReader.FieldExists(*fieldIdPtr)) { ERR_PRINTF2(_L("Field number %D was cleared but still exists."),ii); SetTestStepResult(EFail); } } } } return TestStepResult(); }
/** * Verifies that the downloaded file is not corrupted by using a previously calculated checksum. * @param aSection - The section in config file to look for the Data Verify Type, the file to verify and the checksum. * @return error - Error code. KErrNone if checksum is equal. */ void CT_DataVerify::DoCmdVerifyData(const TTEFSectionName& aSection) { INFO_PRINTF1(_L("*START* CT_TransferData::DoCmdVerifyData")); TBool dataOk =ETrue; TPtrC type; if(!GetStringFromConfig(aSection, KDataVerifyType, type )) { ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDataVerifyType); SetBlockResult(EFail); dataOk = EFalse; } TPtrC filename; if(!GetStringFromConfig(aSection, KDataVerifyFile, filename )) { ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDataVerifyFile); SetBlockResult(EFail); dataOk = EFalse; } TPtrC checksumParameter; if(!GetStringFromConfig(aSection, KChecksum, checksumParameter )) { ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KChecksum); SetBlockResult(EFail); dataOk = EFalse; } if(dataOk) { TBuf8<DataVerify::KMD5Size> checksum; checksum.Append(checksumParameter); if (type == KMD5Type) { INFO_PRINTF1(_L("MD5 selected")); TRAPD(error, VerifyChecksumL(checksum, filename)); if (error == KErrNone) { INFO_PRINTF1(_L("Data verify succeeded")); } else { ERR_PRINTF2(_L("VerifyData failed [%d]"), error); SetError(error); } } } INFO_PRINTF1(_L("*END* CT_TransferData::DoCmdVerifyData")); }
//== Mobile Line functions void CT_RMobilePhoneData::DoCmdOpen(const TDesC& aSection) { INFO_PRINTF1(_L("*START*CT_RMobilePhoneData::DoCmdOpen")); // Check that first phone is available and log phone name. RTelServer::TPhoneInfo info; // Reading phone info for the first available phone TInt error(0); TBool dataOk = ETrue; TInt parPhone = 0; if ( !GetIntFromConfig(aSection, KPhone(), parPhone) ) { ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPhone); SetBlockResult(EFail); dataOk = EFalse; } TPtrC telServerName; if ( !GetStringFromConfig(aSection, KTelServerKey(), telServerName) ) { ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KTelServerKey); SetBlockResult(EFail); dataOk = EFalse; } if ( dataOk ) { RTelServer* telServerObject = static_cast<RTelServer*>(GetDataObjectL(telServerName)); INFO_PRINTF1(_L("Check if phone info was found.")); error = telServerObject->GetPhoneInfo(parPhone, info); if (error != KErrNone) { ERR_PRINTF2(_L("Failed to read phone info for phone KFirstPhone with error %d"), error); SetError(error); } else { // Connect to RMobilePhone interface. INFO_PRINTF1(_L("Opening connection to phone")); error = iMobilePhone->Open(*telServerObject, info.iName); if (error != KErrNone) { ERR_PRINTF2(_L("Connection to phone failed with error %d"), error); SetError(error); } else { INFO_PRINTF1(_L("Opening connection to phone sucessfull")); } } } INFO_PRINTF1(_L("*END*CT_RMobilePhoneData::DoCmdOpen")); }
void CCmdLineTestStep::GetCmdLineL() { TPtrC data; if (!GetStringFromConfig(ConfigSection(), KConversionCmd, data)) { ERR_PRINTF2(KMissingKey, &KConversionCmd); SetTestStepResult(EFail); User::Leave(KErrCorrupt); } iCmdLine.Set(data); TLex lex(data); TBool pass = ETrue; // Skip "-o" _LIT(KMinusOh, "-o"); if (lex.NextToken().Compare(KMinusOh) != 0) { pass = EFalse; } else { iOutFileName.Set(lex.NextToken()); iInFileName.Set(lex.NextToken()); if (iInFileName.Length() == 0) { pass = EFalse; } } if (!pass) { ERR_PRINTF3(KCorruptEntry, &KConversionCmd, &data); SetTestStepResult(EFail); User::Leave(KErrCorrupt); } if (!GetStringFromConfig(ConfigSection(), KExpectedResult, data)) { ERR_PRINTF2(KMissingKey, &KExpectedResult); SetTestStepResult(EFail); User::Leave(KErrCorrupt); } else { iExpectPass = (data == Kpass); } }
/** RHostResolver::Open() */ void CT_InquirySockAddrData::DoCmdOpenHostResolver(const TDesC& aSection) { RSocketServ sockServ; TPtrC bluetoothSocketName; if(GetStringFromConfig(aSection, KBTSocket(), bluetoothSocketName)) { CT_BluetoothSocketNotifier* bluetoothSocketData=static_cast<CT_BluetoothSocketNotifier*>(GetDataObjectL(bluetoothSocketName)); if ( bluetoothSocketData!=NULL ) { sockServ = bluetoothSocketData->iSocketServer; } else { ERR_PRINTF1(_L("CT_CBluetoothSocketDataPersistentObject is NULL")); SetBlockResult(EFail); } } // Find protocol from socket TProtocolDesc protocolDesc; TInt err=sockServ.FindProtocol(_L("BTLinkManager"), protocolDesc); if ( err!=KErrNone ) { ERR_PRINTF2(_L("iSockServ.FindProtocol(aProtocolName, protocolDesc) = %d"), err); SetBlockResult(EFail); } if ( protocolDesc.iAddrFamily != KBTAddrFamily ) { ERR_PRINTF1(_L("Wrong iAddrFamily")); SetBlockResult(EFail); } INFO_PRINTF1(_L("Close a RHostResolver first...")); iHostResolver.Close(); // Open host resolver INFO_PRINTF1(_L("Create and initialise an RHostResolver")); err=iHostResolver.Open(sockServ, protocolDesc.iAddrFamily, protocolDesc.iProtocol); if ( err!=KErrNone ) { ERR_PRINTF2(_L("iHostResolver.Open(iSockServ, protocolDesc.iAddrFamily, protocolDesc.iProtocol) = %d"), err); SetError(err); } else { iHostResolverOpen = ETrue; INFO_PRINTF1(_L("Create and initialise an RHostResolver Completed...")); } }
void RA3FDevSoundTestBase::ToneFinished(TInt aError) { INFO_PRINTF1(_L("========== DevSound ToneFinished() callback ==========")); if (aError == KErrUnderflow) { INFO_PRINTF2(_L("DevSound called CMMFDevSound::ToneFinished with error = %d as expected"), aError); StopTest(aError,EPass); } else { ERR_PRINTF2(_L("DevSound called CMMFDevSound::ToneFinished with error = %d"), aError); ERR_PRINTF2(_L("Expected error = %d"), KErrUnderflow); StopTest(aError); } }
void CT_DataSdpAgent::AttributeRequestComplete(TSdpServRecordHandle aHandle, TInt aError) { INFO_PRINTF2(_L("MSdpAttributeValueVisitor::AttributeRequestComplete Call: aHandle = %d"),aHandle); DecOutstanding(); if ( aHandle!=iSSRHandle) { ERR_PRINTF2(_L("Service record handle not as expected: expected = %d"), iSSRHandle); SetAsyncError(iAttrReqIndex, KErrGeneral); } if ( aError!=KErrNone) { ERR_PRINTF2(_L("AttributeRequestComplete Call failed: aError = %d"),aError); SetAsyncError(iAttrReqIndex, aError); } }
/** * @return - nothing * Check repository settings as defined in the config file. For example, * we might expect 37 strings in the repository. Their keys will be * 'StringKey0' through 'StringKey36'. We'll expect to see hex values for * all of these names (or we will LEAVE). Those keys will be expected * to exist in the repository and have values 'StringVal0' through 'StringVal36' * (or whatever). */ void CRepositoryCheckStep::CheckRepositoryStringSettings(CRepository *arepository, TInt ancheck) { // Careful if the prefix here changes, we don't want to // blow this buffer. Also note the 'Delete' at the end of the loop. TBuf<REPCHECKCREATE_KEYBUFLEN> tkey(KStringKeyPrefix); TBuf<REPCHECKCREATE_VALBUFLEN> tval(KStringValPrefix); TInt keyslen = tkey.Length(); TInt valslen = tval.Length(); for( TInt count=0 ; count < ancheck ; count++ ) { tkey.AppendNum(count); // e.g "StringKey21" tval.AppendNum(count); // e.g "StringVal47" TInt r=0; TInt key; TInt bRet = GetHexFromConfig(ConfigSection(), tkey, key ); if(bRet != 1) { ERR_PRINTF2(_L("Failed to get key%d"), count ); SetTestStepResult(EFail); } TBuf<REPCHECKCREATE_MAXSTRINGLEN> expectedbuf; TPtrC expected(expectedbuf); bRet = GetStringFromConfig(ConfigSection(), tval, expected ); TBuf<REPCHECKCREATE_MAXSTRINGLEN> sval; r = arepository->Get( key, sval ); if(r!=KErrNone) { INFO_PRINTF1(HTML_RED); ERR_PRINTF2(_L("Repository doesn't have StringKey 0x%x"), key ); INFO_PRINTF1(HTML_RED_OFF); SetTestStepResult(EFail); } else if(sval!=expected) { INFO_PRINTF1(HTML_RED); ERR_PRINTF4(_L("String match failure, key 0x%x, got %S, expected %S"), key, &sval, &expected); INFO_PRINTF1(HTML_RED_OFF); SetTestStepResult(EFail); } // Restore the key and value names (i.e strip the digits from the end) tkey.Delete(keyslen, REPCHECKCREATE_KEYBUFLEN); tval.Delete(valslen, REPCHECKCREATE_VALBUFLEN); } // Should we return something? return; }
void CT_DataWindowGc::DoCmdBitBltL(const TDesC& aCommand, const TDesC& aSection, const TInt aAsyncErrorIndex) { TBool dataOk=ETrue; CWsBitmap* wsBitmap=NULL; if ( !CT_GraphicsUtil::GetWsBitmapL(*this, aSection, KFldWsBitmap, wsBitmap) ) { CT_DataBitmapContext::DoCommandL(aCommand, aSection, aAsyncErrorIndex); } else { TPoint point; if ( GetPointFromConfig(aSection, KFldPoint, point) ) { if ( dataOk ) { // Execute command and log parameters INFO_PRINTF1(_L("execute BitBlt(TPoint, CWsBitmap*)")); iWindowGc->BitBlt(point, wsBitmap); } } else { TPoint destination; if ( !GetPointFromConfig(aSection, KFldDestination, destination) ) { dataOk=EFalse; ERR_PRINTF2(KLogMissingParameter, &KFldDestination()); SetBlockResult(EFail); } TRect source; if ( !GetRectFromConfig(aSection, KFldSource, source) ) { dataOk=EFalse; ERR_PRINTF2(KLogMissingParameter, &KFldSource()); SetBlockResult(EFail); } if ( dataOk ) { // Execute command and log parameters INFO_PRINTF1(_L("execute BitBlt(TRect, CWsBitmap*, TRect)")); iWindowGc->BitBlt(destination, wsBitmap, source); } } } }
void CT_RMobileCallData::DoCmdAnswerIncomingCallPost(const TTEFFunction& aSection, const TInt aAsyncErrorIndex) { INFO_PRINTF1(_L("*START*CT_RMobileCallData::DoCmdAnswerIncomingCallPost")); TInt callNameParameter; if ( !GetIntFromConfig(aSection, KCallName, callNameParameter)) { ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCallName); SetBlockResult(EFail); } else { INFO_PRINTF1(_L("Getting mobile call")); TRAPD( error, iMobileCall = GetMobileCallL(callNameParameter) ); if(error != KErrNone) { ERR_PRINTF2(_L("GetMobileCallL left when trying to obtain the MobileCall with error %d"), error); SetBlockResult(EFail); } else { INFO_PRINTF1(_L("Read call status to check if the other party hanged up.")); RCall::TStatus callStatus; error = iMobileCall->GetStatus(callStatus); if ( error != KErrNone) { ERR_PRINTF2(_L("Failed to read mobile call's status [%d]"), error); SetError(error); } else { // Normal status of the connection is EStatusConnected. if ( callStatus == RCall::EStatusConnected) { INFO_PRINTF1(_L("Mobile call is connected.")); } else { INFO_PRINTF1(_L("Mobile call was disconnected, hanging up.")); iMobileCall->HangUp (iActiveCallback->iStatus); iActiveCallback->Activate (aAsyncErrorIndex); IncOutstanding (); } } } } INFO_PRINTF1(_L("*END*CT_RMobileCallData::DoCmdAnswerIncomingCallPost")); }
/** * * InitializeDevSound * @param aDataType * @param aMode * @result TVerdict * */ TVerdict CTestStepSDevSound::InitializeDevSound(TFourCC& aDataType, TMMFState aMode) { iCallbackError = KErrNone; iExpectedValue = KErrNone; iAL->InitialiseActiveListener(); INFO_PRINTF1(_L("Initializing DevSound")); // Initialize TRAPD(err, iMMFDevSound->InitializeL(*this, aDataType, aMode)); if (err) { WARN_PRINTF2 (_L("DevSound InitializeL left with error = %d"), err); return EInconclusive; } else { CActiveScheduler::Start(); if (iCallbackError != iExpectedValue) { ERR_PRINTF3 (_L("DevSound InitializeComplete returned %d, expected %d"), iCallbackError, iExpectedValue); return EFail; } if (iCallbackArray[EInitComplete] != 1) { ERR_PRINTF2 (_L("DevSound InitializeComplete was called %d times, expected 1"), iCallbackArray[EInitComplete]); return EFail; } } return EPass; }
/** Virtual DoCancel - Request to cancel the asynchronous command @internalComponent @see - MTPActiveCallback @param aActive Active Object that DoCancel has been called on @pre - N/A @post - N/A @leave system wide error code */ void CT_DataRSocketServ::DoCancel(CActive* aActive, TInt aAsyncErrorIndex) { TBool straySignal = EFalse; if( aActive==iActiveStartProtocol ) { INFO_PRINTF1(_L("DoCancel StartProtocol called")); } else if( aActive==iActiveStopProtocol ) { INFO_PRINTF1(_L("DoCancel StopProtocol called")); } else if( aActive==iActiveSetExclusiveMode ) { INFO_PRINTF1(_L("DoCancel SetExclusiveMode called")); } else { ERR_PRINTF1(_L("Stray DoCancel signal")); SetBlockResult(EFail); straySignal = ETrue; } if( !straySignal ) { TInt err = aActive->iStatus.Int(); if ( err != KErrNone ) { ERR_PRINTF2(_L("DoCancel Error %d"), err); SetAsyncError(aAsyncErrorIndex, err); } DecOutstanding(); } }
void CT_DataRSocketServ::DoCmdNumProtocols(const TDesC& aSection) { iNumOfProtocols = 0; INFO_PRINTF1(_L("Calling RSocketServ::NumProtocols()")); TInt err = iSocketServ->NumProtocols(iNumOfProtocols); if( err!=KErrNone ) { ERR_PRINTF2(_L("RSocketServ::NumProtocols() failed with error %d"), err); SetError(err); } else { INFO_PRINTF2(_L("RSocketServ::NumProtocols() = %d"), iNumOfProtocols); TInt expectedValue; if( GetIntFromConfig(aSection, KExpectedValue(), expectedValue) ) { if( (TInt)iNumOfProtocols != expectedValue ) { ERR_PRINTF3(_L("Expected NumProtocols (%d) != Actual NumProtocols (%d)"), expectedValue, iNumOfProtocols); SetBlockResult(EFail); } } } }
void CTestBlockController::CreateObjectL(TTEFBlockItem& aCommand) { // Retrieve the object name from the ini file TPtrC name; if( GetStringFromConfig(aCommand.iSection, KName, name) && 0 != aCommand.iSection.Compare(KTEFNull) ) { // Create the wrapper CDataWrapper* data = CreateDataL(aCommand.iObjectType); if( NULL != data) { CleanupStack::PushL(data); data->SetTestBlockController(this); data->SetDataDictionary(&iDataDictionary); data->InitialiseL(); // Add it to the dictionary with the lookup name provided iDataDictionary.AddDataL(name, data); CleanupStack::Pop(data); } else { aCommand.iError = KErrNotFound; ERR_PRINTF2( KErrWrapperCreate, &name ); } } else { ERR_PRINTF1(KErrNoName); aCommand.iError = KErrNotFound; } }
void CT_DataAnimDll::DoCmdnewL(const TDesC& aSection) { DestroyData(); // Get test data for command input parameter(s) TPtrC wsName; RWsSession* ws = NULL; if ( GetStringFromConfig(aSection, KFldWs, wsName) ) { ws = static_cast<RWsSession*>(GetDataObjectL(wsName)); } TInt err = KErrNone; if ( ws!= NULL ) { // Execute command and log parameters INFO_PRINTF1(KLogInfoCmdnewL1); TRAP( err, iAnimDll = new (ELeave) RAnimDll(*ws) ); } else { // Execute command and log parameters INFO_PRINTF1(KLogInfoCmdnewL2); TRAP(err, iAnimDll = new (ELeave) RAnimDll()); } // Check the command return code if ( err!=KErrNone ) { ERR_PRINTF2(KLogErrNum, err); SetError(err); } }
/** * * TestInitialize * @param aDataType * @param aMode * @result TVerdict * */ TVerdict CTestStepSDevSoundPlayDataCap::TestInitialize(TMMFState aMode) { TFourCC pcm16(KMMFFourCCCodePCM16); //default to pcm16 data type iCallbackError = KErrNone; iExpectedValue = KErrNone; ResetCallbacks(); iAL->InitialiseActiveListener(); INFO_PRINTF1(_L("Initializing DevSound")); // Initialize TRAPD(err, iMMFDevSound->InitializeL(*this, pcm16, aMode)); if (err) { WARN_PRINTF2 (_L("DevSound InitializeL left with error = %d"), err); return EInconclusive; } else { CActiveScheduler::Start(); if (iCallbackError != iExpectedValue) { ERR_PRINTF3 (_L("DevSound InitializeComplete returned %d, expected %d"), iCallbackError, iExpectedValue); return EFail; } if (iCallbackArray[EInitComplete] != 1) { ERR_PRINTF2 (_L("DevSound InitializeComplete was called %d times, expected 1"), iCallbackArray[EInitComplete]); return EFail; } } return EPass; }
void CT_DataSdpAttrValue::DoCmdDes(const TDesC& aSection) { TPtrC8 actual=GetSdpAttrValue()->Des(); HBufC* buffer=HBufC::NewLC(actual.Length()); TPtr bufferPtr=buffer->Des(); bufferPtr.Copy(actual); INFO_PRINTF1(_L("CSdpAttrValue::Des result:")); INFO_PRINTF1(bufferPtr); TPtrC expected; if ( GetStringFromConfig(aSection, KExpected(), expected) ) { if ( bufferPtr!=expected ) { ERR_PRINTF1(_L("Des is not as expected!")); SetBlockResult(EFail); } } else { ERR_PRINTF2(_L("Missing expected value %S"), &KExpected()); SetBlockResult(EFail); } CleanupStack::PopAndDestroy(buffer); }
/** Creates a default palette for the display mode specified */ void CT_DataPalette::DoCmdNewDefault(const TDesC& aSection) { INFO_PRINTF1(_L("Calls CPalette::NewDefaultL() creating a default palette for the display mode specified")); // cleanup if any delete iPalette; iPalette = NULL; // get display mode from parameters TDisplayMode displayMode; if ( !CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KDisplayMode(), displayMode) ) { ERR_PRINTF1(_L("No display mode")); SetBlockResult(EFail); } else { // create new palette TRAPD(err, iPalette = CPalette::NewDefaultL(displayMode)); // check error code if (err != KErrNone) { ERR_PRINTF2(_L("CPalette::NewDefaultL error: %d"), err); SetBlockResult(EFail); } } }
/** Used by all tests to wait for listener to recive notification and send confirmation back. timesout if no confirmation received */ void CConcurrentNotifierStep::ProcessWaitL() { iEnd.UniversalTime(); if(ReceivedCountL() == iManyListeners) { if( iTests->Count() > 1 ) { ClearSharedL(); } iWaiting = EFalse; ++iNextTest; } else if( iEnd.MicroSecondsFrom( iStart ).Int64() > KTimeout ) //test has timed out { _LIT(KTimedOut,"Notifier test %d has timed out"); ERR_PRINTF2(KTimedOut, ++iNextTest); if( iTests->Count() > 1 ) { ClearSharedL(); } iWaiting = EFalse; TESTPRINT( EFalse ); iNextTest = iTests->Count(); } //else test is not complete and has not timed out... continue waiting }
/** either release resource after countdown has reached the necessary value or timeout test if countdown is not started after the timeout period has passed */ void CConcurrentTimeOutNotifierStep::ProcessWaitL(const TBool aTransaction) { StartCountdownL(); iEnd.UniversalTime(); const TInt64 KLockTime = iEnd.MicroSecondsFrom( iStart ).Int64(); const TInt64 KTestTime = iEnd.MicroSecondsFrom( iTestStart ).Int64(); if( iCountdown && ( KLockTime >= ((iSeconds - KTimeDiff) * KOneSecond) ) ) { iWaiting = EFalse; iCountdown = EFalse; if(aTransaction) { iContactsDatabase->DatabaseCommitL( EFalse );//unlock database } else { CloseL( ETrue );//unlock contact } ++iNextTest; SetSharedTextL(KSharedNextTest, KDoubleChar, EFalse); } else if( KTestTime > KTimeout ) //test has timed out { _LIT(KTimedOut,"Notifier test %d has timed out"); ERR_PRINTF2(KTimedOut, ++iNextTest); iWaiting = EFalse; iCountdown = EFalse; TESTPRINT( EFalse ); SetSharedTextL(KSharedNextTest, KDoubleChar, EFalse); iNextTest = iTests->Count(); } //else test is not complete and has not timed out... continue waiting }
/** Check the updated categories extended name @param aCalEntry Pointer to CCalEntry @param aCategories Expected category name */ void CTestCalInterimApiFetchEntryAndCheckData::CheckCategoriesL(CCalEntry* aCalEntry, const TDesC& aCategories) { RArray<TPtrC> categoryList; TokenizeStringL(aCategories, categoryList); RPointerArray<CCalCategory> entryCatList; CleanupStack::PushL(TCleanupItem(ResetAndDestroyCategoryArray, &entryCatList)); entryCatList = aCalEntry->CategoryListL(); for(TInt ii = 0; ii < categoryList.Count(); ++ii) { TInt jj = 0; for(; jj < entryCatList.Count(); ++jj) { if(entryCatList[jj]->ExtendedCategoryName() == categoryList[ii]) { INFO_PRINTF2(KInfoCategoryExists, &(categoryList[ii])); break; // break jj } } // jj if(jj >= entryCatList.Count()) { ERR_PRINTF2(KErrCategoryNotExists, &(categoryList[ii])); SetTestStepResult(EFail); } }// ii CleanupStack::PopAndDestroy(&entryCatList); }
/** doTestStepL() Performs the comparison of POP messages @return Returns the teststep result. */ TVerdict CT_MsgComparePopEmailMsgs::doTestStepL() { INFO_PRINTF1(_L("Test Step: Compare Pop Email Msgs")); if(LoadParametersL()) { User::LeaveIfError(iFs.Connect()); CleanupClosePushL(iFs); // Normally do not push an object that is a data member of another object. // But in this case we want to close early if we get a leave. // Otherwise the iFs would be open till the thread had begun to die. if(TestStepResult() == EPass) { CMsvEntry* recvMsvEntry = iSharedDataPOP.iSession->GetEntryL(KMsvRootIndexEntryId); CleanupStack::PushL(recvMsvEntry); CMsvEntry* sentMsvEntry = iSharedDataPOP.iSession->GetEntryL(KMsvRootIndexEntryId); CleanupStack::PushL(sentMsvEntry); for(TInt i = 0;i < iInboxSelectionList->Count();i++) { recvMsvEntry->SetEntryL(iInboxSelectionList->At(i)); TMsvEntry recvEntry = recvMsvEntry->Entry(); for(TInt j = 0;j < iSentSelectionList->Count();j++) { sentMsvEntry->SetEntryL(iSentSelectionList->At(j)); TMsvEntry sentEntry = sentMsvEntry->Entry(); if(recvEntry.iDescription.Compare(sentEntry.iDescription) == 0) { CExpPop3MailInfo* pExpMailInfo = NULL; for(int k = 0;k < iExpResults.Count();k++) { if(iExpResults[k]->GetDescription().Compare(recvEntry.iDescription) == 0) { pExpMailInfo = iExpResults[k]; break; } } if(! pExpMailInfo) { ERR_PRINTF2(_L("Test %d failed could not retrieve expected mail info"), j+1); SetTestStepResult(EFail); break; } if(! DoCompareL(recvEntry, *pExpMailInfo, sentEntry)) { INFO_PRINTF2(_L("Test %d failed"), j + 1); SetTestStepResult(EFail); } } } } CleanupStack::PopAndDestroy(2, recvMsvEntry); // recvMsvEntry, sentMsvEntry } CleanupStack::PopAndDestroy(); } INFO_PRINTF1(_L("T_ComparePopEmailMsgs Completed")); return TestStepResult(); }
TVerdict CListsStep::doTestStepL() /** * @return - TVerdict code * Override of base class pure virtual * Our implementation only gets called if the base class doTestStepPreambleL() did * not leave. That being the case, the current test result value will be EPass. */ { if (TestStepResult()==EPass) { TInt ret = KErrNone; __UHEAP_MARK; TRAP(ret, ClientAppL()); if(KErrNone != ret) { SetTestStepResult(EFail); ERR_PRINTF2(_L("Error %d from CListsStep->ClientAppL()"), ret); } __UHEAP_MARKEND; } return TestStepResult(); }
void CT_DataAnimDll::DoCmdLoad(const TDesC& aSection) { TInt err = KErrNone; // Get test data for command input parameter(s) TPtrC fileName; if(!GetStringFromConfig(aSection, KPlugInFileName(), fileName)) { ERR_PRINTF2(KLogErrMissingPara, &KPlugInFileName()); SetBlockResult(EFail); } else { // Execute command and log parameters if (iAnimDll != NULL) { INFO_PRINTF1(KLogInfoCmdLoad1); err = iAnimDll->Load(fileName); } // Check the command return code if(err != KErrNone) { ERR_PRINTF3(KLogErrLoad, err, &fileName); SetError(err); } } }
/** doTestStepL() Reads the POP account name from the ini file. If ALL string is mentioned in the .ini file it deletes all the IMAP accounts, Else deletes the IMAP account whose name is mentioned in the ini file @return Returns the test step result */ TVerdict CT_MsgDeletePopAccount::doTestStepL() { INFO_PRINTF1(_L("Test Step: Delete Pop Account")); TPtrC popAccountName; // Read Pop Account Name from ini file if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName)) { ERR_PRINTF1(_L("Account name not specified")); SetTestStepResult(EFail); } else { CEmailAccounts* account = CEmailAccounts::NewLC(); RArray<TPopAccount> arrayPop3Accounts; CleanupClosePushL(arrayPop3Accounts); account->GetPopAccountsL(arrayPop3Accounts); TInt count=arrayPop3Accounts.Count(); TBuf<12> temp(popAccountName); temp.UpperCase(); // Making case insensitive if(temp.CompareC(_L("ALL")) == 0) { INFO_PRINTF2(_L("Deleting all accounts. Total = %d"), count); for(TInt i=0; i<count; i++) { TPopAccount id = arrayPop3Accounts[i]; account->DeletePopAccountL(id); } } else { TBool deleteFlag = EFalse; for(TInt i = 0; i < count; i++) { if(popAccountName.CompareC(arrayPop3Accounts[i].iPopAccountName) == 0) { account->DeletePopAccountL(arrayPop3Accounts[i]); // Just ensure that if we try to delete it again we hopefuly get an error // or can see that it has been deleted. arrayPop3Accounts.Remove(i); deleteFlag = ETrue; break; } } if(deleteFlag) { INFO_PRINTF2(_L("Pop acount \" %S \" deleted"), &popAccountName); } else { ERR_PRINTF2(_L("Pop acount \" %S \" not found"), &popAccountName); SetTestStepResult(EFail); User::Leave(KErrNotFound); } } CleanupStack::PopAndDestroy(2, account); //arrayPop3Accounts,account } return TestStepResult(); }