1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-2009 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 |
|
29 |
25 |
30 using namespace NUnitTesting_USBDI; |
26 using namespace NUnitTesting_USBDI; |
31 |
27 |
32 // The test object |
28 // The test object |
33 |
29 |
34 RTest gtest(_L("USBDI Unit Testing")); |
30 RTest gtest(_L("USBDI Unit Testing")); |
35 |
31 |
36 static void MainL() |
32 static void MainL() |
37 { |
33 { |
38 OstTraceFunctionEntry0( _MAINL_ENTRY ); |
34 LOG_CFUNC |
39 // Leave the hooks in for platform security |
35 // Leave the hooks in for platform security |
40 #ifdef __DATA_CAGING__ |
36 #ifdef __DATA_CAGING__ |
41 RProcess().DataCaging(RProcess::EDataCagingOn); |
37 RProcess().DataCaging(RProcess::EDataCagingOn); |
42 RProcess().SecureApi(RProcess::ESecureApiOn); |
38 RProcess().SecureApi(RProcess::ESecureApiOn); |
43 #endif |
39 #endif |
62 |
58 |
63 // Synchronise with the client and start the active scheduler |
59 // Synchronise with the client and start the active scheduler |
64 RProcess::Rendezvous(KErrNone); |
60 RProcess::Rendezvous(KErrNone); |
65 |
61 |
66 User::After(150000); |
62 User::After(150000); |
67 OstTrace0(TRACE_NORMAL, MAINL_MAINL, "CActiveScheduler::Start MainL"); |
63 RDebug::Print(_L("CActiveScheduler::Start MainL")); |
68 CActiveScheduler::Start(); |
64 CActiveScheduler::Start(); |
69 |
65 |
70 CleanupStack::PopAndDestroy(testEngine); |
66 CleanupStack::PopAndDestroy(testEngine); |
71 } |
67 } |
72 else |
68 else |
73 { |
69 { |
74 gtest.Printf(_L("Unable to create the test engine: %d\n"),err); |
70 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); |
|
76 } |
71 } |
77 |
72 |
78 User::After(5000000); |
73 User::After(5000000); |
79 CleanupStack::PopAndDestroy(sched); |
74 CleanupStack::PopAndDestroy(sched); |
80 OstTraceFunctionExit0( _MAINL_EXIT ); |
|
81 } |
75 } |
82 |
76 |
83 TInt E32Main() |
77 TInt E32Main() |
84 { |
78 { |
85 OstTraceFunctionEntry0( _E32MAIN_ENTRY ); |
79 LOG_CFUNC |
86 // Create the new trap-cleanup mechanism |
80 // Create the new trap-cleanup mechanism |
87 CTrapCleanup* cleanup = CTrapCleanup::New(); |
81 CTrapCleanup* cleanup = CTrapCleanup::New(); |
88 |
82 |
89 if(cleanup == NULL) |
83 if(cleanup == NULL) |
90 { |
84 { |
91 OstTraceFunctionExit0( _E32MAIN_EXIT ); |
|
92 return KErrNoMemory; |
85 return KErrNoMemory; |
93 } |
86 } |
94 |
87 |
95 // Perform the tests |
88 // Perform the tests |
96 TRAPD(err,MainL()); |
89 TRAPD(err,MainL()); |
97 if(err != KErrNone) |
90 if(err != KErrNone) |
98 { |
91 { |
99 gtest.Printf(_L("MainL error: %d\n"),err); |
92 gtest.Printf(_L("MainL error: %d\n"),err); |
100 OstTrace1(TRACE_NORMAL, E32MAIN_E32MAIN, "MainL error: %d\n",err); |
|
101 } |
93 } |
102 |
94 |
103 delete cleanup; |
95 delete cleanup; |
104 |
96 |
105 // Provide no error |
97 // Provide no error |
106 OstTraceFunctionExit0( _E32MAIN_EXIT_DUP01 ); |
|
107 return KErrNone; |
98 return KErrNone; |
108 } |
99 } |
109 |
100 |
110 |
101 |