|
1 /* |
|
2 * Copyright (c) 2008-2010 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 * Implements the test server of the Software Component Registry test harness |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #include "tscrserver.h" // TEF Test Server |
|
21 #include "tscrstep.h" // TEF Steps Test Code |
|
22 #include "componentmanagementsteps.h" |
|
23 #include "componentquerysteps.h" |
|
24 #include "transactionmanagementsteps.h" |
|
25 #include "subsessionsteps.h" |
|
26 #include "sifsteps.h" |
|
27 #include "appmanagersteps.h" |
|
28 #include "deletescrdbstep.h" |
|
29 #include "pluginmanagementsteps.h" |
|
30 #include "installloghistorysteps.h" |
|
31 #include "appreginfosteps.h" |
|
32 |
|
33 CScrTestServer* CScrTestServer::NewL() |
|
34 /** |
|
35 Called inside the MainL() function to create and start the CTestServer derived server. |
|
36 @return Instance of the test server |
|
37 */ |
|
38 { |
|
39 CScrTestServer* server = new (ELeave) CScrTestServer(); |
|
40 CleanupStack::PushL(server); |
|
41 User::LeaveIfError(server->iFs.Connect()); |
|
42 User::LeaveIfError(server->iFs.ShareProtected()); |
|
43 User::LeaveIfError(server->iFs.CreatePrivatePath(server->iFs.GetSystemDrive())); |
|
44 server->ConstructL(KScrTestServerName); |
|
45 CleanupStack::Pop(server); |
|
46 return server; |
|
47 } |
|
48 |
|
49 |
|
50 CScrTestServer::~CScrTestServer() |
|
51 /** |
|
52 Destructor. |
|
53 */ |
|
54 { |
|
55 iFs.Close(); |
|
56 } |
|
57 |
|
58 |
|
59 LOCAL_C void MainL() |
|
60 { |
|
61 |
|
62 CActiveScheduler *scheduler = new(ELeave) CActiveScheduler; |
|
63 CActiveScheduler::Install(scheduler); |
|
64 |
|
65 CScrTestServer* server = NULL; |
|
66 |
|
67 // Create the CTestServer derived server |
|
68 TRAPD(err,server = CScrTestServer::NewL()); |
|
69 if(!err) |
|
70 { |
|
71 // Sync with the client and enter the active scheduler |
|
72 RProcess::Rendezvous(KErrNone); |
|
73 scheduler->Start(); |
|
74 } |
|
75 |
|
76 delete server; |
|
77 delete scheduler; |
|
78 } |
|
79 |
|
80 |
|
81 GLDEF_C TInt E32Main() |
|
82 /** |
|
83 * @return - Standard Epoc error code on process exit |
|
84 * Process entry point. Called by client using RProcess API |
|
85 */ |
|
86 { |
|
87 __UHEAP_MARK; |
|
88 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
89 if(cleanup == NULL) |
|
90 { |
|
91 return KErrNoMemory; |
|
92 } |
|
93 TRAPD(err,MainL()); |
|
94 delete cleanup; |
|
95 __UHEAP_MARKEND; |
|
96 return err; |
|
97 } |
|
98 |
|
99 TBool CScrTestServer::IsPerformanceTestStep(const TDesC& aStepName, TPtrC& aStrippedName) |
|
100 { |
|
101 _LIT(KPerformanceStepKeyWord, "Performance-"); |
|
102 if (KErrNotFound == aStepName.FindF(KPerformanceStepKeyWord())) |
|
103 { |
|
104 aStrippedName.Set(aStepName); |
|
105 return EFalse; |
|
106 } |
|
107 |
|
108 TInt len = KPerformanceStepKeyWord().Length(); |
|
109 aStrippedName.Set(aStepName.Mid(len)); |
|
110 return ETrue; |
|
111 } |
|
112 |
|
113 CTestStep* CScrTestServer::CreateTestStep(const TDesC& aStepName) |
|
114 /** |
|
115 Creates a new test step. |
|
116 @param aStepName The name of the requested test step. |
|
117 @return A pointer to the object of the requested test step. |
|
118 */ |
|
119 { |
|
120 TBool performanceStep = EFalse; |
|
121 TPtrC strippedStepName; |
|
122 performanceStep = IsPerformanceTestStep(aStepName, strippedStepName); |
|
123 |
|
124 // Initialise test step object to NULL if no TEF steps are assigned |
|
125 CTestStep* testStep = NULL; |
|
126 |
|
127 if (strippedStepName == KScrAddComponentStep) |
|
128 testStep = new CScrAddComponentStep(*this); |
|
129 else if (strippedStepName == KScrSetComponentPropertyStep) |
|
130 testStep = new CScrSetComponentPropertyStep(*this); |
|
131 else if (strippedStepName == KScrRegisterFileStep) |
|
132 testStep = new CScrRegisterFileStep(*this); |
|
133 else if (strippedStepName == KScrAddFilePropertyStep) |
|
134 testStep = new CScrAddFilePropertyStep(*this); |
|
135 else if (strippedStepName == KScrSetCommonPropertyStep) |
|
136 testStep = new CScrSetCommonPropertyStep(*this); |
|
137 else if (strippedStepName == KScrDeleteComponentPropertyStep) |
|
138 testStep = new CScrDeleteComponentPropertyStep(*this); |
|
139 else if (strippedStepName == KScrDeleteFilePropertyStep) |
|
140 testStep = new CScrDeleteFilePropertyStep(*this); |
|
141 else if (strippedStepName == KScrUnregisterFileStep) |
|
142 testStep = new CScrUnregisterFileStep(*this); |
|
143 else if (strippedStepName == KScrDeleteComponentStep) |
|
144 testStep = new CScrDeleteComponentStep(*this); |
|
145 else if (strippedStepName == KScrDeleteAllComponentsStep) |
|
146 testStep = new CScrDeleteAllComponentsStep(*this); |
|
147 else if (strippedStepName == KScrApplyTransactionStep) |
|
148 testStep = new CScrApplyTransactionStep(*this); |
|
149 else if (strippedStepName == KScrCreateTransactionStep) |
|
150 testStep = new CScrCreateTransactionStep(*this); |
|
151 else if (strippedStepName == KScrManageAnotherTransactionStep) |
|
152 testStep = new CScrManageAnotherTransactionStep(*this); |
|
153 else if (strippedStepName == KScrGetComponentStep) |
|
154 testStep = new CScrGetComponentStep(*this); |
|
155 else if (strippedStepName == KScrGetComponentLocalizedStep) |
|
156 testStep = new CScrGetComponentLocalizedStep(*this); |
|
157 else if (strippedStepName == KScrGetFilePropertiesStep) |
|
158 testStep = new CScrGetFilePropertiesStep(*this); |
|
159 else if (strippedStepName == KScrGetFilePropertyStep) |
|
160 testStep = new CScrGetFilePropertyStep(*this); |
|
161 else if (strippedStepName == KScrGetFileComponentsStep) |
|
162 testStep = new CScrGetFileComponentsStep(*this); |
|
163 else if (strippedStepName == KScrGetComponentPropertiesStep) |
|
164 testStep = new CScrGetComponentPropertiesStep(*this); |
|
165 else if (strippedStepName == KScrGetComponentIdsStep) |
|
166 testStep = new CScrGetComponentIdsStep(*this); |
|
167 else if (strippedStepName == KScrGetComponentPropertyStep) |
|
168 testStep = new CScrGetComponentPropertyStep(*this); |
|
169 else if (strippedStepName == KScrComponentRegistrySubsessionStep) |
|
170 testStep = new CScrComponentRegistrySubsessionStep(*this); |
|
171 else if (strippedStepName == KScrFileListSubsessionStep) |
|
172 testStep = new CScrFileListSubsessionStep(*this); |
|
173 else if (strippedStepName == KScrGetPluginStep) |
|
174 testStep = new CScrGetPluginStep(*this); |
|
175 else if (strippedStepName == KScrSetScomoStateStep) |
|
176 testStep = new CScrSetScomoStateStep(*this); |
|
177 else if (strippedStepName == KScrIsMediaPresentStep) |
|
178 testStep = new CScrIsMediaPresentStep(*this); |
|
179 else if (strippedStepName == KScrInstallComponentStep) |
|
180 testStep = new CScrInstallComponentStep(*this); |
|
181 else if (strippedStepName == KScrGetComponentFilesCountStep) |
|
182 testStep = new CScrGetComponentFilesCountStep(*this); |
|
183 else if (strippedStepName == KScrAddComponentDependencyStep) |
|
184 testStep = new CScrAddComponentDependencyStep(*this); |
|
185 else if (strippedStepName == KScrDeleteComponentDependencyStep) |
|
186 testStep = new CScrDeleteComponentDependencyStep(*this); |
|
187 else if (strippedStepName == KScrGetComponentWithGlobalIdStep) |
|
188 testStep = new CScrGetComponentWithGlobalIdStep(*this); |
|
189 else if (strippedStepName == KScrGetComponentIdStep) |
|
190 testStep = new CScrGetComponentIdStep(*this); |
|
191 else if (strippedStepName == KScrGetGlobalIdList) |
|
192 testStep = new CScrGetGlobalIdListStep(*this); |
|
193 else if (strippedStepName == KScrDeleteDbFileStep) |
|
194 testStep = new CScrDeleteDbFileStep(*this); |
|
195 else if (strippedStepName == KScrAddSoftwareTypeStep) |
|
196 testStep = new CScrAddSoftwareTypeStep(*this); |
|
197 else if (strippedStepName == KScrDeleteSoftwareTypeStep) |
|
198 testStep = new CScrDeleteSoftwareTypeStep(*this); |
|
199 else if (strippedStepName == KScrIsComponentOrphaned) |
|
200 testStep = new CScrIsComponentOrphanedStep(*this); |
|
201 else if (strippedStepName == KScrCopyDbFileStep) |
|
202 testStep = new CScrCopyDbFileStep(*this); |
|
203 else if (strippedStepName == KScrGetLogEntriesStep) |
|
204 testStep = new CScrGetLogEntriesStep(*this); |
|
205 else if (strippedStepName == KScrSetLogFileReadOnlyAttrStep) |
|
206 testStep = new CScrSetLogFileReadOnlyAttrStep(*this); |
|
207 else if (strippedStepName == KScrCreateLogFileStep) |
|
208 testStep = new CScrCreateLogFileStep(*this); |
|
209 else if (strippedStepName == KScrCompareVersions) |
|
210 testStep = new CScrCompareVersionsStep(*this); |
|
211 else if (strippedStepName == KScrIsComponentOnReadOnlyDrive) |
|
212 testStep = new CScrIsComponentOnReadOnlyDriveStep(*this); |
|
213 else if (strippedStepName == KScrComponentPresence) |
|
214 testStep = new CScrComponentPresenceStep(*this); |
|
215 else if (strippedStepName == KScrValuesNegativeStep) |
|
216 testStep = new CScrValuesNegativeStep(*this); |
|
217 else if (strippedStepName == KScrOutOfMemoryStep) |
|
218 testStep = new SCROufOfMemory(*this); |
|
219 else if (strippedStepName == KScrAddApplicationEntry) |
|
220 testStep = new CScrAddApplicationEntryStep(*this); |
|
221 else if (strippedStepName == KScrDeleteApplicationEntry) |
|
222 testStep = new CScrDeleteApplicationEntriesStep(*this); |
|
223 else if (strippedStepName == KSCRGetAppServicesUids) |
|
224 testStep = new CSCRGetAppServicesUids(*this); |
|
225 else if (strippedStepName == KSCRGetAppForDataType) |
|
226 testStep = new CSCRGetAppForDataType(*this); |
|
227 else if (strippedStepName == KSCRGetAppForDataTypeAndService) |
|
228 testStep = new CSCRGetAppForDataTypeAndService(*this); |
|
229 else if (strippedStepName == KSCRGetDefaultScreenNumber) |
|
230 testStep = new CSCRGetDefaultScreenNumber(*this); |
|
231 else if (strippedStepName == KSCRGetNumberOfDefinedIcons) |
|
232 testStep = new CSCRGetNumberOfDefinedIcons(*this); |
|
233 else if (strippedStepName == KSCRGetApplicationLanguage) |
|
234 testStep = new CSCRGetApplicationLanguage(*this); |
|
235 else if (strippedStepName == KScrGetAppOwnedFilesEntry) |
|
236 testStep = new CScrGetAppOwnedFilesEntryStep(*this); |
|
237 else if (strippedStepName == KScrGetAppCapabilityEntry) |
|
238 testStep = new CScrGetAppCharacteristicsEntryStep(*this); |
|
239 else if (strippedStepName == KScrGetAppIconEntry) |
|
240 testStep = new CScrGetAppIconEntryStep(*this); |
|
241 else if (strippedStepName == KScrGetAppViewIconEntry) |
|
242 testStep = new CScrGetAppViewIconEntryStep(*this); |
|
243 else if (strippedStepName == KScrGetAppViewInfoStep) |
|
244 testStep = new CScrGetAppViewsStep(*this); |
|
245 else if (strippedStepName == KScrAppViewSubsessionStep) |
|
246 testStep = new CAppInfoView(*this); |
|
247 else if (strippedStepName == KScrGetAppServiceInfoStep) |
|
248 testStep = new CScrGetAppServiceInfoStep(*this); |
|
249 else if (strippedStepName == KScrGetComponentIdForAppStep) |
|
250 testStep = new CScrGetComponentIdForApp(*this); |
|
251 else if (strippedStepName == KScrGetAppUidsForComponentStep) |
|
252 testStep = new CScrGetAppUidsForComponent(*this); |
|
253 else if (strippedStepName == KScrAddConcurrentApplicationEntryStep) |
|
254 testStep = new CScrAddConcurrentApplicationEntryStep(*this); |
|
255 else if (strippedStepName == KScrGetAppInfoStep) |
|
256 testStep = new CScrGetAppInfoStep(*this); |
|
257 else if (strippedStepName == KScrComponentOnEMMC) |
|
258 testStep = new CScrEMMCComponentStep(*this); |
|
259 else if (strippedStepName == KScrComponentPresentForNameVendor) |
|
260 testStep = new CScrComponentPresentForNameVendorStep(*this); |
|
261 if(performanceStep) |
|
262 { |
|
263 CScrTestStep *scrTestStep = dynamic_cast<CScrTestStep*>(testStep); |
|
264 scrTestStep->MarkAsPerformanceStep(); |
|
265 } |
|
266 |
|
267 return testStep; |
|
268 } |