|
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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @test |
|
19 @internalComponent - Internal Symbian test code |
|
20 */ |
|
21 |
|
22 #include "TPdrStoreServer.h" |
|
23 #include "T_PDRLST.H" |
|
24 #include "T_PDRMEM.H" |
|
25 #include "T_PDR.H" |
|
26 |
|
27 |
|
28 _LIT(KServerName,"TPdrStoreServer"); |
|
29 |
|
30 CTPdrStoreServer* CTPdrStoreServer::NewL() |
|
31 /** |
|
32 @return - Instance of the test server |
|
33 Same code for Secure and non-secure variants |
|
34 Called inside the MainL() function to create and start the |
|
35 CTestServer derived server. |
|
36 */ |
|
37 { |
|
38 CTPdrStoreServer * server = new (ELeave) CTPdrStoreServer(); |
|
39 CleanupStack::PushL(server); |
|
40 // CServer base class call |
|
41 server->StartL(KServerName); |
|
42 CleanupStack::Pop(server); |
|
43 return server; |
|
44 } |
|
45 |
|
46 |
|
47 LOCAL_C void MainL() |
|
48 // |
|
49 // Secure variant |
|
50 // Much simpler, uses the new Rendezvous() call to sync with the client |
|
51 // |
|
52 { |
|
53 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
54 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
55 CActiveScheduler* sched=NULL; |
|
56 sched=new(ELeave) CActiveScheduler; |
|
57 CActiveScheduler::Install(sched); |
|
58 CTPdrStoreServer* server = NULL; |
|
59 // Create the CTestServer derived server |
|
60 TRAPD(err,server = CTPdrStoreServer::NewL()); |
|
61 if(!err) |
|
62 { |
|
63 // Sync with the client and enter the active scheduler |
|
64 RProcess::Rendezvous(KErrNone); |
|
65 sched->Start(); |
|
66 } |
|
67 delete server; |
|
68 delete sched; |
|
69 } |
|
70 |
|
71 GLDEF_C TInt E32Main() |
|
72 |
|
73 /** @return - Standard Epoc error code on process exit |
|
74 Secure variant only |
|
75 Process entry point. Called by client using RProcess API |
|
76 */ |
|
77 { |
|
78 __UHEAP_MARK; |
|
79 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
80 if(cleanup == NULL) |
|
81 { |
|
82 return KErrNoMemory; |
|
83 } |
|
84 TRAPD(err,MainL()); |
|
85 if (err) |
|
86 { |
|
87 RDebug::Print(_L("CTPdrStoreServer::MainL - Error: %d"), err); |
|
88 User::Panic(KServerName,err); |
|
89 } |
|
90 delete cleanup; |
|
91 __UHEAP_MARKEND; |
|
92 return KErrNone; |
|
93 } |
|
94 |
|
95 |
|
96 |
|
97 CTestStep* CTPdrStoreServer::CreateTestStep(const TDesC& aStepName) |
|
98 /** |
|
99 @return - A CTestStep derived instance |
|
100 Secure and non-secure variants |
|
101 Implementation of CTestServer pure virtual |
|
102 */ |
|
103 { |
|
104 CTestStep* testStep = NULL; |
|
105 |
|
106 if(aStepName == KTPdrLstStep) |
|
107 { |
|
108 testStep = new CTPdrLstStep(); |
|
109 } |
|
110 |
|
111 else if(aStepName == KTPdrMemStep) |
|
112 { |
|
113 testStep = new CTPdrMemStep(); |
|
114 } |
|
115 |
|
116 else if(aStepName == KTPdrStep) |
|
117 { |
|
118 testStep = new CTPdrStep(); |
|
119 } |
|
120 |
|
121 return testStep; |
|
122 } |