748
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
872
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
748
|
5 |
// which accompanies this distribution, and is available
|
872
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
748
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// Common utils used by hybrid plugin tests
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
/**
|
|
21 |
@file ctlbsactiveyield.cpp
|
|
22 |
*/
|
|
23 |
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <e32std.h>
|
|
26 |
|
|
27 |
#include <testexecutestepbase.h>
|
|
28 |
|
|
29 |
|
|
30 |
void CheckForObserverEventTestsL(TTimeIntervalMicroSeconds32 aTimeout, CTestStep& aStep)
|
|
31 |
{
|
|
32 |
class CTimeout : public CTimer
|
|
33 |
{
|
|
34 |
CTestStep& iStep;
|
|
35 |
|
|
36 |
void RunL()
|
|
37 |
{
|
|
38 |
iStep.SetTestStepError(KErrTimedOut);
|
|
39 |
CActiveScheduler::Stop();
|
|
40 |
}
|
|
41 |
|
|
42 |
CTimeout(CTestStep& aTestStep) : CTimer(EPriorityLow), iStep(aTestStep) { ; }
|
|
43 |
|
|
44 |
public:
|
|
45 |
static CTimeout* NewL(CTestStep& aTestStep)
|
|
46 |
{
|
|
47 |
CTimeout* p = new (ELeave) CTimeout(aTestStep);
|
|
48 |
CleanupStack::PushL(p);
|
|
49 |
p->ConstructL();
|
|
50 |
CActiveScheduler::Add(p);
|
|
51 |
CleanupStack::Pop(p);
|
|
52 |
return p;
|
|
53 |
}
|
|
54 |
};
|
|
55 |
|
|
56 |
CTimeout *pTimeout = CTimeout::NewL(aStep);
|
|
57 |
pTimeout->After(aTimeout);
|
|
58 |
|
|
59 |
CActiveScheduler::Start();
|
|
60 |
|
|
61 |
if(pTimeout->iStatus == KRequestPending)
|
|
62 |
{
|
|
63 |
pTimeout->Cancel();
|
|
64 |
// User::WaitForRequest(pTimeout->iStatus);
|
|
65 |
}
|
|
66 |
|
|
67 |
pTimeout->Deque();
|
|
68 |
delete pTimeout;
|
|
69 |
|
|
70 |
if(EPass != aStep.TestStepResult())
|
|
71 |
{
|
|
72 |
User::Leave(aStep.TestStepResult());
|
|
73 |
}
|
|
74 |
}
|
|
75 |
|
|
76 |
|
|
77 |
void ReturnToTestStep()
|
|
78 |
{
|
|
79 |
CActiveScheduler::Stop();
|
|
80 |
}
|