sl@0: /* sl@0: * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * TestUtil - server implementation sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent sl@0: */ sl@0: sl@0: #include "testutilserver.h" sl@0: #include "testutilsession.h" sl@0: #include "testutilclientserver.h" sl@0: sl@0: CServer2* CTestUtilServer::NewLC() sl@0: { sl@0: CTestUtilServer* self=new(ELeave) CTestUtilServer; sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: return self; sl@0: } sl@0: sl@0: sl@0: CTestUtilServer::~CTestUtilServer() sl@0: { sl@0: iFs.Close(); sl@0: delete iFileMan; sl@0: delete iTestUtilSessionCommon; sl@0: } sl@0: sl@0: void CTestUtilServer::ConstructL() sl@0: { sl@0: StartL(KTestUtilServerName); sl@0: User::LeaveIfError(iFs.Connect()); sl@0: iFs.ShareProtected(); sl@0: iFileMan = CFileMan::NewL(iFs); sl@0: iTestUtilSessionCommon = new (ELeave) CTestUtilSessionCommon(); sl@0: } sl@0: sl@0: CSession2* CTestUtilServer::NewSessionL(const TVersion&,const RMessage2&) const sl@0: { sl@0: return new(ELeave) CTestUtilSession(); sl@0: } sl@0: sl@0: void CTestUtilServer::AddSession() sl@0: { sl@0: ++iSessionCount; sl@0: } sl@0: sl@0: void CTestUtilServer::DropSession() sl@0: { sl@0: --iSessionCount; sl@0: } sl@0: sl@0: void CTestUtilServer::Send(const TDesC& aMessage) sl@0: { sl@0: iSessionIter.SetToFirst(); sl@0: while ((iSessionIter++)!=0) sl@0: { sl@0: iTestUtilSessionCommon->Send(aMessage); sl@0: } sl@0: }