1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Eclipse Public License v1.0" |
4 // under the terms of the License "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
20 #include <e32base_private.h> |
20 #include <e32base_private.h> |
21 #include <e32test.h> |
21 #include <e32test.h> |
22 |
22 |
23 #include "testdebug.h" |
23 #include "testdebug.h" |
24 #include "TestEngine.h" |
24 #include "TestEngine.h" |
|
25 #include "OstTraceDefinitions.h" |
|
26 #ifdef OST_TRACE_COMPILER_IN_USE |
|
27 #include "mainTraces.h" |
|
28 #endif |
25 |
29 |
26 using namespace NUnitTesting_USBDI; |
30 using namespace NUnitTesting_USBDI; |
27 |
31 |
28 // The test object |
32 // The test object |
29 |
33 |
30 RTest gtest(_L("USBDI Unit Testing")); |
34 RTest gtest(_L("USBDI Unit Testing")); |
31 |
35 |
32 static void MainL() |
36 static void MainL() |
33 { |
37 { |
34 LOG_CFUNC |
38 OstTraceFunctionEntry0( _MAINL_ENTRY ); |
35 // Leave the hooks in for platform security |
39 // Leave the hooks in for platform security |
36 #ifdef __DATA_CAGING__ |
40 #ifdef __DATA_CAGING__ |
37 RProcess().DataCaging(RProcess::EDataCagingOn); |
41 RProcess().DataCaging(RProcess::EDataCagingOn); |
38 RProcess().SecureApi(RProcess::ESecureApiOn); |
42 RProcess().SecureApi(RProcess::ESecureApiOn); |
39 #endif |
43 #endif |
58 |
62 |
59 // Synchronise with the client and start the active scheduler |
63 // Synchronise with the client and start the active scheduler |
60 RProcess::Rendezvous(KErrNone); |
64 RProcess::Rendezvous(KErrNone); |
61 |
65 |
62 User::After(150000); |
66 User::After(150000); |
63 RDebug::Print(_L("CActiveScheduler::Start MainL")); |
67 OstTrace0(TRACE_NORMAL, MAINL_MAINL, "CActiveScheduler::Start MainL"); |
64 CActiveScheduler::Start(); |
68 CActiveScheduler::Start(); |
65 |
69 |
66 CleanupStack::PopAndDestroy(testEngine); |
70 CleanupStack::PopAndDestroy(testEngine); |
67 } |
71 } |
68 else |
72 else |
69 { |
73 { |
70 gtest.Printf(_L("Unable to create the test engine: %d\n"),err); |
74 gtest.Printf(_L("Unable to create the test engine: %d\n"),err); |
|
75 OstTrace1(TRACE_NORMAL, MAINL_MAINL_DUP01, "Unable to create the test engine: %d\n",err); |
71 } |
76 } |
72 |
77 |
73 User::After(5000000); |
78 User::After(5000000); |
74 CleanupStack::PopAndDestroy(sched); |
79 CleanupStack::PopAndDestroy(sched); |
|
80 OstTraceFunctionExit0( _MAINL_EXIT ); |
75 } |
81 } |
76 |
82 |
77 TInt E32Main() |
83 TInt E32Main() |
78 { |
84 { |
79 LOG_CFUNC |
85 OstTraceFunctionEntry0( _E32MAIN_ENTRY ); |
80 // Create the new trap-cleanup mechanism |
86 // Create the new trap-cleanup mechanism |
81 CTrapCleanup* cleanup = CTrapCleanup::New(); |
87 CTrapCleanup* cleanup = CTrapCleanup::New(); |
82 |
88 |
83 if(cleanup == NULL) |
89 if(cleanup == NULL) |
84 { |
90 { |
|
91 OstTraceFunctionExit0( _E32MAIN_EXIT ); |
85 return KErrNoMemory; |
92 return KErrNoMemory; |
86 } |
93 } |
87 |
94 |
88 // Perform the tests |
95 // Perform the tests |
89 TRAPD(err,MainL()); |
96 TRAPD(err,MainL()); |
90 if(err != KErrNone) |
97 if(err != KErrNone) |
91 { |
98 { |
92 gtest.Printf(_L("MainL error: %d\n"),err); |
99 gtest.Printf(_L("MainL error: %d\n"),err); |
|
100 OstTrace1(TRACE_NORMAL, E32MAIN_E32MAIN, "MainL error: %d\n",err); |
93 } |
101 } |
94 |
102 |
95 delete cleanup; |
103 delete cleanup; |
96 |
104 |
97 // Provide no error |
105 // Provide no error |
|
106 OstTraceFunctionExit0( _E32MAIN_EXIT_DUP01 ); |
98 return KErrNone; |
107 return KErrNone; |
99 } |
108 } |
100 |
109 |
101 |
110 |