|
1 // Copyright (c) 2006-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 // |
|
15 |
|
16 // User includes |
|
17 #include "T_MsgServer.h" |
|
18 #include "T_PopServer.h" |
|
19 #include "T_MsgSharedDataPop.h" |
|
20 |
|
21 // Header files of Test Steps POP |
|
22 #include "T_CreatePopAccount.h" |
|
23 #include "T_DeletePopAccount.h" |
|
24 #include "T_VerifyPopAccountsCount.h" |
|
25 #include "T_ModifyPopSettings.h" |
|
26 #include "T_ComparePopSettings.h" |
|
27 #include "T_VerfiyPopSettings.h" |
|
28 #include "T_ConnectPop3Server.h" |
|
29 #include "T_DisConnectPop3Server.h" |
|
30 #include "T_ComparePopEmailMsgs.h" |
|
31 #include "T_CopyPopSelection.h" |
|
32 #include "T_PopInvokeAsyncFunction.h" |
|
33 #include "T_DeleteAllPopChildren.h" |
|
34 #include "T_CheckChildrenCountPop.h" |
|
35 #include "T_StartRamUsageTimer.h" |
|
36 #include "T_StopRamUsageTimer.h" |
|
37 #include "T_CheckPop3AccessPoint.h" |
|
38 #include "T_CreatePopAccountWithoutSmtp.h" |
|
39 #include "T_ModifyPopSettings2.h" |
|
40 #include "T_CheckPopSNAPSetting.h" |
|
41 #include "T_RemovePopSNAPSetting.h" |
|
42 #include "T_CheckPopBMSetting.h" |
|
43 |
|
44 /** |
|
45 MainL() |
|
46 This is the main function which installs the active scheduler and |
|
47 creates an object of the Email server |
|
48 */ |
|
49 LOCAL_C void MainL() |
|
50 /** |
|
51 Secure variant |
|
52 Much simpler, uses the new Rendezvous() call to sync with the client |
|
53 */ |
|
54 { |
|
55 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
56 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
57 |
|
58 CActiveScheduler* sched=NULL; |
|
59 sched=new(ELeave) CActiveScheduler; |
|
60 CActiveScheduler::Install(sched); |
|
61 CT_MsgPopServer* server = NULL; |
|
62 |
|
63 // Create the CTestServer derived Email server |
|
64 TRAPD(err, server = CT_MsgPopServer::NewL()); |
|
65 if ( err == KErrNone ) |
|
66 { |
|
67 // Sync with the client and enter the active scheduler |
|
68 RProcess::Rendezvous(KErrNone); |
|
69 sched->Start(); |
|
70 } |
|
71 delete server; |
|
72 server=NULL; |
|
73 delete sched; |
|
74 sched=NULL; |
|
75 } |
|
76 |
|
77 |
|
78 /** |
|
79 E32Main() |
|
80 It is the entry point for POP testserver |
|
81 |
|
82 @return |
|
83 Returns KErrNone on suceed otherwise the error code |
|
84 */ |
|
85 GLDEF_C TInt E32Main() |
|
86 /** |
|
87 @return |
|
88 Standard Epoc error code on process exit |
|
89 Secure variant only |
|
90 Process entry point. Called by client using RProcess API |
|
91 */ |
|
92 { |
|
93 __UHEAP_MARK; |
|
94 |
|
95 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
96 if(cleanup == NULL) |
|
97 { |
|
98 return KErrNoMemory; |
|
99 } |
|
100 TRAP_IGNORE(MainL()); |
|
101 delete cleanup; |
|
102 cleanup=NULL; |
|
103 __UHEAP_MARKEND; |
|
104 |
|
105 return KErrNone; |
|
106 } |
|
107 |
|
108 |
|
109 /** |
|
110 NewL() |
|
111 Constructs a CT_MsgPopServer object. |
|
112 Uses two phase construction and leaves nothing on the CleanupStack. |
|
113 |
|
114 @leave KErrNoMemory |
|
115 @return |
|
116 Created object of type CT_MsgPopServer |
|
117 */ |
|
118 CT_MsgPopServer* CT_MsgPopServer::NewL() |
|
119 { |
|
120 CT_MsgPopServer* server=new(ELeave) CT_MsgPopServer(); |
|
121 CleanupStack::PushL(server); |
|
122 // server->StartL(KPopServer); |
|
123 server->ConstructL(KPopServer); |
|
124 CleanupStack::Pop(server); |
|
125 return server; |
|
126 } |
|
127 |
|
128 |
|
129 /** |
|
130 CT_MsgPopServer() |
|
131 Intializes iSharedDataPOP with NULL |
|
132 */ |
|
133 CT_MsgPopServer::CT_MsgPopServer() |
|
134 : iSharedDataPOP(NULL) |
|
135 { |
|
136 } |
|
137 |
|
138 /** |
|
139 NewSharedDataL() |
|
140 Constructs a CT_MsgSharedDataPop object dynamically and assigns it's address to iSharedDataPOP |
|
141 |
|
142 @return |
|
143 An object of CT_MsgSharedDataPop |
|
144 */ |
|
145 CT_MsgSharedDataBase* CT_MsgPopServer::NewSharedDataL() |
|
146 { |
|
147 return iSharedDataPOP = CT_MsgSharedDataPop::NewL(); |
|
148 } |
|
149 |
|
150 |
|
151 /** |
|
152 CreateTestStepL() |
|
153 Creates the test steps based on the name read from the script file |
|
154 |
|
155 @param aStepName |
|
156 The name of the test step to be created |
|
157 |
|
158 @return |
|
159 The CTestStep object created |
|
160 */ |
|
161 CTestStep* CT_MsgPopServer::CreateTestStepL(const TDesC& aStepName) |
|
162 { |
|
163 CTestStep* testStep = NULL; |
|
164 |
|
165 if(aStepName == KVerifyPopSettings) |
|
166 { |
|
167 testStep = new(ELeave) CT_MsgVerifyPopSettings(*iSharedDataPOP); |
|
168 } |
|
169 else if(aStepName == KDeleteAllPopChildren) |
|
170 { |
|
171 testStep = CT_MsgDeleteAllPopChildren::NewL(*iSharedDataPOP); |
|
172 } |
|
173 else if(aStepName == KCopyPopSelection) |
|
174 { |
|
175 testStep = CT_MsgCopyPopSelection::NewL(*iSharedDataPOP); |
|
176 } |
|
177 else if(aStepName == KCreatePopAccount) |
|
178 { |
|
179 testStep = new(ELeave) CT_MsgCreatePopAccount(*iSharedDataPOP); |
|
180 } |
|
181 else if(aStepName == KModifyPopSettings) |
|
182 { |
|
183 testStep = new(ELeave) CT_MsgModifyPopSettings(*iSharedDataPOP); |
|
184 } |
|
185 else if(aStepName == KComparePopSettings) |
|
186 { |
|
187 testStep = new(ELeave) CT_MsgComparePopSettings(*iSharedDataPOP); |
|
188 } |
|
189 else if(aStepName == KDeletePopAccount) |
|
190 { |
|
191 testStep = new(ELeave) CT_MsgDeletePopAccount(*iSharedDataPOP); |
|
192 } |
|
193 else if(aStepName == KVerifyPopAccountsCount) |
|
194 { |
|
195 testStep = new(ELeave) CT_MsgVerifyPopAccountsCount(*iSharedDataPOP); |
|
196 } |
|
197 else if(aStepName == KPopInvokeAsyncFunction) |
|
198 { |
|
199 testStep = CT_MsgPopInvokeAsyncFunction::NewL(*iSharedDataPOP); |
|
200 } |
|
201 else if(aStepName == KCheckChildrenCountPop) |
|
202 { |
|
203 testStep = new(ELeave) CT_MsgCheckChildrenCountPop(*iSharedDataPOP); |
|
204 } |
|
205 else if(aStepName == KComparePopEmailMsgs) |
|
206 { |
|
207 testStep = CT_MsgComparePopEmailMsgs::NewL(*iSharedDataPOP); |
|
208 } |
|
209 else if(aStepName == KConnectPop3Server) |
|
210 { |
|
211 testStep = CT_MsgConnectPop3Server::NewL(*iSharedDataPOP); |
|
212 } |
|
213 else if(aStepName == KDisConnectPop3Server) |
|
214 { |
|
215 testStep = CT_MsgDisConnectPop3Server::NewL(*iSharedDataPOP); |
|
216 } |
|
217 else if(aStepName == KStartRamUsageTimer) |
|
218 { |
|
219 testStep = new(ELeave) CT_StartRamUsageTimer(*iSharedDataPOP); |
|
220 } |
|
221 else if(aStepName == KStopRamUsageTimer) |
|
222 { |
|
223 testStep = new(ELeave) CT_StopRamUsageTimer(*iSharedDataPOP); |
|
224 } |
|
225 else if(aStepName == KCheckPop3AccessPoint) |
|
226 { |
|
227 testStep = new(ELeave) CT_MsgCheckPop3AccessPoint(*iSharedDataPOP); |
|
228 } |
|
229 else if(aStepName == KCreatePopAccountWithoutSmtp) |
|
230 { |
|
231 testStep = new(ELeave) CT_MsgCreatePopAccountWithoutSmtp(*iSharedDataPOP); |
|
232 } |
|
233 else if(aStepName == KModifyPopSettings2) |
|
234 { |
|
235 testStep = new(ELeave) CT_MsgModifyPopSettings2(*iSharedDataPOP); |
|
236 } |
|
237 else if(aStepName == KCheckPopSNAPSetting) |
|
238 { |
|
239 testStep = new(ELeave) CT_MsgCheckPopSNAPSetting(*iSharedDataPOP); |
|
240 } |
|
241 else if(aStepName == KRemovePopSNAPSetting) |
|
242 { |
|
243 testStep = new(ELeave) CT_MsgRemovePopSNAPSetting(*iSharedDataPOP); |
|
244 } |
|
245 else if(aStepName == KCheckPopBMSetting) |
|
246 { |
|
247 testStep = new(ELeave) CT_MsgCheckPopBMSetting(*iSharedDataPOP); |
|
248 } |
|
249 else |
|
250 { |
|
251 testStep = CT_MsgServer::CreateTestStepL(aStepName); |
|
252 } |
|
253 |
|
254 return testStep; |
|
255 } |