|
1 /* |
|
2 * Copyright (c) 2008-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 the License "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 * TestUtil - server implementation |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 /** |
|
23 @file |
|
24 @test |
|
25 @internalComponent |
|
26 */ |
|
27 |
|
28 #include "testutilserver.h" |
|
29 #include "testutilsession.h" |
|
30 #include "testutilclientserver.h" |
|
31 |
|
32 CServer2* CTestUtilServer::NewLC() |
|
33 { |
|
34 CTestUtilServer* self=new(ELeave) CTestUtilServer; |
|
35 CleanupStack::PushL(self); |
|
36 self->ConstructL(); |
|
37 return self; |
|
38 } |
|
39 |
|
40 |
|
41 CTestUtilServer::~CTestUtilServer() |
|
42 { |
|
43 iFs.Close(); |
|
44 delete iFileMan; |
|
45 delete iTestUtilSessionCommon; |
|
46 } |
|
47 |
|
48 void CTestUtilServer::ConstructL() |
|
49 { |
|
50 StartL(KTestUtilServerName); |
|
51 User::LeaveIfError(iFs.Connect()); |
|
52 iFs.ShareProtected(); |
|
53 iFileMan = CFileMan::NewL(iFs); |
|
54 iTestUtilSessionCommon = new (ELeave) CTestUtilSessionCommon(); |
|
55 } |
|
56 |
|
57 CSession2* CTestUtilServer::NewSessionL(const TVersion&,const RMessage2&) const |
|
58 { |
|
59 return new(ELeave) CTestUtilSession(); |
|
60 } |
|
61 |
|
62 void CTestUtilServer::AddSession() |
|
63 { |
|
64 ++iSessionCount; |
|
65 } |
|
66 |
|
67 void CTestUtilServer::DropSession() |
|
68 { |
|
69 --iSessionCount; |
|
70 } |
|
71 |
|
72 void CTestUtilServer::Send(const TDesC& aMessage) |
|
73 { |
|
74 iSessionIter.SetToFirst(); |
|
75 while ((iSessionIter++)!=0) |
|
76 { |
|
77 iTestUtilSessionCommon->Send(aMessage); |
|
78 } |
|
79 } |