|
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 class CTestServerStreamManager : public CTimer, |
|
46 public MInputStreamObserver, |
|
47 public MOutputStreamObserver, |
|
48 public MTimerClient |
|
49 { |
|
50 public: |
|
51 static CTestServerStreamManager* NewL(CHTTPTestUtils& aTestUtils, TInt aConnectionIndex, MPipeliningTestCase* aTestCase, MInputStream* aInputStream, MOutputStream* aOutputStream); |
|
52 virtual ~CTestServerStreamManager(); |
|
53 |
|
54 private: |
|
55 CTestServerStreamManager(CHTTPTestUtils& aTestUtils, TInt aConnectionIndex, MPipeliningTestCase* aTestCase, MInputStream* aInputStream, MOutputStream* aOutputStream); |
|
56 void ConstructL(); |
|
57 TBool ProcessRequestL(); |
|
58 TBool IsConnectionCloseInData(const TDesC8& aRequest, const TDesC8& aResponse) const; |
|
59 void SendDataL(); |
|
60 |
|
61 // From MInputStreamObserver |
|
62 void ReceivedDataIndL(const TDesC8& aBuffer); |
|
63 void SecureServerCnf(); |
|
64 void InputStreamCloseInd(TInt aError); |
|
65 void MInputStreamObserver_Reserved(); |
|
66 MHttpResponse* CurrentResponse(); |
|
67 virtual void OnReceiveTimeOut(); |
|
68 |
|
69 // From MOutputStreamObserver |
|
70 void SendDataCnfL(); |
|
71 void SecureClientCnf(); |
|
72 void OutputStreamCloseInd(TInt aError); |
|
73 void MOutputStreamObserver_Reserved(); |
|
74 virtual void OnSendTimeOut(); |
|
75 virtual TInt SendTimeOutVal(); |
|
76 // From CTimer |
|
77 void RunL(); |
|
78 |
|
79 private: |
|
80 void TimeOut(); |
|
81 |
|
82 private: |
|
83 CHTTPTestUtils& iTestUtils; |
|
84 MInputStream* iInputStream; // Not owned |
|
85 MOutputStream* iOutputStream; // Not owned |
|
86 HBufC8* iDataStore; |
|
87 HBufC8* iDataToSend; |
|
88 MPipeliningTestCase* iTestCase; // Not owned |
|
89 TInt iTransCount; |
|
90 TInt iCurrentTrans; |
|
91 TInt iDataPos; |
|
92 TBool iCloseConnection; |
|
93 TInt iConnectionIndex; |
|
94 TBool iMoreResponseBatches; |
|
95 CHttpTimer* iHttpTimer; |
|
96 CActiveSchedulerWait* iASW; |
|
97 }; |
|
98 |
|
99 |
|
100 |
|
101 #endif // __CTESTSERVERSTREAMMANAGER_H__ |