applayerprotocols/httptransportfw/Test/T_HttpPipeliningTest/CTestCase20.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 "CTestCase20.h"
       
    17 #include "httptestutils.h"
       
    18 
       
    19 const TInt KTransactionCount = 2;
       
    20 const TInt KConnectionCount = 1;
       
    21 const TInt KBufferSize = 26; // Batching buffer size in bytes
       
    22 _LIT8(KTxtRawRequest, "GET / HTTP/1.1\r\nHost: 127.0.0.1\r\n\r\n");
       
    23 _LIT8(KTxtRawResponse, "HTTP/1.1 200 Ok\r\nContent-Length: 6\r\n\r\nhello!");
       
    24 
       
    25 CTestCase20* CTestCase20::NewL(CHTTPTestUtils& aTestUtils)
       
    26 	{
       
    27 	CTestCase20* self = new (ELeave) CTestCase20(aTestUtils);
       
    28 	CleanupStack::PushL(self);
       
    29 	self->ConstructL();
       
    30 	CleanupStack::Pop(self);
       
    31 	return self;
       
    32 	}
       
    33 
       
    34 CTestCase20::CTestCase20(CHTTPTestUtils& aTestUtils)
       
    35 : CBatchingTestCase(), iTestUtils(aTestUtils)
       
    36 	{
       
    37 	}
       
    38 
       
    39 void CTestCase20::ConstructL()
       
    40 	{
       
    41 	}
       
    42 
       
    43 CTestCase20::~CTestCase20()
       
    44 	{
       
    45 	}
       
    46 
       
    47 const TDesC& CTestCase20::TestCaseName() const
       
    48 	{
       
    49 	_LIT(KTxtTitle, "Test Case 20");
       
    50 	return KTxtTitle();
       
    51 	}
       
    52 
       
    53 TInt CTestCase20::TotalTransactionCount() const
       
    54 	{
       
    55 	return KTransactionCount;
       
    56 	}
       
    57 	
       
    58 TInt CTestCase20::ConnectionCount() const
       
    59 	{
       
    60 	return KConnectionCount;
       
    61 	}
       
    62 	
       
    63 RHTTPTransaction CTestCase20::GetTransactionL(TInt aIndex, RHTTPSession aSession, MHTTPTransactionCallback& aClient)
       
    64 	{
       
    65 	__ASSERT_ALWAYS(aIndex<KTransactionCount, User::Invariant());
       
    66 	
       
    67 	RStringF method = aSession.StringPool().StringF(HTTP::EGET,RHTTPSession::GetTable());
       
    68 	_LIT8(KTxtUri, "http://127.0.0.1");
       
    69 	TUriParser8 uri; 
       
    70 	uri.Parse(KTxtUri());
       
    71 	
       
    72 	// Buffer size needs to be reduced in the session property before the first transaction.
       
    73 	if( aIndex == 0 )
       
    74 		{
       
    75 		RHTTPConnectionInfo connInfo = aSession.ConnectionInfo();
       
    76 		connInfo.SetPropertyL(aSession.StringPool().StringF(HTTP::EBatchingBufferSize,RHTTPSession::GetTable()), KBufferSize);
       
    77 		}
       
    78 		
       
    79 	return aSession.OpenTransactionL(uri, aClient, method);
       
    80 	}
       
    81 
       
    82 const TDesC8& CTestCase20::GetRawRequest(TInt aConnectionIndex, TInt aTransIndex)
       
    83 	{
       
    84 	__ASSERT_ALWAYS( (aTransIndex<KTransactionCount) && (aConnectionIndex < KConnectionCount), User::Invariant());
       
    85 	
       
    86 	return KTxtRawRequest();
       
    87 	}
       
    88 	
       
    89 const TDesC8& CTestCase20::GetRawResponse(TInt aConnectionIndex, TInt aTransIndex)
       
    90 	{
       
    91 	__ASSERT_ALWAYS( (aTransIndex<KTransactionCount) && (aConnectionIndex < KConnectionCount), User::Invariant());
       
    92 
       
    93 	return KTxtRawResponse();
       
    94 	}