|
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 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 * tAuthSvrServer.cpp |
|
16 * Test code for the TestExecute Server |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 #include "tAuthSvrServer.h" |
|
23 #include "tAuthSvrStep.h" |
|
24 |
|
25 |
|
26 _LIT(KServerName,"tAuthSvrNC"); |
|
27 |
|
28 CTAuthSvrServer* CTAuthSvrServer::NewL() |
|
29 /** |
|
30 * @return - Instance of the test server |
|
31 * Called inside the MainL() function to create and start the |
|
32 * CTestServer derived server. |
|
33 */ |
|
34 { |
|
35 CTAuthSvrServer* server = new (ELeave) CTAuthSvrServer(); |
|
36 CleanupStack::PushL(server); |
|
37 |
|
38 // Either use a StartL or ConstructL, the latter will permit |
|
39 // server Logging. |
|
40 |
|
41 //server->StartL(KServerName); |
|
42 server-> ConstructL(KServerName); |
|
43 CleanupStack::Pop(server); |
|
44 return server; |
|
45 } |
|
46 |
|
47 |
|
48 // EKA2 much simpler |
|
49 // Just an E32Main and a MainL() |
|
50 |
|
51 LOCAL_C void MainL() |
|
52 /** |
|
53 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
54 */ |
|
55 { |
|
56 // Leave the hooks in for platform security |
|
57 #if (defined __DATA_CAGING__) |
|
58 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
59 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
60 #endif |
|
61 CActiveScheduler* sched=NULL; |
|
62 sched=new(ELeave) CActiveScheduler; |
|
63 CleanupStack::PushL(sched); |
|
64 CActiveScheduler::Install(sched); |
|
65 |
|
66 CTAuthSvrServer* server = NULL; |
|
67 // Create the CTestServer derived server |
|
68 TRAPD(err,server = CTAuthSvrServer::NewL()); |
|
69 if(!err) |
|
70 { |
|
71 // Sync with the client and enter the active scheduler |
|
72 RProcess::Rendezvous(KErrNone); |
|
73 sched->Start(); |
|
74 } |
|
75 CleanupStack::Pop(sched); |
|
76 delete server; |
|
77 delete sched; |
|
78 } |
|
79 |
|
80 |
|
81 GLDEF_C TInt E32Main() |
|
82 /** |
|
83 * @return - Standard Epoc error code on exit |
|
84 */ |
|
85 { |
|
86 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
87 if(cleanup == NULL) |
|
88 { |
|
89 return KErrNoMemory; |
|
90 } |
|
91 TRAP_IGNORE(MainL()); |
|
92 delete cleanup; |
|
93 return KErrNone; |
|
94 } |
|
95 |
|
96 |
|
97 CTestStep* CTAuthSvrServer::CreateTestStep(const TDesC& aStepName) |
|
98 /** |
|
99 * @return - A CTestStep derived instance |
|
100 * Implementation of CTestServer pure virtual |
|
101 */ |
|
102 { |
|
103 CTestStep* testStep = NULL; |
|
104 |
|
105 // Test step name constant in the test step header file |
|
106 // Created "just in time" |
|
107 if(aStepName == KTFirstStart) |
|
108 testStep = new CTFirstStart(); |
|
109 else if (aStepName == KTAuthSvrCheck) |
|
110 testStep = new CTAuthSvrCheck(); |
|
111 else if (aStepName == KTRegIdentity) |
|
112 testStep = new CTRegIdentity(*this); |
|
113 else if (aStepName == KTIdentifyMultiple) |
|
114 testStep = new CTIdentifyMultiple(); |
|
115 else if (aStepName == KTStepCreateTestDb) |
|
116 testStep = new CTStepCreateTestDb(); |
|
117 else if (aStepName == KTRetrainPlugin) |
|
118 testStep = new CTRetrainPlugin(*this); |
|
119 else if (aStepName == KTRemoveDbs) |
|
120 testStep = new CTRemoveDbs(); |
|
121 else if (aStepName == KTRemoveIdentity) |
|
122 testStep = new CTRemoveIdentity(*this); |
|
123 else if (aStepName == KTForgetPlugin) |
|
124 testStep = new CTRemoveAuthMethod(*this); |
|
125 else if (aStepName == KTAuthenticate) |
|
126 testStep = new CTAuthenticate(*this); |
|
127 else if (aStepName == KTSetPrefs) |
|
128 testStep = new CTSetAuthPrefs(*this); |
|
129 else |
|
130 { |
|
131 ERR_PRINTF1(_L("The test step name specified does not exist.")); |
|
132 } |
|
133 |
|
134 return testStep; |
|
135 } |
|
136 |