|
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 "CTestCase1.h" |
|
17 #include "httptestutils.h" |
|
18 |
|
19 const TInt KTransactionCount = 5; |
|
20 const TInt KConnectionCount = 1; |
|
21 _LIT8(KTxtRawRequest, "GET / HTTP/1.1\r\nHost: 127.0.0.1\r\n\r\n"); |
|
22 _LIT8(KTxtRawResponse, "HTTP/1.1 200 Ok\r\nContent-Length: 6\r\n\r\nhello!"); |
|
23 |
|
24 CTestCase1* CTestCase1::NewL(CHTTPTestUtils& aTestUtils) |
|
25 { |
|
26 CTestCase1* self = new (ELeave) CTestCase1(aTestUtils); |
|
27 CleanupStack::PushL(self); |
|
28 self->ConstructL(); |
|
29 CleanupStack::Pop(self); |
|
30 return self; |
|
31 } |
|
32 |
|
33 CTestCase1::CTestCase1(CHTTPTestUtils& aTestUtils) |
|
34 : CPipeliningTestCase(), iTestUtils(aTestUtils) |
|
35 { |
|
36 } |
|
37 |
|
38 void CTestCase1::ConstructL() |
|
39 { |
|
40 } |
|
41 |
|
42 CTestCase1::~CTestCase1() |
|
43 { |
|
44 } |
|
45 |
|
46 const TDesC& CTestCase1::TestCaseName() const |
|
47 { |
|
48 _LIT(KTxtTitle, "Test Case 1"); |
|
49 return KTxtTitle(); |
|
50 } |
|
51 |
|
52 TInt CTestCase1::TotalTransactionCount() const |
|
53 { |
|
54 return KTransactionCount; |
|
55 } |
|
56 |
|
57 TInt CTestCase1::ConnectionCount() const |
|
58 { |
|
59 return KConnectionCount; |
|
60 } |
|
61 |
|
62 RHTTPTransaction CTestCase1::GetTransactionL(TInt aIndex, RHTTPSession aSession, MHTTPTransactionCallback& aClient) |
|
63 { |
|
64 __ASSERT_ALWAYS(aIndex<KTransactionCount, User::Invariant()); |
|
65 |
|
66 RStringF method = aSession.StringPool().StringF(HTTP::EGET,RHTTPSession::GetTable()); |
|
67 _LIT8(KTxtUri, "http://127.0.0.1"); |
|
68 TUriParser8 uri; |
|
69 uri.Parse(KTxtUri()); |
|
70 return aSession.OpenTransactionL(uri, aClient, method); |
|
71 } |
|
72 |
|
73 const TDesC8& CTestCase1::GetRawRequest(TInt aConnectionIndex, TInt aTransIndex) |
|
74 { |
|
75 __ASSERT_ALWAYS( (aTransIndex<KTransactionCount) && (aConnectionIndex < KConnectionCount), User::Invariant()); |
|
76 |
|
77 return KTxtRawRequest(); |
|
78 } |
|
79 |
|
80 const TDesC8& CTestCase1::GetRawResponse(TInt aConnectionIndex, TInt aTransIndex) |
|
81 { |
|
82 __ASSERT_ALWAYS( (aTransIndex<KTransactionCount) && (aConnectionIndex < KConnectionCount), User::Invariant()); |
|
83 |
|
84 return KTxtRawResponse(); |
|
85 } |