|
1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // __ACTION_INFO_BEGIN__ |
|
15 // [Action Name] |
|
16 // Sleep |
|
17 // [Action Parameters] |
|
18 // Time <input>: Value of sleep time in seconds. |
|
19 // [Action Description] |
|
20 // Action will be completed after the specified time. |
|
21 // [APIs Used] |
|
22 // none |
|
23 // __ACTION_INFO_END__ |
|
24 // |
|
25 // |
|
26 |
|
27 /** |
|
28 @file |
|
29 */ |
|
30 |
|
31 |
|
32 #include "CMtfTestActionSleep.h" |
|
33 #include "CMtfTestCase.h" |
|
34 #include "CMtfTestActionParameters.h" |
|
35 |
|
36 |
|
37 CMtfTestAction* CMtfTestActionSleep::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
38 { |
|
39 CMtfTestActionSleep* self = new (ELeave) CMtfTestActionSleep(aTestCase); |
|
40 CleanupStack::PushL(self); |
|
41 self->ConstructL(aActionParameters); |
|
42 CleanupStack::Pop(); |
|
43 return self; |
|
44 } |
|
45 |
|
46 |
|
47 CMtfTestActionSleep::CMtfTestActionSleep(CMtfTestCase& aTestCase) |
|
48 : CMtfTestAction(aTestCase) |
|
49 { |
|
50 } |
|
51 |
|
52 |
|
53 CMtfTestActionSleep::~CMtfTestActionSleep() |
|
54 { |
|
55 } |
|
56 |
|
57 |
|
58 void CMtfTestActionSleep::ExecuteActionL() |
|
59 { |
|
60 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSleep); |
|
61 TInt paramTime = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(0)); |
|
62 |
|
63 iTimer = CMtfTestActionUtilsTimer::NewL(); |
|
64 iTimer->After(paramTime,iStatus); |
|
65 CActiveScheduler::Add(this); |
|
66 SetActive(); |
|
67 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSleep); |
|
68 } |
|
69 |
|
70 |
|
71 void CMtfTestActionSleep::DoCancel() |
|
72 { |
|
73 iTimer->Cancel(); |
|
74 } |
|
75 |
|
76 |
|
77 void CMtfTestActionSleep::RunL() |
|
78 { |
|
79 delete iTimer; |
|
80 |
|
81 User::LeaveIfError(iStatus.Int()); |
|
82 TestCase().ActionCompletedL(*this); |
|
83 } |
|
84 |