servicediscoveryandcontrol/pnp/test/upnp/unittests/upnpmessagetest/inc/cupnprequestcomposertest.h
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 // Copyright (c) 2008-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 CUPNPREQUESTCOMPOSERTEST_H_
       
    17 #define CUPNPREQUESTCOMPOSERTEST_H_
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <http/mhttpdatasupplier.h>
       
    21 #include <http/framework/cheadercodec.h>
       
    22 #include <es_mbuf.h>
       
    23 #include <comms-infras/rworkerlock.h>
       
    24 #include <comms-infras/mbufmanager.h>
       
    25 #include <cflog.h>
       
    26 
       
    27 #include "cupnpmessagetest.h"
       
    28 #include "mcomposerobserver.h"
       
    29 #include "cupnprequestcomposer.h"
       
    30 #include "CRequest.h"
       
    31 
       
    32 _LIT(KRequestComposerTest, "RequestComposerTest");
       
    33 
       
    34 class CUpnpRequestComposerTest: public CTestStep,
       
    35 							public MComposerObserver,
       
    36 							public MHTTPDataSupplier
       
    37 	{
       
    38 public:	// factory methods
       
    39 	static CUpnpRequestComposerTest* NewL();
       
    40 	CUpnpRequestComposerTest();
       
    41 	~CUpnpRequestComposerTest();
       
    42 
       
    43 private:	// methods from MComposerObserver
       
    44 	void ComposingConcluded();
       
    45 	void MessageDataReadyL(RBuf8& aData);
       
    46 	void ComposerError(TInt aError);
       
    47 
       
    48 public:	// methods from CTestStep
       
    49 	TVerdict doTestStepPreambleL();
       
    50 	TVerdict doTestStepL();
       
    51 	TVerdict doTestStepPostambleL();
       
    52 
       
    53 public:	// methods from MHTTPDataSupplier
       
    54 	TBool GetNextDataPart(TPtrC8& aDataPart);
       
    55 	void ReleaseData();
       
    56 	TInt OverallDataSize();
       
    57 	TInt Reset();
       
    58 
       
    59 private:
       
    60 	void ConstructRequestMethodL(const TDesC& aRequestMethod);
       
    61 	void ConstructRequestUriL(const TDesC& aRequestUri);
       
    62 	void ConstructRequestHeadersL(const TInt aNoOfHdrValPairs, const TInt aNoOfHdrParamValPairs);
       
    63 	void ConstructRequestBodyL(const TBool aRequestBodyPresence);
       
    64 	void SetHeaderL(const TDesC8& aHeader, const TDesC8& aValue);
       
    65 	void SetParamL(const TDesC8& aHeader, const TDesC8& aParam, const TDesC8& aValue, const TInt aPartIndex);
       
    66 
       
    67 private:
       
    68 	CUpnpRequestComposer*			iRequestComposer;
       
    69 	HBufC8*							iRequestBody;
       
    70 	CActiveScheduler* 				iSched;
       
    71 	RBuf8							iRequestBuffer;
       
    72 	CRequest*						iRequest;
       
    73 	CHeaderCodec*					iCodec;
       
    74 	RStringPool						iStringPool;
       
    75 	CChunkManager* 					iMBufMgr;
       
    76 	//MMBufSizeAllocator* 			iMBufSzAllctr;
       
    77 
       
    78 #ifdef __CFLOG_ACTIVE
       
    79 	__CFLOG_DECLARATION_MEMBER;
       
    80 #endif
       
    81 	};
       
    82 
       
    83 #endif /*CUPNPREQUESTCOMPOSERTEST_H_*/