|
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 // TE_EncrptServer.cpp |
|
19 // |
|
20 // |
|
21 // This main DLL entry point for the TE_ConServer.dll |
|
22 |
|
23 |
|
24 #include "TE_EncrptStep.h" |
|
25 #include "TE_EncrptSteps.h" |
|
26 |
|
27 |
|
28 EXPORT_C CTE_EncrptServer* NewEncrptServer( void ) |
|
29 // |
|
30 // NewTestSuiteEncrptL is exported at ordinal 1 |
|
31 // this provides the interface to allow schedule test |
|
32 // to create instances of this test suite |
|
33 // |
|
34 { |
|
35 CTE_EncrptServer* ts = 0; |
|
36 TRAPD(err,ts = new (ELeave) CTE_EncrptServer); |
|
37 if (err == KErrNone) |
|
38 return ts; |
|
39 return 0; |
|
40 } |
|
41 |
|
42 |
|
43 |
|
44 // __EDIT_ME__ - Substitute the name of your test server |
|
45 _LIT(KServerName,"te_Encrpt"); |
|
46 // __EDIT_ME__ - Use your own server class name |
|
47 CTE_EncrptServer* CTE_EncrptServer::NewL() |
|
48 /** |
|
49 * @return - Instance of the test server |
|
50 * Called inside the MainL() function to create and start the |
|
51 * CTestServer derived server. |
|
52 */ |
|
53 { |
|
54 // __EDIT_ME__ new your server class here |
|
55 CTE_EncrptServer * server = new (ELeave) CTE_EncrptServer(); |
|
56 CleanupStack::PushL(server); |
|
57 |
|
58 // Either use a StartL or ConstructL, the latter will permit |
|
59 // Server Logging. |
|
60 |
|
61 //server->StartL(KServerName); |
|
62 server-> ConstructL(KServerName); |
|
63 CleanupStack::Pop(server); |
|
64 return server; |
|
65 } |
|
66 |
|
67 // EKA2 much simpler |
|
68 // Just an E32Main and a MainL() |
|
69 LOCAL_C void MainL() |
|
70 /** |
|
71 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
72 */ |
|
73 { |
|
74 // Leave the hooks in for platform security |
|
75 #if (defined __DATA_CAGING__) |
|
76 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
77 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
78 #endif |
|
79 CActiveScheduler* sched=NULL; |
|
80 sched=new(ELeave) CActiveScheduler; |
|
81 CActiveScheduler::Install(sched); |
|
82 // __EDIT_ME__ Your server name |
|
83 CTE_EncrptServer* server = NULL; |
|
84 // Create the CTestServer derived server |
|
85 // __EDIT_ME__ Your server name |
|
86 TRAPD(err,server = CTE_EncrptServer::NewL()); |
|
87 if(!err) |
|
88 { |
|
89 // Sync with the client and enter the active scheduler |
|
90 RProcess::Rendezvous(KErrNone); |
|
91 sched->Start(); |
|
92 } |
|
93 delete server; |
|
94 delete sched; |
|
95 } |
|
96 |
|
97 // Only a DLL on emulator for typhoon and earlier |
|
98 |
|
99 GLDEF_C TInt E32Main() |
|
100 /** |
|
101 * @return - Standard Epoc error code on exit |
|
102 */ |
|
103 { |
|
104 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
105 if(cleanup == NULL) |
|
106 { |
|
107 return KErrNoMemory; |
|
108 } |
|
109 TRAP_IGNORE(MainL()); |
|
110 delete cleanup; |
|
111 return KErrNone; |
|
112 } |
|
113 |
|
114 // Create a thread in the calling process |
|
115 // Emulator typhoon and earlier |
|
116 |
|
117 // __EDIT_ME__ - Use your own server class name |
|
118 CTestStep* CTE_EncrptServer::CreateTestStep(const TDesC& aStepName) |
|
119 /** |
|
120 * @return - A CTestStep derived instance |
|
121 * Implementation of CTestServer pure virtual |
|
122 */ |
|
123 { |
|
124 |
|
125 CTestStep* testStep = NULL; |
|
126 // __EDIT_ME__ - Create your own test steps here |
|
127 // This server creates just one step but create as many as you want |
|
128 // They are created "just in time" when the worker thread is created |
|
129 |
|
130 |
|
131 if(aStepName.Compare(_L("CreateEntries")) == 0 ) |
|
132 testStep = new(ELeave) CTE_CreateEntries(); |
|
133 else if(aStepName.Compare(_L("CheckPasswords")) == 0 ) |
|
134 testStep = new(ELeave) CTE_CheckPasswords(); |
|
135 else if(aStepName.Compare(_L("DeleteEntries")) == 0 ) |
|
136 testStep = new(ELeave) CTE_DeleteEntries(); |
|
137 |
|
138 |
|
139 return testStep; |
|
140 } |
|
141 |
|
142 |
|
143 |
|
144 // make a version string available for test system |
|
145 TPtrC CTE_EncrptServer::GetVersion( void ) |
|
146 { |
|
147 |
|
148 #ifdef _DEBUG |
|
149 _LIT(KTxtVersion,"1.0 (udeb)"); |
|
150 #else |
|
151 _LIT(KTxtVersion,"1.0"); |
|
152 #endif |
|
153 |
|
154 return KTxtVersion(); |
|
155 } |
|
156 |
|
157 |