1 /* |
|
2 * Copyright (c) 2009-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 #include "tscrapparcserver.h" // TEF Test Server |
|
20 #include "appreginfoapparcsteps.h" |
|
21 |
|
22 |
|
23 CScrApparcTestServer* CScrApparcTestServer::NewL() |
|
24 /** |
|
25 Called inside the MainL() function to create and start the CTestServer derived server. |
|
26 @return Instance of the test server |
|
27 */ |
|
28 { |
|
29 CScrApparcTestServer* server = new (ELeave) CScrApparcTestServer(); |
|
30 CleanupStack::PushL(server); |
|
31 server->ConstructL(KScrApparcTestServerName); |
|
32 CleanupStack::Pop(server); |
|
33 return server; |
|
34 } |
|
35 |
|
36 |
|
37 CScrApparcTestServer::~CScrApparcTestServer() |
|
38 /** |
|
39 Destructor. |
|
40 */ |
|
41 { |
|
42 |
|
43 } |
|
44 |
|
45 |
|
46 LOCAL_C void MainL() |
|
47 { |
|
48 CActiveScheduler *scheduler = new(ELeave) CActiveScheduler; |
|
49 CActiveScheduler::Install(scheduler); |
|
50 |
|
51 CScrApparcTestServer* server = NULL; |
|
52 |
|
53 //Create the CScrApparcTestServer derived server |
|
54 TRAPD(err,server = CScrApparcTestServer::NewL()); |
|
55 if(!err) |
|
56 { |
|
57 // Sync with the client and enter the active scheduler |
|
58 RProcess::Rendezvous(KErrNone); |
|
59 scheduler->Start(); |
|
60 } |
|
61 |
|
62 delete server; |
|
63 delete scheduler; |
|
64 |
|
65 } |
|
66 |
|
67 |
|
68 GLDEF_C TInt E32Main() |
|
69 /** |
|
70 * @return - Standard Epoc error code on process exit |
|
71 * Process entry point. Called by client using RProcess API |
|
72 */ |
|
73 { |
|
74 __UHEAP_MARK; |
|
75 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
76 if(cleanup == NULL) |
|
77 { |
|
78 return KErrNoMemory; |
|
79 } |
|
80 TRAPD(err,MainL()); |
|
81 delete cleanup; |
|
82 __UHEAP_MARKEND; |
|
83 return err; |
|
84 } |
|
85 |
|
86 TBool CScrApparcTestServer::IsPerformanceTestStep(const TDesC& aStepName, TPtrC& aStrippedName) |
|
87 { |
|
88 _LIT(KPerformanceStepKeyWord, "Performance-"); |
|
89 if (KErrNotFound == aStepName.FindF(KPerformanceStepKeyWord())) |
|
90 { |
|
91 aStrippedName.Set(aStepName); |
|
92 return EFalse; |
|
93 } |
|
94 |
|
95 TInt len = KPerformanceStepKeyWord().Length(); |
|
96 aStrippedName.Set(aStepName.Mid(len)); |
|
97 return ETrue; |
|
98 } |
|
99 |
|
100 CTestStep* CScrApparcTestServer::CreateTestStep(const TDesC& aStepName) |
|
101 { |
|
102 CTestStep* testStep = NULL; |
|
103 |
|
104 TBool performanceStep = EFalse; |
|
105 TPtrC strippedStepName; |
|
106 performanceStep = IsPerformanceTestStep(aStepName, strippedStepName); |
|
107 |
|
108 if (strippedStepName == KScrApplicationRegistrationViewSubsessionStep) |
|
109 testStep = new CScrGetApplicationRegistrationViewSubsessionStep(); |
|
110 else if (strippedStepName == KScrMultipleSubsessionsForAppRegistryViewStep) |
|
111 testStep = new CScrMultipleSubsessionsForAppRegistryViewStep(); |
|
112 |
|
113 if (performanceStep && (strippedStepName == KScrApplicationRegistrationViewSubsessionStep)) |
|
114 { |
|
115 // Currently we support performace testing for only CScrGetApplicationRegistrationViewSubsessionStep |
|
116 CScrGetApplicationRegistrationViewSubsessionStep* scrTestStep = dynamic_cast<CScrGetApplicationRegistrationViewSubsessionStep*>(testStep); |
|
117 scrTestStep->MarkAsPerformanceStep(); |
|
118 } |
|
119 |
|
120 return testStep; |
|
121 } |
|
122 |
|