sl@0
|
1 |
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#ifndef __CURIANDAUTHORITYTEST_H__
|
sl@0
|
17 |
#define __CURIANDAUTHORITYTEST_H__
|
sl@0
|
18 |
|
sl@0
|
19 |
// System includes
|
sl@0
|
20 |
//
|
sl@0
|
21 |
#include <e32base.h>
|
sl@0
|
22 |
|
sl@0
|
23 |
// Local includes
|
sl@0
|
24 |
//
|
sl@0
|
25 |
#include "IpuTestUtils.h"
|
sl@0
|
26 |
#include <uri8.h>
|
sl@0
|
27 |
#include <uri16.h>
|
sl@0
|
28 |
#include <authority8.h>
|
sl@0
|
29 |
#include <authority16.h>
|
sl@0
|
30 |
#include <delimitedpath8.h>
|
sl@0
|
31 |
#include <delimitedpath16.h>
|
sl@0
|
32 |
#include "ctestbase.h"
|
sl@0
|
33 |
|
sl@0
|
34 |
enum TUriMatchAndPresenceFlags
|
sl@0
|
35 |
{
|
sl@0
|
36 |
ESchemeFlag = 0x01,
|
sl@0
|
37 |
EUserinfoFlag = 0x02,
|
sl@0
|
38 |
EHostFlag = 0x04,
|
sl@0
|
39 |
EPortFlag = 0x08,
|
sl@0
|
40 |
EPathFlag = 0x10,
|
sl@0
|
41 |
EQueryFlag = 0x20,
|
sl@0
|
42 |
EFragmentFlag = 0x40
|
sl@0
|
43 |
};
|
sl@0
|
44 |
|
sl@0
|
45 |
// CUriAndAuthorityTest - test class for the Uri and Authority family of classes
|
sl@0
|
46 |
//
|
sl@0
|
47 |
class CUriAndAuthorityTest : public CTestBase
|
sl@0
|
48 |
{
|
sl@0
|
49 |
public:
|
sl@0
|
50 |
|
sl@0
|
51 |
// Static factory c'tor. Leaves pointer to created object on the cleanup stack.
|
sl@0
|
52 |
//
|
sl@0
|
53 |
// Rtn: pointer to newly created object - ownership transfered to caller.
|
sl@0
|
54 |
//
|
sl@0
|
55 |
static CUriAndAuthorityTest* NewLC(CIpuTestHarness* aTestHarness);
|
sl@0
|
56 |
|
sl@0
|
57 |
// Static factory c'tor.
|
sl@0
|
58 |
//
|
sl@0
|
59 |
// Rtn: pointer to newly created object - ownership transfered to caller.
|
sl@0
|
60 |
//
|
sl@0
|
61 |
static CUriAndAuthorityTest* NewL(CIpuTestHarness* aTestHarness);
|
sl@0
|
62 |
|
sl@0
|
63 |
// D'tor
|
sl@0
|
64 |
//
|
sl@0
|
65 |
~CUriAndAuthorityTest();
|
sl@0
|
66 |
|
sl@0
|
67 |
// Runs the defined tests.
|
sl@0
|
68 |
//
|
sl@0
|
69 |
void DoTestsL();
|
sl@0
|
70 |
|
sl@0
|
71 |
//
|
sl@0
|
72 |
//
|
sl@0
|
73 |
// Uri Tests
|
sl@0
|
74 |
//
|
sl@0
|
75 |
//
|
sl@0
|
76 |
|
sl@0
|
77 |
// Tests the parsing of TUriParser components
|
sl@0
|
78 |
//
|
sl@0
|
79 |
// In:
|
sl@0
|
80 |
// aUri - the uri to be parsed
|
sl@0
|
81 |
// aScheme - what the scheme should be
|
sl@0
|
82 |
// aUserInfo - what the userinfo should be
|
sl@0
|
83 |
// aHost - what the host should be
|
sl@0
|
84 |
// aPort - what the port should be
|
sl@0
|
85 |
// aPath - what the path should be
|
sl@0
|
86 |
// aQuery - what the query should be
|
sl@0
|
87 |
// aFragment - what the fragment should be
|
sl@0
|
88 |
//
|
sl@0
|
89 |
void TestUriComponentExtractionL(const TDesC16& aUri, const TDesC16& aScheme,
|
sl@0
|
90 |
const TDesC16& aUserinfo, const TDesC16& aHost,
|
sl@0
|
91 |
const TDesC16& aPort, const TDesC16& aPath,
|
sl@0
|
92 |
const TDesC16& aQuery, const TDesC16& aFragment) const;
|
sl@0
|
93 |
|
sl@0
|
94 |
|
sl@0
|
95 |
void TestUriRemoveComponentL(const TDesC& aUri_NoScheme, const TDesC& aUri_NoHost, const TDesC& aUri_NoUserinfo,
|
sl@0
|
96 |
const TDesC& aUri_NoPort, const TDesC& aUri_NoPath, const TDesC& aUri_NoQuery,
|
sl@0
|
97 |
const TDesC& aUri_NoFragment, const TDesC& aUri_Whole) const;
|
sl@0
|
98 |
|
sl@0
|
99 |
void TestUriSetComponentL(const TDesC& aUri_Scheme, const TDesC& aUri_Host, const TDesC& aUri_Userinfo,
|
sl@0
|
100 |
const TDesC& aUri_Port, const TDesC& aUri_Path, const TDesC& aUri_Query,
|
sl@0
|
101 |
const TDesC& aUri_Fragment, const TDesC& aScheme, const TDesC& aHost,
|
sl@0
|
102 |
const TDesC& aUserinfo, const TDesC& aPort, const TDesC& aPath,
|
sl@0
|
103 |
const TDesC& aQuery, const TDesC& aFragment) const;
|
sl@0
|
104 |
private: // Methods
|
sl@0
|
105 |
|
sl@0
|
106 |
// Default c'tor.
|
sl@0
|
107 |
//
|
sl@0
|
108 |
CUriAndAuthorityTest(CIpuTestHarness* aTestHarness);
|
sl@0
|
109 |
|
sl@0
|
110 |
// Non-trivial c'tor. Second part of 2-phase construction - does all allocation.
|
sl@0
|
111 |
//
|
sl@0
|
112 |
void ConstructL();
|
sl@0
|
113 |
|
sl@0
|
114 |
// Tests uri resolving.
|
sl@0
|
115 |
//
|
sl@0
|
116 |
// In:
|
sl@0
|
117 |
// aBase - base uri
|
sl@0
|
118 |
// aRelative - referene uri to be resolved
|
sl@0
|
119 |
// aExpected - expected result
|
sl@0
|
120 |
//
|
sl@0
|
121 |
void TestResolveL(const TDesC& aBase, const TDesC& aReference, const TDesC& aExpected) const;
|
sl@0
|
122 |
|
sl@0
|
123 |
// Tests comparison of 2 uri's
|
sl@0
|
124 |
//
|
sl@0
|
125 |
// In:
|
sl@0
|
126 |
// aUri1 - a uri
|
sl@0
|
127 |
// aUri2 - a uri
|
sl@0
|
128 |
// aMatchFlags - set of flags specifying which components match
|
sl@0
|
129 |
//
|
sl@0
|
130 |
void TestUriCompareL(const TDesC& aUri1, const TDesC& aUri2, TInt aMatchFlags) const;
|
sl@0
|
131 |
|
sl@0
|
132 |
// Tests the presence of components in a uri
|
sl@0
|
133 |
//
|
sl@0
|
134 |
// In:
|
sl@0
|
135 |
// aUri - the uri to test
|
sl@0
|
136 |
// aPresenceFlags - set of flags specifying which components are present
|
sl@0
|
137 |
//
|
sl@0
|
138 |
void TestUriComponentPresenceL(const TDesC& aUri, TInt aPresenceFlags) const;
|
sl@0
|
139 |
|
sl@0
|
140 |
// Tests the UriDes() function
|
sl@0
|
141 |
//
|
sl@0
|
142 |
// In:
|
sl@0
|
143 |
// aUri - the uri
|
sl@0
|
144 |
//
|
sl@0
|
145 |
void TestUriDesL(const TDesC& aUri) const;
|
sl@0
|
146 |
|
sl@0
|
147 |
// Tests scheme validation
|
sl@0
|
148 |
//
|
sl@0
|
149 |
// In:
|
sl@0
|
150 |
// aUri - the uri
|
sl@0
|
151 |
// aValidScheme - boolean value stating whether scheme is valid or not
|
sl@0
|
152 |
//
|
sl@0
|
153 |
void TestUriSchemeValidiyL(const TDesC& aUri, TBool aValidScheme) const;
|
sl@0
|
154 |
|
sl@0
|
155 |
// Tests retrieving the fragmentless uri
|
sl@0
|
156 |
//
|
sl@0
|
157 |
// In:
|
sl@0
|
158 |
// aUri - the uri
|
sl@0
|
159 |
// aExpected - the expeced fragmentless uri
|
sl@0
|
160 |
//
|
sl@0
|
161 |
void TestUriWithoutFragmentL(const TDesC& aUri, const TDesC& aExpected);
|
sl@0
|
162 |
|
sl@0
|
163 |
//
|
sl@0
|
164 |
//
|
sl@0
|
165 |
// Authority Tests
|
sl@0
|
166 |
//
|
sl@0
|
167 |
//
|
sl@0
|
168 |
|
sl@0
|
169 |
// Tests the parsing of TAuthorityParser components
|
sl@0
|
170 |
//
|
sl@0
|
171 |
// In:
|
sl@0
|
172 |
// aAuthority - the authority to be parsed
|
sl@0
|
173 |
// aHost - what the host should be
|
sl@0
|
174 |
// aUserInfo - what the userinfo should be
|
sl@0
|
175 |
// aPort - what the port should be
|
sl@0
|
176 |
//
|
sl@0
|
177 |
void TestAuthorityComponentExtractionL(const TDesC16& aAuthority, const TDesC16& aHost,
|
sl@0
|
178 |
const TDesC16& aUserinfo, const TDesC16& aPort) const;
|
sl@0
|
179 |
|
sl@0
|
180 |
// Tests comparison of 2 authorities
|
sl@0
|
181 |
//
|
sl@0
|
182 |
// In:
|
sl@0
|
183 |
// aAuthority1 - an authority
|
sl@0
|
184 |
// aAuthority2 - an authority
|
sl@0
|
185 |
// aMatchFlags - set of flags specifying which components match
|
sl@0
|
186 |
//
|
sl@0
|
187 |
void TestAuthorityCompareL(const TDesC& aAuthority1, const TDesC& aAuthority2, TInt aMatchFlags) const;
|
sl@0
|
188 |
|
sl@0
|
189 |
// Tests the presence of components in an authority
|
sl@0
|
190 |
//
|
sl@0
|
191 |
// In:
|
sl@0
|
192 |
// aAuthority - the authority to test
|
sl@0
|
193 |
// aPresenceFlags - set of flags specifying which components are present
|
sl@0
|
194 |
//
|
sl@0
|
195 |
void TestAuthorityComponentPresenceL(const TDesC& aAuthority, TInt aPresenceFlags) const;
|
sl@0
|
196 |
|
sl@0
|
197 |
// Tests the AuthorityDes() function
|
sl@0
|
198 |
//
|
sl@0
|
199 |
// In:
|
sl@0
|
200 |
// aAuthority - the authority
|
sl@0
|
201 |
//
|
sl@0
|
202 |
void TestAuthorityDesL(const TDesC& aAuthority);
|
sl@0
|
203 |
|
sl@0
|
204 |
void TestAuthoritySetComponentL(const TDesC& aAuthority_Host, const TDesC& aAuthority_Userinfo, const TDesC& aAuthority_Port,
|
sl@0
|
205 |
const TDesC& aHost, const TDesC& aUserinfo, const TDesC& aPort);
|
sl@0
|
206 |
|
sl@0
|
207 |
void TestAuthoritySetAndEscapeComponentL(const TDesC& aAuthority_Host, const TDesC& aAuthority_Userinfo, const TDesC& aAuthority_Port,
|
sl@0
|
208 |
const TDesC& aHost, const TDesC& aUserinfo, const TDesC& aPort) const;
|
sl@0
|
209 |
|
sl@0
|
210 |
void TestAuthorityRemoveComponentL(const TDesC& aAuthority_NoHost, const TDesC& aAuthority_NoUserinfo,
|
sl@0
|
211 |
const TDesC& aAuthority_NoPort, const TDesC& aAuthority_Whole) const;
|
sl@0
|
212 |
|
sl@0
|
213 |
private: // Attributes
|
sl@0
|
214 |
|
sl@0
|
215 |
// Test harness
|
sl@0
|
216 |
//
|
sl@0
|
217 |
CIpuTestHarness* iTestHarness;
|
sl@0
|
218 |
|
sl@0
|
219 |
};
|
sl@0
|
220 |
|
sl@0
|
221 |
#endif // __CURIANDAUTHORITYTEST_H__
|