|
1 /** |
|
2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 */ |
|
23 |
|
24 |
|
25 #ifndef __CMTF_TEST_ACTION_H__ |
|
26 #define __CMTF_TEST_ACTION_H__ |
|
27 |
|
28 #include <e32base.h> |
|
29 |
|
30 class CMtfTestActionParameters; |
|
31 class CMtfTestCase; |
|
32 |
|
33 /** Abstract base class for asynchronous test actions. Derived classes need to override |
|
34 ExecuteActionL(), RunL() and DoCancel(). Each test action has an identifier and a set of action |
|
35 parameters. NewL() function of derived classes must call ConstructL(). */ |
|
36 class CMtfTestAction : public CActive |
|
37 { |
|
38 public: |
|
39 |
|
40 // These panics signify that a test action contains a programming error. |
|
41 // |
|
42 enum TMtfTestActionPanic |
|
43 { |
|
44 EMtfNonReferenceParameter, // a non-reference parameter is being used as a reference |
|
45 // parameter |
|
46 EMtfNegativeParameterIndex, // negative index being used to obtain an action parameter |
|
47 EMtfParameterIndexOutOfRange,// index used to obtain an action parameter is out of range |
|
48 EMtfUnexpectedRunL, // RunL of an action has been called but the action has |
|
49 // not overridden RunL |
|
50 EMtfUnexpectedDoCancel, // DoCancel of an action has been called but the action has |
|
51 // not overridden DoCanceL |
|
52 EMtfInvalidParameter // invalid parameter |
|
53 }; |
|
54 |
|
55 |
|
56 ~CMtfTestAction(); |
|
57 static void Panic(TMtfTestActionPanic aPanic); |
|
58 |
|
59 virtual void ExecuteActionL()=0; |
|
60 const CMtfTestActionParameters& ActionParameters() const; |
|
61 TBool CurrentlyBeingWaitedFor() const; |
|
62 const TDesC& ActionIdL() const; |
|
63 void SetActionIdL(const TDesC& aActionId); |
|
64 void SetCurrentlyBeingWaitedFor(const TBool& aWaitedFor); |
|
65 |
|
66 /** Returns true only if this action is the wait framework action. */ |
|
67 virtual TBool WaitAction() const; |
|
68 |
|
69 /** Returns true only if this action is the section complete framework action. */ |
|
70 virtual TBool SectionCompleteAction() const; |
|
71 |
|
72 // |
|
73 // virtual func from CActive |
|
74 TInt RunError(TInt aErr); |
|
75 |
|
76 protected: |
|
77 CMtfTestAction(CMtfTestCase& aTestCase); |
|
78 |
|
79 /** Constructs the test action and takes ownership of action parameters. Ownership is taken |
|
80 at the END of the function. aActionParameters must not be NULL. */ |
|
81 void ConstructL(CMtfTestActionParameters* aActionParams); |
|
82 |
|
83 CMtfTestCase& TestCase(); |
|
84 |
|
85 private: |
|
86 CMtfTestCase& iTestCase; |
|
87 CMtfTestActionParameters* iActionParams; |
|
88 HBufC* iActionId; |
|
89 TBool iCurrentlyBeingWaitedFor; // no need for wait list |
|
90 }; |
|
91 |
|
92 |
|
93 #endif |
|
94 |