os/ossrv/lowlevellibsandfws/apputils/multipartparser/test/tef/smoketest/src/mppsmoketesttefserver.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/lowlevellibsandfws/apputils/multipartparser/test/tef/smoketest/src/mppsmoketesttefserver.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,95 @@
     1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#include "mppsmoketesttefserver.h"
    1.20 +// test steps
    1.21 +#include "mppsmoketeststeps.h"
    1.22 +
    1.23 +
    1.24 +_LIT(KServerName, "MultiPartParserSmokeTestTefSuite");
    1.25 +
    1.26 +CMPPSmokeTestTefServer* CMPPSmokeTestTefServer::NewL()
    1.27 +/**
    1.28 + * @return - Instance of the test server
    1.29 + * Called inside the MainL() function to create and start the
    1.30 + * CTestServer derived server.
    1.31 + */
    1.32 +	{
    1.33 +	CMPPSmokeTestTefServer * server = new (ELeave) CMPPSmokeTestTefServer();
    1.34 +	CleanupStack::PushL(server);
    1.35 +	// CServer base class call
    1.36 +	server->StartL(KServerName);
    1.37 +	CleanupStack::Pop(server);
    1.38 +	return server;
    1.39 +	}
    1.40 +	
    1.41 +LOCAL_C void MainL()
    1.42 +/*
    1.43 + * Uses the new Rendezvous() call to sync with the client
    1.44 + */
    1.45 +	{
    1.46 +	RProcess().DataCaging(RProcess::EDataCagingOn);
    1.47 +	RProcess().SecureApi(RProcess::ESecureApiOn);
    1.48 +	
    1.49 +	CActiveScheduler* sched=new(ELeave) CActiveScheduler;
    1.50 +	CActiveScheduler::Install(sched);
    1.51 +	CMPPSmokeTestTefServer* server = NULL;
    1.52 +	// Create the CTestServer derived server
    1.53 +	TRAPD(err,server = CMPPSmokeTestTefServer::NewL());
    1.54 +	if (KErrNone == err)
    1.55 +		{
    1.56 +		// Sync with the client and enter the active scheduler
    1.57 +		RProcess::Rendezvous(KErrNone);
    1.58 +		sched->Start();
    1.59 +		}
    1.60 +	delete server;
    1.61 +	delete sched;
    1.62 +	}
    1.63 +
    1.64 +
    1.65 +GLDEF_C TInt E32Main()
    1.66 +/**
    1.67 + * @return - Standard Epoc error code on exit
    1.68 + */
    1.69 +	{
    1.70 +	__UHEAP_MARK;
    1.71 +
    1.72 +	CTrapCleanup* cleanup = CTrapCleanup::New();
    1.73 +	if(cleanup == NULL)
    1.74 +		{
    1.75 +		return KErrNoMemory;
    1.76 +		}
    1.77 +	TRAPD(err,MainL());
    1.78 +	delete cleanup;
    1.79 +
    1.80 +	__UHEAP_MARKEND;
    1.81 +	return err;
    1.82 +    }
    1.83 +
    1.84 +CTestStep* CMPPSmokeTestTefServer::CreateTestStep(const TDesC& aStepName)
    1.85 +/**
    1.86 + * @return - A CTestStep derived instance
    1.87 + * Implementation of CTestServer pure virtual
    1.88 + */
    1.89 +	{
    1.90 +	CTestStep* testStep = NULL;
    1.91 +
    1.92 +	if (aStepName == KCParseBase64Encoding)
    1.93 +		{
    1.94 +		testStep = new CParseBase64Encoding();
    1.95 +		}
    1.96 +
    1.97 +	return testStep;
    1.98 +	}