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 * |
|
16 */ |
|
17 |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalTechnology |
|
22 */ |
|
23 |
|
24 #include "tsifsuiteserver.h" |
|
25 #include "tsifoperationstep.h" |
|
26 #include "tsifgenericbrowserinstallstep.h" |
|
27 #include "tsifcommonverificationstep.h" |
|
28 #include "tsifcommonunitteststep.h" |
|
29 #include "tsifnotifierteststep.h" |
|
30 |
|
31 using namespace Usif; |
|
32 |
|
33 _LIT(KSifServerName,"tUsifSuite"); |
|
34 CSifSuiteServer* CSifSuiteServer::NewL() |
|
35 /** |
|
36 * @return - Instance of the test server |
|
37 * Same code for Secure and non-secure variants |
|
38 * Called inside the MainL() function to create and start the |
|
39 * CTestServer derived server. |
|
40 */ |
|
41 { |
|
42 CSifSuiteServer * server = new (ELeave) CSifSuiteServer(); |
|
43 CleanupStack::PushL(server); |
|
44 |
|
45 server->ConstructL(KSifServerName); |
|
46 CleanupStack::Pop(server); |
|
47 return server; |
|
48 } |
|
49 |
|
50 |
|
51 // Secure variants much simpler |
|
52 // For EKA2, just an E32Main and a MainL() |
|
53 LOCAL_C void MainL() |
|
54 /** |
|
55 * Secure variant |
|
56 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
57 */ |
|
58 { |
|
59 // Leave the hooks in for platform security |
|
60 #if (defined __DATA_CAGING__) |
|
61 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
62 RProcess().DataCaging(RProcess::ESecureApiOn); |
|
63 #endif |
|
64 CActiveScheduler* sched=NULL; |
|
65 sched=new(ELeave) CActiveScheduler; |
|
66 CActiveScheduler::Install(sched); |
|
67 CSifSuiteServer* server = NULL; |
|
68 // Create the CTestServer derived server |
|
69 TRAPD(err,server = CSifSuiteServer::NewL()); |
|
70 if(!err) |
|
71 { |
|
72 // Sync with the client and enter the active scheduler |
|
73 RProcess::Rendezvous(KErrNone); |
|
74 sched->Start(); |
|
75 } |
|
76 delete server; |
|
77 delete sched; |
|
78 } |
|
79 |
|
80 |
|
81 |
|
82 GLDEF_C TInt E32Main() |
|
83 /** |
|
84 * @return - Standard Epoc error code on process exit |
|
85 * Secure variant only |
|
86 * Process entry point. Called by client using RProcess API |
|
87 */ |
|
88 { |
|
89 __UHEAP_MARK; |
|
90 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
91 if(cleanup == NULL) |
|
92 { |
|
93 return KErrNoMemory; |
|
94 } |
|
95 TRAPD(err,MainL()); |
|
96 delete cleanup; |
|
97 __UHEAP_MARKEND; |
|
98 return err; |
|
99 } |
|
100 |
|
101 |
|
102 CTestStep* CSifSuiteServer::CreateTestStep(const TDesC& aStepName) |
|
103 /** |
|
104 * @return - A CTestStep derived instance |
|
105 * Secure and non-secure variants |
|
106 * Implementation of CTestServer pure virtual |
|
107 */ |
|
108 { |
|
109 CTestStep* testStep = NULL; |
|
110 if(aStepName == KSifInstallStep) |
|
111 testStep = new CSifInstallStep(); |
|
112 else if(aStepName == KSifGetComponentInfoStep) |
|
113 testStep = new CSifGetComponentInfoStep(); |
|
114 else if(aStepName == KSifUninstallStep) |
|
115 testStep = new CSifUninstallStep(); |
|
116 else if(aStepName == KSifActivateStep) |
|
117 testStep = new CSifActivateStep(ETrue); |
|
118 else if(aStepName == KSifDeactivateStep) |
|
119 testStep = new CSifActivateStep(EFalse); |
|
120 else if(aStepName == KSifGenericBrowserInstallStep) |
|
121 testStep = new CSifGenericBrowserInstallStep(); |
|
122 else if(aStepName == KSifCommonVerificationStep) |
|
123 testStep = new CSifCommonVerificationStep(); |
|
124 else if(aStepName == KSifMultipleInstallStep) |
|
125 testStep = new CSifMultipleInstallStep(); |
|
126 else if(aStepName == KSifCommonUnitTestStep) |
|
127 testStep = new CSifCommonUnitTestStep(); |
|
128 else if(aStepName == KSifSubscribeTestStep) |
|
129 testStep = new CSifSubscribeTestStep(); |
|
130 else if(aStepName == KSifPublishTestStep) |
|
131 testStep = new CSifPublishTestStep(); |
|
132 |
|
133 return testStep; |
|
134 } |
|