os/ossrv/genericservices/httputils/Test/t_uriparser/T_UriParserMain.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericservices/httputils/Test/t_uriparser/T_UriParserMain.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,124 @@
     1.4 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +// MEMORY LEAK TESTING - Change and recompile to enable memory leak testing
    1.20 +// #define __MEMORY_LEAK_TESTING_ENABLED
    1.21 +
    1.22 +
    1.23 +// System includes
    1.24 +//
    1.25 +#include <e32base.h>
    1.26 +
    1.27 +// Local include
    1.28 +//
    1.29 +#include "IpuTestUtils.h"
    1.30 +#include "CUriAndAuthorityTest.h"
    1.31 +#include "CDelimitedPathTest.h"
    1.32 +#include "CDelimitedPathSegmentTest.h"
    1.33 +#include "CDelimitedQueryTest.h"
    1.34 +#include "CEscapeUtilsTest.h"
    1.35 +#include "CTextUtilsTest.h"
    1.36 +#include "CUriUtilsTest.h"
    1.37 +#include "CSipUriAndAuthorityTest.h"
    1.38 +
    1.39 +
    1.40 +// Constants and definions
    1.41 +//
    1.42 +_LIT(KUriParserTestPanic, "T_Uri");
    1.43 +_LIT(KUriTestTitle, "T_Uri Test Harness");
    1.44 +
    1.45 +GLDEF_C void Panic(TInt aPanic);
    1.46 +
    1.47 +//	Local/Global function implementations
    1.48 +//
    1.49 +GLDEF_C void Panic(TInt aPanic)
    1.50 +//
    1.51 +//	Panic the client program.
    1.52 +	{
    1.53 +	User::Panic(KUriParserTestPanic,aPanic);
    1.54 +	}
    1.55 +
    1.56 +GLDEF_C void TestL()
    1.57 +	{
    1.58 +	CIpuTestHarness* testHarness = CIpuTestHarness::NewL(KUriTestTitle);
    1.59 +	CleanupStack::PushL(testHarness);
    1.60 +	testHarness->DoResourceLeakTest(ETrue);
    1.61 +
    1.62 +	testHarness->LogIt(_L ("@SYMTestCaseID IWS-APPPROTOCOLS-INETPROTUTIL-T_URIPARSERMAIN-0001 "));
    1.63 +
    1.64 +	CEscapeUtilsTest* escapeUtilsTest = CEscapeUtilsTest::NewLC(testHarness);
    1.65 +#ifdef __MEMORY_LEAK_TESTING_ENABLED
    1.66 +	CTestBase::MemoryLeakTestL(*escapeUtilsTest,*testHarness);
    1.67 +#endif
    1.68 +	escapeUtilsTest->DoTestsL();
    1.69 +
    1.70 +	CTextUtilsTest* textUtilsTest = CTextUtilsTest::NewLC(testHarness);
    1.71 +#ifdef __MEMORY_LEAK_TESTING_ENABLED
    1.72 +	CTestBase::MemoryLeakTestL(*textUtilsTest,*testHarness);
    1.73 +#endif
    1.74 +	textUtilsTest->DoTestsL();
    1.75 +
    1.76 +	CUriUtilsTest* uriUtilsTest = CUriUtilsTest::NewLC(testHarness);
    1.77 +#ifdef __MEMORY_LEAK_TESTING_ENABLED
    1.78 +	CTestBase::MemoryLeakTestL(*uriUtilsTest,*testHarness);
    1.79 +#endif
    1.80 +	uriUtilsTest->DoTestsL();
    1.81 +
    1.82 +	CUriAndAuthorityTest* uriAndAuthorityTest = CUriAndAuthorityTest::NewLC(testHarness);
    1.83 +#ifdef __MEMORY_LEAK_TESTING_ENABLED
    1.84 +	CTestBase::MemoryLeakTestL(*uriAndAuthorityTest,*testHarness);
    1.85 +#endif
    1.86 +	uriAndAuthorityTest->DoTestsL();
    1.87 +	
    1.88 +	CDelimitedPathTest* delimitedPathTest = CDelimitedPathTest::NewLC(testHarness);
    1.89 +#ifdef __MEMORY_LEAK_TESTING_ENABLED
    1.90 +	CTestBase::MemoryLeakTestL(*delimitedPathTest,*testHarness);
    1.91 +#endif
    1.92 +	delimitedPathTest->DoTestsL();
    1.93 +
    1.94 +	CDelimitedPathSegmentTest* delimitedPathSegmentTest = CDelimitedPathSegmentTest::NewLC(testHarness);
    1.95 +#ifdef __MEMORY_LEAK_TESTING_ENABLED
    1.96 +	CTestBase::MemoryLeakTestL(*delimitedPathSegmentTest,*testHarness);
    1.97 +#endif
    1.98 +	delimitedPathSegmentTest->DoTestsL();
    1.99 +
   1.100 +	CDelimitedQueryTest* delimitedQueryTest = CDelimitedQueryTest::NewLC(testHarness);
   1.101 +#ifdef __MEMORY_LEAK_TESTING_ENABLED
   1.102 +	CTestBase::MemoryLeakTestL(*delimitedQueryTest,*testHarness);
   1.103 +#endif
   1.104 +	delimitedQueryTest->DoTestsL();
   1.105 +
   1.106 +	CSipUriAndAuthorityTest* sipUriAndAuthorityTest = CSipUriAndAuthorityTest::NewLC(testHarness);
   1.107 +#ifdef __MEMORY_LEAK_TESTING_ENABLED
   1.108 +	CTestBase::MemoryLeakTestL(*sipUriAndAuthorityTest,*testHarness);
   1.109 +#endif
   1.110 +	sipUriAndAuthorityTest->DoTestsL();
   1.111 +
   1.112 +	CleanupStack::PopAndDestroy(9, testHarness);	//	lots!
   1.113 +	}
   1.114 +
   1.115 +GLDEF_C TInt E32Main()
   1.116 +//
   1.117 +// Main function
   1.118 +	{
   1.119 +	__UHEAP_MARK;
   1.120 +	CTrapCleanup* tc=CTrapCleanup::New();
   1.121 +	TRAPD(err,TestL());
   1.122 +	if (err!=KErrNone)
   1.123 +		User::Panic(_L("Failed to complete test"),err);
   1.124 +	delete tc;
   1.125 +	__UHEAP_MARKEND;
   1.126 +	return KErrNone;
   1.127 +	}