diff -r e8c1ea2c6496 -r 8758140453c0 lbs/common/src/ctlbsactiveyield.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lbs/common/src/ctlbsactiveyield.cpp Thu Jan 21 12:53:44 2010 +0000 @@ -0,0 +1,80 @@ +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Common utils used by hybrid plugin tests +// +// + + + +/** + @file ctlbsactiveyield.cpp +*/ + +#include +#include + +#include + + +void CheckForObserverEventTestsL(TTimeIntervalMicroSeconds32 aTimeout, CTestStep& aStep) + { + class CTimeout : public CTimer + { + CTestStep& iStep; + + void RunL() + { + iStep.SetTestStepError(KErrTimedOut); + CActiveScheduler::Stop(); + } + + CTimeout(CTestStep& aTestStep) : CTimer(EPriorityLow), iStep(aTestStep) { ; } + + public: + static CTimeout* NewL(CTestStep& aTestStep) + { + CTimeout* p = new (ELeave) CTimeout(aTestStep); + CleanupStack::PushL(p); + p->ConstructL(); + CActiveScheduler::Add(p); + CleanupStack::Pop(p); + return p; + } + }; + + CTimeout *pTimeout = CTimeout::NewL(aStep); + pTimeout->After(aTimeout); + + CActiveScheduler::Start(); + + if(pTimeout->iStatus == KRequestPending) + { + pTimeout->Cancel(); +// User::WaitForRequest(pTimeout->iStatus); + } + + pTimeout->Deque(); + delete pTimeout; + + if(EPass != aStep.TestStepResult()) + { + User::Leave(aStep.TestStepResult()); + } + } + + +void ReturnToTestStep() + { + CActiveScheduler::Stop(); + }