|
1 // Copyright (c) 2004-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 |
|
17 #ifndef __TRANS_H__ |
|
18 #define __TRANS_H__ |
|
19 |
|
20 #include <http/mhttpauthenticationcallback.h> |
|
21 #include <ssl.h> //For TCertInfo |
|
22 |
|
23 #include "HttpTestCore.h" |
|
24 #include "CHttpAccepTtestBase.h" |
|
25 #include <http.h> |
|
26 #include "TestScripts.h" |
|
27 #include "csrvaddrval.h" |
|
28 enum TConfigureProxyAction |
|
29 { |
|
30 ECreate, |
|
31 EDelete |
|
32 }; |
|
33 |
|
34 |
|
35 class CX509Certificate; |
|
36 |
|
37 |
|
38 class CHttpTestTransactions: public CHttpAcceptTestBase, public MHTTPAuthenticationCallback |
|
39 { |
|
40 public: |
|
41 virtual TBool GetCredentialsL(const TUriC8& aURI, RString aRealm, RStringF aAuthenticationType, RString& aUsername, RString& aPassword); |
|
42 protected: |
|
43 TInt FindEndOfTransaction(TInt aStartItem); |
|
44 HBufC8* FindItemLC(const TDesC& aItem, TInt aStart, TInt aEnd, const TDesC8 aDefault); |
|
45 RHTTPTransaction CreateTransactionL(TInt aStartItem); |
|
46 ~CHttpTestTransactions(); |
|
47 |
|
48 const TDesC& TestName(); |
|
49 TBool GetNextDataPart(TPtrC8& aDataChunk); |
|
50 void ReleaseData(); |
|
51 TInt OverallDataSize(); |
|
52 TPtr8 WideToNarrowLC(TPtrC aPtr16); |
|
53 void ConstructL(CScriptFile& aIniFile, CScriptFile* aIniSettingsFile, const TInt aSectionNumber); |
|
54 void CreateAcceptStringL(RHTTPHeaders aRequestHeaders); |
|
55 void CreateAcceptCharsetStringL(RHTTPHeaders aRequestHeaders); |
|
56 void CreateAcceptEncodingStringL(RHTTPHeaders aRequestHeaders); |
|
57 void DoHeaderL(RHTTPHeaders aRequestHeaders, const TDesC8& aHeader); |
|
58 void CloseTestSession(); |
|
59 TReal StrToReal(TPtr8); |
|
60 void SetProxyL(TInt aStartItem); |
|
61 void SetMaxRedirectsL(TInt aStartItem); |
|
62 void LogCertificateL(TCertInfo aCertInfo); |
|
63 void LogCertificateL(const CX509Certificate* aCertInfo); |
|
64 void LoadBodyFromFileL(const TDesC& aFilePath); |
|
65 void ConfigureDefaultProxyL(TConfigureProxyAction aAction); |
|
66 |
|
67 protected: |
|
68 HBufC8* iBody; |
|
69 TBool iLogCert; |
|
70 |
|
71 private: |
|
72 TBuf<80> iTestName; |
|
73 RString iUsername; |
|
74 RString iPassword; |
|
75 TBool iUsernameUsed; |
|
76 /** This has the instance of the settings.ini file. This instance is passed |
|
77 to ReplaceHostNameL() function which uses this instance to retrieve the |
|
78 data from settings.ini file. |
|
79 */ |
|
80 CScriptFile* iIniSettingsFile; |
|
81 }; |
|
82 |
|
83 #endif |