javamanager/javaregistry/tsrc/src/SymbianAllTests.cpp
branchRCL_3
changeset 19 04becd199f91
equal deleted inserted replaced
16:f5050f1da672 19:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include "Platform.h"
       
    19 #include "CommandLineTestRunner.h"
       
    20 
       
    21 #include <e32cons.h>            // Console
       
    22 
       
    23 _LIT(KTextConsoleTitle, "Console");
       
    24 _LIT(KTextPressAnyKey, " [press any key]\n");
       
    25 
       
    26 LOCAL_D CConsoleBase* console;  // write all messages to this
       
    27 
       
    28 LOCAL_C void MainL()
       
    29 {
       
    30     CommandLineTestRunner::RunAllTests(0, NULL);
       
    31 }
       
    32 
       
    33 
       
    34 LOCAL_C void DoStartL()
       
    35 {
       
    36     // Create active scheduler (to run active objects)
       
    37     CActiveScheduler* scheduler = new(ELeave) CActiveScheduler();
       
    38     CleanupStack::PushL(scheduler);
       
    39     CActiveScheduler::Install(scheduler);
       
    40 
       
    41     MainL();
       
    42 
       
    43     // Delete active scheduler
       
    44     CleanupStack::PopAndDestroy(scheduler);
       
    45 }
       
    46 
       
    47 GLDEF_C TInt E32Main()
       
    48 {
       
    49     // Create cleanup stack
       
    50     __UHEAP_MARK;
       
    51     CTrapCleanup* cleanup = CTrapCleanup::New();
       
    52 
       
    53     // Create output console
       
    54     TRAPD(createError, console = Console::NewL(KTextConsoleTitle, TSize(KConsFullScreen,KConsFullScreen)));
       
    55     if (createError)
       
    56         return createError;
       
    57 
       
    58     // Run application code inside TRAP harness, wait keypress when terminated
       
    59     TRAPD(mainError, DoStartL());
       
    60     console->Printf(KTextPressAnyKey);
       
    61     console->Getch();
       
    62 
       
    63     delete console;
       
    64     delete cleanup;
       
    65     __UHEAP_MARKEND;
       
    66     return KErrNone;
       
    67 }
       
    68 
       
    69 #include "AllTests.h"