messagingfw/wappushfw/tpush/pushtests.h
changeset 62 db3f5fa34ec7
parent 0 8e480a14352b
equal deleted inserted replaced
60:9f5ae1728557 62:db3f5fa34ec7
       
     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 __PUSHTESTS_H__
       
    17 #define __PUSHTESTS_H__
       
    18 
       
    19 #include "t_wappush.h"
       
    20 #include <msvapi.h>
       
    21 #include <mtclbase.h>
       
    22 #include "dummywapstack.h"		// MDummyWapStackObserver
       
    23 
       
    24 #include <push/pushlog.h>			// for test engine Rfs/Cwatcherlog
       
    25 #include "ConnMan.h"			// for connection manager
       
    26 #include <caf/manager.h>
       
    27 #include <caf/rightsmanager.h>
       
    28 
       
    29 //const TInt KBufferSize = 256;		// imitates KReceiveBufferSize from CLWatcher
       
    30 //const TInt KBufferSize = 1024;
       
    31 const TInt KBufferSize = 2048;
       
    32 
       
    33 class MWapPushLog;
       
    34 class CWapPushMsgGen;
       
    35 
       
    36 class MTimeoutCallback
       
    37 	{
       
    38 public:
       
    39 	virtual void Timeout() = 0;
       
    40 	};
       
    41 
       
    42 class CTestTimer : public CTimer
       
    43 	{
       
    44 public:
       
    45 	static CTestTimer* NewL(MTimeoutCallback* callback)
       
    46 		{
       
    47 		CTestTimer* self = new(ELeave) CTestTimer(callback);
       
    48 		CleanupStack::PushL(self);
       
    49 		self->ConstructL(); // CTimer
       
    50 		CActiveScheduler::Add(self);
       
    51 		CleanupStack::Pop();
       
    52 		return self;
       
    53 		}
       
    54 
       
    55 protected:
       
    56 	virtual void RunL() 
       
    57 		{ 
       
    58 		iCallback->Timeout(); 
       
    59 		}
       
    60 private:
       
    61 	CTestTimer(MTimeoutCallback* callback): CTimer(EPriorityLow), iCallback(callback)
       
    62 	{};
       
    63 	
       
    64 	MTimeoutCallback* iCallback;
       
    65 	};
       
    66 
       
    67 
       
    68 /**
       
    69  * 	Derived test case class which implementation the stack observer
       
    70  * 	to allow communication with the stack
       
    71  *
       
    72  *	This class has been made abstract to allow different derived classes
       
    73  *	to implement creating multiple test messages via PrepareTestMessageL()
       
    74  *	and the support of NumberTestCasesToRun()
       
    75  *	BOTH must be implimented in any derived class.
       
    76  *	ConfirmMessagesSavedL provides confirmation of message storage and 
       
    77  *  reports on number of messages found in store.
       
    78  */
       
    79 class CWapPushBaseMessageTest : public CWapPushTest, public MDummyWapStackObserver
       
    80 	{
       
    81 public:
       
    82 	virtual ~CWapPushBaseMessageTest();
       
    83 	virtual void RunL();
       
    84 	virtual TInt RunError(TInt aError);
       
    85 	virtual void DoCancel();
       
    86 	virtual const TDesC& TestName();
       
    87 
       
    88 	virtual void NumberTestCasesToRun();
       
    89 	virtual void PrepareTestMessageL(TInt aCurrentTestCase) = 0;	// abstract class now!!!
       
    90 	virtual TBool ConfirmMessagesSavedL() = 0;
       
    91 
       
    92 	// from MDummyWapStackObserver	
       
    93 	virtual void DWSOUnitWaitPushL(CDummyWSPCLConn& aDummyCLConn);
       
    94 	virtual void DWSOCancelUnitWaitPush(CDummyWSPCLConn& aDummyCLConn);
       
    95 	virtual void DWSOServerShutDown();
       
    96 	virtual void DWSOError(const TDesC& aDes, TInt aLineNum);
       
    97 	virtual void DWSOConnect(CDummyWSPCOConn& aDummyCOConn);
       
    98 	virtual void DWSOGetEventL(CDummyWSPCOConn& aDummyCOConn);
       
    99 	virtual void DWSOCancelGetEvent(CDummyWSPCOConn& aDummyCOConn);
       
   100 	virtual void DWSOAckTransaction(CDummyWSPCOTrans& aDummyCOTrans);
       
   101 protected:
       
   102 	void MoveToNextState();
       
   103 	void CompleteOwnRequest();
       
   104 
       
   105 	void InitialiseMsgService();
       
   106 	
       
   107 protected:
       
   108 	enum TState
       
   109 		{
       
   110 		EInitialisation,
       
   111 		EWaitForPush,
       
   112 		EFinished
       
   113 		};
       
   114 protected:
       
   115 	TState						iState;
       
   116 	
       
   117 	TBuf8<KBufferSize>			iBodyBuf;
       
   118 	TBuf8<KBufferSize>			iHeadersBuf;
       
   119 	HBufC8*						iBody;
       
   120 	HBufC8*						iHeaders;
       
   121 
       
   122 	CDummyWapStack* iWapStack;
       
   123 	CConnectionManager* iConnMan;
       
   124 	TBool iHasMsgBeenCompleted;
       
   125 	TBool iHasTestBeenCompleted;
       
   126 
       
   127 	TInt iNumberOfTestCases;			
       
   128 	TInt iCurrentTestCase;
       
   129 
       
   130 	};
       
   131 
       
   132 /** SL derived test case */
       
   133 class CWapPushSLMessageTest : public CWapPushBaseMessageTest
       
   134 	{
       
   135 	virtual const TDesC& TestName();
       
   136 	
       
   137 	virtual void NumberTestCasesToRun();
       
   138 	virtual void PrepareTestMessageL(TInt aCurrentTestCase);
       
   139 	// new to validate expected test messages(s) stored ok...
       
   140 	virtual TBool ConfirmMessagesSavedL();
       
   141 	};
       
   142 
       
   143 /** SLC derived test case */
       
   144 class CWapPushSLCMessageTest : public CWapPushBaseMessageTest
       
   145 	{
       
   146 	virtual const TDesC& TestName ();
       
   147 	virtual void NumberTestCasesToRun ();
       
   148 	virtual void PrepareTestMessageL ( TInt aCurrentTestCase );
       
   149 	virtual TBool ConfirmMessagesSavedL();
       
   150 	};
       
   151 
       
   152 /** SI derived test case */
       
   153 class CWapPushSIMessageTest : public CWapPushBaseMessageTest
       
   154 	{
       
   155 	virtual const TDesC& TestName();
       
   156 		
       
   157 	virtual void NumberTestCasesToRun();
       
   158 	virtual void PrepareTestMessageL(TInt aCurrentTestCase);
       
   159 	// new to validate expected test messages(s) stored ok...
       
   160 	virtual TBool ConfirmMessagesSavedL();
       
   161 
       
   162 private:
       
   163 	void PrepareApostropheTestMessageL();
       
   164 	};
       
   165 
       
   166 /** SIC derived test case */
       
   167 class CWapPushSICMessageTest : public CWapPushBaseMessageTest
       
   168 	{
       
   169 	virtual const TDesC& TestName();		
       
   170 	virtual void NumberTestCasesToRun();
       
   171 	virtual void PrepareTestMessageL(TInt aCurrentTestCase);
       
   172 	// new to validate expected test messages(s) stored ok...
       
   173 	virtual TBool ConfirmMessagesSavedL();
       
   174 	private:
       
   175 	TBool TestMessageL ( const TDesC& aUri, const TDesC8& aText );
       
   176 	};
       
   177 
       
   178 /** Invalid DTD test case */
       
   179 class CInvalidWAPDTDMessages : public CWapPushBaseMessageTest
       
   180 	{
       
   181 	virtual const TDesC& TestName ();
       
   182 	virtual void NumberTestCasesToRun ();
       
   183 	virtual void PrepareTestMessageL (TInt aCurrentTestCase);
       
   184 	// new to validate expected test messages(s) stored ok...
       
   185 	virtual TBool ConfirmMessagesSavedL ();
       
   186 	virtual TInt RunError(TInt aError);
       
   187 	};
       
   188 
       
   189 /** Test case for INC081489,INC081568, INC082189, INC082190, INC082191  */
       
   190 class CINC081489 : public CWapPushBaseMessageTest
       
   191 	{
       
   192 	virtual const TDesC& TestName();
       
   193 		
       
   194 	virtual void NumberTestCasesToRun();
       
   195 	virtual void PrepareTestMessageL(TInt aCurrentTestCase);
       
   196 	// new to validate expected test messages(s) stored ok...
       
   197 	virtual TBool ConfirmMessagesSavedL();
       
   198 	};
       
   199 
       
   200 
       
   201 /** Multipart-Mixed derived test case */
       
   202 class CWapPushMMMessageTest : public CWapPushBaseMessageTest
       
   203 	{
       
   204 	virtual const TDesC& TestName();
       
   205 		
       
   206 	virtual void NumberTestCasesToRun();
       
   207 	virtual void PrepareTestMessageL(TInt aCurrentTestCase);
       
   208 	// new to validate expected test messages(s) stored ok...
       
   209 	virtual TBool ConfirmMessagesSavedL();
       
   210 	};
       
   211 
       
   212 /** Multipart-Related derived test case */
       
   213 class CWapPushMRMessageTest : public CWapPushBaseMessageTest
       
   214 	{
       
   215 	virtual const TDesC& TestName();
       
   216 		
       
   217 	virtual void NumberTestCasesToRun();
       
   218 	virtual void PrepareTestMessageL(TInt aCurrentTestCase);
       
   219 	// new to validate expected test messages(s) stored ok...
       
   220 	virtual TBool ConfirmMessagesSavedL();
       
   221 	};
       
   222 
       
   223 /** Multipart-Alternative derived test case */
       
   224 class CWapPushMAMessageTest : public CWapPushBaseMessageTest
       
   225 	{
       
   226 	virtual const TDesC& TestName();
       
   227 		
       
   228 	virtual void NumberTestCasesToRun();
       
   229 	virtual void PrepareTestMessageL(TInt aCurrentTestCase);
       
   230 	// new to validate expected test messages(s) stored ok...
       
   231 	virtual TBool ConfirmMessagesSavedL();
       
   232 	};
       
   233 
       
   234 /** Unknown Handler derived test case */
       
   235 class CWapPushUnkMessageTest : public CWapPushBaseMessageTest
       
   236 	{
       
   237 	virtual const TDesC& TestName();
       
   238 		
       
   239 	virtual void NumberTestCasesToRun();
       
   240 	virtual void PrepareTestMessageL(TInt aCurrentTestCase);
       
   241 	// new to validate expected test messages(s) stored ok...
       
   242 	virtual TBool ConfirmMessagesSavedL();
       
   243 	void TestAndPrint(const TDesC& aTestCase, const TDesC& aFilename, const TDesC& aLocalFilename);
       
   244 	};
       
   245 
       
   246 /** 
       
   247  *	SIA Handler derived test case 
       
   248  */
       
   249 class CWapPushSIAMessageTest : public CWapPushBaseMessageTest
       
   250 	{
       
   251 	virtual const TDesC& TestName();
       
   252 		
       
   253 	virtual void NumberTestCasesToRun();
       
   254 	virtual void PrepareTestMessageL(TInt aCurrentTestCase);
       
   255 	
       
   256 	virtual TBool ConfirmMessagesSavedL();
       
   257 	void SetupAddressL();
       
   258 	};
       
   259 
       
   260 
       
   261 /** SL derived test case */
       
   262 class CWapPushCorruptMessageTest : public CWapPushBaseMessageTest
       
   263 	{
       
   264 	virtual const TDesC& TestName();
       
   265 	
       
   266 	virtual void NumberTestCasesToRun();
       
   267 	virtual void PrepareTestMessageL(TInt aCurrentTestCase);
       
   268 	// new to validate expected test messages(s) stored ok...
       
   269 	virtual TBool ConfirmMessagesSavedL();
       
   270 private:	
       
   271 	void SetHeaderBuffer(TUint aTestCase);
       
   272 
       
   273 	enum TWapPushCorruptMsgType {
       
   274 		//-- Test SI Corrupt Msgs -- 
       
   275 		ECorruptSiMsg1=0,	// 'href' - Optinal data missing
       
   276 		ECorruptSiMsg2,		// 'si-id' - Optianl data missing
       
   277 		ECorruptSiMsg3,		// 'created' - Mandatory data missing
       
   278 		ECorruptSiMsg4,		// 'si-expires' - Mandatory data missing	
       
   279 		ECorruptSiMsg5,		// 'action' - Optional data missing
       
   280 		ECorruptSiMsg6,		// Mandatory data missing - The INFO Element-
       
   281 		ECorruptSiMsg7,		// Missing Body
       
   282 		ECorruptSicMsg1,	// Missing Body
       
   283 		//-- Test SL Corrupt Msgs --
       
   284 		ECorruptSlMsg1,		// 
       
   285 		ECorruptSlMsg2,		// Header - Content type SLC instead of SL
       
   286 		ECorruptSlMsg3,		// Missing Body
       
   287 		ECorruptSlMsg4,		// Unsupported XML version - 2.0
       
   288 		ECorruptSlMsg5,		// Corrupt XML body - incorrect DTD
       
   289 		ECorruptSlMsg6,		// Corrupt XML body - invalid tag in XML header 
       
   290 		ECorruptSlMsg7,		// Corrupt XML body - unknown tags in XML content
       
   291 		ECorruptSlMsg8,		// Corrupt XML body - "hreg" not "href"
       
   292 		ECorruptSlMsg9,		// Corrupt XML body - "adtion" not "action"
       
   293 		ECorruptSlMsg10,	// Missing Href	
       
   294 		ECorruptSlMsg11,	// Missing Action
       
   295 
       
   296 		//-- Test SLC Corrupt Msgs --
       
   297 		ECorruptSlcMsg1,	// Header - wrong App ID 
       
   298 		ECorruptSlcMsg2,	// Header - Content type SL instead of SLC
       
   299 		ECorruptSlcMsg3,	// WMLC - body has corrupt bit 
       
   300 		ECorruptSlcMsg4,	// WMLC - body has been abruptly ended - invalid termination
       
   301 		ECorruptSlcMsg5,	// WMLC - missing Body
       
   302 		ECorruptSlcMsg6,	// WMLC - body contains only a single Null character
       
   303 		ECorruptSlcMsg7,	// WMLC - missing Href
       
   304 		ECorruptSlcMsg8,	// WMLC - missing Action
       
   305 		
       
   306 		//-- Test SIA Corrupt Msgs --
       
   307 		ECorruptSiaMsg1,	// Corrupt Body
       
   308 		ECorruptSiaMsg2,	// Corrupt CO/Ack
       
   309 		ECorruptSiaMsg3,	// Corrupt CO/no Ack
       
   310 		ECorruptSiaMsg4,	// SIA doesn't accept a connection, the test harness should time out
       
   311 
       
   312 		//-- Test Multi-Part/Mixed Corrupt Msgs --
       
   313 		ECorruptMultiMixedMsg1,	//Corrupt first part
       
   314 		ECorruptMultiMixedMsg2,	//Corrupt 2nd multipart
       
   315 		ECorruptMultiMixedMsg3,	// Corrupt Header
       
   316 		ECorruptMultiMixedMsg4,    // 1st Part Hdr - header length value too small
       
   317 		ECorruptMultiMixedMsg5,	// 2nd Part Hdr - header length value too small
       
   318 		ECorruptMultiMixedMsg6,	// 1st Part Hdr - header length value too large
       
   319 		ECorruptMultiMixedMsg7,	// 2nd Part Hdr - header length value too large
       
   320 		ECorruptMultiMixedMsg8,	// 1st Part Hdr - part body length value too small
       
   321 		ECorruptMultiMixedMsg9,	// 2nd Part Hdr - part body length value too small
       
   322 		ECorruptMultiMixedMsg10,	// 1st Part Hdr - part body length value too large
       
   323 		ECorruptMultiMixedMsg11,	// 2nd Part Hdr - part body length value too large
       
   324 		ECorruptMultiMixedMsg12,	// 1st Part Body - part body shorter than header length value 
       
   325 		ECorruptMultiMixedMsg13,	// 2nd Part Body - part body shorter than header length value 
       
   326 		ECorruptMultiMixedMsg14,	// 1st Part Body - part body longer than header length value 
       
   327 		ECorruptMultiMixedMsg15,	// 2nd Part Body - part body longer than header length value 
       
   328 		ECorruptMultiMixedMsg16,   // Multipart header incorrectly specifies 3 parts when there's 2
       
   329 		ECorruptMultiMixedMsg17,	// Multipart header incorrectly specifies 2 parts when there's 3
       
   330 		ECorruptMultiMixedMsg18,	// Corrupt Wrong App Id - UnknownAppHandler
       
   331 		ECorruptMultiMixedMsg19,   // No binary data - WAP Push message body is empty
       
   332 		ECorruptMultiMixedMsg20,	// WAP Push message body contains only a single null value
       
   333 		ECorruptMultiMixedMsg21,	// Message body is full of junk - no proper WAP Multipart headers
       
   334 
       
   335 		//-- Test Multi-Part/Related Corrupt Msgs --
       
   336 		ECorruptMultiRelatedMsg1,	//Corrupt first part
       
   337 		ECorruptMultiRelatedMsg2,	//Corrupt 2nd multipart
       
   338 		ECorruptMultiRelatedMsg3,	// Corrupt Header
       
   339 		ECorruptMultiRelatedMsg4,    // 1st Part Hdr - header length value too small
       
   340 		ECorruptMultiRelatedMsg5,	// 2nd Part Hdr - header length value too small
       
   341 		ECorruptMultiRelatedMsg6,	// 1st Part Hdr - header length value too large
       
   342 		ECorruptMultiRelatedMsg7,	// 2nd Part Hdr - header length value too large
       
   343 		ECorruptMultiRelatedMsg8,	// 1st Part Hdr - part body length value too small
       
   344 		ECorruptMultiRelatedMsg9,	// 2nd Part Hdr - part body length value too small
       
   345 		ECorruptMultiRelatedMsg10,	// 1st Part Hdr - part body length value too large
       
   346 		ECorruptMultiRelatedMsg11,	// 2nd Part Hdr - part body length value too large
       
   347 		ECorruptMultiRelatedMsg12,	// 1st Part Body - part body shorter than header length value 
       
   348 		ECorruptMultiRelatedMsg13,	// 2nd Part Body - part body shorter than header length value 
       
   349 		ECorruptMultiRelatedMsg14,	// 1st Part Body - part body longer than header length value 
       
   350 		ECorruptMultiRelatedMsg15,	// 2nd Part Body - part body longer than header length value 
       
   351 		ECorruptMultiRelatedMsg16,   // Multipart header incorrectly specifies 3 parts when there's 2
       
   352 		ECorruptMultiRelatedMsg17,	// Multipart header incorrectly specifies 2 parts when there's 3
       
   353 		ECorruptMultiRelatedMsg18,	// Corrupt Wrong App Id - UnknownAppHandler
       
   354 		ECorruptMultiRelatedMsg19,   // No binary data - WAP Push message body is empty
       
   355 		ECorruptMultiRelatedMsg20,	// WAP Push message body contains only a single null value
       
   356 		ECorruptMultiRelatedMsg21,	// Message body is full of junk - no proper WAP Multipart headers
       
   357 	
       
   358 		//-- Test Multi-Part/Alternative Corrupt Msgs --
       
   359 		ECorruptMultiAlternativeMsg1,	//Corrupt 1st multipart
       
   360 		ECorruptMultiAlternativeMsg2,	//Corrupt 2nd multipart
       
   361 		ECorruptMultiAlternativeMsg3,	// Corrupt Header
       
   362 		ECorruptMultiAlternativeMsg4,    // 1st Part Hdr - header length value too small
       
   363 		ECorruptMultiAlternativeMsg5,	// 2nd Part Hdr - header length value too small
       
   364 		ECorruptMultiAlternativeMsg6,	// 1st Part Hdr - header length value too large
       
   365 		ECorruptMultiAlternativeMsg7,	// 2nd Part Hdr - header length value too large
       
   366 		ECorruptMultiAlternativeMsg8,	// 1st Part Hdr - part body length value too small
       
   367 		ECorruptMultiAlternativeMsg9,	// 2nd Part Hdr - part body length value too small
       
   368 		ECorruptMultiAlternativeMsg10,	// 1st Part Hdr - part body length value too large
       
   369 		ECorruptMultiAlternativeMsg11,	// 2nd Part Hdr - part body length value too large
       
   370 		ECorruptMultiAlternativeMsg12,	// 1st Part Body - part body shorter than header length value 
       
   371 		ECorruptMultiAlternativeMsg13,	// 2nd Part Body - part body shorter than header length value 
       
   372 		ECorruptMultiAlternativeMsg14,	// 1st Part Body - part body longer than header length value 
       
   373 		ECorruptMultiAlternativeMsg15,	// 2nd Part Body - part body longer than header length value 
       
   374 		ECorruptMultiAlternativeMsg16,   // Multipart header incorrectly specifies 3 parts when there's 2
       
   375 		ECorruptMultiAlternativeMsg17,	// Multipart header incorrectly specifies 2 parts when there's 3
       
   376 		ECorruptMultiAlternativeMsg18,	// Corrupt Wrong App Id - UnknownAppHandler
       
   377 		ECorruptMultiAlternativeMsg19,   // No binary data - WAP Push message body is empty
       
   378 		ECorruptMultiAlternativeMsg20,	// WAP Push message body contains only a single null value
       
   379 		ECorruptMultiAlternativeMsg21	// Message body is full of junk - no proper WAP Multipart headers
       
   380 		};
       
   381 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS	
       
   382     /** 
       
   383 	WAP Push Message status value. 
       
   384 	*/
       
   385     enum TPushMsgStatus	
       
   386 		{
       
   387 		/** Message is corrupt. */
       
   388 		EPushMsgStatusCorrupt = 3
       
   389 		};
       
   390 #endif//SYMBIAN_ENABLE_SPLIT_HEADERS
       
   391 	
       
   392 	};
       
   393 
       
   394 
       
   395 
       
   396 
       
   397 
       
   398 
       
   399 #ifdef XXXX
       
   400 
       
   401 
       
   402 /**
       
   403  * Tests the following use case
       
   404  * 'secure confirmed multipart/mixed containing SI and SL using WAP plug-in
       
   405  * interface'
       
   406  */
       
   407 class CWapPushR2Test : public CWapPushTest, public MDummyWapStackObserver
       
   408 	{
       
   409 public:
       
   410 	~CWapPushR2Test();
       
   411 	virtual void RunL();
       
   412 	virtual void DoCancel();
       
   413 	virtual const TDesC& TestName();
       
   414 
       
   415 	// from MDummyWapStackObserver	
       
   416 	virtual void DWSOUnitWaitPushL(CDummyWSPCLConn& aDummyCLConn);
       
   417 	virtual void DWSOCancelUnitWaitPush(CDummyWSPCLConn& aDummyCLConn);
       
   418 	virtual void DWSOServerShutDown();
       
   419 	virtual void DWSOError(const TDesC& aDes, TInt aLineNum);	
       
   420 	virtual void DWSOConnect(CDummyWSPCOConn& aDummyCOConn);
       
   421 	virtual void DWSOGetEventL(CDummyWSPCOConn& aDummyCOConn);
       
   422 	virtual void DWSOCancelGetEvent(CDummyWSPCOConn& aDummyCOConn);
       
   423 	virtual void DWSOAckTransaction(CDummyWSPCOTrans& aDummyCOTrans);
       
   424 private:
       
   425 	void MoveToNextState();
       
   426 	void CompleteOwnRequest();
       
   427 	void CreatePushMsg();
       
   428 	void CreateMultiMixedPushMsg();
       
   429 private:
       
   430 	enum TState
       
   431 		{
       
   432 		EInitialisation,
       
   433 		ESendSIA,
       
   434 		EWaitForAcknowledge,
       
   435 		EFinished
       
   436 		};
       
   437 	enum TResponseState
       
   438 		{
       
   439 		ESessionConfirm,
       
   440 		ETransaction
       
   441 		};
       
   442 private:
       
   443 	TState iState;
       
   444 	TResponseState iResponseState;
       
   445 
       
   446 	TBuf8<KBufferSize> iBodyBuf;
       
   447 	TBuf8<KBufferSize> iHeadersBuf;
       
   448 	HBufC8*	iBody;
       
   449 	HBufC8*	iHeaders;
       
   450 
       
   451 	CDummyWapStack* iWapStack;
       
   452 	CConnectionManager* iConnMan;
       
   453 	TBool iHasMsgBeenCompleted;
       
   454 	TBool iAck;
       
   455 
       
   456 	};
       
   457 
       
   458 #endif
       
   459 
       
   460 /**
       
   461  * Tests the following use case:
       
   462  *  - Connectionless Secure SIA Push Message
       
   463  *  - Connection Oriented Unsecure
       
   464  *  - Multipart/related Push Message Containing Si, vCard, JPEG
       
   465  */
       
   466 class CWapPushR3Test : public CWapPushTest, public MDummyWapStackObserver, public MTimeoutCallback
       
   467 	{
       
   468 public:
       
   469 	~CWapPushR3Test();
       
   470 	virtual void RunL();
       
   471 	virtual void DoCancel();
       
   472 	virtual const TDesC& TestName();
       
   473 
       
   474 	// from MDummyWapStackObserver	
       
   475 	virtual void DWSOUnitWaitPushL(CDummyWSPCLConn& aDummyCLConn);
       
   476 	virtual void DWSOCancelUnitWaitPush(CDummyWSPCLConn& aDummyCLConn);
       
   477 	virtual void DWSOServerShutDown();
       
   478 	virtual void DWSOError(const TDesC& aDes, TInt aLineNum);	
       
   479 	virtual void DWSOConnect(CDummyWSPCOConn& aDummyCOConn);
       
   480 	virtual void DWSOGetEventL(CDummyWSPCOConn& aDummyCOConn);
       
   481 	virtual void DWSOCancelGetEvent(CDummyWSPCOConn& aDummyCOConn);
       
   482 	virtual void DWSOAckTransaction(CDummyWSPCOTrans& aDummyCOTrans);
       
   483 
       
   484 	// MTimeoutCallback
       
   485 	virtual void Timeout();
       
   486 private:
       
   487 	void MoveToNextState();
       
   488 	void CompleteOwnRequest();
       
   489 	void CreateMultiPartRelatedPushMsg();
       
   490 	void CreateSLPushMsg();
       
   491 	void CreateClSecureSiaPushMsgL();
       
   492 	void SetupAddressL();
       
   493 private:
       
   494 	enum TState
       
   495 		{
       
   496 		EInitialisation,
       
   497 		EDWSOGetEventInitialisation,
       
   498 		EWaitForAcknowledge,
       
   499 		EFinished
       
   500 		};
       
   501 	enum TResponseState
       
   502 		{
       
   503 		ESessionConfirm,
       
   504 		ETransaction
       
   505 		};
       
   506 private:
       
   507 	TState iState;
       
   508 	TResponseState iResponseState;
       
   509 
       
   510 	TBuf8<KBufferSize> iBodyBuf;
       
   511 	TBuf8<KBufferSize> iHeadersBuf;
       
   512 	HBufC8*	iBody;
       
   513 	HBufC8*	iHeaders;
       
   514 
       
   515 	CDummyWapStack* iWapStack;
       
   516 	CConnectionManager* iConnMan;
       
   517 	TBool iHasMsgBeenCompleted;
       
   518 	TBool iAck;
       
   519 	TBool iSiaMsgPushed;
       
   520 	CTestTimer	*iTimer;
       
   521 
       
   522 	};
       
   523 
       
   524 //------------------------------------------------------------------------------
       
   525 class CDummyObserver : public CBase, public MMsvSessionObserver
       
   526 	{
       
   527 public:
       
   528 	void HandleSessionEventL(TMsvSessionEvent, TAny*, TAny*, TAny*) {};
       
   529 	};
       
   530 
       
   531 //------------------------------------------------------------------------------
       
   532 class CWapClientMtmFindTest : public CWapPushTest
       
   533 	{
       
   534 public:
       
   535 	CWapClientMtmFindTest() : 
       
   536 		iSession(NULL), iDummyObserver(NULL){};
       
   537 	~CWapClientMtmFindTest();
       
   538 private:
       
   539 	// From CWapPushTest
       
   540 	const TDesC& TestName();
       
   541 
       
   542 	// From CActive
       
   543 	void RunL();
       
   544 	void DoCancel();
       
   545 	TInt RunError(TInt aError);
       
   546 
       
   547 	// Private methods
       
   548 	void SetupFindDataL(CMsvEntry* entry);
       
   549 	void PerformTests(CBaseMtm* aWapPushClientMtm);
       
   550 	void TestAndPrint(
       
   551 		CBaseMtm* aWapPushClientMtm, 
       
   552 		const TDesC& aTestText, 
       
   553 		TMsvPartList aResultList);
       
   554 
       
   555 private:
       
   556 	CMsvSession* iSession;
       
   557 	CDummyObserver* iDummyObserver;
       
   558 	TMsvId iMessageId;
       
   559 	};
       
   560 //------------------------------------------------------------------------------
       
   561 
       
   562 /** DRM derived test case */
       
   563 class CWapPushDRMMessageTest : public CWapPushBaseMessageTest
       
   564 	{
       
   565 	virtual const TDesC& TestName();
       
   566 	
       
   567 	virtual void NumberTestCasesToRun();
       
   568 	virtual void PrepareTestMessageL(TInt aCurrentTestCase);
       
   569 	// new to validate expected test messages(s) stored ok...
       
   570 	virtual TBool ConfirmMessagesSavedL();
       
   571 	
       
   572 	void RegRequesttriggerMessageL();
       
   573 	void ROAquisationTriggerMessageL();
       
   574 	void JoinDomaintriggerMessageL();
       
   575 	void LeaveDomainTriggerMessageL();
       
   576 	void WbXmlROMessageL();
       
   577 	void InvalidWbXmlROMessageL();
       
   578 	void XmlROMessageL();
       
   579 	void InvalidXmlROMessageL();
       
   580 	void LargeXmlROMessageL();
       
   581 	void LargeWbXmlROMessageL();
       
   582 	void InvalidRegRequesttriggerMessageL();
       
   583 	void InvalidROAquisationTriggerMessageL();
       
   584 	void InvalidJoinDomaintriggerMessageL();
       
   585 	void InvalidLeaveDomainTriggerMessageL();
       
   586 	private :
       
   587 		HBufC8* iMsg;
       
   588 	};
       
   589 
       
   590 
       
   591 #endif