|
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 __CPIPELININGTESTCLIENT_H__ |
|
17 #define __CPIPELININGTESTCLIENT_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <http.h> |
|
21 |
|
22 class CHTTPTestUtils; |
|
23 class MPipeliningTestCase; |
|
24 class MPipeliningTestObserver; |
|
25 |
|
26 class MTimerClient1 |
|
27 { |
|
28 public: |
|
29 virtual void TimeOut() = 0; |
|
30 }; |
|
31 |
|
32 class CHttpTimer1: public CActive |
|
33 { |
|
34 public: |
|
35 CHttpTimer1(MTimerClient1& aClient); |
|
36 ~CHttpTimer1(); |
|
37 void After(TTimeIntervalMicroSeconds32 anInterval); |
|
38 void DoCancel(); |
|
39 void RunL(); |
|
40 private: |
|
41 RTimer iTimer; |
|
42 MTimerClient1& iClient; |
|
43 }; |
|
44 |
|
45 class CPipeliningTestClient : public CBase, |
|
46 public MHTTPTransactionCallback, public MTimerClient1 |
|
47 { |
|
48 public: |
|
49 static CPipeliningTestClient* NewL(CHTTPTestUtils& aTestUtils, MPipeliningTestObserver& aObserver); |
|
50 ~CPipeliningTestClient(); |
|
51 |
|
52 RHTTPSession& GetSession(); |
|
53 void AddTransactionL(RHTTPTransaction aTransaction); |
|
54 void StartClientL(); |
|
55 void SetTestCase(MPipeliningTestCase* aTestCase); |
|
56 |
|
57 private: |
|
58 CPipeliningTestClient(CHTTPTestUtils& aTestUtils, MPipeliningTestObserver& aObserver); |
|
59 void ConstructL(); |
|
60 |
|
61 // From MHTTPTransactionCallback |
|
62 void MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent); |
|
63 TInt MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent); |
|
64 |
|
65 void EndTestL(TInt aErrorCode); |
|
66 void TimeOut(); |
|
67 |
|
68 private: |
|
69 CHTTPTestUtils& iTestUtils; |
|
70 MPipeliningTestObserver& iObserver; |
|
71 RHTTPSession iSession; |
|
72 RArray<RHTTPTransaction> iTransArray; |
|
73 MPipeliningTestCase* iTestCase; // Not owned |
|
74 TInt iCurrentTrans; |
|
75 TInt iLastError; |
|
76 CHttpTimer1* iHttpTimer; |
|
77 CActiveSchedulerWait* iASW; |
|
78 }; |
|
79 |
|
80 #endif // __CPIPELININGTESTCLIENT_H__ |