sl@0
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\system\t_svr_connect.cpp
|
sl@0
|
15 |
// Overview:
|
sl@0
|
16 |
// Tests correct operation of server when interleaving connect/disconnect/
|
sl@0
|
17 |
// other messages and creating the user-side session object (setting the
|
sl@0
|
18 |
// session cookie) in interesting manners.
|
sl@0
|
19 |
// Tests that clients/servers are panicked when performing illegal operations
|
sl@0
|
20 |
// w.r.t. server connection, i.e. a client thread may not send more than one
|
sl@0
|
21 |
// connect message simultaneously, nor may it send another connect message
|
sl@0
|
22 |
// once a connect message has been successfully completed. Similarly, a server
|
sl@0
|
23 |
// may not set the cookie twice nor may it set the cookie to be NULL. Also, a
|
sl@0
|
24 |
// server may only set the cookie from a connect message and from no other.
|
sl@0
|
25 |
// API Information:
|
sl@0
|
26 |
// RServer2
|
sl@0
|
27 |
// Details:
|
sl@0
|
28 |
// - Test asynchronous server connect in various ways. Verify results
|
sl@0
|
29 |
// are as expected.
|
sl@0
|
30 |
// - Test illegal client/server behaviour. Verify threads are panicked,
|
sl@0
|
31 |
// as expected.
|
sl@0
|
32 |
// Platforms/Drives/Compatibility:
|
sl@0
|
33 |
// All.
|
sl@0
|
34 |
// Assumptions/Requirement/Pre-requisites:
|
sl@0
|
35 |
// None.
|
sl@0
|
36 |
// Failures and causes:
|
sl@0
|
37 |
// Failure of this test would be caused by an incorrect modification of
|
sl@0
|
38 |
// the internal client/server mechanism in the kernel.
|
sl@0
|
39 |
// Base Port information:
|
sl@0
|
40 |
// This is a unit test of the client/server mechanism within the kernel.
|
sl@0
|
41 |
// It should be invariant to base ports. If the kernel proper has not been
|
sl@0
|
42 |
// modified, this test should not fail with any new base port.
|
sl@0
|
43 |
//
|
sl@0
|
44 |
//
|
sl@0
|
45 |
|
sl@0
|
46 |
#include <e32test.h>
|
sl@0
|
47 |
#include "../misc/int_svr_calls.h"
|
sl@0
|
48 |
#include <e32kpan.h>
|
sl@0
|
49 |
|
sl@0
|
50 |
_LIT(KTestName, "t_svr_connect");
|
sl@0
|
51 |
LOCAL_D RTest test(KTestName);
|
sl@0
|
52 |
LOCAL_D RTest test_client(KTestName);
|
sl@0
|
53 |
LOCAL_D RTest test_server(KTestName);
|
sl@0
|
54 |
|
sl@0
|
55 |
_LIT(KServerName, "t_svr_connect");
|
sl@0
|
56 |
_LIT8(KServerName8, "t_svr_connect");
|
sl@0
|
57 |
_LIT(KMainThread, "main thread");
|
sl@0
|
58 |
_LIT(KServerThread, "server thread");
|
sl@0
|
59 |
_LIT(KClientThread, "client thread");
|
sl@0
|
60 |
_LIT(KClientThread2, "client thread2");
|
sl@0
|
61 |
_LIT(KClientThread3, "client thread3");
|
sl@0
|
62 |
|
sl@0
|
63 |
class RTestServer : public RSessionBase
|
sl@0
|
64 |
{
|
sl@0
|
65 |
public:
|
sl@0
|
66 |
inline static TInt CreateSession(TInt aMsgSlots) { return SessionCreate(KServerName8,aMsgSlots,NULL,EIpcSession_Sharable); }
|
sl@0
|
67 |
};
|
sl@0
|
68 |
|
sl@0
|
69 |
// Messages to send:
|
sl@0
|
70 |
//
|
sl@0
|
71 |
// connect, 1
|
sl@0
|
72 |
// a.n.other, 2
|
sl@0
|
73 |
// disconnect 3
|
sl@0
|
74 |
//
|
sl@0
|
75 |
// Things to do in the server:
|
sl@0
|
76 |
//
|
sl@0
|
77 |
// recieve connect 4
|
sl@0
|
78 |
// set cookie 5
|
sl@0
|
79 |
// complete connect 6
|
sl@0
|
80 |
// receive a.n.other 7
|
sl@0
|
81 |
// complete a.n.other 8
|
sl@0
|
82 |
// receive disconnect 9
|
sl@0
|
83 |
// complete disconnect 10
|
sl@0
|
84 |
//
|
sl@0
|
85 |
|
sl@0
|
86 |
enum TMsgType
|
sl@0
|
87 |
{
|
sl@0
|
88 |
EConnect = -1,
|
sl@0
|
89 |
EDisConnect = -2,
|
sl@0
|
90 |
EANOther = 1,
|
sl@0
|
91 |
EANOther2 = 2,
|
sl@0
|
92 |
EMsgCount = 4
|
sl@0
|
93 |
};
|
sl@0
|
94 |
|
sl@0
|
95 |
enum TServerControl
|
sl@0
|
96 |
{
|
sl@0
|
97 |
EReceiveMsg = 0,
|
sl@0
|
98 |
EReceiveBlocked = 1,
|
sl@0
|
99 |
EWaitForReceive = 2,
|
sl@0
|
100 |
ESetCookie = 3,
|
sl@0
|
101 |
ESetNullCookie = 4,
|
sl@0
|
102 |
ECompleteMsg = 5,
|
sl@0
|
103 |
EServerDie = 6
|
sl@0
|
104 |
};
|
sl@0
|
105 |
|
sl@0
|
106 |
enum TClientControl
|
sl@0
|
107 |
{
|
sl@0
|
108 |
ESendMsg = 0,
|
sl@0
|
109 |
EWaitMsg = 1,
|
sl@0
|
110 |
ECreateSession = 2,
|
sl@0
|
111 |
EClientDie = 3,
|
sl@0
|
112 |
ESetCritical = 4
|
sl@0
|
113 |
};
|
sl@0
|
114 |
|
sl@0
|
115 |
static TMsgType TheMsgType;
|
sl@0
|
116 |
static TServerControl TheServerControl;
|
sl@0
|
117 |
static TClientControl TheClientControl;
|
sl@0
|
118 |
static RSemaphore ServerSemaphore;
|
sl@0
|
119 |
static RSemaphore ClientSemaphore;
|
sl@0
|
120 |
static RSemaphore TaskCompletionSemaphore;
|
sl@0
|
121 |
static RMessage2 Msgs[EMsgCount];
|
sl@0
|
122 |
static RServer2 Server;
|
sl@0
|
123 |
static RThread ServerThread;
|
sl@0
|
124 |
static RThread ClientThread;
|
sl@0
|
125 |
static RTestServer ServerHandle;
|
sl@0
|
126 |
static TRequestStatus ConnectStatus;
|
sl@0
|
127 |
static TRequestStatus ANOtherStatus;
|
sl@0
|
128 |
static TRequestStatus ANOther2Status;
|
sl@0
|
129 |
static TRequestStatus ServerReceiveStatus;
|
sl@0
|
130 |
static TInt TheNumberOfMsgSlots;
|
sl@0
|
131 |
static TInt ErrorExpected;
|
sl@0
|
132 |
static User::TCritical CriticalLevel;
|
sl@0
|
133 |
|
sl@0
|
134 |
|
sl@0
|
135 |
static const TAny* const KSessionCookie = (const TAny*)0x12345;
|
sl@0
|
136 |
static TRequestStatus* volatile KNullReference = 0;
|
sl@0
|
137 |
|
sl@0
|
138 |
void DoServerAction();
|
sl@0
|
139 |
void DoClientAction();
|
sl@0
|
140 |
TInt Index();
|
sl@0
|
141 |
|
sl@0
|
142 |
TInt TestThreadServer(TAny*)
|
sl@0
|
143 |
{
|
sl@0
|
144 |
test_server(Server.CreateGlobal(KServerName) == KErrNone);
|
sl@0
|
145 |
RThread::Rendezvous(KErrNone);
|
sl@0
|
146 |
|
sl@0
|
147 |
for (;;)
|
sl@0
|
148 |
{
|
sl@0
|
149 |
ServerSemaphore.Wait();
|
sl@0
|
150 |
DoServerAction();
|
sl@0
|
151 |
TaskCompletionSemaphore.Signal();
|
sl@0
|
152 |
}
|
sl@0
|
153 |
}
|
sl@0
|
154 |
|
sl@0
|
155 |
TInt Index()
|
sl@0
|
156 |
{
|
sl@0
|
157 |
switch (TheMsgType)
|
sl@0
|
158 |
{
|
sl@0
|
159 |
case EConnect:
|
sl@0
|
160 |
return 0;
|
sl@0
|
161 |
case EDisConnect:
|
sl@0
|
162 |
return 3;
|
sl@0
|
163 |
case EANOther:
|
sl@0
|
164 |
return 1;
|
sl@0
|
165 |
case EANOther2:
|
sl@0
|
166 |
return 2;
|
sl@0
|
167 |
default:
|
sl@0
|
168 |
return -1;
|
sl@0
|
169 |
};
|
sl@0
|
170 |
}
|
sl@0
|
171 |
|
sl@0
|
172 |
TRequestStatus& RequestStatus()
|
sl@0
|
173 |
{
|
sl@0
|
174 |
switch (TheMsgType)
|
sl@0
|
175 |
{
|
sl@0
|
176 |
case EConnect:
|
sl@0
|
177 |
return ConnectStatus;
|
sl@0
|
178 |
case EANOther:
|
sl@0
|
179 |
return ANOtherStatus;
|
sl@0
|
180 |
case EANOther2:
|
sl@0
|
181 |
return ANOther2Status;
|
sl@0
|
182 |
default:
|
sl@0
|
183 |
User::Invariant();
|
sl@0
|
184 |
};
|
sl@0
|
185 |
return *(TRequestStatus*)KNullReference;
|
sl@0
|
186 |
}
|
sl@0
|
187 |
|
sl@0
|
188 |
void DoServerAction()
|
sl@0
|
189 |
{
|
sl@0
|
190 |
switch (TheServerControl)
|
sl@0
|
191 |
{
|
sl@0
|
192 |
case EReceiveMsg:
|
sl@0
|
193 |
{
|
sl@0
|
194 |
RMessage2& msg = Msgs[Index()];
|
sl@0
|
195 |
Server.Receive(msg);
|
sl@0
|
196 |
test_server(msg.Function() == TheMsgType);
|
sl@0
|
197 |
}
|
sl@0
|
198 |
break;
|
sl@0
|
199 |
case EReceiveBlocked:
|
sl@0
|
200 |
{
|
sl@0
|
201 |
RMessage2& msg = Msgs[Index()];
|
sl@0
|
202 |
Server.Receive(msg, ServerReceiveStatus);
|
sl@0
|
203 |
test_server(ServerReceiveStatus.Int() == KRequestPending);
|
sl@0
|
204 |
}
|
sl@0
|
205 |
break;
|
sl@0
|
206 |
case EWaitForReceive:
|
sl@0
|
207 |
{
|
sl@0
|
208 |
User::WaitForRequest(ServerReceiveStatus);
|
sl@0
|
209 |
test_server(ServerReceiveStatus.Int() == KErrNone);
|
sl@0
|
210 |
test_server(Msgs[Index()].Function() == TheMsgType);
|
sl@0
|
211 |
}
|
sl@0
|
212 |
break;
|
sl@0
|
213 |
case ESetCookie:
|
sl@0
|
214 |
{
|
sl@0
|
215 |
SetSessionPtr(Msgs[Index()].Handle(), KSessionCookie);
|
sl@0
|
216 |
}
|
sl@0
|
217 |
break;
|
sl@0
|
218 |
case ESetNullCookie:
|
sl@0
|
219 |
{
|
sl@0
|
220 |
SetSessionPtr(Msgs[Index()].Handle(), NULL);
|
sl@0
|
221 |
}
|
sl@0
|
222 |
break;
|
sl@0
|
223 |
case ECompleteMsg:
|
sl@0
|
224 |
{
|
sl@0
|
225 |
Msgs[Index()].Complete(KErrNone);
|
sl@0
|
226 |
}
|
sl@0
|
227 |
break;
|
sl@0
|
228 |
case EServerDie:
|
sl@0
|
229 |
{
|
sl@0
|
230 |
User::Exit(0);
|
sl@0
|
231 |
}
|
sl@0
|
232 |
break;
|
sl@0
|
233 |
default:
|
sl@0
|
234 |
{
|
sl@0
|
235 |
}
|
sl@0
|
236 |
break;
|
sl@0
|
237 |
};
|
sl@0
|
238 |
}
|
sl@0
|
239 |
|
sl@0
|
240 |
void StartServer()
|
sl@0
|
241 |
{
|
sl@0
|
242 |
ServerThread.Create(KServerThread, TestThreadServer, KDefaultStackSize, 4096, 4096, NULL);
|
sl@0
|
243 |
|
sl@0
|
244 |
TRequestStatus started;
|
sl@0
|
245 |
ServerThread.Rendezvous(started);
|
sl@0
|
246 |
|
sl@0
|
247 |
ServerThread.Resume();
|
sl@0
|
248 |
User::WaitForRequest(started);
|
sl@0
|
249 |
|
sl@0
|
250 |
test(started.Int() == KErrNone);
|
sl@0
|
251 |
}
|
sl@0
|
252 |
|
sl@0
|
253 |
void StopServer()
|
sl@0
|
254 |
{
|
sl@0
|
255 |
TRequestStatus logon;
|
sl@0
|
256 |
ServerThread.Logon(logon);
|
sl@0
|
257 |
|
sl@0
|
258 |
TheServerControl = EServerDie;
|
sl@0
|
259 |
ServerSemaphore.Signal();
|
sl@0
|
260 |
|
sl@0
|
261 |
User::WaitForRequest(logon);
|
sl@0
|
262 |
test(logon.Int() == KErrNone);
|
sl@0
|
263 |
|
sl@0
|
264 |
CLOSE_AND_WAIT(ServerThread);
|
sl@0
|
265 |
}
|
sl@0
|
266 |
|
sl@0
|
267 |
TInt TestThreadClient(TAny*)
|
sl@0
|
268 |
{
|
sl@0
|
269 |
RThread::Rendezvous(KErrNone);
|
sl@0
|
270 |
|
sl@0
|
271 |
for (;;)
|
sl@0
|
272 |
{
|
sl@0
|
273 |
ClientSemaphore.Wait();
|
sl@0
|
274 |
DoClientAction();
|
sl@0
|
275 |
TaskCompletionSemaphore.Signal();
|
sl@0
|
276 |
}
|
sl@0
|
277 |
}
|
sl@0
|
278 |
|
sl@0
|
279 |
void DoClientAction()
|
sl@0
|
280 |
{
|
sl@0
|
281 |
switch (TheClientControl)
|
sl@0
|
282 |
{
|
sl@0
|
283 |
case ESendMsg:
|
sl@0
|
284 |
{
|
sl@0
|
285 |
if (TheMsgType == EDisConnect)
|
sl@0
|
286 |
ServerHandle.Close();
|
sl@0
|
287 |
else
|
sl@0
|
288 |
SessionSend(ServerHandle.Handle(), TheMsgType, NULL, &RequestStatus());
|
sl@0
|
289 |
}
|
sl@0
|
290 |
break;
|
sl@0
|
291 |
case EWaitMsg:
|
sl@0
|
292 |
{
|
sl@0
|
293 |
User::WaitForRequest(RequestStatus());
|
sl@0
|
294 |
}
|
sl@0
|
295 |
break;
|
sl@0
|
296 |
case ECreateSession:
|
sl@0
|
297 |
{
|
sl@0
|
298 |
TInt err = ServerHandle.SetReturnedHandle(RTestServer::CreateSession(TheNumberOfMsgSlots));
|
sl@0
|
299 |
|
sl@0
|
300 |
if (err != ErrorExpected)
|
sl@0
|
301 |
{
|
sl@0
|
302 |
test_client.Printf(_L("Error returned = %d\n"),err);
|
sl@0
|
303 |
test_client(EFalse,__LINE__);
|
sl@0
|
304 |
}
|
sl@0
|
305 |
}
|
sl@0
|
306 |
break;
|
sl@0
|
307 |
case EClientDie:
|
sl@0
|
308 |
{
|
sl@0
|
309 |
User::SetCritical(User::ENotCritical);
|
sl@0
|
310 |
User::Exit(0);
|
sl@0
|
311 |
}
|
sl@0
|
312 |
break;
|
sl@0
|
313 |
case ESetCritical:
|
sl@0
|
314 |
{
|
sl@0
|
315 |
User::SetCritical(CriticalLevel);
|
sl@0
|
316 |
break;
|
sl@0
|
317 |
}
|
sl@0
|
318 |
default:
|
sl@0
|
319 |
{
|
sl@0
|
320 |
}
|
sl@0
|
321 |
break;
|
sl@0
|
322 |
};
|
sl@0
|
323 |
}
|
sl@0
|
324 |
|
sl@0
|
325 |
// I'm lazy and I haven't completed all the IPC the client thread does,
|
sl@0
|
326 |
// so even when the client thread panics, the DObject is still kept alive
|
sl@0
|
327 |
// until the server goes away. Therefore if I want another client I rename.
|
sl@0
|
328 |
void StartClient(const TDesC& aName)
|
sl@0
|
329 |
{
|
sl@0
|
330 |
ClientThread.Create(aName, TestThreadClient, KDefaultStackSize, 4096, 4096, NULL);
|
sl@0
|
331 |
|
sl@0
|
332 |
TRequestStatus started;
|
sl@0
|
333 |
ClientThread.Rendezvous(started);
|
sl@0
|
334 |
|
sl@0
|
335 |
ClientThread.Resume();
|
sl@0
|
336 |
User::WaitForRequest(started);
|
sl@0
|
337 |
|
sl@0
|
338 |
test(started.Int() == KErrNone);
|
sl@0
|
339 |
}
|
sl@0
|
340 |
|
sl@0
|
341 |
void StartClient()
|
sl@0
|
342 |
{
|
sl@0
|
343 |
StartClient(KClientThread);
|
sl@0
|
344 |
}
|
sl@0
|
345 |
|
sl@0
|
346 |
void StopClient()
|
sl@0
|
347 |
{
|
sl@0
|
348 |
TRequestStatus logon;
|
sl@0
|
349 |
ClientThread.Logon(logon);
|
sl@0
|
350 |
|
sl@0
|
351 |
TheClientControl = EClientDie;
|
sl@0
|
352 |
ClientSemaphore.Signal();
|
sl@0
|
353 |
|
sl@0
|
354 |
User::WaitForRequest(logon);
|
sl@0
|
355 |
test(logon.Int() == KErrNone);
|
sl@0
|
356 |
|
sl@0
|
357 |
CLOSE_AND_WAIT(ClientThread);
|
sl@0
|
358 |
}
|
sl@0
|
359 |
|
sl@0
|
360 |
void CreateSemaphores()
|
sl@0
|
361 |
{
|
sl@0
|
362 |
TInt err = ServerSemaphore.CreateLocal(0);
|
sl@0
|
363 |
test(err == KErrNone);
|
sl@0
|
364 |
err = ClientSemaphore.CreateLocal(0);
|
sl@0
|
365 |
test(err == KErrNone);
|
sl@0
|
366 |
err = TaskCompletionSemaphore.CreateLocal(0);
|
sl@0
|
367 |
test(err == KErrNone);
|
sl@0
|
368 |
}
|
sl@0
|
369 |
|
sl@0
|
370 |
void CloseSemaphores()
|
sl@0
|
371 |
{
|
sl@0
|
372 |
ServerSemaphore.Close();
|
sl@0
|
373 |
ClientSemaphore.Close();
|
sl@0
|
374 |
TaskCompletionSemaphore.Close();
|
sl@0
|
375 |
}
|
sl@0
|
376 |
|
sl@0
|
377 |
void CreateSession(TInt aErrorExpected=KErrNone, TInt aMsgSlots=-1)
|
sl@0
|
378 |
{
|
sl@0
|
379 |
TheClientControl = ECreateSession;
|
sl@0
|
380 |
TheNumberOfMsgSlots = aMsgSlots;
|
sl@0
|
381 |
ErrorExpected=aErrorExpected;
|
sl@0
|
382 |
ClientSemaphore.Signal();
|
sl@0
|
383 |
TaskCompletionSemaphore.Wait();
|
sl@0
|
384 |
}
|
sl@0
|
385 |
|
sl@0
|
386 |
void SendMsg(TMsgType aType)
|
sl@0
|
387 |
{
|
sl@0
|
388 |
TheClientControl = ESendMsg;
|
sl@0
|
389 |
TheMsgType = aType;
|
sl@0
|
390 |
ClientSemaphore.Signal();
|
sl@0
|
391 |
TaskCompletionSemaphore.Wait();
|
sl@0
|
392 |
}
|
sl@0
|
393 |
|
sl@0
|
394 |
void SendMsg_NoWait(TMsgType aType)
|
sl@0
|
395 |
{
|
sl@0
|
396 |
TheClientControl = ESendMsg;
|
sl@0
|
397 |
TheMsgType = aType;
|
sl@0
|
398 |
ClientSemaphore.Signal();
|
sl@0
|
399 |
}
|
sl@0
|
400 |
|
sl@0
|
401 |
void WaitMsg(TMsgType aType)
|
sl@0
|
402 |
{
|
sl@0
|
403 |
TheClientControl = EWaitMsg;
|
sl@0
|
404 |
TheMsgType = aType;
|
sl@0
|
405 |
ClientSemaphore.Signal();
|
sl@0
|
406 |
TaskCompletionSemaphore.Wait();
|
sl@0
|
407 |
}
|
sl@0
|
408 |
|
sl@0
|
409 |
void ReceiveBlocked(TMsgType aType)
|
sl@0
|
410 |
{
|
sl@0
|
411 |
TheServerControl = EReceiveBlocked;
|
sl@0
|
412 |
TheMsgType = aType;
|
sl@0
|
413 |
ServerSemaphore.Signal();
|
sl@0
|
414 |
TaskCompletionSemaphore.Wait();
|
sl@0
|
415 |
}
|
sl@0
|
416 |
|
sl@0
|
417 |
void WaitForReceive(TMsgType aType)
|
sl@0
|
418 |
{
|
sl@0
|
419 |
TheServerControl = EWaitForReceive;
|
sl@0
|
420 |
TheMsgType = aType;
|
sl@0
|
421 |
ServerSemaphore.Signal();
|
sl@0
|
422 |
TaskCompletionSemaphore.Wait();
|
sl@0
|
423 |
}
|
sl@0
|
424 |
|
sl@0
|
425 |
void ReceiveMsg(TMsgType aType)
|
sl@0
|
426 |
{
|
sl@0
|
427 |
TheServerControl = EReceiveMsg;
|
sl@0
|
428 |
TheMsgType = aType;
|
sl@0
|
429 |
ServerSemaphore.Signal();
|
sl@0
|
430 |
TaskCompletionSemaphore.Wait();
|
sl@0
|
431 |
}
|
sl@0
|
432 |
|
sl@0
|
433 |
void CompleteMsg(TMsgType aType)
|
sl@0
|
434 |
{
|
sl@0
|
435 |
TheServerControl = ECompleteMsg;
|
sl@0
|
436 |
TheMsgType = aType;
|
sl@0
|
437 |
ServerSemaphore.Signal();
|
sl@0
|
438 |
TaskCompletionSemaphore.Wait();
|
sl@0
|
439 |
}
|
sl@0
|
440 |
|
sl@0
|
441 |
void SetCookie()
|
sl@0
|
442 |
{
|
sl@0
|
443 |
TheServerControl = ESetCookie;
|
sl@0
|
444 |
TheMsgType = EConnect;
|
sl@0
|
445 |
ServerSemaphore.Signal();
|
sl@0
|
446 |
TaskCompletionSemaphore.Wait();
|
sl@0
|
447 |
}
|
sl@0
|
448 |
|
sl@0
|
449 |
void SetCookie_NoWait()
|
sl@0
|
450 |
{
|
sl@0
|
451 |
TheServerControl = ESetCookie;
|
sl@0
|
452 |
TheMsgType = EConnect;
|
sl@0
|
453 |
ServerSemaphore.Signal();
|
sl@0
|
454 |
}
|
sl@0
|
455 |
|
sl@0
|
456 |
void SetNullCookie()
|
sl@0
|
457 |
{
|
sl@0
|
458 |
TheServerControl = ESetNullCookie;
|
sl@0
|
459 |
TheMsgType = EConnect;
|
sl@0
|
460 |
ServerSemaphore.Signal();
|
sl@0
|
461 |
}
|
sl@0
|
462 |
|
sl@0
|
463 |
void SetBadCookie(TMsgType aType)
|
sl@0
|
464 |
{
|
sl@0
|
465 |
TheServerControl = ESetCookie;
|
sl@0
|
466 |
test(aType != EConnect);
|
sl@0
|
467 |
TheMsgType = aType;
|
sl@0
|
468 |
ServerSemaphore.Signal();
|
sl@0
|
469 |
}
|
sl@0
|
470 |
void SetClientCritical(User::TCritical aCritical)
|
sl@0
|
471 |
{
|
sl@0
|
472 |
TheClientControl = ESetCritical;
|
sl@0
|
473 |
CriticalLevel=aCritical;
|
sl@0
|
474 |
ClientSemaphore.Signal();
|
sl@0
|
475 |
TaskCompletionSemaphore.Wait();
|
sl@0
|
476 |
}
|
sl@0
|
477 |
|
sl@0
|
478 |
void Test1()
|
sl@0
|
479 |
{
|
sl@0
|
480 |
test.Next(_L("Create session with test server"));
|
sl@0
|
481 |
CreateSession();
|
sl@0
|
482 |
test.Next(_L("Send connect message"));
|
sl@0
|
483 |
SendMsg(EConnect);
|
sl@0
|
484 |
test.Next(_L("Send A.N.Other message"));
|
sl@0
|
485 |
SendMsg(EANOther);
|
sl@0
|
486 |
test.Next(_L("Sending disconnect message"));
|
sl@0
|
487 |
SendMsg(EDisConnect);
|
sl@0
|
488 |
test.Next(_L("Receive A.N.Other message"));
|
sl@0
|
489 |
ReceiveMsg(EANOther);
|
sl@0
|
490 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
491 |
test.Next(_L("Receive disconnect message"));
|
sl@0
|
492 |
ReceiveMsg(EDisConnect);
|
sl@0
|
493 |
test.Next(_L("Check the session has gone"));
|
sl@0
|
494 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
495 |
test.Next(_L("Set up receive for next test"));
|
sl@0
|
496 |
ReceiveBlocked(EConnect);
|
sl@0
|
497 |
}
|
sl@0
|
498 |
|
sl@0
|
499 |
void Test2()
|
sl@0
|
500 |
{
|
sl@0
|
501 |
test.Next(_L("Create session with test server"));
|
sl@0
|
502 |
CreateSession();
|
sl@0
|
503 |
test.Next(_L("Send connect message"));
|
sl@0
|
504 |
SendMsg(EConnect);
|
sl@0
|
505 |
test.Next(_L("Send A.N.Other message"));
|
sl@0
|
506 |
SendMsg(EANOther);
|
sl@0
|
507 |
test.Next(_L("Receive connect message"));
|
sl@0
|
508 |
WaitForReceive(EConnect);
|
sl@0
|
509 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
510 |
test.Next(_L("Receive A.N.Other message"));
|
sl@0
|
511 |
ReceiveMsg(EANOther);
|
sl@0
|
512 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
513 |
test.Next(_L("Sending disconnect message"));
|
sl@0
|
514 |
SendMsg(EDisConnect);
|
sl@0
|
515 |
test.Next(_L("Await disconnect message"));
|
sl@0
|
516 |
ReceiveBlocked(EDisConnect);
|
sl@0
|
517 |
test.Next(_L("Set cookie"));
|
sl@0
|
518 |
SetCookie();
|
sl@0
|
519 |
test.Next(_L("Check disconnect message received"));
|
sl@0
|
520 |
WaitForReceive(EDisConnect);
|
sl@0
|
521 |
test(Msgs[Index()].Session() == KSessionCookie);
|
sl@0
|
522 |
test.Next(_L("Complete connect message"));
|
sl@0
|
523 |
CompleteMsg(EConnect);
|
sl@0
|
524 |
}
|
sl@0
|
525 |
|
sl@0
|
526 |
void Test2a()
|
sl@0
|
527 |
{
|
sl@0
|
528 |
CreateSession();
|
sl@0
|
529 |
SendMsg(EConnect);
|
sl@0
|
530 |
SendMsg(EANOther);
|
sl@0
|
531 |
ReceiveMsg(EConnect);
|
sl@0
|
532 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
533 |
ReceiveMsg(EANOther);
|
sl@0
|
534 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
535 |
SendMsg(EDisConnect);
|
sl@0
|
536 |
ReceiveBlocked(EDisConnect);
|
sl@0
|
537 |
CompleteMsg(EConnect);
|
sl@0
|
538 |
WaitForReceive(EDisConnect);
|
sl@0
|
539 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
540 |
}
|
sl@0
|
541 |
|
sl@0
|
542 |
void Test2b()
|
sl@0
|
543 |
{
|
sl@0
|
544 |
CreateSession();
|
sl@0
|
545 |
SendMsg(EConnect);
|
sl@0
|
546 |
SendMsg(EANOther);
|
sl@0
|
547 |
ReceiveMsg(EConnect);
|
sl@0
|
548 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
549 |
SetCookie();
|
sl@0
|
550 |
ReceiveMsg(EANOther);
|
sl@0
|
551 |
test(Msgs[Index()].Session() == KSessionCookie);
|
sl@0
|
552 |
SendMsg(EDisConnect);
|
sl@0
|
553 |
ReceiveMsg(EDisConnect);
|
sl@0
|
554 |
test(Msgs[Index()].Session() == KSessionCookie);
|
sl@0
|
555 |
}
|
sl@0
|
556 |
|
sl@0
|
557 |
void Test3()
|
sl@0
|
558 |
{
|
sl@0
|
559 |
CreateSession();
|
sl@0
|
560 |
SendMsg(EConnect);
|
sl@0
|
561 |
ReceiveMsg(EConnect);
|
sl@0
|
562 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
563 |
SendMsg(EANOther);
|
sl@0
|
564 |
ReceiveMsg(EANOther);
|
sl@0
|
565 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
566 |
SendMsg(EDisConnect);
|
sl@0
|
567 |
ReceiveBlocked(EDisConnect);
|
sl@0
|
568 |
SetCookie();
|
sl@0
|
569 |
WaitForReceive(EDisConnect);
|
sl@0
|
570 |
test(Msgs[Index()].Session() == KSessionCookie);
|
sl@0
|
571 |
CompleteMsg(EConnect);
|
sl@0
|
572 |
}
|
sl@0
|
573 |
|
sl@0
|
574 |
void Test3a()
|
sl@0
|
575 |
{
|
sl@0
|
576 |
CreateSession();
|
sl@0
|
577 |
SendMsg(EConnect);
|
sl@0
|
578 |
ReceiveMsg(EConnect);
|
sl@0
|
579 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
580 |
SendMsg(EANOther);
|
sl@0
|
581 |
ReceiveMsg(EANOther);
|
sl@0
|
582 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
583 |
SendMsg(EDisConnect);
|
sl@0
|
584 |
ReceiveBlocked(EDisConnect);
|
sl@0
|
585 |
CompleteMsg(EConnect);
|
sl@0
|
586 |
WaitForReceive(EDisConnect);
|
sl@0
|
587 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
588 |
}
|
sl@0
|
589 |
|
sl@0
|
590 |
void Test3b()
|
sl@0
|
591 |
{
|
sl@0
|
592 |
CreateSession();
|
sl@0
|
593 |
SendMsg(EConnect);
|
sl@0
|
594 |
ReceiveMsg(EConnect);
|
sl@0
|
595 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
596 |
SetCookie();
|
sl@0
|
597 |
SendMsg(EANOther);
|
sl@0
|
598 |
ReceiveMsg(EANOther);
|
sl@0
|
599 |
test(Msgs[Index()].Session() == KSessionCookie);
|
sl@0
|
600 |
SendMsg(EDisConnect);
|
sl@0
|
601 |
ReceiveMsg(EDisConnect);
|
sl@0
|
602 |
test(Msgs[Index()].Session() == KSessionCookie);
|
sl@0
|
603 |
}
|
sl@0
|
604 |
|
sl@0
|
605 |
void Test4()
|
sl@0
|
606 |
{
|
sl@0
|
607 |
CreateSession();
|
sl@0
|
608 |
SendMsg(EANOther);
|
sl@0
|
609 |
SendMsg(EConnect);
|
sl@0
|
610 |
SendMsg(EANOther2);
|
sl@0
|
611 |
SendMsg(EDisConnect);
|
sl@0
|
612 |
ReceiveMsg(EANOther);
|
sl@0
|
613 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
614 |
ReceiveMsg(EANOther2);
|
sl@0
|
615 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
616 |
ReceiveMsg(EDisConnect);
|
sl@0
|
617 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
618 |
}
|
sl@0
|
619 |
|
sl@0
|
620 |
void Test5()
|
sl@0
|
621 |
{
|
sl@0
|
622 |
CreateSession();
|
sl@0
|
623 |
SendMsg(EANOther);
|
sl@0
|
624 |
SendMsg(EConnect);
|
sl@0
|
625 |
SendMsg(EANOther2);
|
sl@0
|
626 |
ReceiveMsg(EANOther);
|
sl@0
|
627 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
628 |
SendMsg(EDisConnect);
|
sl@0
|
629 |
ReceiveMsg(EANOther2);
|
sl@0
|
630 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
631 |
ReceiveMsg(EDisConnect);
|
sl@0
|
632 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
633 |
ReceiveBlocked(EANOther);
|
sl@0
|
634 |
}
|
sl@0
|
635 |
|
sl@0
|
636 |
void Test6()
|
sl@0
|
637 |
{
|
sl@0
|
638 |
CreateSession();
|
sl@0
|
639 |
SendMsg(EANOther);
|
sl@0
|
640 |
SendMsg(EConnect);
|
sl@0
|
641 |
SendMsg(EANOther2);
|
sl@0
|
642 |
WaitForReceive(EANOther);
|
sl@0
|
643 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
644 |
ReceiveMsg(EConnect);
|
sl@0
|
645 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
646 |
ReceiveMsg(EANOther2);
|
sl@0
|
647 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
648 |
SendMsg(EDisConnect);
|
sl@0
|
649 |
ReceiveBlocked(EDisConnect);
|
sl@0
|
650 |
SetCookie();
|
sl@0
|
651 |
WaitForReceive(EDisConnect);
|
sl@0
|
652 |
test(Msgs[Index()].Session() == KSessionCookie);
|
sl@0
|
653 |
CompleteMsg(EConnect);
|
sl@0
|
654 |
}
|
sl@0
|
655 |
|
sl@0
|
656 |
void Test6a()
|
sl@0
|
657 |
{
|
sl@0
|
658 |
CreateSession();
|
sl@0
|
659 |
SendMsg(EANOther);
|
sl@0
|
660 |
SendMsg(EConnect);
|
sl@0
|
661 |
SendMsg(EANOther2);
|
sl@0
|
662 |
ReceiveMsg(EANOther);
|
sl@0
|
663 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
664 |
ReceiveMsg(EConnect);
|
sl@0
|
665 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
666 |
ReceiveMsg(EANOther2);
|
sl@0
|
667 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
668 |
SendMsg(EDisConnect);
|
sl@0
|
669 |
ReceiveBlocked(EDisConnect);
|
sl@0
|
670 |
CompleteMsg(EConnect);
|
sl@0
|
671 |
WaitForReceive(EDisConnect);
|
sl@0
|
672 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
673 |
}
|
sl@0
|
674 |
|
sl@0
|
675 |
void Test6b()
|
sl@0
|
676 |
{
|
sl@0
|
677 |
CreateSession();
|
sl@0
|
678 |
SendMsg(EANOther);
|
sl@0
|
679 |
SendMsg(EConnect);
|
sl@0
|
680 |
SendMsg(EANOther2);
|
sl@0
|
681 |
ReceiveMsg(EANOther);
|
sl@0
|
682 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
683 |
ReceiveMsg(EConnect);
|
sl@0
|
684 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
685 |
SetCookie();
|
sl@0
|
686 |
ReceiveMsg(EANOther2);
|
sl@0
|
687 |
test(Msgs[Index()].Session() == KSessionCookie);
|
sl@0
|
688 |
SendMsg(EDisConnect);
|
sl@0
|
689 |
ReceiveMsg(EDisConnect);
|
sl@0
|
690 |
test(Msgs[Index()].Session() == KSessionCookie);
|
sl@0
|
691 |
}
|
sl@0
|
692 |
|
sl@0
|
693 |
void Test7()
|
sl@0
|
694 |
{
|
sl@0
|
695 |
CreateSession();
|
sl@0
|
696 |
SendMsg(EANOther);
|
sl@0
|
697 |
SendMsg(EConnect);
|
sl@0
|
698 |
ReceiveMsg(EANOther);
|
sl@0
|
699 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
700 |
SendMsg(EANOther2);
|
sl@0
|
701 |
ReceiveMsg(EConnect);
|
sl@0
|
702 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
703 |
SetCookie();
|
sl@0
|
704 |
ReceiveMsg(EANOther2);
|
sl@0
|
705 |
test(Msgs[Index()].Session() == KSessionCookie);
|
sl@0
|
706 |
SendMsg(EDisConnect);
|
sl@0
|
707 |
ReceiveMsg(EDisConnect);
|
sl@0
|
708 |
test(Msgs[Index()].Session() == KSessionCookie);
|
sl@0
|
709 |
}
|
sl@0
|
710 |
|
sl@0
|
711 |
void Test8()
|
sl@0
|
712 |
{
|
sl@0
|
713 |
CreateSession();
|
sl@0
|
714 |
SendMsg(EANOther);
|
sl@0
|
715 |
SendMsg(EConnect);
|
sl@0
|
716 |
ReceiveMsg(EANOther);
|
sl@0
|
717 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
718 |
ReceiveMsg(EConnect);
|
sl@0
|
719 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
720 |
SetCookie();
|
sl@0
|
721 |
SendMsg(EANOther2);
|
sl@0
|
722 |
ReceiveMsg(EANOther2);
|
sl@0
|
723 |
test(Msgs[Index()].Session() == KSessionCookie);
|
sl@0
|
724 |
SendMsg(EDisConnect);
|
sl@0
|
725 |
ReceiveMsg(EDisConnect);
|
sl@0
|
726 |
test(Msgs[Index()].Session() == KSessionCookie);
|
sl@0
|
727 |
}
|
sl@0
|
728 |
|
sl@0
|
729 |
void Test9()
|
sl@0
|
730 |
{
|
sl@0
|
731 |
CreateSession();
|
sl@0
|
732 |
SendMsg(EANOther);
|
sl@0
|
733 |
ReceiveMsg(EANOther);
|
sl@0
|
734 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
735 |
SendMsg(EConnect);
|
sl@0
|
736 |
ReceiveMsg(EConnect);
|
sl@0
|
737 |
test(Msgs[Index()].Session() == NULL);
|
sl@0
|
738 |
SetCookie();
|
sl@0
|
739 |
SendMsg(EANOther2);
|
sl@0
|
740 |
ReceiveMsg(EANOther2);
|
sl@0
|
741 |
test(Msgs[Index()].Session() == KSessionCookie);
|
sl@0
|
742 |
SendMsg(EDisConnect);
|
sl@0
|
743 |
ReceiveMsg(EDisConnect);
|
sl@0
|
744 |
test(Msgs[Index()].Session() == KSessionCookie);
|
sl@0
|
745 |
}
|
sl@0
|
746 |
|
sl@0
|
747 |
void Test10()
|
sl@0
|
748 |
{
|
sl@0
|
749 |
// Try connecting with too many message slots
|
sl@0
|
750 |
// (Check for DEF091903 regression)
|
sl@0
|
751 |
CreateSession(KErrArgument, 1000);
|
sl@0
|
752 |
}
|
sl@0
|
753 |
|
sl@0
|
754 |
_LIT(KKernExec, "KERN-EXEC");
|
sl@0
|
755 |
|
sl@0
|
756 |
void CheckClientDeath(TInt aReason)
|
sl@0
|
757 |
{
|
sl@0
|
758 |
TRequestStatus logon;
|
sl@0
|
759 |
|
sl@0
|
760 |
ClientThread.Logon(logon);
|
sl@0
|
761 |
User::WaitForRequest(logon);
|
sl@0
|
762 |
|
sl@0
|
763 |
test(ClientThread.ExitType() == EExitPanic);
|
sl@0
|
764 |
test(ClientThread.ExitCategory() == KKernExec);
|
sl@0
|
765 |
test(ClientThread.ExitReason() == aReason);
|
sl@0
|
766 |
|
sl@0
|
767 |
ClientThread.Close();
|
sl@0
|
768 |
ClientThread.SetHandle(KNullHandle);
|
sl@0
|
769 |
}
|
sl@0
|
770 |
|
sl@0
|
771 |
void CheckServerDeath(TInt aReason)
|
sl@0
|
772 |
{
|
sl@0
|
773 |
TRequestStatus logon;
|
sl@0
|
774 |
|
sl@0
|
775 |
ServerThread.Logon(logon);
|
sl@0
|
776 |
User::WaitForRequest(logon);
|
sl@0
|
777 |
|
sl@0
|
778 |
test(ServerThread.ExitType() == EExitPanic);
|
sl@0
|
779 |
test(ServerThread.ExitCategory() == KKernExec);
|
sl@0
|
780 |
test(ServerThread.ExitReason() == aReason);
|
sl@0
|
781 |
|
sl@0
|
782 |
CLOSE_AND_WAIT(ServerThread);
|
sl@0
|
783 |
ServerThread.SetHandle(KNullHandle);
|
sl@0
|
784 |
}
|
sl@0
|
785 |
|
sl@0
|
786 |
void TestNaughty()
|
sl@0
|
787 |
{
|
sl@0
|
788 |
TBool jit = User::JustInTime();
|
sl@0
|
789 |
User::SetJustInTime(EFalse);
|
sl@0
|
790 |
|
sl@0
|
791 |
SetClientCritical(User::ENotCritical);
|
sl@0
|
792 |
test.Next(_L("Two connect msgs at once is naughty"));
|
sl@0
|
793 |
CreateSession();
|
sl@0
|
794 |
SendMsg(EConnect);
|
sl@0
|
795 |
ReceiveMsg(EConnect);
|
sl@0
|
796 |
SetCookie();
|
sl@0
|
797 |
SendMsg_NoWait(EConnect);
|
sl@0
|
798 |
CheckClientDeath(ERequestAlreadyPending);
|
sl@0
|
799 |
StartClient(KClientThread2);
|
sl@0
|
800 |
test.Next(_L("Another connect message after a sucessful connect msg is naughty"));
|
sl@0
|
801 |
CreateSession();
|
sl@0
|
802 |
SendMsg(EConnect);
|
sl@0
|
803 |
ReceiveMsg(EConnect);
|
sl@0
|
804 |
SetCookie();
|
sl@0
|
805 |
CompleteMsg(EConnect);
|
sl@0
|
806 |
SendMsg_NoWait(EConnect);
|
sl@0
|
807 |
CheckClientDeath(ESessionAlreadyConnected);
|
sl@0
|
808 |
StartClient(KClientThread3);
|
sl@0
|
809 |
|
sl@0
|
810 |
test.Next(_L("A null session cookie is naughty"));
|
sl@0
|
811 |
CreateSession();
|
sl@0
|
812 |
SendMsg(EConnect);
|
sl@0
|
813 |
ReceiveMsg(EConnect);
|
sl@0
|
814 |
SetNullCookie();
|
sl@0
|
815 |
CheckServerDeath(ESessionNullCookie);
|
sl@0
|
816 |
StartServer();
|
sl@0
|
817 |
|
sl@0
|
818 |
test.Next(_L("Setting the session cookie twice is naughty"));
|
sl@0
|
819 |
CreateSession();
|
sl@0
|
820 |
SendMsg(EConnect);
|
sl@0
|
821 |
ReceiveMsg(EConnect);
|
sl@0
|
822 |
SetCookie();
|
sl@0
|
823 |
SetCookie_NoWait();
|
sl@0
|
824 |
CheckServerDeath(ESessionCookieAlreadySet);
|
sl@0
|
825 |
StartServer();
|
sl@0
|
826 |
|
sl@0
|
827 |
test.Next(_L("Trying to set the session cookie from a non-connect message is naughty"));
|
sl@0
|
828 |
CreateSession();
|
sl@0
|
829 |
SendMsg(EConnect);
|
sl@0
|
830 |
ReceiveMsg(EConnect);
|
sl@0
|
831 |
SendMsg(EANOther);
|
sl@0
|
832 |
ReceiveMsg(EANOther);
|
sl@0
|
833 |
SetBadCookie(EANOther);
|
sl@0
|
834 |
CheckServerDeath(ESessionInvalidCookieMsg);
|
sl@0
|
835 |
StartServer();
|
sl@0
|
836 |
|
sl@0
|
837 |
User::SetJustInTime(jit);
|
sl@0
|
838 |
}
|
sl@0
|
839 |
|
sl@0
|
840 |
TInt E32Main()
|
sl@0
|
841 |
{
|
sl@0
|
842 |
User::RenameThread(KMainThread);
|
sl@0
|
843 |
|
sl@0
|
844 |
__UHEAP_MARK;
|
sl@0
|
845 |
|
sl@0
|
846 |
test.Title();
|
sl@0
|
847 |
|
sl@0
|
848 |
test.Start(_L("Creating semaphores"));
|
sl@0
|
849 |
CreateSemaphores();
|
sl@0
|
850 |
|
sl@0
|
851 |
test.Next(_L("Starting test server"));
|
sl@0
|
852 |
StartServer();
|
sl@0
|
853 |
|
sl@0
|
854 |
test.Next(_L("Starting test client"));
|
sl@0
|
855 |
StartClient();
|
sl@0
|
856 |
SetClientCritical(User::EProcessCritical);
|
sl@0
|
857 |
// test combinations of receiving messages with messages sent by the client in the
|
sl@0
|
858 |
// correct order (w.r.t to each other, but not necessarily to when messages are received)
|
sl@0
|
859 |
test.Next(_L("Sending in order"));
|
sl@0
|
860 |
test.Next(_L("1"));
|
sl@0
|
861 |
Test1();
|
sl@0
|
862 |
test.Next(_L("2"));
|
sl@0
|
863 |
Test2();
|
sl@0
|
864 |
test.Next(_L("2a"));
|
sl@0
|
865 |
Test2a();
|
sl@0
|
866 |
test.Next(_L("2b"));
|
sl@0
|
867 |
Test2b();
|
sl@0
|
868 |
test.Next(_L("3"));
|
sl@0
|
869 |
Test3();
|
sl@0
|
870 |
test.Next(_L("3a"));
|
sl@0
|
871 |
Test3a();
|
sl@0
|
872 |
test.Next(_L("3b"));
|
sl@0
|
873 |
Test3b();
|
sl@0
|
874 |
|
sl@0
|
875 |
// test combinations of receiving messages with messages sent by the client in the
|
sl@0
|
876 |
// wrong order (w.r.t to each other, but not necessarily to when messages are received)
|
sl@0
|
877 |
test.Next(_L("Sending out of order"));
|
sl@0
|
878 |
test.Next(_L("4"));
|
sl@0
|
879 |
Test4();
|
sl@0
|
880 |
test.Next(_L("5"));
|
sl@0
|
881 |
Test5();
|
sl@0
|
882 |
test.Next(_L("6"));
|
sl@0
|
883 |
Test6();
|
sl@0
|
884 |
test.Next(_L("6a"));
|
sl@0
|
885 |
Test6a();
|
sl@0
|
886 |
test.Next(_L("6b"));
|
sl@0
|
887 |
Test6b();
|
sl@0
|
888 |
test.Next(_L("7"));
|
sl@0
|
889 |
Test7();
|
sl@0
|
890 |
test.Next(_L("8"));
|
sl@0
|
891 |
Test8();
|
sl@0
|
892 |
test.Next(_L("9"));
|
sl@0
|
893 |
Test9();
|
sl@0
|
894 |
test.Next(_L("10"));
|
sl@0
|
895 |
Test10();
|
sl@0
|
896 |
|
sl@0
|
897 |
test.Next(_L("Test other naughty behaviour is trapped"));
|
sl@0
|
898 |
TestNaughty();
|
sl@0
|
899 |
|
sl@0
|
900 |
test.Next(_L("Stopping test client"));
|
sl@0
|
901 |
StopClient();
|
sl@0
|
902 |
|
sl@0
|
903 |
test.Next(_L("Stopping test server"));
|
sl@0
|
904 |
StopServer();
|
sl@0
|
905 |
|
sl@0
|
906 |
test.Next(_L("Closing semaphores"));
|
sl@0
|
907 |
CloseSemaphores();
|
sl@0
|
908 |
|
sl@0
|
909 |
test.End();
|
sl@0
|
910 |
test.Close();
|
sl@0
|
911 |
|
sl@0
|
912 |
__UHEAP_MARKEND;
|
sl@0
|
913 |
|
sl@0
|
914 |
return KErrNone;
|
sl@0
|
915 |
}
|