|
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 |
|
23 #include "tsus_server.h" |
|
24 #include "tsus_step_supinfo.h" |
|
25 #include "tsus_step_suploader.h" |
|
26 #include "tsus_step_utilserver.h" |
|
27 #include "tsus_step_platsec.h" |
|
28 #include "tsus_step_platsec2.h" |
|
29 #include "tsus_step_loadplugin.h" |
|
30 #include "tsus_step_adaptionserver.h" |
|
31 #include "tsus_step_susadaptationpluginloader.h" |
|
32 #include "tsus_step_loadadaptationserver.h" |
|
33 |
|
34 |
|
35 _LIT(KSusTestServerName, "SusTestServer"); |
|
36 |
|
37 CSusTestServer* CSusTestServer::NewLC( ) |
|
38 { |
|
39 CSusTestServer* server = new (ELeave) CSusTestServer(); |
|
40 CleanupStack::PushL(server); |
|
41 TParsePtrC serverName(RProcess().FileName()); |
|
42 server->StartL(serverName.Name()); |
|
43 return server; |
|
44 } |
|
45 |
|
46 static void MainL() |
|
47 { |
|
48 CActiveScheduler* sched = new(ELeave) CActiveScheduler; |
|
49 CleanupStack::PushL (sched); |
|
50 CActiveScheduler::Install (sched); |
|
51 |
|
52 CSusTestServer* server = CSusTestServer::NewLC( ); |
|
53 RProcess::Rendezvous (KErrNone ); |
|
54 sched->Start( ); |
|
55 |
|
56 CleanupStack::PopAndDestroy (server ); |
|
57 CleanupStack::PopAndDestroy (sched ); |
|
58 } |
|
59 |
|
60 /** |
|
61 Process entry point. Called by client using RProcess API |
|
62 @return - Standard Epoc error code on process exit |
|
63 */ |
|
64 TInt E32Main(void) //lint -e765 -e714 Suppress 'not referenced' and 'could be static' |
|
65 { |
|
66 __UHEAP_MARK; |
|
67 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
68 if(cleanup == NULL) |
|
69 { |
|
70 return KErrNoMemory; |
|
71 } |
|
72 TRAPD(err,MainL()); |
|
73 if (err) |
|
74 { |
|
75 _LIT(KMainErrorStatement, "SusTestServer::MainL - Error: %d"); |
|
76 RDebug::Print(KMainErrorStatement, err); |
|
77 User::Panic(KSusTestServerName, err); |
|
78 } |
|
79 delete cleanup; |
|
80 |
|
81 __UHEAP_MARKEND; |
|
82 return KErrNone; |
|
83 } |
|
84 |
|
85 /** |
|
86 @return - A CTestStep derived instance |
|
87 */ |
|
88 CTestStep* CSusTestServer::CreateTestStep(const TDesC& aStepName ) |
|
89 { |
|
90 CTestStep* testStep = NULL; |
|
91 if (aStepName == KTSusUtilServerStep) |
|
92 { |
|
93 testStep = new CSusUtilServerTest(); |
|
94 } |
|
95 else if (aStepName == KTSusAdaptionServerStep) |
|
96 { |
|
97 testStep = new CSusAdaptionServerTest(); |
|
98 } |
|
99 else if (aStepName == KTSsmSupInfoStep) |
|
100 { |
|
101 testStep = new CSsmSupInfoTest(); |
|
102 } |
|
103 else if (aStepName == KTSsmSupLoaderStep) |
|
104 { |
|
105 testStep = new CSsmSupLoaderTest(); |
|
106 } |
|
107 else if (aStepName == KTSusPlatsecStep) |
|
108 { |
|
109 testStep = new CSusPlatsecTest(); |
|
110 } |
|
111 else if (aStepName == KTSusPlatsecStepProtSrvBegin) |
|
112 { |
|
113 testStep = new CSusPlatsecTestProtSrvBegin(); |
|
114 } |
|
115 else if (aStepName == KTSusPlatsecStepProtSrv) |
|
116 { |
|
117 testStep = new CSusPlatsecTestProtSrv(); |
|
118 } |
|
119 else if (aStepName == KTSusPlatsecStepProtSrvEnd) |
|
120 { |
|
121 testStep = new CSusPlatsecTestProtSrvEnd(); |
|
122 } |
|
123 else if (aStepName == KTSusLoadPluginStep) |
|
124 { |
|
125 testStep = new CSusLoadPluginTest(); |
|
126 } |
|
127 else if (aStepName == KTSsmSupAdaptationPluginLoaderStep) |
|
128 { |
|
129 testStep = new CSsmSupAdaptationPluginLoaderTest(); |
|
130 } |
|
131 else if (aStepName == KTSusLoadAdaptationServerStep) |
|
132 { |
|
133 testStep = new CTestSusLoadAdaptationServer(); |
|
134 } |
|
135 else |
|
136 { |
|
137 RDebug::Printf ("Unknown SusTest step %S", &aStepName ); |
|
138 } |
|
139 |
|
140 return testStep; |
|
141 } |