|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Test code for the TestExecute Server |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #include "tAuthSvrServer.h" |
|
22 #include "tAuthSvrStep.h" |
|
23 |
|
24 |
|
25 CTAuthSvrServer* CTAuthSvrServer::NewL() |
|
26 /** |
|
27 * @return - Instance of the test server |
|
28 * Called inside the MainL() function to create and start the |
|
29 * CTestServer derived server. |
|
30 */ |
|
31 { |
|
32 CTAuthSvrServer* server = new (ELeave) CTAuthSvrServer(); |
|
33 CleanupStack::PushL(server); |
|
34 |
|
35 RProcess handle = RProcess(); |
|
36 TParsePtrC serverName(handle.FileName()); |
|
37 // Either use a StartL or ConstructL, the latter will permit |
|
38 // server Logging. |
|
39 |
|
40 //server->StartL(KServerName); |
|
41 server-> ConstructL(serverName.Name()); |
|
42 CleanupStack::Pop(server); |
|
43 return server; |
|
44 } |
|
45 |
|
46 |
|
47 // EKA2 much simpler |
|
48 // Just an E32Main and a MainL() |
|
49 |
|
50 LOCAL_C void MainL() |
|
51 /** |
|
52 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
53 */ |
|
54 { |
|
55 // Leave the hooks in for platform security |
|
56 #if (defined __DATA_CAGING__) |
|
57 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
58 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
59 #endif |
|
60 CActiveScheduler* sched=NULL; |
|
61 sched=new(ELeave) CActiveScheduler; |
|
62 CleanupStack::PushL(sched); |
|
63 CActiveScheduler::Install(sched); |
|
64 CTAuthSvrServer* server = NULL; |
|
65 // Create the CTestServer derived server |
|
66 TRAPD(err,server = CTAuthSvrServer::NewL()); |
|
67 if(!err) |
|
68 { |
|
69 // Sync with the client and enter the active scheduler |
|
70 RProcess::Rendezvous(KErrNone); |
|
71 sched->Start(); |
|
72 } |
|
73 CleanupStack::Pop(sched); |
|
74 delete server; |
|
75 delete sched; |
|
76 } |
|
77 |
|
78 |
|
79 GLDEF_C TInt E32Main() |
|
80 /** |
|
81 * @return - Standard Epoc error code on exit |
|
82 */ |
|
83 { |
|
84 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
85 if(cleanup == NULL) |
|
86 { |
|
87 return KErrNoMemory; |
|
88 } |
|
89 TRAP_IGNORE(MainL()); |
|
90 delete cleanup; |
|
91 return KErrNone; |
|
92 } |
|
93 |
|
94 |
|
95 CTestStep* CTAuthSvrServer::CreateTestStep(const TDesC& aStepName) |
|
96 /** |
|
97 * @return - A CTestStep derived instance |
|
98 * Implementation of CTestServer pure virtual |
|
99 */ |
|
100 { |
|
101 // Test step name constant in the test step header file |
|
102 // Created "just in time" |
|
103 if(aStepName == KTFirstStart) |
|
104 { |
|
105 return new CTFirstStart(); |
|
106 } |
|
107 else if (aStepName == KTAuthSvrCheck) |
|
108 { |
|
109 return new CTAuthSvrCheck(); |
|
110 } |
|
111 else if (aStepName == KTRegIdentity) |
|
112 { |
|
113 return new CTRegIdentity(*this); |
|
114 } |
|
115 else if (aStepName == KTIdentifyMultiple) |
|
116 { |
|
117 return new CTIdentifyMultiple(); |
|
118 } |
|
119 else if (aStepName == KTStepCreateTestDb) |
|
120 { |
|
121 return new CTStepCreateTestDb(); |
|
122 } |
|
123 else if (aStepName == KTRetrainPlugin) |
|
124 { |
|
125 return new CTRetrainPlugin(*this); |
|
126 } |
|
127 else if (aStepName == KTRemoveDbs) |
|
128 { |
|
129 return new CTRemoveDbs(); |
|
130 } |
|
131 else if (aStepName == KTRemoveIdentity) |
|
132 { |
|
133 return new CTRemoveIdentity(*this); |
|
134 } |
|
135 else if (aStepName == KTForgetPlugin) |
|
136 { |
|
137 return new CTRemoveAuthMethod(*this); |
|
138 } |
|
139 else if (aStepName == KTAuthenticate) |
|
140 { |
|
141 return new CTAuthenticate(*this); |
|
142 } |
|
143 else if (aStepName == KTSetPrefs) |
|
144 { |
|
145 return new CTSetAuthPrefs(*this); |
|
146 } |
|
147 else if (aStepName == KTInitCenRep) |
|
148 { |
|
149 return new CTInitCenRep(*this); |
|
150 } |
|
151 else if (aStepName == KTResultAvailability) |
|
152 { |
|
153 return new CResultAvailability(*this); |
|
154 } |
|
155 else if (aStepName == KTResultChangeNotify) |
|
156 { |
|
157 return new CResultChangeNotify(*this); |
|
158 } |
|
159 else if (aStepName == KTResetIdentity) |
|
160 { |
|
161 return new CTResetIdentity(*this); |
|
162 } |
|
163 else if (aStepName == KTPostMarketPlugin) |
|
164 { |
|
165 return new CTPostMarketPlugin(); |
|
166 } |
|
167 else if (aStepName == KTStepClientSidSupportCheck) |
|
168 { |
|
169 return new CTStepClientSidSupport(*this); |
|
170 } |
|
171 else if (aStepName == KTInstallPluginStep) |
|
172 { |
|
173 return new CTInstallPluginStep(); |
|
174 } |
|
175 else if (aStepName == KTUninstallPluginStep) |
|
176 { |
|
177 return new CTUninstallPluginStep(); |
|
178 } |
|
179 else if (aStepName == KTAuthServerOom) |
|
180 { |
|
181 return new CAuthSvrOom(*this); |
|
182 } |
|
183 else if (aStepName == KTUpdateSysTime) |
|
184 { |
|
185 return new CTSysTimeUpdate(*this); |
|
186 } |
|
187 else if (aStepName == KTMultiThreadedTest) |
|
188 { |
|
189 return new CTMultiThreaded(*this); |
|
190 } |
|
191 else |
|
192 { |
|
193 ERR_PRINTF1(_L("The test step name specified does not exist.")); |
|
194 } |
|
195 |
|
196 return NULL; |
|
197 } |
|
198 |