genericservices/httputils/Test/t_uriparser/T_UriParserMain.cpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 // MEMORY LEAK TESTING - Change and recompile to enable memory leak testing
       
    17 // #define __MEMORY_LEAK_TESTING_ENABLED
       
    18 
       
    19 
       
    20 // System includes
       
    21 //
       
    22 #include <e32base.h>
       
    23 
       
    24 // Local include
       
    25 //
       
    26 #include "IpuTestUtils.h"
       
    27 #include "CUriAndAuthorityTest.h"
       
    28 #include "CDelimitedPathTest.h"
       
    29 #include "CDelimitedPathSegmentTest.h"
       
    30 #include "CDelimitedQueryTest.h"
       
    31 #include "CEscapeUtilsTest.h"
       
    32 #include "CTextUtilsTest.h"
       
    33 #include "CUriUtilsTest.h"
       
    34 #include "CSipUriAndAuthorityTest.h"
       
    35 
       
    36 
       
    37 // Constants and definions
       
    38 //
       
    39 _LIT(KUriParserTestPanic, "T_Uri");
       
    40 _LIT(KUriTestTitle, "T_Uri Test Harness");
       
    41 
       
    42 GLDEF_C void Panic(TInt aPanic);
       
    43 
       
    44 //	Local/Global function implementations
       
    45 //
       
    46 GLDEF_C void Panic(TInt aPanic)
       
    47 //
       
    48 //	Panic the client program.
       
    49 	{
       
    50 	User::Panic(KUriParserTestPanic,aPanic);
       
    51 	}
       
    52 
       
    53 GLDEF_C void TestL()
       
    54 	{
       
    55 	CIpuTestHarness* testHarness = CIpuTestHarness::NewL(KUriTestTitle);
       
    56 	CleanupStack::PushL(testHarness);
       
    57 	testHarness->DoResourceLeakTest(ETrue);
       
    58 
       
    59 	testHarness->LogIt(_L ("@SYMTestCaseID IWS-APPPROTOCOLS-INETPROTUTIL-T_URIPARSERMAIN-0001 "));
       
    60 
       
    61 	CEscapeUtilsTest* escapeUtilsTest = CEscapeUtilsTest::NewLC(testHarness);
       
    62 #ifdef __MEMORY_LEAK_TESTING_ENABLED
       
    63 	CTestBase::MemoryLeakTestL(*escapeUtilsTest,*testHarness);
       
    64 #endif
       
    65 	escapeUtilsTest->DoTestsL();
       
    66 
       
    67 	CTextUtilsTest* textUtilsTest = CTextUtilsTest::NewLC(testHarness);
       
    68 #ifdef __MEMORY_LEAK_TESTING_ENABLED
       
    69 	CTestBase::MemoryLeakTestL(*textUtilsTest,*testHarness);
       
    70 #endif
       
    71 	textUtilsTest->DoTestsL();
       
    72 
       
    73 	CUriUtilsTest* uriUtilsTest = CUriUtilsTest::NewLC(testHarness);
       
    74 #ifdef __MEMORY_LEAK_TESTING_ENABLED
       
    75 	CTestBase::MemoryLeakTestL(*uriUtilsTest,*testHarness);
       
    76 #endif
       
    77 	uriUtilsTest->DoTestsL();
       
    78 
       
    79 	CUriAndAuthorityTest* uriAndAuthorityTest = CUriAndAuthorityTest::NewLC(testHarness);
       
    80 #ifdef __MEMORY_LEAK_TESTING_ENABLED
       
    81 	CTestBase::MemoryLeakTestL(*uriAndAuthorityTest,*testHarness);
       
    82 #endif
       
    83 	uriAndAuthorityTest->DoTestsL();
       
    84 	
       
    85 	CDelimitedPathTest* delimitedPathTest = CDelimitedPathTest::NewLC(testHarness);
       
    86 #ifdef __MEMORY_LEAK_TESTING_ENABLED
       
    87 	CTestBase::MemoryLeakTestL(*delimitedPathTest,*testHarness);
       
    88 #endif
       
    89 	delimitedPathTest->DoTestsL();
       
    90 
       
    91 	CDelimitedPathSegmentTest* delimitedPathSegmentTest = CDelimitedPathSegmentTest::NewLC(testHarness);
       
    92 #ifdef __MEMORY_LEAK_TESTING_ENABLED
       
    93 	CTestBase::MemoryLeakTestL(*delimitedPathSegmentTest,*testHarness);
       
    94 #endif
       
    95 	delimitedPathSegmentTest->DoTestsL();
       
    96 
       
    97 	CDelimitedQueryTest* delimitedQueryTest = CDelimitedQueryTest::NewLC(testHarness);
       
    98 #ifdef __MEMORY_LEAK_TESTING_ENABLED
       
    99 	CTestBase::MemoryLeakTestL(*delimitedQueryTest,*testHarness);
       
   100 #endif
       
   101 	delimitedQueryTest->DoTestsL();
       
   102 
       
   103 	CSipUriAndAuthorityTest* sipUriAndAuthorityTest = CSipUriAndAuthorityTest::NewLC(testHarness);
       
   104 #ifdef __MEMORY_LEAK_TESTING_ENABLED
       
   105 	CTestBase::MemoryLeakTestL(*sipUriAndAuthorityTest,*testHarness);
       
   106 #endif
       
   107 	sipUriAndAuthorityTest->DoTestsL();
       
   108 
       
   109 	CleanupStack::PopAndDestroy(9, testHarness);	//	lots!
       
   110 	}
       
   111 
       
   112 GLDEF_C TInt E32Main()
       
   113 //
       
   114 // Main function
       
   115 	{
       
   116 	__UHEAP_MARK;
       
   117 	CTrapCleanup* tc=CTrapCleanup::New();
       
   118 	TRAPD(err,TestL());
       
   119 	if (err!=KErrNone)
       
   120 		User::Panic(_L("Failed to complete test"),err);
       
   121 	delete tc;
       
   122 	__UHEAP_MARKEND;
       
   123 	return KErrNone;
       
   124 	}