|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Non-secure versions will be xxxServer.Dll and require a thread to be started |
|
15 // in the process of the client. The client initialises the server by calling the |
|
16 // one and only ordinal. |
|
17 // |
|
18 // |
|
19 |
|
20 /** |
|
21 @file |
|
22 @test |
|
23 @internalComponent - Internal Symbian test code |
|
24 */ |
|
25 #include "TConArcTestServer.h" |
|
26 #include "TCnfStep.h" |
|
27 #include "TB64CnvStep.h" |
|
28 #include "TLoadEcomCnvStep.h" |
|
29 |
|
30 |
|
31 _LIT(KServerName,"TConArcTestServer"); |
|
32 CTConArcTestServer* CTConArcTestServer::NewL() |
|
33 /** |
|
34 @return - Instance of the test server |
|
35 Same code for Secure and non-secure variants |
|
36 Called inside the MainL() function to create and start the |
|
37 CTestServer derived server. |
|
38 */ |
|
39 { |
|
40 CTConArcTestServer * server = new (ELeave) CTConArcTestServer(); |
|
41 CleanupStack::PushL(server); |
|
42 // CServer base class call |
|
43 server->StartL(KServerName); |
|
44 CleanupStack::Pop(server); |
|
45 return server; |
|
46 } |
|
47 |
|
48 |
|
49 LOCAL_C void MainL() |
|
50 |
|
51 /** Secure variant |
|
52 Much simpler, uses the new Rendezvous() call to sync with the client |
|
53 */ |
|
54 { |
|
55 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
56 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
57 |
|
58 CActiveScheduler* sched=NULL; |
|
59 sched=new(ELeave) CActiveScheduler; |
|
60 CActiveScheduler::Install(sched); |
|
61 CTConArcTestServer* server = NULL; |
|
62 // Create the CTestServer derived server |
|
63 TRAPD(err,server = CTConArcTestServer::NewL()); |
|
64 if(!err) |
|
65 { |
|
66 // Sync with the client and enter the active scheduler |
|
67 RProcess::Rendezvous(KErrNone); |
|
68 sched->Start(); |
|
69 } |
|
70 delete server; |
|
71 delete sched; |
|
72 } |
|
73 |
|
74 GLDEF_C TInt E32Main() |
|
75 /** |
|
76 @return - Standard Epoc error code on process exit |
|
77 Secure variant only |
|
78 Process entry point. Called by client using RProcess API |
|
79 */ |
|
80 { |
|
81 __UHEAP_MARK; |
|
82 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
83 if(cleanup == NULL) |
|
84 { |
|
85 return KErrNoMemory; |
|
86 } |
|
87 TRAP_IGNORE(MainL()); |
|
88 delete cleanup; |
|
89 __UHEAP_MARKEND; |
|
90 return KErrNone; |
|
91 } |
|
92 |
|
93 |
|
94 |
|
95 CTestStep* CTConArcTestServer::CreateTestStep(const TDesC& aStepName) |
|
96 /** |
|
97 @return - A CTestStep derived instance |
|
98 Secure and non-secure variants |
|
99 Implementation of CTestServer pure virtual |
|
100 */ |
|
101 { |
|
102 CTestStep* testStep = NULL; |
|
103 // This server creates just one step but create as many as you want |
|
104 // They are created "just in time" when the worker thread is created |
|
105 if(aStepName == KTCnfStep) |
|
106 testStep = new CTCnfStep(); |
|
107 else if(aStepName == KTB64CnvStep) |
|
108 testStep = new CTB64CnvStep(); |
|
109 else if(aStepName == KTLoadEComCnvStep) |
|
110 testStep = new CTLoadEComCnvStep(); |
|
111 return testStep; |
|
112 } |