applayerprotocols/httptransportfw/Test/T_HttpPipeliningTest/CTestCase9.cpp
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2003-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 #include "CTestCase9.h"
       
    17 #include "httptestutils.h"
       
    18 
       
    19 const TInt KTransactionCount = 3;
       
    20 const TInt KConnectionCount = 3;
       
    21 _LIT8(KTxtRawRequest, "GET / HTTP/1.0\r\n\r\n");
       
    22 _LIT8(KTxtRawResponse, "HTTP/1.0 200 Ok\r\nContent-Length: 6\r\n\r\nhello!");
       
    23 
       
    24 CTestCase9* CTestCase9::NewL(CHTTPTestUtils& aTestUtils)
       
    25 	{
       
    26 	CTestCase9* self = new (ELeave) CTestCase9(aTestUtils);
       
    27 	CleanupStack::PushL(self);
       
    28 	self->ConstructL();
       
    29 	CleanupStack::Pop(self);
       
    30 	return self;
       
    31 	}
       
    32 
       
    33 CTestCase9::CTestCase9(CHTTPTestUtils& aTestUtils)
       
    34 : CPipeliningTestCase(), iTestUtils(aTestUtils)
       
    35 	{
       
    36 	}
       
    37 
       
    38 void CTestCase9::ConstructL()
       
    39 	{
       
    40 	}
       
    41 
       
    42 CTestCase9::~CTestCase9()
       
    43 	{
       
    44 	}
       
    45 
       
    46 const TDesC& CTestCase9::TestCaseName() const
       
    47 	{
       
    48 	_LIT(KTxtTitle, "Test Case 9");
       
    49 	return KTxtTitle();
       
    50 	}
       
    51 
       
    52 TInt CTestCase9::TransactionCount(TInt /*aConnectionIndex*/) const
       
    53 	{
       
    54 	return 1;
       
    55 	}
       
    56 
       
    57 TInt CTestCase9::TotalTransactionCount() const
       
    58 	{
       
    59 	return KTransactionCount;
       
    60 	}
       
    61 
       
    62 TInt CTestCase9::ConnectionCount() const
       
    63 	{
       
    64 	return KConnectionCount;
       
    65 	}
       
    66 	
       
    67 RHTTPTransaction CTestCase9::GetTransactionL(TInt aIndex, RHTTPSession aSession, MHTTPTransactionCallback& aClient)
       
    68 	{
       
    69 	__ASSERT_ALWAYS(aIndex<KTransactionCount, User::Invariant());
       
    70 	
       
    71 	// Change the session properties to be a HTTP/1.0 client
       
    72 	if( aIndex == 0 )
       
    73 		{
       
    74 		RHTTPConnectionInfo connInfo = aSession.ConnectionInfo();
       
    75 		RStringPool strPool = aSession.StringPool();
       
    76 		THTTPHdrVal http10( strPool.StringF( HTTP::EHttp10, RHTTPSession::GetTable() ) );
       
    77 		connInfo.SetPropertyL( strPool.StringF( HTTP::EHTTPVersion,RHTTPSession::GetTable() ), http10 );
       
    78 		}
       
    79 
       
    80 	RStringF method = aSession.StringPool().StringF(HTTP::EGET, RHTTPSession::GetTable());
       
    81 	_LIT8(KTxtUri, "http://127.0.0.1");
       
    82 	TUriParser8 uri; 
       
    83 	uri.Parse(KTxtUri());
       
    84 	return aSession.OpenTransactionL(uri, aClient, method);
       
    85 	}
       
    86 	
       
    87 const TDesC8& CTestCase9::GetRawRequest(TInt aConnectionIndex, TInt aTransIndex)
       
    88 	{
       
    89 	__ASSERT_ALWAYS( (aTransIndex<KTransactionCount) && (aConnectionIndex<KConnectionCount), User::Invariant());
       
    90 	
       
    91 	return KTxtRawRequest();
       
    92 	}
       
    93 	
       
    94 const TDesC8& CTestCase9::GetRawResponse(TInt aConnectionIndex, TInt aTransIndex)
       
    95 	{
       
    96 	__ASSERT_ALWAYS( (aTransIndex<KTransactionCount) && (aConnectionIndex<KConnectionCount), User::Invariant());
       
    97 
       
    98 	return KTxtRawResponse();
       
    99 	}
       
   100