|
1 // Copyright (c) 2008-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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @test |
|
19 @internalComponent - Internal Symbian test code |
|
20 */ |
|
21 |
|
22 |
|
23 #include "tssm_server.h" |
|
24 #include "tssm_step_server.h" |
|
25 #include "tssm_step_statepolicyresolver.h" |
|
26 #include "tssm_step_statetransitionengine.h" |
|
27 #include "tssm_step_swppolicymap.h" |
|
28 #include "tssm_step_swppolicyresolver.h" |
|
29 #include "tssm_step_swprequesthandler.h" |
|
30 #include "tssm_step_swptransitionengine.h" |
|
31 #include "tssm_step_swptransitionscheduler.h" |
|
32 #include "tssm_step_validstatelist.h" |
|
33 #include "tssm_step_validswplist.h" |
|
34 #include "tssm_step_platsec.h" |
|
35 #include "tssm_step_swpcommonplugin.h" |
|
36 #include "tssm_step_paniccle.h" |
|
37 #include "tssm_step_swpdependencies.h" |
|
38 #include "tssm_step_swphandlecleret.h" |
|
39 #include "tssm_step_statefurthertransition.h" |
|
40 #include "tssm_step_conditionalcommands.h" |
|
41 #include "tssm_step_ssmcledeadlock.h" |
|
42 #include "tssm_step_repeatedpublishstate.h" |
|
43 #include "tssm_step_notifypropertychange.h" |
|
44 #include "tssmswppolicy_step_rswppolicysess.h" |
|
45 #include "tssm_step_cmdexecutionoom.h" |
|
46 #include "ssmserverpanic.h" |
|
47 |
|
48 _LIT(KSsmTestServerName, "SsmTestServer"); |
|
49 |
|
50 CSsmTestServer* CSsmTestServer::NewLC( ) |
|
51 { |
|
52 CSsmTestServer * server = new (ELeave) CSsmTestServer(); |
|
53 CleanupStack::PushL(server); |
|
54 TParsePtrC serverName(RProcess().FileName()); |
|
55 server->StartL(serverName.Name()); |
|
56 return server; |
|
57 } |
|
58 |
|
59 static void MainL() |
|
60 { |
|
61 CActiveScheduler* sched = new(ELeave) CActiveScheduler; |
|
62 CleanupStack::PushL (sched); |
|
63 CActiveScheduler::Install (sched); |
|
64 |
|
65 CSsmTestServer* server = CSsmTestServer::NewLC( ); |
|
66 RProcess::Rendezvous (KErrNone ); |
|
67 sched->Start( ); |
|
68 |
|
69 CleanupStack::PopAndDestroy (server ); |
|
70 CleanupStack::PopAndDestroy (sched ); |
|
71 } |
|
72 |
|
73 /** |
|
74 Process entry point. Called by client using RProcess API |
|
75 @return - Standard Epoc error code on process exit |
|
76 */ |
|
77 TInt E32Main(void) //lint -e765 -e714 Suppress 'not referenced' and 'could be static' |
|
78 { |
|
79 __UHEAP_MARK; |
|
80 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
81 if(cleanup == NULL) |
|
82 { |
|
83 return KErrNoMemory; |
|
84 } |
|
85 TRAPD(err,MainL()); |
|
86 if (err) |
|
87 { |
|
88 _LIT(KMainErrorStatement, "SsmTestServer::MainL - Error: %d"); |
|
89 RDebug::Print(KMainErrorStatement, err); |
|
90 PanicNow(KSsmTestServerName, err); |
|
91 } |
|
92 delete cleanup; |
|
93 |
|
94 __UHEAP_MARKEND; |
|
95 return KErrNone; |
|
96 } |
|
97 |
|
98 /** |
|
99 @return - A CTestStep derived instance |
|
100 */ |
|
101 CTestStep* CSsmTestServer::CreateTestStep(const TDesC& aStepName ) |
|
102 { |
|
103 CTestStep* testStep = NULL; |
|
104 if (aStepName == KTSsmServerStep) |
|
105 { |
|
106 testStep = new CSsmServerTest(); |
|
107 } |
|
108 else if (aStepName == KTSsmStatePolicyResolverStep) |
|
109 { |
|
110 testStep = new CSsmStatePolicyResolverTest(); |
|
111 } |
|
112 else if (aStepName == KTSsmStateTransitionEngineStep) |
|
113 { |
|
114 testStep = new CSsmStateTransitionEngineTest(); |
|
115 } |
|
116 else if (aStepName == KTSsmSwpPolicyMapStep) |
|
117 { |
|
118 testStep = new CSsmSwpPolicyMapTest(); |
|
119 } |
|
120 else if (aStepName == KTSsmSwpPolicyResolverStep) |
|
121 { |
|
122 testStep = new CSsmSwpPolicyResolverTest(); |
|
123 } |
|
124 else if (aStepName == KTSsmSwpTransitionEngineStep) |
|
125 { |
|
126 testStep = new CSsmSwpTransitionEngineTest(); |
|
127 } |
|
128 else if (aStepName == KTSsmSwpRequestHandlerStep) |
|
129 { |
|
130 testStep = new CSsmSwpRequestHandlerTest(); |
|
131 } |
|
132 else if (aStepName == KTSsmSwpTransitionSchedulerStep) |
|
133 { |
|
134 testStep = new CSsmSwpTransitionSchedulerTest(); |
|
135 } |
|
136 else if (aStepName == KTSsmValidStateListStep) |
|
137 { |
|
138 testStep = new CSsmValidStateListTest(); |
|
139 } |
|
140 else if (aStepName == KTSsmValidSwpListStep) |
|
141 { |
|
142 testStep = new CSsmValidSwpListTest(); |
|
143 } |
|
144 else if (aStepName == KTSsmPlatsecStep) |
|
145 { |
|
146 testStep = new CSsmPlatsecTest(); |
|
147 } |
|
148 else if (aStepName == KTSsmSwpCommonPluginStep) |
|
149 { |
|
150 testStep = new CSsmSwpCommonPluginTest(); |
|
151 } |
|
152 else if (aStepName == KTSsmPanicCleStep) |
|
153 { |
|
154 testStep = new CSsmPanicCleTest(); |
|
155 } |
|
156 else if (aStepName == KTSsmSwpDependenciesStep) |
|
157 { |
|
158 testStep = new CSsmSwpDependenciesTest(); |
|
159 } |
|
160 else if (aStepName == KTSsmStateFurtherTransitionStep) |
|
161 { |
|
162 testStep = new CSsmStateFurtherTransitionTest(); |
|
163 } |
|
164 else if (aStepName == KTSsmSwpHandleCleRetStep) |
|
165 { |
|
166 testStep = new CSsmSwpHandleCleRetTest(); |
|
167 } |
|
168 else if (aStepName == KTSsmConditionalCommandsStep) |
|
169 { |
|
170 testStep = new CSsmConditionalCommandsTest(); |
|
171 } |
|
172 else if (aStepName == KTSsmSsmCleDeadlockStep) |
|
173 { |
|
174 testStep = new CSsmSsmCleDeadlockTest(); |
|
175 } |
|
176 else if (aStepName == KTSsmRepeatedPublishStateStep) |
|
177 { |
|
178 testStep = new CSsmRepeatedPublishStateTest(); |
|
179 } |
|
180 else if (aStepName == KTSsmNotifyPropertyChangeStep) |
|
181 { |
|
182 testStep = new CSsmNotifyPropertyChangeTest(); |
|
183 } |
|
184 else if (aStepName == KTSsmSwpRSwpPolicySessionStep) |
|
185 { |
|
186 testStep = new CSsmSwpRSwpPolicySessionTest(); |
|
187 } |
|
188 else if (aStepName == KTSsmCmdExecutionOomStep) |
|
189 { |
|
190 testStep = new CSsmCmdExecutionOomTest(); |
|
191 } |
|
192 |
|
193 else |
|
194 { |
|
195 RDebug::Printf ("Unknown SsmTest step %S", &aStepName ); |
|
196 } |
|
197 |
|
198 return testStep; |
|
199 } |