|
1 // Copyright (c) 2008-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 |
|
20 */ |
|
21 |
|
22 // User includes |
|
23 #include "twservscreenconstructserver.h" |
|
24 #include "twservscreenconstructstepload.h" |
|
25 #include "twservscreenconstructconsts.h" |
|
26 |
|
27 /** |
|
28 * @return - Instance of the test server |
|
29 * Same code for Secure and non-secure variants |
|
30 * Called inside the MainL() function to create and start the |
|
31 * CTestServer derived server. |
|
32 */ |
|
33 CTWServScreenConstructServer* CTWServScreenConstructServer::NewL() |
|
34 { |
|
35 CTWServScreenConstructServer* server = new(ELeave) CTWServScreenConstructServer(); |
|
36 CleanupStack::PushL(server); |
|
37 server->ConstructL(); |
|
38 CleanupStack::Pop(server); |
|
39 return server; |
|
40 } |
|
41 |
|
42 void CTWServScreenConstructServer::ConstructL() |
|
43 { |
|
44 RProcess handle = RProcess(); |
|
45 TParsePtrC serverName(handle.FileName()); |
|
46 CTestServer::ConstructL(serverName.Name()); |
|
47 } |
|
48 |
|
49 /** |
|
50 * Secure variant |
|
51 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
52 */ |
|
53 LOCAL_C void MainL() |
|
54 { |
|
55 #if (defined __DATA_CAGING__) |
|
56 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
57 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
58 #endif |
|
59 CActiveScheduler* sched=NULL; |
|
60 sched=new(ELeave) CActiveScheduler; |
|
61 CActiveScheduler::Install(sched); |
|
62 CTWServScreenConstructServer* server = NULL; |
|
63 // Create the CTestServer derived server |
|
64 TRAPD(err,server = CTWServScreenConstructServer::NewL()); |
|
65 if(!err) |
|
66 { |
|
67 // Sync with the client and enter the active scheduler |
|
68 RProcess::Rendezvous(KErrNone); |
|
69 sched->Start(); |
|
70 } |
|
71 delete server; |
|
72 delete sched; |
|
73 } |
|
74 |
|
75 /** |
|
76 * @return - Standard Epoc error code on process exit |
|
77 * Secure variant only |
|
78 * Process entry point. Called by client using RProcess Integ |
|
79 */ |
|
80 GLDEF_C TInt E32Main() |
|
81 { |
|
82 __UHEAP_MARK; |
|
83 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
84 if(cleanup == NULL) |
|
85 { |
|
86 return KErrNoMemory; |
|
87 } |
|
88 #if (defined TRAP_IGNORE) |
|
89 TRAP_IGNORE(MainL()); |
|
90 #else |
|
91 TRAPD(err,MainL()); |
|
92 #endif |
|
93 delete cleanup; |
|
94 __UHEAP_MARKEND; |
|
95 return KErrNone; |
|
96 } |
|
97 |
|
98 /** |
|
99 * @return - A CTestStep derived instance |
|
100 * Secure and non-secure variants |
|
101 * Implementation of CTestServer pure virtual |
|
102 */ |
|
103 CTestStep* CTWServScreenConstructServer::CreateTestStep(const TDesC& aStepName) |
|
104 { |
|
105 CTestStep* testStep = NULL; |
|
106 |
|
107 if ( aStepName==KTWServScreenConstructStepLoad ) |
|
108 { |
|
109 testStep=new CTWServScreenConstructStepLoad(); |
|
110 } |
|
111 return testStep; |
|
112 } |