os/ossrv/lowlevellibsandfws/apputils/multipartparser/test/tef/smoketest/src/mppsmoketesttefserver.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2008-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 "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
//
sl@0
    15
sl@0
    16
#include "mppsmoketesttefserver.h"
sl@0
    17
// test steps
sl@0
    18
#include "mppsmoketeststeps.h"
sl@0
    19
sl@0
    20
sl@0
    21
_LIT(KServerName, "MultiPartParserSmokeTestTefSuite");
sl@0
    22
sl@0
    23
CMPPSmokeTestTefServer* CMPPSmokeTestTefServer::NewL()
sl@0
    24
/**
sl@0
    25
 * @return - Instance of the test server
sl@0
    26
 * Called inside the MainL() function to create and start the
sl@0
    27
 * CTestServer derived server.
sl@0
    28
 */
sl@0
    29
	{
sl@0
    30
	CMPPSmokeTestTefServer * server = new (ELeave) CMPPSmokeTestTefServer();
sl@0
    31
	CleanupStack::PushL(server);
sl@0
    32
	// CServer base class call
sl@0
    33
	server->StartL(KServerName);
sl@0
    34
	CleanupStack::Pop(server);
sl@0
    35
	return server;
sl@0
    36
	}
sl@0
    37
	
sl@0
    38
LOCAL_C void MainL()
sl@0
    39
/*
sl@0
    40
 * Uses the new Rendezvous() call to sync with the client
sl@0
    41
 */
sl@0
    42
	{
sl@0
    43
	RProcess().DataCaging(RProcess::EDataCagingOn);
sl@0
    44
	RProcess().SecureApi(RProcess::ESecureApiOn);
sl@0
    45
	
sl@0
    46
	CActiveScheduler* sched=new(ELeave) CActiveScheduler;
sl@0
    47
	CActiveScheduler::Install(sched);
sl@0
    48
	CMPPSmokeTestTefServer* server = NULL;
sl@0
    49
	// Create the CTestServer derived server
sl@0
    50
	TRAPD(err,server = CMPPSmokeTestTefServer::NewL());
sl@0
    51
	if (KErrNone == err)
sl@0
    52
		{
sl@0
    53
		// Sync with the client and enter the active scheduler
sl@0
    54
		RProcess::Rendezvous(KErrNone);
sl@0
    55
		sched->Start();
sl@0
    56
		}
sl@0
    57
	delete server;
sl@0
    58
	delete sched;
sl@0
    59
	}
sl@0
    60
sl@0
    61
sl@0
    62
GLDEF_C TInt E32Main()
sl@0
    63
/**
sl@0
    64
 * @return - Standard Epoc error code on exit
sl@0
    65
 */
sl@0
    66
	{
sl@0
    67
	__UHEAP_MARK;
sl@0
    68
sl@0
    69
	CTrapCleanup* cleanup = CTrapCleanup::New();
sl@0
    70
	if(cleanup == NULL)
sl@0
    71
		{
sl@0
    72
		return KErrNoMemory;
sl@0
    73
		}
sl@0
    74
	TRAPD(err,MainL());
sl@0
    75
	delete cleanup;
sl@0
    76
sl@0
    77
	__UHEAP_MARKEND;
sl@0
    78
	return err;
sl@0
    79
    }
sl@0
    80
sl@0
    81
CTestStep* CMPPSmokeTestTefServer::CreateTestStep(const TDesC& aStepName)
sl@0
    82
/**
sl@0
    83
 * @return - A CTestStep derived instance
sl@0
    84
 * Implementation of CTestServer pure virtual
sl@0
    85
 */
sl@0
    86
	{
sl@0
    87
	CTestStep* testStep = NULL;
sl@0
    88
sl@0
    89
	if (aStepName == KCParseBase64Encoding)
sl@0
    90
		{
sl@0
    91
		testStep = new CParseBase64Encoding();
sl@0
    92
		}
sl@0
    93
sl@0
    94
	return testStep;
sl@0
    95
	}