|
1 // Copyright (c) 2006-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 "CINC077703New.h" |
|
17 |
|
18 const TInt KTransactionCount = 1; |
|
19 const TInt KConnectionCount = 1; |
|
20 |
|
21 _LIT8(KTxtRawRequest, "GET / HTTP/1.1\r\nHost: 127.0.0.1\r\n\r\n"); |
|
22 _LIT8(KTxtRawResponse, "HTTP/1.0 302 Moved\nStatus: 302 Moved\nPragma: no-cache\nContent-Type: text/html\nContent-Length: 6\nLocation: http://127.0.0.1\n\nHello!"); |
|
23 _LIT8(KTxtRawResponse1, "HTTP/1.0 302 Moved\nStatus: 302 Moved\nPragma: no-cache\nConnection: close\nLocation: http://127.0.0.1\n"); |
|
24 _LIT8(KTxtRawResponse2, "HTTP/1.0 200 OK\nContent-Length: 12\n\nHello world!"); |
|
25 |
|
26 CINC077703New* CINC077703New::NewL(CHTTPTestUtils& aTestUtils) |
|
27 { |
|
28 CINC077703New* self = new (ELeave) CINC077703New(aTestUtils); |
|
29 return self; |
|
30 } |
|
31 |
|
32 CINC077703New::~CINC077703New() |
|
33 { |
|
34 |
|
35 } |
|
36 |
|
37 CINC077703New::CINC077703New(CHTTPTestUtils& aTestUtils) |
|
38 : CPipeliningTestCase(), iTestUtils(aTestUtils) |
|
39 { |
|
40 |
|
41 } |
|
42 |
|
43 const TDesC& CINC077703New::TestCaseName() const |
|
44 { |
|
45 _LIT(KTxtTitle, "Defect Fix CINC077703 New"); |
|
46 return KTxtTitle(); |
|
47 } |
|
48 |
|
49 TInt CINC077703New::TotalTransactionCount() const |
|
50 { |
|
51 return KTransactionCount; |
|
52 } |
|
53 |
|
54 TInt CINC077703New::ConnectionCount() const |
|
55 { |
|
56 return KConnectionCount; |
|
57 } |
|
58 |
|
59 RHTTPTransaction CINC077703New::GetTransactionL(TInt aIndex, RHTTPSession aSession, MHTTPTransactionCallback& aClient) |
|
60 { |
|
61 __ASSERT_ALWAYS(aIndex<KTransactionCount, User::Invariant()); |
|
62 |
|
63 RStringF method = aSession.StringPool().StringF(HTTP::EGET,RHTTPSession::GetTable()); |
|
64 _LIT8(KTxtUri, "http://127.0.0.1"); |
|
65 TUriParser8 uri; |
|
66 uri.Parse(KTxtUri()); |
|
67 return aSession.OpenTransactionL(uri, aClient, method); |
|
68 } |
|
69 |
|
70 const TDesC8& CINC077703New::GetRawRequest( TInt aConnectionIndex, TInt aTransIndex ) |
|
71 { |
|
72 __ASSERT_ALWAYS( (aTransIndex<KTransactionCount) && (aConnectionIndex <= (KConnectionCount+1)), User::Invariant()); |
|
73 |
|
74 return KTxtRawRequest(); |
|
75 } |
|
76 |
|
77 const TDesC8& CINC077703New::GetRawResponse(TInt aConnectionIndex, TInt aTransIndex) |
|
78 { |
|
79 __ASSERT_ALWAYS( (aTransIndex<KTransactionCount) && (KConnectionCount+1), User::Invariant()); |
|
80 if ( aConnectionIndex == 0 ) |
|
81 return KTxtRawResponse(); |
|
82 if ( aConnectionIndex == 1 ) |
|
83 return KTxtRawResponse1(); |
|
84 else |
|
85 return KTxtRawResponse2(); |
|
86 } |