applayerprotocols/httptransportfw/Test/T_HttpPipeliningTest/CINC073400.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 "CINC073400.h"
       
    17 #include "httptestutils.h"
       
    18 
       
    19 const TInt KConn1TransCount = 3;
       
    20 const TInt KConn2TransCount = 1;
       
    21 const TInt KConn3TransCount = 1;
       
    22 const TInt KConnectionCount = 3;
       
    23 _LIT8(KTxtRawRequest, "GET / HTTP/1.1\r\nHost: 127.0.0.1\r\n\r\n");
       
    24 _LIT8(KTxtRawResponse, "HTTP/1.1 200 Ok\r\nContent-Length: 6\r\n\r\nhello!");
       
    25 _LIT8(KTxtRawResponseWithClose, "HTTP/1.1 200 Ok\r\nConnection: Close\r\n\r\nhello!");
       
    26 
       
    27 CINC073400* CINC073400::NewL(CHTTPTestUtils& aTestUtils)
       
    28 	{
       
    29 	CINC073400* self = new (ELeave) CINC073400(aTestUtils);
       
    30 	CleanupStack::PushL(self);
       
    31 	self->ConstructL();
       
    32 	CleanupStack::Pop(self);
       
    33 	return self;
       
    34 	}
       
    35 
       
    36 CINC073400::CINC073400(CHTTPTestUtils& aTestUtils)
       
    37 : CPipeliningTestCase(), iTestUtils(aTestUtils)
       
    38 	{
       
    39 	}
       
    40 
       
    41 void CINC073400::ConstructL()
       
    42 	{
       
    43 	}
       
    44 
       
    45 CINC073400::~CINC073400()
       
    46 	{
       
    47 	}
       
    48 
       
    49 const TDesC& CINC073400::TestCaseName() const
       
    50 	{
       
    51 	_LIT(KTxtTitle, "CINC073400");
       
    52 	return KTxtTitle();
       
    53 	}
       
    54 
       
    55 TInt CINC073400::TransactionCount(TInt aConnectionIndex) const
       
    56 	{
       
    57 	TInt transCount = 0;
       
    58 	switch(aConnectionIndex)
       
    59 		{
       
    60 		case 0:
       
    61 			{
       
    62 			transCount = KConn1TransCount;
       
    63 			} break;
       
    64 		case 1:
       
    65 			{
       
    66 			transCount = KConn2TransCount;
       
    67 			} break;
       
    68 		case 2:
       
    69 			{
       
    70 			transCount = KConn3TransCount;
       
    71 			} break;
       
    72 		default:
       
    73 			User::Invariant();
       
    74 		}
       
    75 
       
    76 	return transCount;
       
    77 	}
       
    78 
       
    79 TInt CINC073400::TotalTransactionCount() const
       
    80 	{
       
    81 	return KConn1TransCount + KConn2TransCount + KConn3TransCount;
       
    82 	}
       
    83 
       
    84 TInt CINC073400::ConnectionCount() const
       
    85 	{
       
    86 	return KConnectionCount;
       
    87 	}
       
    88 	
       
    89 RHTTPTransaction CINC073400::GetTransactionL(TInt aIndex, RHTTPSession aSession, MHTTPTransactionCallback& aClient)
       
    90 	{
       
    91 	__ASSERT_ALWAYS(aIndex<TotalTransactionCount(), User::Invariant());
       
    92 	
       
    93 	RStringF method = aSession.StringPool().StringF(HTTP::EGET,RHTTPSession::GetTable());
       
    94 	_LIT8(KTxtUri, "http://127.0.0.1");
       
    95 	TUriParser8 uri; 
       
    96 	uri.Parse(KTxtUri());
       
    97 
       
    98 	return aSession.OpenTransactionL(uri, aClient, method);
       
    99 	}
       
   100 
       
   101 const TDesC8& CINC073400::GetRawRequest(TInt aConnectionIndex, TInt aTransIndex)
       
   102 	{
       
   103 	__ASSERT_ALWAYS( (aTransIndex<TotalTransactionCount()) && (aConnectionIndex<KConnectionCount), User::Invariant());
       
   104 	
       
   105 	return KTxtRawRequest();
       
   106 	}
       
   107 	
       
   108 const TDesC8& CINC073400::GetRawResponse(TInt aConnectionIndex, TInt aTransIndex)
       
   109 	{
       
   110 	__ASSERT_ALWAYS(aTransIndex<TotalTransactionCount(), User::Invariant());
       
   111 	
       
   112 	if( aConnectionIndex==0 && aTransIndex==2 )
       
   113 		return KTxtRawResponseWithClose();
       
   114 
       
   115 	return KTxtRawResponse();
       
   116 	}
       
   117 
       
   118