void CAlfPerfAppAvkonTestCaseBasic::NextCycleL() { TAlfCustomEventCommand command( KAlfPerfAppAvkonCmdNext, this ); User::LeaveIfError( Env().Send( command, KCycleDurationMs ) ); iCycleCounter++; iAnimTimer->Cancel(); iAnimTimer->Start(KAnimSleepTimeUs, KAnimSleepTimeUs, TCallBack(AnimTimerCbL, this)); iAnimFrameNum = 0; iCycleStartTime.UniversalTime(); }
/** * Allows other active objects to run while waiting for the specified time. * */ void CTestStepCsdAgt::DelayL(TInt aMicroseconds) { // Construct and start the timer TCallBack callbackfn(CTestStepCsdAgt::TimerCallback, this); CPeriodic *regularUpdater = CPeriodic::NewL(CActive::EPriorityStandard); CleanupStack::PushL(regularUpdater); regularUpdater->Start(aMicroseconds,aMicroseconds,callbackfn); // Block until timer complete CActiveScheduler::Start(); // Stop and delete the timer regularUpdater->Cancel(); CleanupStack::PopAndDestroy(); }
void CActiveConsole::ProcessValue() { switch (iCmdGetValue) { case 'C' : if (iValue > 0 && gNextChunk < MAX_CHUNKS) { CreateChunk (&gChunk[gNextChunk], iValue); ReadChunk (&gChunk[gNextChunk]); ShowMemoryUse(); gNextChunk++; } break; case 'H' : CacheSize (0,iValue); break; case 'L' : CacheSize (iValue,0); break; case 'P' : iPeriod = iValue; iActions = (TUint16)(iValue < KFlushQuietLimit ? EFlushQuiet : EFlush); iTimer->Cancel(); if (iValue > 0) { iTimer->Start(0,iValue,TCallBack(Callback,this)); } break; default : break; } iCmdGetValue = 0; iPrompt = ETrue; }
TVerdict CStepProcMonIgnore::doTestStepL() { INFO_PRINTF1(_L("TEST APPFWK-SYSMON-0005")); INFO_PRINTF1(_L("Going to start a process")); RProcess process; CleanupClosePushL(process); User::LeaveIfError(process.Create(KTestProcGood, KNullDesC)); ResumeL(process); //Setup monitoring and instruct KTestProcGood to not rendevouz when restarted INFO_PRINTF1(_L("Going to request process monitoring")); CStartupProperties* prop = CStartupProperties::NewLC(KTestProcGood, KTestProcGoodNoRendevouz); prop->SetMonitored(ETrue); prop->SetStartupType(EStartProcess); prop->SetStartMethod(EWaitForStart); prop->SetNoOfRetries(1); prop->SetTimeout(100); prop->SetRecoveryParams(EIgnoreOnFailure, 0); //this is what we are testing MonitorL(process, *prop); CleanupStack::PopAndDestroy(prop); //Create a scheduler for callbacks CActiveScheduler* sched = new(ELeave) CActiveScheduler; CleanupStack::PushL(sched); CActiveScheduler::Install(sched); //Timed callback to stop the nested scheduler when we have allowed enough time for the recovery policy to execute CPeriodic* timer = CPeriodic::NewL(CActive::EPriorityStandard); CleanupStack::PushL(timer); const TInt delay = KThrottleTime + 5000000; //make sure delay allow all retries enough time to complete their timeouts timer->Start(delay, delay, TCallBack(CancelWait, this)); //Observer for OS restart iNotifier = CSaveNotifier::NewL(*this); //Kill process and wait throttletime + time for recovery policy to execute TEST(Exists(KTestProcGood)); process.Kill(KErrNone); TEST(EFalse == Exists(KTestProcGood)); TTime time; time.HomeTime(); INFO_PRINTF3(_L("Killed process at time %d:%d, going to sleep for KThrottleTime + 5 seconds."), time.DateTime().Minute(), time.DateTime().Second()); CActiveScheduler::Start(); // now wait until one of the callbacks occur timer->Cancel(); CleanupStack::PopAndDestroy(timer); CleanupStack::PopAndDestroy(sched); CleanupStack::PopAndDestroy(&process); //Assert the process isn't there i.e. that the failure to restart KTestProcGood was ignored. INFO_PRINTF1(_L("Going to assert that the process failed to restart.")); const TBool running = Exists(KTestProcGood); TEST(EFalse == running); if(!running) { INFO_PRINTF1(_L("Process not running.")); } INFO_PRINTF1(_L("Test complete.")); return TestStepResult(); }