os/ossrv/lowlevellibsandfws/pluginfw/TestExecute/EComPerfTest/src/TE_EcomGranularityTestServer.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/TestExecute/EComPerfTest/src/TE_EcomGranularityTestServer.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,88 @@
1.4 +// Copyright (c) 2006-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 <test/testexecuteserverbase.h>
1.20 +#include "TE_EcomGranularityTestStep.h"
1.21 +
1.22 +_LIT(KServerName, "TE_EcomGranularityTestServer");
1.23 +
1.24 +class CEcomGranularityTestServer : public CTestServer
1.25 + {
1.26 +public:
1.27 + static CEcomGranularityTestServer* NewL();
1.28 + virtual CTestStep* CreateTestStep(const TDesC& aStepName);
1.29 + };
1.30 +
1.31 +/**
1.32 +Called inside the MainL() function to create and start the
1.33 +CTestServer derived server.
1.34 +*/
1.35 +CEcomGranularityTestServer* CEcomGranularityTestServer::NewL()
1.36 + {
1.37 + CEcomGranularityTestServer* server = new (ELeave) CEcomGranularityTestServer();
1.38 + CleanupStack::PushL(server);
1.39 + // CServer base class call
1.40 + server->StartL(KServerName);
1.41 + CleanupStack::Pop(server);
1.42 + return server;
1.43 + }
1.44 +
1.45 +LOCAL_C void MainL()
1.46 + {
1.47 + RProcess().DataCaging(RProcess::EDataCagingOn);
1.48 + RProcess().SecureApi(RProcess::ESecureApiOn);
1.49 +
1.50 + CActiveScheduler* sched=NULL;
1.51 + sched=new(ELeave) CActiveScheduler;
1.52 + CActiveScheduler::Install(sched);
1.53 + CEcomGranularityTestServer* server = NULL;
1.54 + // Create the CTestServer derived server
1.55 + TRAPD(err,server = CEcomGranularityTestServer::NewL());
1.56 + if(KErrNone == err)
1.57 + {
1.58 + // Sync with the client and enter the active scheduler
1.59 + RProcess::Rendezvous(KErrNone);
1.60 + sched->Start();
1.61 + }
1.62 + delete server;
1.63 + delete sched;
1.64 + }
1.65 +
1.66 +GLDEF_C TInt E32Main()
1.67 + {
1.68 + CTrapCleanup* cleanup = CTrapCleanup::New();
1.69 + if(cleanup == NULL)
1.70 + {
1.71 + return KErrNoMemory;
1.72 + }
1.73 + TRAPD(err,MainL());
1.74 + delete cleanup;
1.75 + return err;
1.76 + }
1.77 +
1.78 +/**
1.79 +@return - A CTestStep derived instance
1.80 +Implementation of CTestServer pure virtual
1.81 +*/
1.82 +CTestStep* CEcomGranularityTestServer::CreateTestStep(const TDesC& aStepName)
1.83 + {
1.84 + CTestStep* testStep = NULL;
1.85 +
1.86 + if (aStepName == KEComImplIndexPerfTest)
1.87 + {
1.88 + testStep = new CEComImplIndexPerfTest();
1.89 + }
1.90 + return testStep;
1.91 + }