Update contrib.
1 // Copyright (c) 2001-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __CURIANDAUTHORITYTEST_H__
17 #define __CURIANDAUTHORITYTEST_H__
25 #include "IpuTestUtils.h"
28 #include <authority8.h>
29 #include <authority16.h>
30 #include <delimitedpath8.h>
31 #include <delimitedpath16.h>
32 #include "ctestbase.h"
34 enum TUriMatchAndPresenceFlags
45 // CUriAndAuthorityTest - test class for the Uri and Authority family of classes
47 class CUriAndAuthorityTest : public CTestBase
51 // Static factory c'tor. Leaves pointer to created object on the cleanup stack.
53 // Rtn: pointer to newly created object - ownership transfered to caller.
55 static CUriAndAuthorityTest* NewLC(CIpuTestHarness* aTestHarness);
57 // Static factory c'tor.
59 // Rtn: pointer to newly created object - ownership transfered to caller.
61 static CUriAndAuthorityTest* NewL(CIpuTestHarness* aTestHarness);
65 ~CUriAndAuthorityTest();
67 // Runs the defined tests.
77 // Tests the parsing of TUriParser components
80 // aUri - the uri to be parsed
81 // aScheme - what the scheme should be
82 // aUserInfo - what the userinfo should be
83 // aHost - what the host should be
84 // aPort - what the port should be
85 // aPath - what the path should be
86 // aQuery - what the query should be
87 // aFragment - what the fragment should be
89 void TestUriComponentExtractionL(const TDesC16& aUri, const TDesC16& aScheme,
90 const TDesC16& aUserinfo, const TDesC16& aHost,
91 const TDesC16& aPort, const TDesC16& aPath,
92 const TDesC16& aQuery, const TDesC16& aFragment) const;
95 void TestUriRemoveComponentL(const TDesC& aUri_NoScheme, const TDesC& aUri_NoHost, const TDesC& aUri_NoUserinfo,
96 const TDesC& aUri_NoPort, const TDesC& aUri_NoPath, const TDesC& aUri_NoQuery,
97 const TDesC& aUri_NoFragment, const TDesC& aUri_Whole) const;
99 void TestUriSetComponentL(const TDesC& aUri_Scheme, const TDesC& aUri_Host, const TDesC& aUri_Userinfo,
100 const TDesC& aUri_Port, const TDesC& aUri_Path, const TDesC& aUri_Query,
101 const TDesC& aUri_Fragment, const TDesC& aScheme, const TDesC& aHost,
102 const TDesC& aUserinfo, const TDesC& aPort, const TDesC& aPath,
103 const TDesC& aQuery, const TDesC& aFragment) const;
108 CUriAndAuthorityTest(CIpuTestHarness* aTestHarness);
110 // Non-trivial c'tor. Second part of 2-phase construction - does all allocation.
114 // Tests uri resolving.
118 // aRelative - referene uri to be resolved
119 // aExpected - expected result
121 void TestResolveL(const TDesC& aBase, const TDesC& aReference, const TDesC& aExpected) const;
123 // Tests comparison of 2 uri's
128 // aMatchFlags - set of flags specifying which components match
130 void TestUriCompareL(const TDesC& aUri1, const TDesC& aUri2, TInt aMatchFlags) const;
132 // Tests the presence of components in a uri
135 // aUri - the uri to test
136 // aPresenceFlags - set of flags specifying which components are present
138 void TestUriComponentPresenceL(const TDesC& aUri, TInt aPresenceFlags) const;
140 // Tests the UriDes() function
145 void TestUriDesL(const TDesC& aUri) const;
147 // Tests scheme validation
151 // aValidScheme - boolean value stating whether scheme is valid or not
153 void TestUriSchemeValidiyL(const TDesC& aUri, TBool aValidScheme) const;
155 // Tests retrieving the fragmentless uri
159 // aExpected - the expeced fragmentless uri
161 void TestUriWithoutFragmentL(const TDesC& aUri, const TDesC& aExpected);
169 // Tests the parsing of TAuthorityParser components
172 // aAuthority - the authority to be parsed
173 // aHost - what the host should be
174 // aUserInfo - what the userinfo should be
175 // aPort - what the port should be
177 void TestAuthorityComponentExtractionL(const TDesC16& aAuthority, const TDesC16& aHost,
178 const TDesC16& aUserinfo, const TDesC16& aPort) const;
180 // Tests comparison of 2 authorities
183 // aAuthority1 - an authority
184 // aAuthority2 - an authority
185 // aMatchFlags - set of flags specifying which components match
187 void TestAuthorityCompareL(const TDesC& aAuthority1, const TDesC& aAuthority2, TInt aMatchFlags) const;
189 // Tests the presence of components in an authority
192 // aAuthority - the authority to test
193 // aPresenceFlags - set of flags specifying which components are present
195 void TestAuthorityComponentPresenceL(const TDesC& aAuthority, TInt aPresenceFlags) const;
197 // Tests the AuthorityDes() function
200 // aAuthority - the authority
202 void TestAuthorityDesL(const TDesC& aAuthority);
204 void TestAuthoritySetComponentL(const TDesC& aAuthority_Host, const TDesC& aAuthority_Userinfo, const TDesC& aAuthority_Port,
205 const TDesC& aHost, const TDesC& aUserinfo, const TDesC& aPort);
207 void TestAuthoritySetAndEscapeComponentL(const TDesC& aAuthority_Host, const TDesC& aAuthority_Userinfo, const TDesC& aAuthority_Port,
208 const TDesC& aHost, const TDesC& aUserinfo, const TDesC& aPort) const;
210 void TestAuthorityRemoveComponentL(const TDesC& aAuthority_NoHost, const TDesC& aAuthority_NoUserinfo,
211 const TDesC& aAuthority_NoPort, const TDesC& aAuthority_Whole) const;
213 private: // Attributes
217 CIpuTestHarness* iTestHarness;
221 #endif // __CURIANDAUTHORITYTEST_H__