|
1 // Copyright (c) 2004-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 the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This main DLL entry point for the Smoketest_Agenda.dll |
|
15 // |
|
16 // |
|
17 |
|
18 |
|
19 // EPOC includes |
|
20 #include <e32base.h> |
|
21 |
|
22 #include "TestAgendaServer.h" |
|
23 #include "TestAgendaAddAppt.h" |
|
24 #include "TestAgendaCreateDB.h" |
|
25 |
|
26 |
|
27 _LIT(KServerName,"Smoketest_Agenda_Server"); |
|
28 |
|
29 CTestAgendaServer* CTestAgendaServer::NewL() |
|
30 /** |
|
31 * @return - Instance of the test server |
|
32 * Same code for Secure and non-secure variants |
|
33 * Called inside the MainL() function to create and start the |
|
34 * CTestServer derived server. |
|
35 */ |
|
36 { |
|
37 CTestAgendaServer* server = new (ELeave) CTestAgendaServer(); |
|
38 CleanupStack::PushL(server); |
|
39 // CServer base class call |
|
40 server->StartL(KServerName); |
|
41 CleanupStack::Pop(server); |
|
42 return server; |
|
43 } |
|
44 |
|
45 |
|
46 LOCAL_C void MainL() |
|
47 /** |
|
48 * Secure variant |
|
49 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
50 */ |
|
51 { |
|
52 #if (defined __DATA_CAGING__) |
|
53 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
54 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
55 #endif |
|
56 CActiveScheduler* sched=NULL; |
|
57 sched=new(ELeave) CActiveScheduler; |
|
58 CActiveScheduler::Install(sched); |
|
59 CTestAgendaServer* server = NULL; |
|
60 // Create the CTestServer derived server |
|
61 TRAPD(err,server = CTestAgendaServer::NewL()); |
|
62 if(!err) |
|
63 { |
|
64 // Sync with the client and enter the active scheduler |
|
65 RProcess::Rendezvous(KErrNone); |
|
66 sched->Start(); |
|
67 } |
|
68 delete server; |
|
69 delete sched; |
|
70 } |
|
71 |
|
72 |
|
73 GLDEF_C TInt E32Main() |
|
74 /** |
|
75 * @return - Standard Epoc error code on process exit |
|
76 * Secure variant only |
|
77 * Process entry point. Called by client using RProcess API |
|
78 */ |
|
79 { |
|
80 __UHEAP_MARK; |
|
81 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
82 if(cleanup == NULL) |
|
83 { |
|
84 return KErrNoMemory; |
|
85 } |
|
86 TRAPD(err,MainL()); |
|
87 delete cleanup; |
|
88 __UHEAP_MARKEND; |
|
89 return err; |
|
90 } |
|
91 |
|
92 |
|
93 CTestStep* CTestAgendaServer::CreateTestStep(const TDesC& aStepName) |
|
94 /** |
|
95 * @return - A CTestStep derived instance |
|
96 * Secure and non-secure variants |
|
97 * Implementation of CTestServer pure virtual |
|
98 */ |
|
99 { |
|
100 CTestStep* testStep = NULL; |
|
101 |
|
102 if(aStepName == _L("AddAppt")) |
|
103 testStep = new CTestAgendaAddAppt(); |
|
104 else if(aStepName == _L("CreateDB")) |
|
105 testStep = new CTestAgendaCreateDB(); |
|
106 return testStep; |
|
107 } |