|
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 |
|
50 // Create cleanup stack |
|
51 __UHEAP_MARK; |
|
52 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
53 |
|
54 // Create output console |
|
55 TRAPD(createError, console = Console::NewL(KTextConsoleTitle, TSize(KConsFullScreen,KConsFullScreen))); |
|
56 if (createError) |
|
57 return createError; |
|
58 |
|
59 // Run application code inside TRAP harness, wait keypress when terminated |
|
60 TRAPD(mainError, DoStartL()); |
|
61 console->Printf(KTextPressAnyKey); |
|
62 console->Getch(); |
|
63 |
|
64 delete console; |
|
65 delete cleanup; |
|
66 __UHEAP_MARKEND; |
|
67 |
|
68 return KErrNone; |
|
69 } |
|
70 |
|
71 #include "AllTests.h" |