|
1 /* |
|
2 * Copyright (c) 2008-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 * Implements the test server of the Security Utils test harness |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #include "tsecurityutils.h" // TEF Steps Test Code |
|
23 #include "tsecurityutilsserver.h" |
|
24 |
|
25 CSecurityUtilsTestServer* CSecurityUtilsTestServer::NewL() |
|
26 /** |
|
27 Called inside the MainL() function to create and start the CTestServer derived server. |
|
28 @return Instance of the test server |
|
29 */ |
|
30 { |
|
31 CSecurityUtilsTestServer* server = new (ELeave) CSecurityUtilsTestServer(); |
|
32 CleanupStack::PushL(server); |
|
33 server->ConstructL(_L("tsecurityutils")); |
|
34 CleanupStack::Pop(server); |
|
35 return server; |
|
36 } |
|
37 |
|
38 |
|
39 LOCAL_C void MainL() |
|
40 { |
|
41 |
|
42 CActiveScheduler *scheduler = new(ELeave) CActiveScheduler; |
|
43 CActiveScheduler::Install(scheduler); |
|
44 |
|
45 CSecurityUtilsTestServer* server = NULL; |
|
46 |
|
47 // Create the CTestServer derived server |
|
48 TRAPD(err,server = CSecurityUtilsTestServer::NewL()); |
|
49 if(!err) |
|
50 { |
|
51 // Sync with the client and enter the active scheduler |
|
52 RProcess::Rendezvous(KErrNone); |
|
53 scheduler->Start(); |
|
54 } |
|
55 |
|
56 delete server; |
|
57 delete scheduler; |
|
58 } |
|
59 |
|
60 |
|
61 GLDEF_C TInt E32Main() |
|
62 /** |
|
63 * @return - Standard Epoc error code on process exit |
|
64 * Process entry point. Called by client using RProcess API |
|
65 */ |
|
66 { |
|
67 __UHEAP_MARK; |
|
68 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
69 if(cleanup == NULL) |
|
70 { |
|
71 return KErrNoMemory; |
|
72 } |
|
73 TRAPD(err,MainL()); |
|
74 delete cleanup; |
|
75 __UHEAP_MARKEND; |
|
76 return err; |
|
77 } |
|
78 |
|
79 |
|
80 CTestStep* CSecurityUtilsTestServer::CreateTestStep(const TDesC& aStepName) |
|
81 { |
|
82 CTestStep* testStep = NULL; |
|
83 |
|
84 if(aStepName == KSecurityUtilsStep) |
|
85 testStep = new CSecurityUtilsStep(); |
|
86 |
|
87 return testStep; |
|
88 } |