resourcemgmt/hwresourcesmgr/test/multiclient/mctest_b/main.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2008-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 "mctest_b.h"
       
    17 #include <e32cons.h>
       
    18 
       
    19 CConsoleBase* console;
       
    20 
       
    21 _LIT(KProgramName,"McTest_B");
       
    22 #define PANIC(XXX)     User::Panic(KProgramName, XXX)
       
    23 
       
    24 //
       
    25 // Main executable functions
       
    26 //
       
    27 void mainL()
       
    28 	{
       
    29 	CHwrmMcTest_B* mcTestB = CHwrmMcTest_B::NewL(*console);
       
    30 	CleanupStack::PushL(mcTestB);
       
    31 
       
    32 	mcTestB->RunMulticlientTestCases_B();
       
    33 	
       
    34 	CleanupStack::PopAndDestroy(mcTestB);
       
    35 	}
       
    36 
       
    37 void consoleMainL()
       
    38 	{
       
    39 	const TInt KSmallConsHeight(12);
       
    40 	console = Console::NewL(KProgramName, TSize(KConsFullScreen,KSmallConsHeight));
       
    41 	CleanupStack::PushL(console);
       
    42 	CActiveScheduler* sched = new(ELeave) CActiveScheduler();
       
    43 	CleanupStack::PushL(sched);
       
    44 	CActiveScheduler::Install(sched);
       
    45 
       
    46 
       
    47 	TRAPD(err,mainL());
       
    48 	if (err)
       
    49 		console->Printf(_L("\nSetting up the test failed with error code %d.\n"), err);
       
    50 
       
    51 	CActiveScheduler::Install(NULL);
       
    52 	CleanupStack::PopAndDestroy(2, console);
       
    53 	}
       
    54 
       
    55 GLDEF_C TInt E32Main()
       
    56 	{  
       
    57 	__UHEAP_MARK;
       
    58 	CTrapCleanup* cleanupStack=CTrapCleanup::New();
       
    59 	TRAPD(error,consoleMainL());
       
    60 	// consoleMainL only leaves if creation of console / active scheduler fails
       
    61 	__ASSERT_ALWAYS(!error,PANIC(error));
       
    62 	delete cleanupStack;
       
    63 	__UHEAP_MARKEND;
       
    64 	return 0;
       
    65 	}