|
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 "CINC078630.h" |
|
17 #include "httptestutils.h" |
|
18 |
|
19 const TInt KTransactionCount = 1; |
|
20 const TInt KConnectionCount = 1; |
|
21 _LIT8(KTxtRawRequest, "POST Microsoft-Server-ActiveSync?DeviceId=Foo&DeviceType=9999&Cmd=Ping HTTP/1.1\r\nHost: 127.0.0.1\r\nAccept-Language: en-us\r\nMS-ASProtocolVersion: 2.5\r\n\r\n"); |
|
22 _LIT8(KTxtRawResponse, "HTTP/1.1 200 Ok\r\nContent-Length: 6\r\n\r\nhello!"); |
|
23 |
|
24 CINC078630* CINC078630::NewL(CHTTPTestUtils& aTestUtils) |
|
25 { |
|
26 CINC078630* self = new (ELeave) CINC078630(aTestUtils); |
|
27 CleanupStack::PushL(self); |
|
28 self->ConstructL(); |
|
29 CleanupStack::Pop(self); |
|
30 return self; |
|
31 } |
|
32 |
|
33 CINC078630::CINC078630(CHTTPTestUtils& aTestUtils) |
|
34 : CPipeliningTestCase(), iTestUtils(aTestUtils) |
|
35 { |
|
36 } |
|
37 |
|
38 void CINC078630::ConstructL() |
|
39 { |
|
40 } |
|
41 |
|
42 CINC078630::~CINC078630() |
|
43 { |
|
44 } |
|
45 |
|
46 const TDesC& CINC078630::TestCaseName() const |
|
47 { |
|
48 _LIT(KTxtTitle, "Defect Fix INC078630"); |
|
49 return KTxtTitle(); |
|
50 } |
|
51 |
|
52 TInt CINC078630::TotalTransactionCount() const |
|
53 { |
|
54 return KTransactionCount; |
|
55 } |
|
56 |
|
57 TInt CINC078630::ConnectionCount() const |
|
58 { |
|
59 return KConnectionCount; |
|
60 } |
|
61 |
|
62 RHTTPTransaction CINC078630::GetTransactionL(TInt aIndex, RHTTPSession aSession, MHTTPTransactionCallback& aClient) |
|
63 { |
|
64 __ASSERT_ALWAYS(aIndex<KTransactionCount, User::Invariant()); |
|
65 |
|
66 _LIT8(KTxtUri, "Microsoft-Server-ActiveSync?DeviceId=Foo&DeviceType=9999&Cmd=Ping"); |
|
67 TUriParser8 uri; |
|
68 uri.Parse(KTxtUri()); |
|
69 |
|
70 |
|
71 RStringF method = aSession.StringPool().StringF(HTTP::EPOST,RHTTPSession::GetTable()); |
|
72 RHTTPTransaction trans = aSession.OpenTransactionL(uri, aClient, method); |
|
73 RHTTPHeaders headers = trans.Request().GetHeaderCollection(); |
|
74 |
|
75 |
|
76 _LIT8(KTxtHeaderName0, "Host"); |
|
77 _LIT8(KTxtHeaderValue0, "127.0.0.1"); |
|
78 RStringF headerStrName0 = aSession.StringPool().OpenFStringL(KTxtHeaderName0()); |
|
79 CleanupClosePushL(headerStrName0); |
|
80 RStringF headerStrValue0 = aSession.StringPool().OpenFStringL(KTxtHeaderValue0()); |
|
81 CleanupClosePushL(headerStrValue0); |
|
82 THTTPHdrVal headerValue0(headerStrValue0); |
|
83 headers.SetFieldL(headerStrName0, headerValue0); |
|
84 CleanupStack::PopAndDestroy(2, &headerStrName0); |
|
85 |
|
86 _LIT8(KTxtHeaderName, "Accept-Language"); |
|
87 _LIT8(KTxtHeaderValue, "en-us"); |
|
88 RStringF headerStrName = aSession.StringPool().OpenFStringL(KTxtHeaderName()); |
|
89 CleanupClosePushL(headerStrName); |
|
90 RStringF headerStrValue = aSession.StringPool().OpenFStringL(KTxtHeaderValue()); |
|
91 CleanupClosePushL(headerStrValue); |
|
92 THTTPHdrVal headerValue(headerStrValue); |
|
93 headers.SetFieldL(headerStrName, headerValue); |
|
94 CleanupStack::PopAndDestroy(2, &headerStrName); |
|
95 |
|
96 _LIT8(KTxtHeaderName1, "MS-ASProtocolVersion"); |
|
97 _LIT8(KTxtHeaderValue1, "2.5"); |
|
98 RStringF headerStrName1 = aSession.StringPool().OpenFStringL(KTxtHeaderName1()); |
|
99 CleanupClosePushL(headerStrName1); |
|
100 RStringF headerStrValue1 = aSession.StringPool().OpenFStringL(KTxtHeaderValue1()); |
|
101 CleanupClosePushL(headerStrValue1); |
|
102 THTTPHdrVal headerValue1(headerStrValue1); |
|
103 headers.SetFieldL(headerStrName1, headerValue1); |
|
104 CleanupStack::PopAndDestroy(2, &headerStrName1); |
|
105 |
|
106 return trans; |
|
107 |
|
108 } |
|
109 |
|
110 const TDesC8& CINC078630::GetRawRequest(TInt aConnectionIndex, TInt aTransIndex) |
|
111 { |
|
112 __ASSERT_ALWAYS( (aTransIndex<KTransactionCount) && (aConnectionIndex < KConnectionCount), User::Invariant()); |
|
113 |
|
114 return KTxtRawRequest(); |
|
115 } |
|
116 |
|
117 const TDesC8& CINC078630::GetRawResponse(TInt aConnectionIndex, TInt aTransIndex) |
|
118 { |
|
119 __ASSERT_ALWAYS( (aTransIndex<KTransactionCount) && (aConnectionIndex < KConnectionCount), User::Invariant()); |
|
120 |
|
121 return KTxtRawResponse(); |
|
122 } |
|
123 |