os/graphics/egl/egltest/src/egltestserver.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/egl/egltest/src/egltestserver.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,100 @@
     1.4 +// Copyright (c) 2007-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 +/** 
    1.20 + @file
    1.21 + @test
    1.22 +*/
    1.23 +
    1.24 +#include <ecom/ecom.h>
    1.25 +
    1.26 +#include "egltestserver.h"
    1.27 +#include "eglteststep.h"
    1.28 +
    1.29 +
    1.30 +_LIT(KEGLTestServerName,"egltestserver");
    1.31 +
    1.32 +
    1.33 +CTestStep* CTestEGLServer::CreateTestStep(const TDesC& aStepName)
    1.34 +	{
    1.35 +	return EglTestStepFactory::GetEglTestStep(aStepName);
    1.36 +	}
    1.37 +
    1.38 +CTestEGLServer* CTestEGLServer::NewL()
    1.39 +	{
    1.40 +	CTestEGLServer* server = new(ELeave) CTestEGLServer();
    1.41 +	CleanupStack::PushL(server);
    1.42 +	// CServer base class call
    1.43 +	TParsePtrC serverName(RProcess().FileName());	
    1.44 +	server->StartL(serverName.Name());
    1.45 +	CleanupStack::Pop(server);
    1.46 +	return server;
    1.47 +	}
    1.48 +
    1.49 +static void MainL()
    1.50 +	{
    1.51 +	CActiveScheduler* sched=NULL;
    1.52 +	sched=new(ELeave) CActiveScheduler;
    1.53 +	CActiveScheduler::Install(sched);
    1.54 +
    1.55 +#ifdef __WINS__
    1.56 +	// Construct and destroy a process-wide state object in emulator builds.
    1.57 +	// This will cause initialisation of PLS for EGL and SgDriver
    1.58 +	// and allow checking for leaks in tests
    1.59 +	if(!eglReleaseThread())
    1.60 +		{
    1.61 +		// Call to eglReleaseThread failed
    1.62 +		User::Leave(KErrGeneral);
    1.63 +		}
    1.64 +#endif //__WINS__ 
    1.65 +
    1.66 +	CTestEGLServer* server = NULL;
    1.67 +	// Create the CTestServer derived server
    1.68 +	TRAPD(err, server = CTestEGLServer::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 +		sched->Start();
    1.74 +		}
    1.75 +	delete server;
    1.76 +	delete sched;
    1.77 +	}
    1.78 +
    1.79 +/**
    1.80 +  @return Standard Epoc error code on process exit
    1.81 +  Process entry point. Called by client using RProcess API
    1.82 +  */
    1.83 +TInt E32Main()
    1.84 +	{
    1.85 +	__UHEAP_MARK;
    1.86 +	CTrapCleanup* cleanup = CTrapCleanup::New();
    1.87 +	if(cleanup == NULL)
    1.88 +		{
    1.89 +		return KErrNoMemory;
    1.90 +		}
    1.91 +	TRAPD(err,MainL());
    1.92 +	
    1.93 +	if (err)
    1.94 +		{
    1.95 +		RDebug::Print(_L("CTestEGLServer::MainL - Error: %d"), err);
    1.96 +	   	User::Panic(KEGLTestServerName,err);
    1.97 +		}
    1.98 +		
    1.99 +	delete cleanup;
   1.100 +	REComSession::FinalClose();	
   1.101 +	__UHEAP_MARKEND;
   1.102 +	return KErrNone;
   1.103 +    }