os/graphics/graphicstest/uibench/src/tgcesuiteserver.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicstest/uibench/src/tgcesuiteserver.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,123 @@
     1.4 +// Copyright (c) 2008-2010 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 +/**
    1.20 + @file
    1.21 + @test
    1.22 + @internalComponent - Internal Symbian test code 
    1.23 +*/
    1.24 +
    1.25 +#include "tgcesuiteserver.h"
    1.26 +#include "tgraphicsresource.h"
    1.27 +#include "tbitbltperf_directgdi.h"
    1.28 +#include "tsimpledrawing_directgdi.h"
    1.29 +#include "tdirectgdiperf.h"
    1.30 +#include "teventhandlingperf.h"
    1.31 +#include "tflipframerate.h"
    1.32 +#include "trenderorientation.h"
    1.33 +
    1.34 +/**
    1.35 +Same code for Secure and non-secure variants
    1.36 +Called inside the MainL() function to create and start the
    1.37 +CTestServer derived server.
    1.38 +
    1.39 +@return - Instance of the test server
    1.40 +*/
    1.41 +CGceSuiteServer* CGceSuiteServer::NewL()
    1.42 +	{
    1.43 +	CGceSuiteServer * server = new (ELeave) CGceSuiteServer();
    1.44 +	CleanupStack::PushL(server);
    1.45 +
    1.46 +	// Get server name from process so we can use SetCap to change the capabilites and use this server with a different filename
    1.47 +	RProcess handle = RProcess();
    1.48 +	TParsePtrC serverName(handle.FileName());
    1.49 +
    1.50 +	server->ConstructL(serverName.Name());
    1.51 +	CleanupStack::Pop(server);
    1.52 +	return server;
    1.53 +	}
    1.54 +
    1.55 +
    1.56 +/**
    1.57 +MainL - uses the new Rendezvous() call to sync with the client
    1.58 +*/
    1.59 +LOCAL_C void MainL()
    1.60 +	{
    1.61 +	// Active scheduler only for this thread. Test need to create own active scheduler	
    1.62 +	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
    1.63 +	CActiveScheduler::Install(scheduler);
    1.64 +
    1.65 +	CGceSuiteServer* server = NULL;
    1.66 +
    1.67 +	// Create the CTestServer derived server
    1.68 +	TRAPD(err,server = CGceSuiteServer::NewL());
    1.69 +	if(!err)
    1.70 +		{
    1.71 +		// Sync with the client and enter the active scheduler
    1.72 +		RProcess::Rendezvous(KErrNone);
    1.73 +		scheduler->Start();
    1.74 +		}
    1.75 +	delete server;
    1.76 +	delete scheduler;
    1.77 +	}
    1.78 +
    1.79 +
    1.80 +/**
    1.81 +Secure variant only
    1.82 +Process entry point. Called by client using RProcess API
    1.83 +
    1.84 +@return - Standard Epoc error code on process exit
    1.85 +*/
    1.86 +GLDEF_C TInt E32Main()
    1.87 +	{
    1.88 +	__UHEAP_MARK;
    1.89 +	CTrapCleanup* cleanup = CTrapCleanup::New();
    1.90 +	if(cleanup == NULL)
    1.91 +		{
    1.92 +		return KErrNoMemory;
    1.93 +		}
    1.94 +	TRAPD(err,MainL());
    1.95 +	delete cleanup;
    1.96 +	__UHEAP_MARKEND;
    1.97 +	return err;
    1.98 +    }
    1.99 +
   1.100 +/**
   1.101 +Secure and non-secure variants
   1.102 +Implementation of CTestServer pure virtual
   1.103 +
   1.104 +@return - A CTestStep derived instance
   1.105 +*/
   1.106 +CTestStep* CGceSuiteServer::CreateTestStep(const TDesC& aStepName)
   1.107 +	{
   1.108 +	CTestStep* testStep = NULL;
   1.109 +	
   1.110 +	if(aStepName == KTGraphicsResource)
   1.111 +		testStep = new CTGraphicsResource();
   1.112 +	else if(aStepName == KTBitBltPerfDirectGdi)
   1.113 +		testStep = new CTBitBltPerfDirectGdi();
   1.114 +	else if(aStepName == KTDirectGdiPerfTest)
   1.115 +		testStep = new CTDirectGdiPerf();
   1.116 +	else if(aStepName == KTSimpleDrawingPerfDirectGdi)
   1.117 +		testStep = new CTSimpleDrawingDirectGdi();
   1.118 +	else if(aStepName == KEventHandlingPerfName)
   1.119 +		testStep = new CTEventHandlingPerf();
   1.120 +	else if(aStepName == KTFlipFramerate)
   1.121 +	    testStep = new CTFlipFramerate();
   1.122 +	else if(aStepName == KTRenderOrientation)
   1.123 +	    testStep = new CTRenderOrientation;
   1.124 +	
   1.125 +	return testStep;
   1.126 +	}