|
1 // Copyright (c) 2002-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 #include "TestMessServer.h" |
|
17 #include "TestMessSession.h" |
|
18 #include "TestMessCleanMessageFolder.h" |
|
19 #include "TestMessCreateSmsAccount.h" |
|
20 //IMK #include "TestMessCreatePopAccount.h" |
|
21 //IMK #include "TestMessCreateImapAccount.h" |
|
22 #include "TestMessSetDefaultSc.h" |
|
23 //IMK #include "TestMessCreateBIO.h" |
|
24 //IMK #include "TestMessCreateEmail.h" |
|
25 //IMK #include "TestMessCreateBulkEmail.h" |
|
26 //IMK #include "TestMessCreateEMS.h" |
|
27 #include "TestMessCreateSMS.h" |
|
28 //IMK #include "TestMessCreateBulkSMS.h" |
|
29 //IMK #include "TestMessEntryCount.h" |
|
30 //IMK #include "TestMessSendEmail.h" |
|
31 //IMK #include "TestMessSendBulkEmail.h" |
|
32 //IMK #include "TestMessSendSms.h" |
|
33 //IMK #include "TestMessDeleteEmailImap.h" |
|
34 //IMK #include "TestMessDeleteEmailPop.h" |
|
35 //IMK #include "TestMessFullSyncImap.h" |
|
36 //IMK #include "TestMessReceiveEmailImap.h" |
|
37 //IMK #include "TestMessReceiveEmailPop.h" |
|
38 //IMK #include "TestMessOpen.h" |
|
39 //IMK #include "TestMessVerifyEntry.h" |
|
40 //IMK #include "TestMessReply.h" |
|
41 //IMK #include "TestMessForward.h" |
|
42 //IMK #include "TestMessCompareMessages.h" |
|
43 //IMK #include "TestMessSetSyncRateImap.h" |
|
44 //IMK #include "TestMessDeleteSharedData.h" |
|
45 #include "TestMessEditEntry.h" |
|
46 //IMK #include "TestMessSaveEmailAttachments.h" |
|
47 //IMK #include "TestMessDeleteFolder.h" |
|
48 //IMK #include "TestMessCreateFolder.h" |
|
49 //IMK #include "TestMessRenameFolder.h" |
|
50 //IMK #include "TestMessMoveMessages.h" |
|
51 //IMK #include "TestMessSearchMessage.h" |
|
52 //IMK #include "TestMessDeleteMessages.h" |
|
53 //IMK #include "TestMessScheduleSendSMS.h" |
|
54 //IMK #include "TestMessCancelScheduledSMS.h" |
|
55 //IMK #include "TestMessVerifyScheduleSMS.h" |
|
56 //IMK #include "TestMessBackupStore.h" |
|
57 //IMK #include "TestMessRestoreStore.h" |
|
58 //IMK #include "TestMessReceiveHeadersEmailPop.h" |
|
59 //IMK #if (defined _PLATTEST_CDMA_) |
|
60 //IMK #include "TestMessCreateCancelSms.h" |
|
61 //IMK #endif |
|
62 |
|
63 |
|
64 // EPOC includes |
|
65 #include <e32base.h> |
|
66 #include <es_sock.h> |
|
67 #include <smsuaddr.h> |
|
68 #include <TestExecuteServerUtils.h> |
|
69 |
|
70 /** |
|
71 * @name Constant Literals used. |
|
72 */ |
|
73 /*@{*/ |
|
74 /*@}*/ |
|
75 |
|
76 |
|
77 LOCAL_C void MainL() |
|
78 /** |
|
79 * Secure variant |
|
80 * Much simpler, uses the new Rendezvous() call to sync with the client |
|
81 */ |
|
82 { |
|
83 #if (defined __DATA_CAGING__) |
|
84 RProcess().DataCaging(RProcess::EDataCagingOn); |
|
85 RProcess().SecureApi(RProcess::ESecureApiOn); |
|
86 #endif |
|
87 CActiveScheduler* sched=NULL; |
|
88 sched=new(ELeave) CActiveScheduler; |
|
89 CActiveScheduler::Install(sched); |
|
90 CTestMessServer* server = NULL; |
|
91 // Create the CTestServer derived server |
|
92 TRAPD(err,server = CTestMessServer::NewL()); |
|
93 if ( err==KErrNone ) |
|
94 { |
|
95 // Sync with the client and enter the active scheduler |
|
96 RProcess::Rendezvous(KErrNone); |
|
97 sched->Start(); |
|
98 } |
|
99 delete server; |
|
100 delete sched; |
|
101 } |
|
102 |
|
103 GLDEF_C TInt E32Main() |
|
104 /** |
|
105 * @return - Standard Epoc error code on process exit |
|
106 * Secure variant only |
|
107 * Process entry point. Called by client using RProcess API |
|
108 */ |
|
109 { |
|
110 __UHEAP_MARK; |
|
111 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
112 if(cleanup == NULL) |
|
113 { |
|
114 return KErrNoMemory; |
|
115 } |
|
116 #if (defined TRAP_IGNORE) |
|
117 TRAP_IGNORE(MainL()); |
|
118 #else |
|
119 TRAPD(err,MainL()); |
|
120 #endif |
|
121 delete cleanup; |
|
122 __UHEAP_MARKEND; |
|
123 return KErrNone; |
|
124 } |
|
125 |
|
126 |
|
127 CTestMessServer* CTestMessServer::NewL() |
|
128 { |
|
129 CTestMessServer* server=new(ELeave) CTestMessServer(); |
|
130 CleanupStack::PushL(server); |
|
131 RProcess handle = RProcess(); |
|
132 TParsePtrC serverName(handle.FileName()); |
|
133 server->ConstructL(serverName.Name()); |
|
134 CleanupStack::Pop(); |
|
135 return server; |
|
136 } |
|
137 |
|
138 CTestMessServer::CTestMessServer() |
|
139 : CTestServer() |
|
140 , iSharedData(NULL) |
|
141 { |
|
142 } |
|
143 |
|
144 void CTestMessServer::ConstructL(const TDesC& aName) |
|
145 { |
|
146 CTestServer::ConstructL(aName); |
|
147 iSharedData=CTestMessSharedData::NewL(); |
|
148 } |
|
149 |
|
150 CTestMessServer::~CTestMessServer() |
|
151 { |
|
152 delete iSharedData; |
|
153 iSharedData=NULL; |
|
154 } |
|
155 |
|
156 CSession2* CTestMessServer::NewSessionL(const TVersion& /*aVersion*/,const RMessage2& /*aMessage*/) const |
|
157 /** |
|
158 * @param RMessage - RMessage for the session open |
|
159 * Secure version |
|
160 */ |
|
161 { |
|
162 CTestSession* session = new (ELeave) CTestMessSession(iSharedData); |
|
163 CONST_CAST(CTestMessServer*,this)->IncSessionCount(); |
|
164 return session; |
|
165 } |
|
166 |
|
167 // constructor for ESOCK test suite |
|
168 // this creates all the ESOCK test steps and |
|
169 // stores them inside CTestSuiteEsock |
|
170 CTestStep* CTestMessServer::CreateTestStep(const TDesC& aStepName) |
|
171 { |
|
172 CTestMessBase* testStep = NULL; |
|
173 |
|
174 if(aStepName == _L("CleanMessageFolder")) |
|
175 { |
|
176 testStep = new CTestMessCleanMessageFolder(); |
|
177 } |
|
178 else if(aStepName == _L("CreateSms")) |
|
179 { |
|
180 testStep = new CTestMessCreateSMS(); |
|
181 } |
|
182 else if(aStepName == _L("CreateSmsAccount")) |
|
183 { |
|
184 testStep = new CTestMessCreateSmsAccount(); |
|
185 } |
|
186 else if(aStepName == _L("SetSmsSc")) |
|
187 { |
|
188 testStep = new CTestMessSetDefaultSc(); |
|
189 } |
|
190 return testStep; |
|
191 } |