diff -r 000000000000 -r f5a58ecadc66 servicediscoveryandcontrol/pnp/test/upnp/IntegTest/testsynchronization/src/testupnp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/servicediscoveryandcontrol/pnp/test/upnp/IntegTest/testsynchronization/src/testupnp.cpp Tue Feb 02 01:12:20 2010 +0200 @@ -0,0 +1,110 @@ +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Contains implementation of CTestUPnPManager class +// +// + +/** + @file + @internalTechnology +*/ + +#include "testupnp.h" +#include "testupnpmanager.h" + +/** + Static factory constructor. Uses two phase construction and leaves nothing on the + CleanupStack. Creates a CTestUPnP object. + @param None + @return Instance of the test server + */ +CTestUPnP* CTestUPnP::NewL() + { + CTestUPnP * server = new (ELeave) CTestUPnP(); + CleanupStack::PushL(server); + // CServer base class call + RProcess handle = RProcess(); + TParsePtrC serverName(handle.FileName()); + server->ConstructL(serverName.Name()); + CleanupStack::Pop(server); + return server; + } + +/** + Function to create and start the CTestServer derived server. + Secure variant.Much simpler, uses the new Rendezvous() call to sync with the client + @param None + @return None +*/ +LOCAL_C void MainL() + { + // Leave the hooks in for platform security + RProcess().DataCaging(RProcess::EDataCagingOn); + RProcess().DataCaging(RProcess::ESecureApiOn); + CActiveScheduler* sched = new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CTestUPnP* server = NULL; + // Create the CTestServer derived server + TRAPD(err,server = CTestUPnP::NewL()); + if(err == KErrNone) + { + // Sync with the client and enter the active scheduler + RProcess::Rendezvous(KErrNone); + sched->Start(); + } + delete server; + delete sched; + } + +/** + Secure variant only + Process entry point. Called by client using RProcess API. + @param None + @return Standard Epoc error code on process exit + */ +GLDEF_C TInt E32Main() + { + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + if(cleanup == NULL) + { + return KErrNoMemory; + } + TRAPD( error, MainL() ); + delete cleanup; + __UHEAP_MARKEND; + return error; + } + +/** + Secure and non-secure variants + Implementation of CTestServer pure virtual + @param aStepName a reference to string + @return A CTestStep derived instance + */ +CTestStep* CTestUPnP::CreateTestStep(const TDesC& aStepName) + { + CTestStep* testStep = NULL; + // They are created "just in time" when the worker thread is created + // More test steps can be added below + if(aStepName == KTestUPnPManager) + { + testStep = new CTestUPnPManager(); + } + + return testStep; + } + + +