|
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 #ifndef __CTESTSERVERSTREAMMANAGER_H__ |
|
17 #define __CTESTSERVERSTREAMMANAGER_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <minputstreamobserver.h> |
|
21 #include <moutputstreamobserver.h> |
|
22 |
|
23 class CHTTPTestUtils; |
|
24 class MPipeliningTestCase; |
|
25 |
|
26 class MTimerClient |
|
27 { |
|
28 public: |
|
29 virtual void TimeOut() = 0; |
|
30 }; |
|
31 |
|
32 class CHttpTimer: public CActive |
|
33 { |
|
34 public: |
|
35 CHttpTimer(MTimerClient& aClient); |
|
36 ~CHttpTimer(); |
|
37 void After(TTimeIntervalMicroSeconds32 anInterval); |
|
38 void DoCancel(); |
|
39 void RunL(); |
|
40 private: |
|
41 RTimer iTimer; |
|
42 MTimerClient& iClient; |
|
43 }; |
|
44 |
|
45 |
|
46 class CTestServerStreamManager : public CTimer, |
|
47 public MInputStreamObserver, |
|
48 public MOutputStreamObserver, |
|
49 public MTimerClient |
|
50 |
|
51 { |
|
52 public: |
|
53 static CTestServerStreamManager* NewL(CHTTPTestUtils& aTestUtils, TInt aConnectionIndex, MPipeliningTestCase* aTestCase, MInputStream* aInputStream, MOutputStream* aOutputStream); |
|
54 virtual ~CTestServerStreamManager(); |
|
55 |
|
56 private: |
|
57 CTestServerStreamManager(CHTTPTestUtils& aTestUtils, TInt aConnectionIndex, MPipeliningTestCase* aTestCase, MInputStream* aInputStream, MOutputStream* aOutputStream); |
|
58 void ConstructL(); |
|
59 TBool ProcessRequestL(); |
|
60 TBool IsConnectionCloseInData(const TDesC8& aRequest, const TDesC8& aResponse) const; |
|
61 void SendDataL(); |
|
62 |
|
63 // From MInputStreamObserver |
|
64 void ReceivedDataIndL(const TDesC8& aBuffer); |
|
65 void SecureServerCnf(); |
|
66 void InputStreamCloseInd(TInt aError); |
|
67 void MInputStreamObserver_Reserved(); |
|
68 MHttpResponse* CurrentResponse(); |
|
69 virtual void OnReceiveTimeOut(); |
|
70 |
|
71 // From MOutputStreamObserver |
|
72 void SendDataCnfL(); |
|
73 void SecureClientCnf(); |
|
74 void OutputStreamCloseInd(TInt aError); |
|
75 void MOutputStreamObserver_Reserved(); |
|
76 virtual void OnSendTimeOut(); |
|
77 virtual TInt SendTimeOutVal(); |
|
78 |
|
79 // From CTimer |
|
80 void RunL(); |
|
81 |
|
82 private: |
|
83 void TimeOut(); |
|
84 |
|
85 |
|
86 private: |
|
87 CHTTPTestUtils& iTestUtils; |
|
88 MInputStream* iInputStream; // Not owned |
|
89 MOutputStream* iOutputStream; // Not owned |
|
90 HBufC8* iDataStore; |
|
91 HBufC8* iDataToSend; |
|
92 MPipeliningTestCase* iTestCase; // Not owned |
|
93 TInt iTransCount; |
|
94 TInt iCurrentTrans; |
|
95 TInt iDataPos; |
|
96 TBool iCloseConnection; |
|
97 TInt iConnectionIndex; |
|
98 TBool iMoreResponseBatches; |
|
99 CHttpTimer* iHttpTimer; |
|
100 CActiveSchedulerWait* iASW; |
|
101 }; |
|
102 |
|
103 #endif // __CTESTSERVERSTREAMMANAGER_H__ |