os/ossrv/lowlevellibsandfws/pluginfw/TestExecute/EComPerfTest/src/TE_EcomGranularityTestServer.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2006-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 <test/testexecuteserverbase.h>
    17 #include "TE_EcomGranularityTestStep.h" 
    18 
    19 _LIT(KServerName, "TE_EcomGranularityTestServer");
    20 
    21 class CEcomGranularityTestServer : public CTestServer
    22 	{
    23 public:
    24 	static CEcomGranularityTestServer* NewL();
    25 	virtual CTestStep* CreateTestStep(const TDesC& aStepName);
    26 	};
    27 
    28 /**
    29 Called inside the MainL() function to create and start the
    30 CTestServer derived server.
    31 */
    32 CEcomGranularityTestServer* CEcomGranularityTestServer::NewL()
    33 	{
    34 	CEcomGranularityTestServer* server = new (ELeave) CEcomGranularityTestServer();
    35 	CleanupStack::PushL(server);
    36 	// CServer base class call
    37 	server->StartL(KServerName);
    38 	CleanupStack::Pop(server);
    39 	return server;
    40 	}
    41 	
    42 LOCAL_C void MainL()
    43 	{
    44 	RProcess().DataCaging(RProcess::EDataCagingOn);
    45 	RProcess().SecureApi(RProcess::ESecureApiOn);
    46 	
    47 	CActiveScheduler* sched=NULL;
    48 	sched=new(ELeave) CActiveScheduler;
    49 	CActiveScheduler::Install(sched);
    50 	CEcomGranularityTestServer* server = NULL;
    51 	// Create the CTestServer derived server
    52 	TRAPD(err,server = CEcomGranularityTestServer::NewL());
    53 	if(KErrNone == err)
    54 		{
    55 		// Sync with the client and enter the active scheduler
    56 		RProcess::Rendezvous(KErrNone);
    57 		sched->Start();
    58 		}
    59 	delete server;
    60 	delete sched;
    61 	}
    62 
    63 GLDEF_C TInt E32Main()
    64 	{
    65 	CTrapCleanup* cleanup = CTrapCleanup::New();
    66 	if(cleanup == NULL)
    67 		{
    68 		return KErrNoMemory;
    69 		}
    70 	TRAPD(err,MainL());
    71 	delete cleanup;
    72 	return err;
    73     }
    74 
    75 /**
    76 @return - A CTestStep derived instance
    77 Implementation of CTestServer pure virtual
    78 */
    79 CTestStep* CEcomGranularityTestServer::CreateTestStep(const TDesC& aStepName)
    80 	{
    81 	CTestStep* testStep = NULL;
    82 
    83 	if (aStepName == KEComImplIndexPerfTest)
    84 		{
    85 		testStep = new CEComImplIndexPerfTest();
    86 		}
    87 	return testStep;
    88 	}