1 /* |
|
2 * Copyright (c) 2006-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 * TestExecute Server testing pin plugin |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 */ |
|
23 #include "tpinplugin.h" |
|
24 #include "tpinpluginteststep.h" |
|
25 |
|
26 using namespace AuthServer; |
|
27 |
|
28 CPinPluginTestServer* CPinPluginTestServer::NewL() |
|
29 { |
|
30 CPinPluginTestServer* server = new (ELeave) CPinPluginTestServer(); |
|
31 CleanupStack::PushL(server); |
|
32 |
|
33 // Either use a StartL or ConstructL, the latter will permit |
|
34 // Server Logging. |
|
35 TParsePtrC serverName(RProcess().FileName()); |
|
36 server->ConstructL(serverName.Name()); |
|
37 CleanupStack::Pop(server); |
|
38 return server; |
|
39 } |
|
40 |
|
41 // EKA2 much simpler |
|
42 // Just an E32Main and a MainL() |
|
43 LOCAL_C void MainL() |
|
44 /** |
|
45 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
46 */ |
|
47 { |
|
48 // Leave the hooks in for platform security |
|
49 #if (defined __DATA_CAGING__) |
|
50 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
51 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
52 #endif |
|
53 CActiveScheduler* sched=NULL; |
|
54 sched=new(ELeave) CActiveScheduler; |
|
55 CleanupStack::PushL(sched); |
|
56 CActiveScheduler::Install(sched); |
|
57 CPinPluginTestServer* server = NULL; |
|
58 // Create the CTestServer derived server |
|
59 TRAPD(err,server = CPinPluginTestServer::NewL()); |
|
60 if(!err) |
|
61 { |
|
62 // Sync with the client and enter the active scheduler |
|
63 RProcess::Rendezvous(KErrNone); |
|
64 sched->Start(); |
|
65 } |
|
66 CleanupStack::Pop(sched); |
|
67 delete server; |
|
68 delete sched; |
|
69 } |
|
70 |
|
71 // Only a DLL on emulator for typhoon and earlier |
|
72 |
|
73 GLDEF_C TInt E32Main() |
|
74 /** |
|
75 @return - Standard Epoc error code on exit |
|
76 */ |
|
77 { |
|
78 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
79 if(cleanup == NULL) |
|
80 { |
|
81 return KErrNoMemory; |
|
82 } |
|
83 TRAP_IGNORE(MainL()); |
|
84 delete cleanup; |
|
85 return KErrNone; |
|
86 } |
|
87 |
|
88 // Create a thread in the calling process |
|
89 // Emulator typhoon and earlier |
|
90 |
|
91 CTestStep* CPinPluginTestServer::CreateTestStep(const TDesC& aStepName) |
|
92 { |
|
93 CTestStep* testStep = NULL; |
|
94 |
|
95 // This server creates just one step |
|
96 // They are created "just in time" when the worker thread is created |
|
97 |
|
98 if(aStepName == KPinPluginTestStep) |
|
99 { |
|
100 testStep = new CPinPluginTestStep(); |
|
101 } |
|
102 else if (aStepName == KCreateInputFile) |
|
103 { |
|
104 testStep = new CCreateFile(); |
|
105 } |
|
106 else |
|
107 { |
|
108 ERR_PRINTF1(_L("The test step name specified does not exist.")); |
|
109 } |
|
110 |
|
111 return testStep; |
|
112 } |
|
113 |
|
114 |
|
115 |
|