|
1 // Copyright (c) 2007-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 #include <ssm/ssmswp.h> |
|
23 |
|
24 #include "tcmd_server.h" |
|
25 #include "tcmd_step_resourcereader.h" |
|
26 #include "tcmd_step_commandlist.h" |
|
27 #include "tcmd_step_reqswpchange.h" |
|
28 #include "tcmd_step_publishsystemstate.h" |
|
29 #include "tcmd_step_publishswp.h" |
|
30 #include "tcmd_step_poweroff.h" |
|
31 #include "tcmd_step_persisthalattributes.h" |
|
32 #include "tcmd_step_loadsup.h" |
|
33 #include "tcmd_step_customcommand.h" |
|
34 #include "tcmd_step_finalisedrives.h" |
|
35 #include "tcmd_step_amastarter.h" |
|
36 #include "tcmd_step_multiplewait.h" |
|
37 #include "tcmd_step_setpandskey.h" |
|
38 #include "tcmd_step_startapp.h" |
|
39 #include "tcmd_step_startprocess.h" |
|
40 #include "tcmd_step_waitforapparcinit.h" |
|
41 #include "tcmd_step_createswp.h" |
|
42 |
|
43 #include "ssmdebug.h" |
|
44 |
|
45 _LIT(KCmdTestServerName, "CmdTestServer"); |
|
46 |
|
47 CCmdTestServer* CCmdTestServer::NewLC( ) |
|
48 { |
|
49 CCmdTestServer * server = new (ELeave) CCmdTestServer(); |
|
50 CleanupStack::PushL(server); |
|
51 TParsePtrC serverName(RProcess().FileName()); |
|
52 server->StartL(serverName.Name()); |
|
53 return server; |
|
54 } |
|
55 |
|
56 static void MainL() |
|
57 { |
|
58 CActiveScheduler* sched = new(ELeave) CActiveScheduler; |
|
59 CleanupStack::PushL (sched); |
|
60 CActiveScheduler::Install (sched); |
|
61 |
|
62 CCmdTestServer* server = CCmdTestServer::NewLC( ); |
|
63 RProcess::Rendezvous (KErrNone ); |
|
64 sched->Start( ); |
|
65 |
|
66 CleanupStack::PopAndDestroy (server ); |
|
67 CleanupStack::PopAndDestroy (sched ); |
|
68 } |
|
69 |
|
70 /** |
|
71 Process entry point. Called by client using RProcess API |
|
72 @return - Standard Epoc error code on process exit |
|
73 */ |
|
74 TInt E32Main(void) |
|
75 { |
|
76 __UHEAP_MARK; |
|
77 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
78 if(cleanup == NULL) |
|
79 { |
|
80 return KErrNoMemory; |
|
81 } |
|
82 TRAPD(err,MainL()); |
|
83 if (err) |
|
84 { |
|
85 _LIT(KMainErrorStatement, "CmdTestServer::MainL - Error: %d"); |
|
86 RDebug::Print(KMainErrorStatement, err); |
|
87 User::Panic(KCmdTestServerName, err); |
|
88 } |
|
89 delete cleanup; |
|
90 |
|
91 __UHEAP_MARKEND; |
|
92 return KErrNone; |
|
93 } |
|
94 |
|
95 /** |
|
96 @return - A CTestStep derived instance |
|
97 */ |
|
98 CTestStep* CCmdTestServer::CreateTestStep(const TDesC& aStepName) |
|
99 { |
|
100 CTestStep* testStep = NULL; |
|
101 if (aStepName == KTResourceReader) |
|
102 { |
|
103 testStep = new CResourceReaderTest(); |
|
104 } |
|
105 else if (aStepName == KTCommandList) |
|
106 { |
|
107 testStep = new CCommandListTest(); |
|
108 } |
|
109 else if (aStepName == KTCCmdTestCustomCommand) |
|
110 { |
|
111 testStep = new CCmdTestCustomCommand(); |
|
112 } |
|
113 else if (aStepName == KTCCmdTestFinaliseDrives) |
|
114 { |
|
115 testStep = new CCmdTestFinaliseDrives(); |
|
116 } |
|
117 else if (aStepName == KTCCmdTestLoadSup) |
|
118 { |
|
119 testStep = new CCmdTestLoadSup(); |
|
120 } |
|
121 else if (aStepName == KTCCmdTestPersistHalAttributes) |
|
122 { |
|
123 testStep = new CCmdTestPersistHalAttributes(); |
|
124 } |
|
125 else if (aStepName == KTCCmdTestPowerOff) |
|
126 { |
|
127 testStep = new CCmdTestPowerOff(); |
|
128 } |
|
129 else if (aStepName == KTCCmdTestPublishSwp) |
|
130 { |
|
131 testStep = new CCmdTestPublishSwp(); |
|
132 } |
|
133 else if (aStepName == KTCCmdTestPublishSystemState) |
|
134 { |
|
135 testStep = new CCmdTestPublishSystemState(); |
|
136 } |
|
137 else if (aStepName == KTCCmdTestReqSwpChange) |
|
138 { |
|
139 testStep = new CCmdTestReqSwpChange(); |
|
140 } |
|
141 else if (aStepName == KTCCmdTestAMAStarter) |
|
142 { |
|
143 testStep = new CCmdTestAMAStarter(); |
|
144 } |
|
145 else if (aStepName == KTCCmdTestMultipleWait) |
|
146 { |
|
147 testStep = new CCmdTestMultipleWait(); |
|
148 } |
|
149 else if (aStepName == KTCCmdTestSetPAndSKey) |
|
150 { |
|
151 testStep = new CCmdTestSetPAndSKey(); |
|
152 } |
|
153 else if (aStepName == KTCCmdTestStartApp) |
|
154 { |
|
155 testStep = new CCmdTestStartApp(); |
|
156 } |
|
157 else if (aStepName == KTCCmdTestStartProcess) |
|
158 { |
|
159 testStep = new CCmdTestStartProcess(); |
|
160 } |
|
161 else if (aStepName == KTCCmdTestWaitForApparcInit) |
|
162 { |
|
163 testStep = new CCmdTestWaitForApparcInit(); |
|
164 } |
|
165 else if (aStepName == KTCCmdTestCreateSwp) |
|
166 { |
|
167 testStep = new CCmdTestCreateSwp(); |
|
168 } |
|
169 else |
|
170 { |
|
171 RDebug::Printf ("Unknown CmmTest step %S", &aStepName ); |
|
172 } |
|
173 |
|
174 return testStep; |
|
175 } |