|
1 // Copyright (c) 2000-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 // This file contains the declaration of the CWapPushTest which represents a testcase to be run |
|
15 // and CWapPushTestEngine which drives the test objects. |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file T_WAPPUSH.H |
|
21 */ |
|
22 |
|
23 #ifndef __T_WAPPUSH_H__ |
|
24 #define __T_WAPPUSH_H__ |
|
25 |
|
26 #include <e32std.h> |
|
27 #include <e32base.h> |
|
28 #include <e32cons.h> |
|
29 #include <push/pushlog.h> |
|
30 |
|
31 _LIT(KTextFinishedTest,"Finished all tests successfully - Press any key"); |
|
32 _LIT(KTextFailedTest,"!!! TEST FAILED !!! - Press any key"); |
|
33 const TInt KPushLogBuffer=256; |
|
34 |
|
35 // forward declarations |
|
36 class CWapPushTestEngine; |
|
37 class CPushMessage; |
|
38 |
|
39 |
|
40 |
|
41 /** |
|
42 * This class represents a single test case to be run |
|
43 */ |
|
44 class CWapPushTest : public CActive, public MWapPushLog |
|
45 { |
|
46 public: |
|
47 CWapPushTest() : CActive(CActive::EPriorityStandard) {}; |
|
48 // |
|
49 inline void SetEngine(CWapPushTestEngine* aEngine) { iEngine = aEngine; } |
|
50 void BeginTest(); |
|
51 void Printf(const TDesC& aString); |
|
52 void Test(TInt aTestResult,TInt aLine); |
|
53 public: |
|
54 // from MWapPushLog |
|
55 virtual void WPLPrintf(const TDesC& aDescription); |
|
56 virtual void WPLPrintfL(CPushMessage& aMessage); |
|
57 virtual void WPLLogBinaryAsHex(const TDesC& aDescription); |
|
58 virtual void WPLLogError(const TDesC& aDescription,TInt aError); |
|
59 protected: |
|
60 virtual const TDesC& TestName()=0; |
|
61 protected: |
|
62 CWapPushTestEngine* iEngine; |
|
63 |
|
64 }; |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 /** |
|
71 * This class drives CWapPushTest derived test objects |
|
72 * |
|
73 */ |
|
74 class CWapPushTestEngine : public CActive |
|
75 { |
|
76 public: |
|
77 static CWapPushTestEngine* NewL(); |
|
78 CWapPushTestEngine::CWapPushTestEngine() : CActive(EPriorityUserInput) {} |
|
79 ~CWapPushTestEngine(); |
|
80 void TestCompleted(TInt aResult); |
|
81 void Printf(const TDesC& aString); |
|
82 void Printf(const TDesC& aName, const TDesC& aString); |
|
83 TKeyCode Getch(); |
|
84 CConsoleBase& Console() const; |
|
85 private: |
|
86 // from CActive |
|
87 virtual void DoCancel(); |
|
88 virtual void RunL(); |
|
89 private: |
|
90 void RunNextTestL(); |
|
91 void ConstructL(); |
|
92 void InitialiseMsgServiceL(); |
|
93 |
|
94 private: |
|
95 enum TState { EIdle=0, ERunningTest, EShuttingDown}; |
|
96 enum TTest { |
|
97 ESCRIPT, |
|
98 EFinished |
|
99 }; |
|
100 private: |
|
101 TState iState; |
|
102 TTest iTest; |
|
103 CWapPushTest* iCurrentTest; |
|
104 CConsoleBase* iConsole; |
|
105 }; |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 #endif |