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 "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 * Example file/test code to demonstrate how to develop a TestExecute Server |
|
16 * Developers should take this project as a template and substitute their own |
|
17 * for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started |
|
18 * in the process of the client. The client initialises the server by calling the |
|
19 * one and only ordinal. |
|
20 * |
|
21 */ |
|
22 |
|
23 |
|
24 |
|
25 /** |
|
26 @file te_concurrenttestsuiteserver.cpp |
|
27 @internalTechnology |
|
28 */ |
|
29 |
|
30 #include "te_regconcurrenttestsuiteserver.h" |
|
31 #include "te_regwaitstep.h" |
|
32 #include "te_regloopstep.h" |
|
33 #include "te_regaccessstaticvarstep.h" |
|
34 #include "te_regdummystep.h" |
|
35 #include "te_regchecktestresultstep.h" |
|
36 |
|
37 #ifdef TEST_SUITE1 |
|
38 _LIT(KServerName,"Te_RegConcurrentTestSuite1"); |
|
39 #elif TEST_SUITE2 |
|
40 _LIT(KServerName,"Te_RegConcurrentTestSuite2"); |
|
41 #elif TEST_SUITE3 |
|
42 _LIT(KServerName,"Te_RegConcurrentTestSuite3"); |
|
43 #endif |
|
44 CTe_RegConcurrentTestSuiteServer* CTe_RegConcurrentTestSuiteServer::NewL() |
|
45 /** |
|
46 * @return - Instance of the test server |
|
47 * Same code for Secure and non-secure variants |
|
48 * Called inside the MainL() function to create and start the |
|
49 * CTestServer derived server. |
|
50 */ |
|
51 { |
|
52 CTe_RegConcurrentTestSuiteServer * server = new (ELeave) CTe_RegConcurrentTestSuiteServer(); |
|
53 CleanupStack::PushL(server); |
|
54 |
|
55 server->ConstructL(KServerName); |
|
56 CleanupStack::Pop(server); |
|
57 return server; |
|
58 } |
|
59 |
|
60 |
|
61 // Secure variants much simpler |
|
62 // For EKA2, just an E32Main and a MainL() |
|
63 LOCAL_C void MainL() |
|
64 /** |
|
65 * Secure variant |
|
66 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
67 */ |
|
68 { |
|
69 // Leave the hooks in for platform security |
|
70 #if (defined __DATA_CAGING__) |
|
71 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
72 RProcess().DataCaging(RProcess::ESecureApiOn); |
|
73 #endif |
|
74 CActiveScheduler* sched=NULL; |
|
75 sched=new(ELeave) CActiveScheduler; |
|
76 CActiveScheduler::Install(sched); |
|
77 CTe_RegConcurrentTestSuiteServer* server = NULL; |
|
78 // Create the CTestServer derived server |
|
79 TRAPD(err,server = CTe_RegConcurrentTestSuiteServer::NewL()); |
|
80 if(!err) |
|
81 { |
|
82 // Sync with the client and enter the active scheduler |
|
83 RProcess::Rendezvous(KErrNone); |
|
84 sched->Start(); |
|
85 } |
|
86 delete server; |
|
87 delete sched; |
|
88 } |
|
89 |
|
90 |
|
91 |
|
92 GLDEF_C TInt E32Main() |
|
93 /** |
|
94 * @return - Standard Epoc error code on process exit |
|
95 * Secure variant only |
|
96 * Process entry point. Called by client using RProcess API |
|
97 */ |
|
98 { |
|
99 __UHEAP_MARK; |
|
100 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
101 if(cleanup == NULL) |
|
102 { |
|
103 return KErrNoMemory; |
|
104 } |
|
105 TRAPD(err,MainL()); |
|
106 delete cleanup; |
|
107 __UHEAP_MARKEND; |
|
108 return err; |
|
109 } |
|
110 |
|
111 |
|
112 CTestStep* CTe_RegConcurrentTestSuiteServer::CreateTestStep(const TDesC& aStepName) |
|
113 /** |
|
114 * @return - A CTestStep derived instance |
|
115 * Secure and non-secure variants |
|
116 * Implementation of CTestServer pure virtual |
|
117 */ |
|
118 { |
|
119 CTestStep* testStep = NULL; |
|
120 if(aStepName == KTe_RegWaitStep) |
|
121 { |
|
122 testStep = new CTe_RegWaitStep(); |
|
123 } |
|
124 else if(aStepName == KTe_RegLoopStep) |
|
125 { |
|
126 testStep = new CTe_RegLoopStep(); |
|
127 } |
|
128 else if(aStepName == KTe_RegAccessStaticVarStep) |
|
129 { |
|
130 testStep = new CTe_RegAccessStaticVarStep(); |
|
131 } |
|
132 else if(aStepName == KTe_RegDummyStep) |
|
133 { |
|
134 testStep = new CTe_RegDummyStep(); |
|
135 } |
|
136 else if (aStepName == KTe_RegCheckTestResultStep()) |
|
137 { |
|
138 testStep = new CTe_RegCheckTestResultStep(); |
|
139 } |
|
140 |
|
141 return testStep; |
|
142 } |
|