applayerprotocols/httpexamples/TestWebBrowser/src/Main.cpp
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2005-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 <e32base.h>
       
    17 
       
    18 #include <http.h>
       
    19 #include <chttpformencoder.h>
       
    20 #include "httpexampleutils.h"
       
    21 #include "testwebbrowser.h"
       
    22 
       
    23 // Create a test object, invoke the tests using it and remove
       
    24 LOCAL_D void TestL()
       
    25 	{
       
    26 	// Start C32 and initalize some device drivers. This is necessary when running a test console as these won't 
       
    27 	// have been started
       
    28 	CHttpExampleUtils::InitCommsL();
       
    29 	
       
    30 	CHttpExampleUtils* httpUtils = CHttpExampleUtils::NewL ( _L ( "Test web browser" ) );
       
    31 	CleanupStack::PushL ( httpUtils );
       
    32 
       
    33 		
       
    34 	// create an active scheduler to use
       
    35 	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler();
       
    36 	CleanupStack::PushL( scheduler );
       
    37 	CActiveScheduler::Install( scheduler );
       
    38 	
       
    39 	
       
    40 	// Create and start the web browser	
       
    41 	CTestWebBrowser* webBrowser = CTestWebBrowser::NewLC ( *httpUtils );
       
    42 	CActiveScheduler::Start ();
       
    43 	
       
    44 
       
    45 	CleanupStack::Pop ( webBrowser ); // Pop and destroy webBrowser
       
    46 	delete webBrowser;
       
    47 	CleanupStack::Pop ( scheduler );  // Pop and destroy scheduler
       
    48 	delete scheduler;
       
    49 	CleanupStack::Pop ( httpUtils );  // pop and destroy httpUtils
       
    50 	delete httpUtils;
       
    51 	}
       
    52 
       
    53 
       
    54 // Main program - run the tests within a TRAP harness, reporting any errors that
       
    55 // occur via the panic mechanism. Test for memory leaks using heap marking.
       
    56 GLDEF_C TInt E32Main()
       
    57 	{
       
    58 
       
    59 	__UHEAP_MARK;
       
    60 	CTrapCleanup* tc = CTrapCleanup::New();
       
    61 	TRAPD( err,TestL() );
       
    62 	if ( err != KErrNone )
       
    63 		User::Panic( _L( "Test failed with error code: %i" ), err );
       
    64 	delete tc;
       
    65 	__UHEAP_MARKEND;
       
    66 	return KErrNone;
       
    67 	}
       
    68 
       
    69 
       
    70 
       
    71 
       
    72 
       
    73