messagingfw/wappushfw/tpush/t_wappush.h
changeset 22 bde600d88860
parent 0 8e480a14352b
equal deleted inserted replaced
21:08008ce8a6df 22:bde600d88860
       
     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 //
       
    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 
       
    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 
       
    56 	};
       
    57 
       
    58 
       
    59 
       
    60 
       
    61 
       
    62 /**
       
    63  * This class drives CWapPushTest derived test objects
       
    64  * 
       
    65  */
       
    66 class CWapPushTestEngine : public CActive
       
    67 	{
       
    68 public:
       
    69 	static CWapPushTestEngine* NewL();
       
    70 	CWapPushTestEngine() : CActive(CActive::EPriorityUserInput) {}
       
    71 	virtual ~CWapPushTestEngine();
       
    72 	virtual void TestCompleted(TInt aResult);
       
    73 	void Printf(const TDesC& aString);
       
    74 	void Printf(const TDesC& aName, const TDesC& aString);
       
    75 	TKeyCode Getch();
       
    76 	CConsoleBase& Console() const;
       
    77 protected:
       
    78 	// from CActive
       
    79 	virtual void DoCancel();
       
    80 	virtual void RunL();
       
    81 	void RunNextTestL();
       
    82 	void ConstructL();
       
    83 	void InitialiseMsgServiceL();
       
    84 	
       
    85 	enum TState { EIdle=0, ERunningTest, EShuttingDown};
       
    86 	enum TTest	{
       
    87 					EUnknownMessage,
       
    88 					ESLMessage, 
       
    89 					ESIMessage,
       
    90 					ESICMessage,
       
    91 					ESLCMessage,
       
    92 					EMultipartRelated,
       
    93 					EMultipartAlternative,
       
    94 					EMultipartMixed,
       
    95 					ESIAMessage,
       
    96 					EReleaseThree,
       
    97 					EClientMtmFind,
       
    98 					EFailMessageTest,		
       
    99 					EINC081489,
       
   100 					EDRMMessage,
       
   101 					EInvalidDTDMessage,
       
   102 					ECorruptMsgs,
       
   103 					EReleaseTwo,
       
   104 					EFinished
       
   105 					};
       
   106 
       
   107 	TState				iState;
       
   108 	TTest				iTest;
       
   109 	CWapPushTest*		iCurrentTest;
       
   110 	CConsoleBase*		iConsole;
       
   111 	};
       
   112 
       
   113 class CWapPushOOMTestEngine : public CWapPushTestEngine
       
   114 	{
       
   115 public:
       
   116 	static CWapPushOOMTestEngine* NewL ();
       
   117 	~CWapPushOOMTestEngine ();
       
   118 	void TestCompleted ( TInt aResult );
       
   119 	TTest NextTest () const;
       
   120 	void SetNextTest ( TInt aTest );
       
   121 	TInt Error () const;
       
   122 	void SetError ( TInt aErr );
       
   123 	private:
       
   124 	void DoCancel ();
       
   125 	void RunL ();
       
   126 		
       
   127 private:
       
   128 	TInt				iError;
       
   129 	};
       
   130 
       
   131 
       
   132 
       
   133 #endif