applayerpluginsandutils/uripermissionservices/Test/tineturilist.cpp
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2007-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 #include <ineturilistdef.h>
       
    17 
       
    18 #include <s32mem.h>
       
    19 #include <s32buf.h>
       
    20 #include "testutils.h"
       
    21 #include <ineturilist.h>
       
    22 #include "tineturilisttester.h"
       
    23 
       
    24 _LIT(KTitle, "InetUriList Dll Tests");
       
    25 
       
    26 LOCAL_D RTest gTest( KTitle() );
       
    27 
       
    28 LOCAL_D CTestWrapper* gTestWrapper;
       
    29 
       
    30 LOCAL_C void RunTestsL ( TBool aNormalRun = ETrue )
       
    31 	{	
       
    32 	CInetUriListTester* listTester = CInetUriListTester::NewL ( *gTestWrapper );
       
    33 	CleanupStack::PushL ( listTester );
       
    34 	listTester->TestL (aNormalRun);
       
    35 	listTester->DoListCleanupL ();
       
    36 	CleanupStack::PopAndDestroy (); // listTester
       
    37 	}
       
    38 	
       
    39 	
       
    40 LOCAL_C void RunOoomTestsL ()
       
    41 	{
       
    42 	gTestWrapper->Next(_L("@SYMTestCaseID IWS-APPPROTOCOLS-INETURILIST-LIST-0001 [Inet Uri List tests] OOM testing"));
       
    43 	TRAPD( ret, RunTestsL(EFalse) );
       
    44 	gTestWrapper->TESTE( ret==KErrNone, ret );
       
    45 	}
       
    46 
       
    47 LOCAL_C void DoTestsL ()
       
    48 	{	
       
    49 	gTestWrapper = CTestWrapper::NewLC(gTest);
       
    50 	gTestWrapper->Start(_L("test"));
       
    51 		
       
    52 	TRAPD ( err, RunTestsL () );
       
    53 	gTestWrapper->TESTE( err==KErrNone, err );	
       
    54 
       
    55 	TRAP ( err, RunOoomTestsL () );
       
    56 	gTestWrapper->TESTE( err==KErrNone, err );	
       
    57 
       
    58 	gTestWrapper->End();
       
    59 	CleanupStack::PopAndDestroy(gTestWrapper);
       
    60 	}
       
    61 
       
    62 GLDEF_C TInt E32Main()
       
    63 	{
       
    64 	__UHEAP_MARK;
       
    65 	CTrapCleanup* tc = CTrapCleanup::New();
       
    66 	TRAPD( err, DoTestsL() );
       
    67 	if ( err != KErrNone )
       
    68 		User::Panic( _L( "Test failed with error code: %i" ), err );
       
    69 	delete tc;
       
    70 	__UHEAP_MARKEND;
       
    71 	return KErrNone;
       
    72 	}