|
1 // Copyright (c) 2008-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 "CRecvTimeOut.h" |
|
17 |
|
18 const TInt KTransactionCount = 1; |
|
19 const TInt KConnectionCount = 1; |
|
20 _LIT8(KTxtRawRequest, "GET / HTTP/1.1\r\nHost: 127.0.0.1\r\n\r\n"); |
|
21 _LIT8(KTxtRawResponse, "HTTP/1.0 200 OK\nContent-Length: 12\n\nHello world!"); |
|
22 |
|
23 CRecvTimeOut* CRecvTimeOut::NewL(CHTTPTestUtils& aTestUtils) |
|
24 { |
|
25 CRecvTimeOut* self = new (ELeave) CRecvTimeOut(aTestUtils); |
|
26 return self; |
|
27 } |
|
28 |
|
29 CRecvTimeOut::~CRecvTimeOut() |
|
30 { |
|
31 |
|
32 } |
|
33 |
|
34 CRecvTimeOut::CRecvTimeOut(CHTTPTestUtils& aTestUtils) |
|
35 : CPipeliningTestCase(), iTestUtils(aTestUtils) |
|
36 { |
|
37 |
|
38 } |
|
39 |
|
40 |
|
41 |
|
42 const TDesC& CRecvTimeOut::TestCaseName() const |
|
43 { |
|
44 _LIT(KTxtTitle, "CRecvTimeOut"); |
|
45 return KTxtTitle(); |
|
46 } |
|
47 |
|
48 TInt CRecvTimeOut::TotalTransactionCount() const |
|
49 { |
|
50 return KTransactionCount; |
|
51 } |
|
52 |
|
53 TInt CRecvTimeOut::ConnectionCount() const |
|
54 { |
|
55 return KConnectionCount; |
|
56 } |
|
57 |
|
58 RHTTPTransaction CRecvTimeOut::GetTransactionL(TInt aIndex, RHTTPSession aSession, MHTTPTransactionCallback& aClient) |
|
59 { |
|
60 __ASSERT_ALWAYS(aIndex<KTransactionCount, User::Invariant()); |
|
61 |
|
62 RStringF method = aSession.StringPool().StringF(HTTP::EGET,RHTTPSession::GetTable()); |
|
63 _LIT8(KTxtUri, "http://127.0.0.1"); |
|
64 TUriParser8 uri; |
|
65 uri.Parse(KTxtUri()); |
|
66 |
|
67 RHTTPTransaction trans = aSession.OpenTransactionL(uri, aClient, method); |
|
68 //Set TimeOut Values |
|
69 RStringF sendTimeOutProp = aSession.StringPool().StringF(HTTP::ESendTimeOutValue, aSession.GetTable()); |
|
70 THTTPHdrVal sendTimeOutPropValue; |
|
71 sendTimeOutPropValue.SetInt(10); |
|
72 trans.PropertySet().SetPropertyL(sendTimeOutProp, sendTimeOutPropValue); |
|
73 |
|
74 RStringF recvTimeOutProp = aSession.StringPool().StringF(HTTP::EReceiveTimeOutValue, aSession.GetTable()); |
|
75 THTTPHdrVal recvTimeOutPropValue; |
|
76 recvTimeOutPropValue.SetInt(10); |
|
77 trans.PropertySet().SetPropertyL(recvTimeOutProp, recvTimeOutPropValue); |
|
78 |
|
79 return trans; |
|
80 } |
|
81 |
|
82 const TDesC8& CRecvTimeOut::GetRawRequest( TInt aConnectionIndex, TInt aTransIndex ) |
|
83 { |
|
84 __ASSERT_ALWAYS( (aTransIndex<KTransactionCount) && (aConnectionIndex <= KConnectionCount), User::Invariant()); |
|
85 |
|
86 return KTxtRawRequest(); |
|
87 } |
|
88 |
|
89 const TDesC8& CRecvTimeOut::GetRawResponse(TInt aConnectionIndex, TInt aTransIndex) |
|
90 { |
|
91 __ASSERT_ALWAYS( (aTransIndex<KTransactionCount) && (aConnectionIndex <= KConnectionCount), User::Invariant()); |
|
92 |
|
93 return KTxtRawResponse(); |
|
94 } |
|
95 |
|
96 |
|
97 |