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