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.
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include "mppsmoketesttefserver.h"
    17 // test steps
    18 #include "mppsmoketeststeps.h"
    19 
    20 
    21 _LIT(KServerName, "MultiPartParserSmokeTestTefSuite");
    22 
    23 CMPPSmokeTestTefServer* CMPPSmokeTestTefServer::NewL()
    24 /**
    25  * @return - Instance of the test server
    26  * Called inside the MainL() function to create and start the
    27  * CTestServer derived server.
    28  */
    29 	{
    30 	CMPPSmokeTestTefServer * server = new (ELeave) CMPPSmokeTestTefServer();
    31 	CleanupStack::PushL(server);
    32 	// CServer base class call
    33 	server->StartL(KServerName);
    34 	CleanupStack::Pop(server);
    35 	return server;
    36 	}
    37 	
    38 LOCAL_C void MainL()
    39 /*
    40  * Uses the new Rendezvous() call to sync with the client
    41  */
    42 	{
    43 	RProcess().DataCaging(RProcess::EDataCagingOn);
    44 	RProcess().SecureApi(RProcess::ESecureApiOn);
    45 	
    46 	CActiveScheduler* sched=new(ELeave) CActiveScheduler;
    47 	CActiveScheduler::Install(sched);
    48 	CMPPSmokeTestTefServer* server = NULL;
    49 	// Create the CTestServer derived server
    50 	TRAPD(err,server = CMPPSmokeTestTefServer::NewL());
    51 	if (KErrNone == err)
    52 		{
    53 		// Sync with the client and enter the active scheduler
    54 		RProcess::Rendezvous(KErrNone);
    55 		sched->Start();
    56 		}
    57 	delete server;
    58 	delete sched;
    59 	}
    60 
    61 
    62 GLDEF_C TInt E32Main()
    63 /**
    64  * @return - Standard Epoc error code on exit
    65  */
    66 	{
    67 	__UHEAP_MARK;
    68 
    69 	CTrapCleanup* cleanup = CTrapCleanup::New();
    70 	if(cleanup == NULL)
    71 		{
    72 		return KErrNoMemory;
    73 		}
    74 	TRAPD(err,MainL());
    75 	delete cleanup;
    76 
    77 	__UHEAP_MARKEND;
    78 	return err;
    79     }
    80 
    81 CTestStep* CMPPSmokeTestTefServer::CreateTestStep(const TDesC& aStepName)
    82 /**
    83  * @return - A CTestStep derived instance
    84  * Implementation of CTestServer pure virtual
    85  */
    86 	{
    87 	CTestStep* testStep = NULL;
    88 
    89 	if (aStepName == KCParseBase64Encoding)
    90 		{
    91 		testStep = new CParseBase64Encoding();
    92 		}
    93 
    94 	return testStep;
    95 	}