void CTe_locsrvSuiteStepBase::PositionRequestWithCheck(TPositionInfo& _aInfo, TRequestStatus& aStatus, TInt _aResult, TUid _aModuleId, RPositioner aPositioner) { aPositioner.NotifyPositionUpdate(_aInfo, aStatus); User::WaitForRequest(aStatus); CheckExpectedResult(aStatus.Int(), _aResult, KWrongRequestResult); CheckExpectedResult((_aInfo).ModuleId(), _aModuleId, KWrongModuleIdReturned); }
void RelativeDateTimeFormatterTest::RunTest( const RelativeDateTimeFormatter& fmt, const WithoutQuantityExpected* expectedResults, int32_t expectedResultLength, const char *description) { for (int32_t i = 0; i < expectedResultLength; ++i) { CheckExpectedResult(fmt, expectedResults[i], description); } }
void CompactDecimalFormatTest::CheckLocale(const Locale& locale, UNumberCompactStyle style, const ExpectedResult* expectedResults, int32_t expectedResultLength) { UErrorCode status = U_ZERO_ERROR; LocalPointer<CompactDecimalFormat> cdf(createCDFInstance(locale, style, status)); if (U_FAILURE(status)) { dataerrln("Unable to create format object - %s", u_errorName(status)); return; } char description[256]; sprintf(description,"%s - %s", locale.getName(), StyleStr(style)); for (int32_t i = 0; i < expectedResultLength; i++) { CheckExpectedResult(cdf.getAlias(), &expectedResults[i], description); } }
TVerdict CGetFixTestStep::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. */ { StandardPrepareL(); RPositionServer server; if(KErrNone != server.Connect()) { ERR_PRINTF1(KFailedConnectServer); SetTestStepResult(EFail); return TestStepResult(); } CleanupClosePushL(server); RPositioner positioner; if(KErrNone != positioner.Open(server)) { ERR_PRINTF1(KFailedOpenPositioner); SetTestStepResult(EFail); return TestStepResult(); } CleanupClosePushL(positioner); CheckExpectedResult(KErrNone, SetAuthenticRequestor(positioner)); TPositionInfo posInfo; TRequestStatus reqStatus; // // 1. No modules, no last known fix DisableAllModulesL(); // ask for a fix positioner.NotifyPositionUpdate(posInfo, reqStatus); User::WaitForRequest(reqStatus); CheckExpectedResult(reqStatus.Int(), KErrNotFound, KWrongResult); // ask for last known pos TRequestStatus dbclear; server.EmptyLastKnownPositionStore(dbclear); User::WaitForRequest(dbclear); positioner.GetLastKnownPosition(posInfo, reqStatus); User::WaitForRequest(reqStatus); if (reqStatus.Int() != KErrUnknown) { ERR_PRINTF2(_L("GetLastKnownPosition returned %d"),reqStatus.Int()); SetTestStepResult(EFail); } // // 2. Some modules, last known fix exists // first, create LastKnownPos const TUid KPsy1Uid = {KLcfPsy1UidValue}; TogglePsyL(KPsy1Uid, ETrue); positioner.NotifyPositionUpdate(posInfo, reqStatus); User::WaitForRequest(reqStatus); CheckExpectedResult(reqStatus.Int(), KErrNone, KWrongResult); // now last known pos exists, ask for it positioner.GetLastKnownPosition(posInfo, reqStatus); User::WaitForRequest(reqStatus); CheckExpectedResult(reqStatus.Int(), KErrNone, KWrongResult); // // 3. No modules, last known fix exists TogglePsyL(KPsy1Uid, EFalse); // ask for a fix positioner.NotifyPositionUpdate(posInfo, reqStatus); User::WaitForRequest(reqStatus); CheckExpectedResult(reqStatus.Int(), KErrNotFound, KWrongResult); // now last known pos exists, ask for it positioner.GetLastKnownPosition(posInfo, reqStatus); User::WaitForRequest(reqStatus); CheckExpectedResult(reqStatus.Int(), KErrNone, KWrongResult); CleanupStack::PopAndDestroy(2, &server); return TestStepResult(); }
TVerdict CTwoPsysStep::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. */ { StandardPrepareL(); InitPsySettingsL(2, KIntGpsPsy1, 1, KNetworkPsy1, 1); ConfigPsyL(KIntGpsPsy1, 7, KConfigLRNoError, //Step 1. no error KConfigLRErrGeneral1s, //Step 2. KErrGeneral KConfigLRNoError35s, //Step 3. no error in 35s KConfigLRErrGeneral1s, //Step 4. KErrGeneral in 1 seconds KConfigLRNoError35s, //Step 5. no error in 35s KConfigLRNoError35s, //Step 6. no error in 35s KConfigLRErrGeneral35s //Step 7. KErrGeneral in 35s. ); ConfigPsyL(KNetworkPsy1, 6, KConfigLRNoError, //Step2. no error KConfigLRNoError, //Step3. no error KConfigLRErrNoMemory, //Step4. KErrNoMemory in 1 seconds KConfigLRNoError35s, //Step5. no error in 35 seconds KConfigLRErrNoMemory, //Step6. KErrNoMemory in 1 seconds KConfigLRNoError10s //Step7. no error in 35s ); User::After(KSecond*7); //Delay is needed after every time PSY is configured. TRequestStatus status; TPositionInfo posInfo; TPositionUpdateOptions options; //1. When PSY1 is able to give a fix. Make location request, //it shall be completed from IntGpsPsy1 SET_TIME PositionRequestWithCheck(posInfo, KErrNone, KIntGpsPsy1); CHECK_TIME(1) //2. When PSY1 returns a error code, PSY2 shall return KErrNone PositionRequestWithCheck(posInfo, KErrNone, KNetworkPsy1); CHECK_TIME(2) //Reset the priority of default proxy. Delay shall be used every time //PSY1 gives a error code User::After(KSecond*7); //3. When PSY1 does not response anything within timeshift, PSY2 shall //return KErrNone SET_TIME PositionRequestWithCheck(posInfo, KErrNone, KNetworkPsy1); CHECK_TIME(31) //30 is the timeshift value min(TTFF(80), 30) User::After(KSecond*7); //4. When both PSY returns error code, the error code from the //first PSY be returned //If the completion code is not KErrNone or KPositionPartialUpdate, //Location Server will not return module ID. SET_TIME iPositioner.NotifyPositionUpdate(posInfo,status); User::WaitForRequest(status); CheckExpectedResult(status.Int(), KErrGeneral, KWrongRequestResult); CHECK_TIME(2) //Reset the priority of default proxy. Delay shall be used every time //PSY1 gives error code User::After(KSecond*7); //5. PSY1 does not give a fix within timeshift, PSY2 is tried. Before PSY2 //returns a fix, PSY gives a fix, then fix from PSY1 shall be used. SET_TIME PositionRequestWithCheck(posInfo, KErrNone, KIntGpsPsy1); CHECK_TIME(35) //6. PSY1 does not give a fix within timeshift, PSY2 is tried. But PSY2 failed //to give a fix, default proxy will wait until PSY1 give a fix PositionRequestWithCheck(posInfo, KErrNone, KIntGpsPsy1); CHECK_TIME(35) //7. PSY1 does not give a fix within timeshift, PSY2 is tried. If PSY1 then //give a error code, then fix from PSY2 will be used. PositionRequestWithCheck(posInfo, KErrNone, KNetworkPsy1); CHECK_TIME(40) StandardCleanup(); return TestStepResult(); }
TVerdict CTrackingSessionStep::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. */ { StandardPrepareL(); const TInt KInterval = 1 * KSecondsToMicro; const TTimeIntervalMicroSeconds KFirstRequestDelay = 200 * 1000; // 0.2 sec const TTimeIntervalMicroSeconds KNormalRequestDelay = 200 * 1000; // 0.2 sec const TInt KDiff = 200 * 1000; // 0.2 sec const TInt KIntervalError = 100 * 1000; // 0.1 sec TRequestStatus status; TWatch watch; TTime secondRequest, stopTracking; TInt interval; HPositionGenericInfo* genInfo = HPositionGenericInfo::NewLC(); // setup : only PSY6 ToggleModuleL(KUidLcfPsy1, EFalse); ToggleModuleL(KUidLcfPsy3, EFalse); User::After(KSecond * 7); InitPsyListInDefaultProxyL(); // make one request to allow default proxy rebuild its database // this will guarantee that first request will be as fast as possible TPositionCourseInfo courseInfo; PositionRequestWithCheck(courseInfo, KErrArgument, KNullUid); // setup tracking session TPositionUpdateOptions updateOptions; updateOptions.SetUpdateInterval(KInterval); iPositioner.SetUpdateOptions(updateOptions); // 1st request // first request must be quick watch.Tick(); PositionRequestWithCheck(*genInfo, KErrNone, KUidLcfPsy6); if(watch.ElapsedFromTick() > KFirstRequestDelay) { ERR_PRINTF1(KFirstDelayTooLong); SetTestStepResult(EFail); } // drop delay and make 2nd and 3rd requests genInfo->ClearRequestedFields(); { watch.Tick(); PositionRequestWithCheck(*genInfo, KErrNone, KUidLcfPsy6); secondRequest.UniversalTime(); interval = (TInt) watch.ElapsedFromTick().Int64(); if(Abs(interval - KInterval) > KIntervalError) { ERR_PRINTF1(KSecondDelayOutOfRange); SetTestStepResult(EFail); } watch.Tick(); PositionRequestWithCheck(*genInfo, KErrNone, KUidLcfPsy6); interval = watch.ElapsedFromTick().Int64(); if(Abs(interval - KInterval) > KIntervalError) { ERR_PRINTF1(KThirdDelayOutOfRange); SetTestStepResult(EFail); } } // stop tracking updateOptions.SetUpdateInterval(TTimeIntervalMicroSeconds(0)); iPositioner.SetUpdateOptions(updateOptions); stopTracking.UniversalTime(); // psy6 must return event log genInfo->SetRequestedField(KPSY6FieldEventLog); watch.Tick(); PositionRequestWithCheck(*genInfo, KErrNone, KUidLcfPsy6); if(watch.ElapsedFromTick() > KNormalRequestDelay) { ERR_PRINTF1(KNormalDelayTooBig); SetTestStepResult(EFail); } // Analyze event log from PSY6 TQueryEvent* eventArray = GetPsy6EventLogL(*genInfo); TInt32 logSize; if(KErrNone != genInfo->GetValue(KPSY6FieldEventLogSize, logSize)) { ERR_PRINTF1(KFailedReadLogsize); SetTestStepResult(EFail); return TestStepResult(); } TUint expectedEvents[] = {EUpdate, ETrackingStart, EUpdate, EUpdate, ETrackingStop, EUpdate}; TUint numExpectedEvents = sizeof(expectedEvents) / sizeof(TUint); CheckExpectedResult(logSize, numExpectedEvents, KWrongEventNumberPSY6); // check event types for (TInt32 index = 0; index < Min(logSize, numExpectedEvents); index++) { TQueryEvent& event = *(eventArray + index); CheckExpectedResult(event.iEventType, expectedEvents[index], KUnexpectedEvent); } // check event times if(logSize != numExpectedEvents) { ERR_PRINTF1(KCannotCheckEventTimes); SetTestStepResult(EFail); return TestStepResult(); } // ( ETrackingStart should have happenned right after first // request was completed ) // Harley: Because of intelligent Default Proxy change, the tracking start // shall happen just before the second location request is issued to the PSY. TQueryEvent& event = *(eventArray + 1); if(Abs(secondRequest.MicroSecondsFrom(event.iTime).Int64()) > KDiff) { ERR_PRINTF1(KStartEventBeyondExpectendRange); SetTestStepResult(EFail); } // ETrackingStop should have happenned right after second // SetUpdateOptions event = *(eventArray + 4); if(Abs(stopTracking.MicroSecondsFrom(event.iTime).Int64()) > KDiff) { ERR_PRINTF1(KStopEventBeyondExpectendRange); SetTestStepResult(EFail); } // cleanup CleanupStack::PopAndDestroy(genInfo); StandardCleanup(); return TestStepResult(); }
TVerdict CPsyDisabledStep::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. */ { StandardPrepareL(); InitPsySettingsL(3, KNetworkPsy1, 1, KIntGpsPsy1, 1, KNetworkPsy2, 1); ConfigPsyL(KNetworkPsy1, 1, KConfigLRNoError10s //Step1. no error in 10s ); ConfigPsyL(KIntGpsPsy1, 2, KConfigLRNoError, //Step 1. no error KConfigLRNoError10s //Step 2. no error in 10s ); ConfigPsyL(KNetworkPsy2, 1, KConfigLRNoError //Step2. no error ); User::After(KSecond*7); TRequestStatus status; TPositionInfo posInfo; TPositionUpdateOptions options; //1. Disable PSY1 while location request is on going. LR shall //fallback to PSY2 and then fix from PSY2 is used. iPositioner.NotifyPositionUpdate(posInfo, status); User::After(KTinyDelay); SET_TIME ToggleModuleL(KNetworkPsy1, EFalse); User::WaitForRequest(status); //CHECK_TIME(1) CheckExpectedResult(status.Int(), KErrNone, KFailedPositionRequest); CheckExpectedResult(posInfo.ModuleId(), KIntGpsPsy1, KWrongModuleIdReturned); ToggleModuleL(KNetworkPsy1, ETrue); //Config PSY1 again since it was unloaded when it was disabled. ConfigPsyL(KNetworkPsy1, 1, KConfigLRNoError20s //Step2. no error in 20s ); User::After(KSecond*7); //2. Disable PSY2 while location request ongoing, the request shall //fallbck to PSY3 SET_TIME iPositioner.NotifyPositionUpdate(posInfo, status); User::After(KSecond*15); //after 15s disable PSY2 ToggleModuleL(KIntGpsPsy1, EFalse); User::WaitForRequest(status); CHECK_TIME(16) //After PSY2 is disabled in 15 seconds, PSY3 is used. CheckExpectedResult(status.Int(), KErrNone, KFailedPositionRequest); CheckExpectedResult(posInfo.ModuleId(), KNetworkPsy2, KWrongModuleIdReturned); // cleanup StandardCleanup(); return TestStepResult(); }
TVerdict CPsyVisibleStep::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. */ { StandardPrepareL(); InitPsySettingsL(3, KNetworkPsy1, 1, KIntGpsPsy1, 1, KNetworkPsy2, 1); ConfigPsyL(KIntGpsPsy1, 3, KConfigLRNoError5s, //Step 1. no error in 5s KConfigLRErrGeneral1s, //Step 2. error in 1s KConfigLRErrGeneral1s //Step 3. error in 1s ); User::After(KSecond*7); TRequestStatus status; TPositionInfo posInfo; TPositionUpdateOptions options; ToggleModuleVisibleL(KNetworkPsy1, EFalse); //1. Set PSY1 visible shall not affect location request SET_TIME iPositioner.NotifyPositionUpdate(posInfo, status); User::After(KTinyDelay); ToggleModuleVisibleL(KNetworkPsy1, ETrue); User::WaitForRequest(status); CHECK_TIME(5) CheckExpectedResult(status.Int(), KErrNone, KFailedPositionRequest); CheckExpectedResult(posInfo.ModuleId(), KIntGpsPsy1, KWrongModuleIdReturned); ToggleModuleVisibleL(KNetworkPsy2, EFalse); ConfigPsyL(KNetworkPsy1, 2, KConfigLRNoError35s, //Step2. no error in 35s KConfigLRErrNoMemory //Step 3. error in 1s ); User::After(KSecond*7); //2. Set PSY3 visible during fallback shall has no effect SET_TIME iPositioner.NotifyPositionUpdate(posInfo, status); User::After(KSecond*5); ToggleModuleVisibleL(KNetworkPsy2, ETrue); User::WaitForRequest(status); CHECK_TIME(35) //PSY1 response time CheckExpectedResult(status.Int(), KErrNone, KFailedPositionRequest); CheckExpectedResult(posInfo.ModuleId(), KNetworkPsy1, KWrongModuleIdReturned); //3. PSY3 shall be used in next LR SET_TIME iPositioner.NotifyPositionUpdate(posInfo, status); User::WaitForRequest(status); CheckExpectedResult(status.Int(), KErrNone, KFailedPositionRequest); CheckExpectedResult(posInfo.ModuleId(), KNetworkPsy2, KWrongModuleIdReturned); // cleanup StandardCleanup(); return TestStepResult(); }
TVerdict CMultipleClientsStep::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. */ { StandardPrepareL(); InitPsySettingsL(3, KExtGpsPsy1, 1, KIntGpsPsy1, 1, KNetworkPsy2, 1); TRequestStatus status; TPositionInfo posInfo; TPositionUpdateOptions options; TRequestStatus status2; TPositionInfo posInfo2; TPositionUpdateOptions options2; RPositioner positioner2; User::LeaveIfError(positioner2.Open(iServer)); CleanupClosePushL(positioner2); User::LeaveIfError(positioner2.SetRequestor( CRequestor::ERequestorService, CRequestor::EFormatApplication, KTdDefProxyTestName)); //1. Make location request from both PSYs. All should succeed from ExtGpsPsy1 positioner2.NotifyPositionUpdate(posInfo2,status2); PositionRequestWithCheck(posInfo, KErrNone, KExtGpsPsy1); User::WaitForRequest(status2); CheckExpectedResult(status2.Int(), KErrNone, KWrongRequestResult); CheckExpectedResult(posInfo2.ModuleId(), KExtGpsPsy1, KWrongModuleIdReturned); \ //2. When all PSYs returns error code, both PSYs shall //get error code from the first PSY ConfigPsyL(KExtGpsPsy1, 1, KConfigLRErrNoMemory //KErrNoMemory 1s ); ConfigPsyL(KIntGpsPsy1, 1, KConfigLRErrGeneral1s //KErrGeneral 1s ); ConfigPsyL(KNetworkPsy2, 1, KConfigLRErrNoMemory //KErrNoMemory 1s ); ConfigPsyL(positioner2, KExtGpsPsy1, 1, KConfigLRErrNoMemory //KErrNoMemory 1s ); ConfigPsyL(positioner2, KIntGpsPsy1, 1, KConfigLRErrGeneral1s //KErrGeneral 1s ); ConfigPsyL(positioner2, KNetworkPsy2, 1, KConfigLRErrNoMemory //KErrNoMemory 1s ); InitPsyListInDefaultProxyL(); iPositioner.NotifyPositionUpdate(posInfo, status); positioner2.NotifyPositionUpdate(posInfo2, status2); User::WaitForRequest(status); CheckExpectedResult(status.Int(), KErrNoMemory, KWrongRequestResult); User::WaitForRequest(status2); CheckExpectedResult(status2.Int(), KErrNoMemory, KWrongRequestResult); //3. When PSY1 returns error code to to client 1. Location request //from PSY2 shall fallback imediately ConfigPsyL(KExtGpsPsy1, 1, KConfigLRErrNoMemory //KErrNoMemory 1s ); ConfigPsyL(KIntGpsPsy1, 1, KConfigLRErrGeneral1s //KErrGeneral 1s ); ConfigPsyL(KNetworkPsy2, 1, KConfigLRNoError1s //No error 1s ); ConfigPsyL(positioner2, KExtGpsPsy1, 1, KConfigLRNoError10s //No error in 10s ); ConfigPsyL(positioner2, KIntGpsPsy1, 1, KConfigLRNoError10s //KErrGeneral 1s ); ConfigPsyL(positioner2, KNetworkPsy2, 1, KConfigLRNoError1s //KErrNoMemory 1s ); InitPsyListInDefaultProxyL(); User::After(KSecond * 7); //Delay after configuration SET_TIME PositionRequestWithCheck(posInfo, KErrNone, KNetworkPsy2); INFO_PRINTF1(_L("1 3")); CHECK_TIME(3) //LR from second PSY positioner2.NotifyPositionUpdate(posInfo2, status2); User::WaitForRequest(status2); INFO_PRINTF1(_L("2 1")); CHECK_TIME(1) //PSY1 and PSY2 fallback imediately, LR completed from PSY3 in 1s CheckExpectedResult(status2.Int(), KErrNone, KWrongRequestResult); CheckExpectedResult(posInfo2.ModuleId(), KNetworkPsy2, KWrongModuleIdReturned); //4. PSY state change beause of LR for client1 shall affect LR for client2 as well // ConfigPsyL(KExtGpsPsy1, 1, KConfigLRErrNoMemory //KErrNoMemory 1s ); ConfigPsyL(positioner2, KExtGpsPsy1, 1, KConfigLRNoError10s //No error in 10s ); InitPsyListInDefaultProxyL(); User::After(KSecond * 7); //Delay after configuration SET_TIME positioner2.NotifyPositionUpdate(posInfo2, status2); PositionRequestWithCheck(posInfo, KErrNone, KIntGpsPsy1); INFO_PRINTF1(_L("3 1")); CHECK_TIME(1); User::WaitForRequest(status2); CheckExpectedResult(status2.Int(), KErrNone, KWrongRequestResult); CheckExpectedResult(posInfo2.ModuleId(), KIntGpsPsy1, KWrongModuleIdReturned); INFO_PRINTF1(_L("4 0")); CHECK_TIME(0); //5. Dynamic list change caused by PSY1 shall not affect PSY list orders of client2 //if location request is already made. ConfigPsyL(KExtGpsPsy1, 1, KConfigLRErrNoMemory //KErrNoMemory 1s ); ConfigPsyL(KIntGpsPsy1, 2, KConfigLRNoError1s, //No error in 10s KConfigLRErrNoMemory //KErrNoMemory 1s ); ConfigPsyL(positioner2, KIntGpsPsy1, 2, KConfigLRNoError1s, //No error in 10s KConfigLRNoError20s //No error in 10s ); ConfigPsyL(positioner2, KExtGpsPsy1, 1, KConfigLRNoError45s //No error in 45s ); InitPsyListInDefaultProxyL(); User::After(KSecond * 7); //Delay after configuration PositionRequestWithCheck(posInfo, KErrNone, KIntGpsPsy1); //Location request from client 2 shall be completed imediatelly, since //IntGpsPsy shall be the first on the dynamic list SET_TIME positioner2.NotifyPositionUpdate(posInfo2, status2); User::WaitForRequest(status2); CheckExpectedResult(status2.Int(), KErrNone, KWrongRequestResult); CheckExpectedResult(posInfo2.ModuleId(), KIntGpsPsy1, KWrongModuleIdReturned); INFO_PRINTF1(_L("5 1")); CHECK_TIME(1); //Make location request from client 2 positioner2.NotifyPositionUpdate(posInfo2, status2); SET_TIME PositionRequestWithCheck(posInfo, KErrNone, KExtGpsPsy1); INFO_PRINTF1(_L("6 1")); CHECK_TIME(1) User::WaitForRequest(status2); CheckExpectedResult(status2.Int(), KErrNone, KWrongRequestResult); CheckExpectedResult(posInfo2.ModuleId(), KNetworkPsy2, KWrongModuleIdReturned); INFO_PRINTF1(_L("7 0")); CHECK_TIME(0) CleanupStack::PopAndDestroy(&positioner2); //Cleanup StandardCleanup(); return TestStepResult(); }
TInt CTe_locsrvSuiteStepBase::DoPanicTestL(TThreadFunction aThreadFunction, TExitCategoryName aExpectedExitCat, TInt aExpectedExitReason, TTimeIntervalMicroSeconds32 aTimeoutValue) { #ifdef __WINS__ User::SetJustInTime(EFalse); CleanupStack::PushL(TCleanupItem(TurnJITBackOn)); #endif RThread panickingThread; SPanicThreadFunctionData threadData; threadData.iPanicFunction = aThreadFunction; threadData.iPtr = NULL; // check that thread does not already exist TInt result = KErrNone; TBuf<24> threadName(KPanicThreadName); result = panickingThread.Create( threadName, PanicThreadFunction, KDefaultStackSize, KTestHeapMinSize, KTestHeapMaxSize, &threadData, EOwnerProcess); CheckExpectedResult(result, KErrNone, KUnexpectedErrorCreatingPanicThread); User::LeaveIfError(result); CleanupClosePushL(panickingThread); RTimer timeoutTimer; User::LeaveIfError(timeoutTimer.CreateLocal()); CleanupClosePushL(timeoutTimer); TRequestStatus timerStatus; timeoutTimer.After(timerStatus, aTimeoutValue); TRequestStatus threadStatus; panickingThread.Rendezvous(threadStatus); if (threadStatus != KRequestPending) { // logon failed - thread is not yet running, so cannot have terminated User::WaitForRequest(threadStatus); // eat signal panickingThread.Kill(threadStatus.Int()); // abort startup } else { panickingThread.Resume(); User::WaitForRequest(threadStatus, timerStatus); } TInt exitReason = KErrNone; if (threadStatus == KRequestPending) { ERR_PRINTF1(KThreadDidntDieKillIt); panickingThread.Kill(KErrTimedOut); User::WaitForRequest(threadStatus); } else // (timerStatus == KRequestPending) { // stop timer timeoutTimer.Cancel(); User::WaitForRequest(timerStatus); } exitReason = panickingThread.ExitReason(); TExitCategoryName exitCat = panickingThread.ExitCategory(); switch(panickingThread.ExitType()) { case EExitKill: INFO_PRINTF2(KThreadWasKilled, exitReason); break; case EExitTerminate: INFO_PRINTF2(KThreadWasTerminated, exitReason); break; case EExitPanic: // check exit reasons if (exitCat.Compare(aExpectedExitCat) != 0) { INFO_PRINTF3(KUnexpectedPanicCategory, &exitCat, &aExpectedExitCat); } CheckExpectedResult(exitReason, aExpectedExitReason, KUnexpectedPanicReason); break; default: CheckExpectedResult((TInt)EExitPanic, threadStatus.Int(), KUnexpectedThreadExitType); break; } CleanupStack::PopAndDestroy(&timeoutTimer); CleanupStack::PopAndDestroy(&panickingThread); #ifdef __WINS__ CleanupStack::PopAndDestroy(); //TurnJITBackOn #endif // wait a bit to make sure this thread is over const TTimeIntervalMicroSeconds32 KThreadDelay = 1000 * 1000; // 1 s User::After(KThreadDelay); return exitReason; }