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