sl@0: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef __CURIANDAUTHORITYTEST_H__ sl@0: #define __CURIANDAUTHORITYTEST_H__ sl@0: sl@0: // System includes sl@0: // sl@0: #include sl@0: sl@0: // Local includes sl@0: // sl@0: #include "IpuTestUtils.h" sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "ctestbase.h" sl@0: sl@0: enum TUriMatchAndPresenceFlags sl@0: { sl@0: ESchemeFlag = 0x01, sl@0: EUserinfoFlag = 0x02, sl@0: EHostFlag = 0x04, sl@0: EPortFlag = 0x08, sl@0: EPathFlag = 0x10, sl@0: EQueryFlag = 0x20, sl@0: EFragmentFlag = 0x40 sl@0: }; sl@0: sl@0: // CUriAndAuthorityTest - test class for the Uri and Authority family of classes sl@0: // sl@0: class CUriAndAuthorityTest : public CTestBase sl@0: { sl@0: public: sl@0: sl@0: // Static factory c'tor. Leaves pointer to created object on the cleanup stack. sl@0: // sl@0: // Rtn: pointer to newly created object - ownership transfered to caller. sl@0: // sl@0: static CUriAndAuthorityTest* NewLC(CIpuTestHarness* aTestHarness); sl@0: sl@0: // Static factory c'tor. sl@0: // sl@0: // Rtn: pointer to newly created object - ownership transfered to caller. sl@0: // sl@0: static CUriAndAuthorityTest* NewL(CIpuTestHarness* aTestHarness); sl@0: sl@0: // D'tor sl@0: // sl@0: ~CUriAndAuthorityTest(); sl@0: sl@0: // Runs the defined tests. sl@0: // sl@0: void DoTestsL(); sl@0: sl@0: // sl@0: // sl@0: // Uri Tests sl@0: // sl@0: // sl@0: sl@0: // Tests the parsing of TUriParser components sl@0: // sl@0: // In: sl@0: // aUri - the uri to be parsed sl@0: // aScheme - what the scheme should be sl@0: // aUserInfo - what the userinfo should be sl@0: // aHost - what the host should be sl@0: // aPort - what the port should be sl@0: // aPath - what the path should be sl@0: // aQuery - what the query should be sl@0: // aFragment - what the fragment should be sl@0: // sl@0: void TestUriComponentExtractionL(const TDesC16& aUri, const TDesC16& aScheme, sl@0: const TDesC16& aUserinfo, const TDesC16& aHost, sl@0: const TDesC16& aPort, const TDesC16& aPath, sl@0: const TDesC16& aQuery, const TDesC16& aFragment) const; sl@0: sl@0: sl@0: void TestUriRemoveComponentL(const TDesC& aUri_NoScheme, const TDesC& aUri_NoHost, const TDesC& aUri_NoUserinfo, sl@0: const TDesC& aUri_NoPort, const TDesC& aUri_NoPath, const TDesC& aUri_NoQuery, sl@0: const TDesC& aUri_NoFragment, const TDesC& aUri_Whole) const; sl@0: sl@0: void TestUriSetComponentL(const TDesC& aUri_Scheme, const TDesC& aUri_Host, const TDesC& aUri_Userinfo, sl@0: const TDesC& aUri_Port, const TDesC& aUri_Path, const TDesC& aUri_Query, sl@0: const TDesC& aUri_Fragment, const TDesC& aScheme, const TDesC& aHost, sl@0: const TDesC& aUserinfo, const TDesC& aPort, const TDesC& aPath, sl@0: const TDesC& aQuery, const TDesC& aFragment) const; sl@0: private: // Methods sl@0: sl@0: // Default c'tor. sl@0: // sl@0: CUriAndAuthorityTest(CIpuTestHarness* aTestHarness); sl@0: sl@0: // Non-trivial c'tor. Second part of 2-phase construction - does all allocation. sl@0: // sl@0: void ConstructL(); sl@0: sl@0: // Tests uri resolving. sl@0: // sl@0: // In: sl@0: // aBase - base uri sl@0: // aRelative - referene uri to be resolved sl@0: // aExpected - expected result sl@0: // sl@0: void TestResolveL(const TDesC& aBase, const TDesC& aReference, const TDesC& aExpected) const; sl@0: sl@0: // Tests comparison of 2 uri's sl@0: // sl@0: // In: sl@0: // aUri1 - a uri sl@0: // aUri2 - a uri sl@0: // aMatchFlags - set of flags specifying which components match sl@0: // sl@0: void TestUriCompareL(const TDesC& aUri1, const TDesC& aUri2, TInt aMatchFlags) const; sl@0: sl@0: // Tests the presence of components in a uri sl@0: // sl@0: // In: sl@0: // aUri - the uri to test sl@0: // aPresenceFlags - set of flags specifying which components are present sl@0: // sl@0: void TestUriComponentPresenceL(const TDesC& aUri, TInt aPresenceFlags) const; sl@0: sl@0: // Tests the UriDes() function sl@0: // sl@0: // In: sl@0: // aUri - the uri sl@0: // sl@0: void TestUriDesL(const TDesC& aUri) const; sl@0: sl@0: // Tests scheme validation sl@0: // sl@0: // In: sl@0: // aUri - the uri sl@0: // aValidScheme - boolean value stating whether scheme is valid or not sl@0: // sl@0: void TestUriSchemeValidiyL(const TDesC& aUri, TBool aValidScheme) const; sl@0: sl@0: // Tests retrieving the fragmentless uri sl@0: // sl@0: // In: sl@0: // aUri - the uri sl@0: // aExpected - the expeced fragmentless uri sl@0: // sl@0: void TestUriWithoutFragmentL(const TDesC& aUri, const TDesC& aExpected); sl@0: sl@0: // sl@0: // sl@0: // Authority Tests sl@0: // sl@0: // sl@0: sl@0: // Tests the parsing of TAuthorityParser components sl@0: // sl@0: // In: sl@0: // aAuthority - the authority to be parsed sl@0: // aHost - what the host should be sl@0: // aUserInfo - what the userinfo should be sl@0: // aPort - what the port should be sl@0: // sl@0: void TestAuthorityComponentExtractionL(const TDesC16& aAuthority, const TDesC16& aHost, sl@0: const TDesC16& aUserinfo, const TDesC16& aPort) const; sl@0: sl@0: // Tests comparison of 2 authorities sl@0: // sl@0: // In: sl@0: // aAuthority1 - an authority sl@0: // aAuthority2 - an authority sl@0: // aMatchFlags - set of flags specifying which components match sl@0: // sl@0: void TestAuthorityCompareL(const TDesC& aAuthority1, const TDesC& aAuthority2, TInt aMatchFlags) const; sl@0: sl@0: // Tests the presence of components in an authority sl@0: // sl@0: // In: sl@0: // aAuthority - the authority to test sl@0: // aPresenceFlags - set of flags specifying which components are present sl@0: // sl@0: void TestAuthorityComponentPresenceL(const TDesC& aAuthority, TInt aPresenceFlags) const; sl@0: sl@0: // Tests the AuthorityDes() function sl@0: // sl@0: // In: sl@0: // aAuthority - the authority sl@0: // sl@0: void TestAuthorityDesL(const TDesC& aAuthority); sl@0: sl@0: void TestAuthoritySetComponentL(const TDesC& aAuthority_Host, const TDesC& aAuthority_Userinfo, const TDesC& aAuthority_Port, sl@0: const TDesC& aHost, const TDesC& aUserinfo, const TDesC& aPort); sl@0: sl@0: void TestAuthoritySetAndEscapeComponentL(const TDesC& aAuthority_Host, const TDesC& aAuthority_Userinfo, const TDesC& aAuthority_Port, sl@0: const TDesC& aHost, const TDesC& aUserinfo, const TDesC& aPort) const; sl@0: sl@0: void TestAuthorityRemoveComponentL(const TDesC& aAuthority_NoHost, const TDesC& aAuthority_NoUserinfo, sl@0: const TDesC& aAuthority_NoPort, const TDesC& aAuthority_Whole) const; sl@0: sl@0: private: // Attributes sl@0: sl@0: // Test harness sl@0: // sl@0: CIpuTestHarness* iTestHarness; sl@0: sl@0: }; sl@0: sl@0: #endif // __CURIANDAUTHORITYTEST_H__