|
1 // Copyright (c) 2005-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 // Startup State Aware (SSA) test component used to |
|
15 // test apparc StartApp and StartDocument functionality \n |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 @test |
|
22 @internalComponent Internal Symbian test code |
|
23 */ |
|
24 |
|
25 #include <e32base.h> |
|
26 #include <e32debug.h> |
|
27 #include <s32file.h> |
|
28 #include <startupdomaindefs.h> |
|
29 #include <domainmanager.h> |
|
30 #include <startup.hrh> |
|
31 |
|
32 #include "tssaac.h" |
|
33 #include "SysStartApparcTestCases.h" |
|
34 |
|
35 |
|
36 CApparcFuncInSystart* CApparcFuncInSystart::NewL(TDmHierarchyId aHierarchyId, TDmDomainId aDomainId) |
|
37 { |
|
38 RDebug::Print(_L("CApparcFuncInSystart::NewL - entry")); |
|
39 CApparcFuncInSystart* self = NewLC(aHierarchyId, aDomainId); |
|
40 CleanupStack::Pop(self); |
|
41 RDebug::Print(_L("CApparcFuncInSystart::NewL - exit")); |
|
42 return self; |
|
43 } |
|
44 |
|
45 CApparcFuncInSystart* CApparcFuncInSystart::NewLC(TDmHierarchyId aHierarchyId, TDmDomainId aDomainId) |
|
46 { |
|
47 RDebug::Print(_L("CApparcFuncInSystart::NewLC - entry")); |
|
48 CApparcFuncInSystart* self = new (ELeave) CApparcFuncInSystart(aHierarchyId, aDomainId); |
|
49 CleanupStack::PushL(self); |
|
50 self->ConstructL(); |
|
51 RDebug::Print(_L("CApparcFuncInSystart::NewLC - exit")); |
|
52 return self; |
|
53 } |
|
54 |
|
55 /** |
|
56 Constructor |
|
57 */ |
|
58 CApparcFuncInSystart::CApparcFuncInSystart(TDmHierarchyId aHierarchyId, TDmDomainId aDomainId) : |
|
59 CDmDomain(aHierarchyId, aDomainId) |
|
60 { |
|
61 } |
|
62 |
|
63 /** |
|
64 Destructor |
|
65 */ |
|
66 CApparcFuncInSystart::~CApparcFuncInSystart() |
|
67 { |
|
68 Cancel(); |
|
69 } |
|
70 |
|
71 /** |
|
72 Start - Register the requests |
|
73 */ |
|
74 void CApparcFuncInSystart::Start() |
|
75 { |
|
76 RDebug::Print(_L("CApparcFuncInSystart::Start - entry")); |
|
77 |
|
78 __ASSERT_ALWAYS(!IsActive(), User::Panic(KApparcFuncInSystartPanic,1)); |
|
79 |
|
80 // register a request for further transition notifications |
|
81 RDebug::Print(_L("CApparcFuncInSystart: Request Transition Notification")); |
|
82 RequestTransitionNotification(); |
|
83 RDebug::Print(_L("CApparcFuncInSystart: Transition Acknowlege")); |
|
84 } |
|
85 |
|
86 |
|
87 /** |
|
88 DoCancel() |
|
89 */ |
|
90 void CApparcFuncInSystart::DoCancel() |
|
91 { |
|
92 } |
|
93 |
|
94 |
|
95 /** |
|
96 RunL() |
|
97 */ |
|
98 void CApparcFuncInSystart::RunL() |
|
99 { |
|
100 RDebug::Print(_L("CApparcFuncInSystart::RunL - entry")); |
|
101 |
|
102 // Check current state |
|
103 TInt state = GetState(); |
|
104 if (state != EStartupStateCriticalDynamic) |
|
105 { |
|
106 RDebug::Print(_L("CApparcFuncInSystart::RunL - Initial state check failure! Current state = %d"), state); |
|
107 User::Leave(KErrGeneral); |
|
108 } |
|
109 |
|
110 // Perform tests - creates a test case object used for running the apparc test cases |
|
111 CSysStartApparcTestCase* teststep = new (ELeave) CSysStartApparcTestCase(); |
|
112 CleanupStack::PushL(teststep); |
|
113 teststep->doTestCasesL(); |
|
114 CleanupStack::PopAndDestroy(teststep); |
|
115 |
|
116 // Check current state |
|
117 state = GetState(); |
|
118 if (state != EStartupStateCriticalDynamic) |
|
119 { |
|
120 RDebug::Print(_L("CApparcFuncInSystart::RunL - Final state check failure! Current state = %d"), state); |
|
121 User::Leave(KErrGeneral); |
|
122 } |
|
123 |
|
124 // Acknowledge this state (The transition should pass) |
|
125 AcknowledgeLastState(KErrNone); |
|
126 |
|
127 RDebug::Print(_L("CApparcFuncInSystart::RunL - exit")); |
|
128 } |
|
129 |
|
130 |
|
131 |
|
132 LOCAL_C void StartSystemL(); |
|
133 |
|
134 GLDEF_C TInt E32Main() |
|
135 { |
|
136 RDebug::Print(_L("CApparcFuncInSystart::E32Main - entry")); |
|
137 __UHEAP_MARK; // mark heap state |
|
138 |
|
139 CTrapCleanup* TheTrapCleanup = CTrapCleanup::New(); |
|
140 TRAPD(error, StartSystemL()); |
|
141 delete TheTrapCleanup; |
|
142 |
|
143 __UHEAP_MARKEND; // check for no memory leak |
|
144 |
|
145 RDebug::Print(_L("CApparcFuncInSystart::E32Main - exit")); |
|
146 return error; |
|
147 } |
|
148 |
|
149 LOCAL_C void StartSystemL() |
|
150 { |
|
151 RDebug::Print(_L("CApparcFuncInSystart::StartSystemL - entry")); |
|
152 |
|
153 //Prevent emulator closing when a panic occurs |
|
154 User::SetJustInTime(EFalse); |
|
155 |
|
156 CActiveScheduler* theScheduler = new (ELeave) CActiveScheduler(); |
|
157 CleanupStack::PushL(theScheduler); |
|
158 CActiveScheduler::Install(theScheduler); |
|
159 |
|
160 #ifdef SYMBIAN_SYSTEM_STATE_MANAGEMENT |
|
161 CApparcFuncInSystart *starter = CApparcFuncInSystart::NewLC(KDmHierarchyIdStartup, KSM2AppServicesDomain3); |
|
162 #else |
|
163 CApparcFuncInSystart *starter = CApparcFuncInSystart::NewLC(KDmHierarchyIdStartup, KAppServicesDomain3); |
|
164 #endif |
|
165 |
|
166 starter->Start(); |
|
167 |
|
168 CActiveScheduler::Start(); |
|
169 |
|
170 // This point should never be reached |
|
171 User::Panic(KApparcFuncInSystartPanic,1); |
|
172 |
|
173 CleanupStack::PopAndDestroy(2); // starter, theScheduler |
|
174 CleanupStack::PopAndDestroy(theScheduler); |
|
175 RDebug::Print(_L("CApparcFuncInSystart::StartSystemL - exit")); |
|
176 } |