1 /* |
|
2 * Copyright (c) 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 "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 * |
|
16 */ |
|
17 |
|
18 #include "TestAppServer.h" |
|
19 #include "TestAppStep.h" |
|
20 |
|
21 |
|
22 _LIT(KServerName,"Smoketest_TestApp_Server"); |
|
23 |
|
24 CTestAppServer* CTestAppServer::NewL() |
|
25 /** |
|
26 * @return - Instance of the test server |
|
27 * Called inside the MainL() function to create and start the |
|
28 * CTestServer derived server. |
|
29 */ |
|
30 { |
|
31 CTestAppServer * server = new (ELeave) CTestAppServer(); |
|
32 CleanupStack::PushL(server); |
|
33 |
|
34 server-> ConstructL(KServerName); |
|
35 CleanupStack::Pop(server); |
|
36 return server; |
|
37 } |
|
38 |
|
39 |
|
40 LOCAL_C void MainL() |
|
41 { |
|
42 // Leave the hooks in for platform security |
|
43 #if (defined __DATA_CAGING__) |
|
44 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
45 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
46 #endif |
|
47 CActiveScheduler* sched=NULL; |
|
48 sched=new(ELeave) CActiveScheduler; |
|
49 CActiveScheduler::Install(sched); |
|
50 |
|
51 CTestAppServer* server = NULL; |
|
52 TRAPD(err,server = CTestAppServer::NewL()); |
|
53 if(!err) |
|
54 { |
|
55 // Sync with the client and enter the active scheduler |
|
56 RProcess::Rendezvous(KErrNone); |
|
57 sched->Start(); |
|
58 } |
|
59 delete server; |
|
60 delete sched; |
|
61 } |
|
62 |
|
63 GLDEF_C TInt E32Main() |
|
64 /** |
|
65 * @return - Standard Epoc error code on exit |
|
66 */ |
|
67 { |
|
68 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
69 if(cleanup == NULL) |
|
70 { |
|
71 return KErrNoMemory; |
|
72 } |
|
73 TRAP_IGNORE(MainL()); |
|
74 delete cleanup; |
|
75 return KErrNone; |
|
76 } |
|
77 |
|
78 |
|
79 CTestStep* CTestAppServer::CreateTestStep(const TDesC& aStepName) |
|
80 /** |
|
81 * @return - A CTestStep derived instance |
|
82 */ |
|
83 { |
|
84 CTestStep* testStep = NULL; |
|
85 |
|
86 if(aStepName == KSampleStep1) |
|
87 testStep = new CTestAppStep1(); |
|
88 |
|
89 return testStep; |
|
90 } |
|
91 |
|