applayerprotocols/httptransportfw/Test/T_HttpPipeliningTest/CTestCase7.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 "CTestCase7.h"
       
    17 #include "httptestutils.h"
       
    18 
       
    19 const TInt KTransactionCount = 10;
       
    20 
       
    21 CTestCase7* CTestCase7::NewL(CHTTPTestUtils& aTestUtils)
       
    22 	{
       
    23 	CTestCase7* self = new (ELeave) CTestCase7(aTestUtils);
       
    24 	CleanupStack::PushL(self);
       
    25 	self->ConstructL();
       
    26 	CleanupStack::Pop(self);
       
    27 	return self;
       
    28 	}
       
    29 
       
    30 CTestCase7::CTestCase7(CHTTPTestUtils& aTestUtils)
       
    31 : CPipeliningTestCase(), iTestUtils(aTestUtils), iTransCount(KTransactionCount)
       
    32 	{
       
    33 	}
       
    34 
       
    35 void CTestCase7::ConstructL()
       
    36 	{
       
    37 	}
       
    38 
       
    39 CTestCase7::~CTestCase7()
       
    40 	{
       
    41 	}
       
    42 
       
    43 const TDesC& CTestCase7::TestCaseName() const
       
    44 	{
       
    45 	_LIT(KTxtTitle, "Test Case 7");
       
    46 	return KTxtTitle();
       
    47 	}
       
    48 
       
    49 TInt CTestCase7::TotalTransactionCount() const
       
    50 	{
       
    51 	return iTransCount;
       
    52 	}
       
    53 	
       
    54 	
       
    55 TInt CTestCase7::RealExpectedConnectionCount() const
       
    56  	{
       
    57  	return 1;
       
    58  	}	
       
    59  	
       
    60 	
       
    61 RHTTPTransaction CTestCase7::GetTransactionL(TInt aIndex, RHTTPSession aSession, MHTTPTransactionCallback& aClient)
       
    62 	{
       
    63 	__ASSERT_ALWAYS(aIndex<KTransactionCount, User::Invariant());
       
    64 	
       
    65 	RStringF method = aSession.StringPool().StringF(HTTP::EGET,RHTTPSession::GetTable());
       
    66 	_LIT8(KTxtUri, "http://10.29.23.60/pipeline/hello.txt");
       
    67 	TUriParser8 uri; 
       
    68 	uri.Parse(KTxtUri());
       
    69 
       
    70 	if( aIndex == 4 )
       
    71 		{
       
    72 		iTransToCancel = aSession.OpenTransactionL(uri, aClient, method);
       
    73 		return iTransToCancel;
       
    74 		}
       
    75 
       
    76 	return aSession.OpenTransactionL(uri, aClient, method);
       
    77 	}
       
    78 	
       
    79 const TDesC8& CTestCase7::GetRawRequest(TInt /*aConnectionIndex*/, TInt /*aTransIndex*/)
       
    80 	{
       
    81 	// This method shoulod never be called as we are going to a live server
       
    82 	User::Invariant();
       
    83 	
       
    84 	return KNullDesC8();
       
    85 	}
       
    86 	
       
    87 const TDesC8& CTestCase7::GetRawResponse(TInt /*aConnectionIndex*/, TInt /*aTransIndex*/)
       
    88 	{
       
    89 	// This method shoulod never be called as we are going to a live server
       
    90 	User::Invariant();
       
    91 	
       
    92 	return KNullDesC8();
       
    93 	}
       
    94 	
       
    95 TInt CTestCase7::ExpectedError(RHTTPTransaction aTrans)
       
    96 	{
       
    97 	if(!iIsTransCancelled)
       
    98 		{
       
    99 		if(aTrans.Id()==3)
       
   100 			{
       
   101 			iTransToCancel.Cancel();
       
   102 			iIsTransCancelled = ETrue;
       
   103 			--iTransCount;
       
   104 			}
       
   105 		}
       
   106 		
       
   107 	if( iTransToCancel.Id() == aTrans.Id() )
       
   108 		return KErrCancel;
       
   109 
       
   110 	return KErrNone;
       
   111 	}