sl@0: // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** @file sl@0: @test sl@0: */ sl@0: sl@0: #include sl@0: sl@0: #include "egltestrefserver.h" sl@0: #include "egltestrefstep.h" sl@0: sl@0: sl@0: _LIT(KEGLTestServerName,"egltestrefserver"); sl@0: sl@0: sl@0: CTestStep* CTestEGLRefServer::CreateTestStep(const TDesC& aStepName) sl@0: { sl@0: return EglTestStepFactory::GetEglTestStep(aStepName); sl@0: } sl@0: sl@0: CTestEGLRefServer* CTestEGLRefServer::NewL() sl@0: { sl@0: CTestEGLRefServer* server = new(ELeave) CTestEGLRefServer(); sl@0: CleanupStack::PushL(server); sl@0: // CServer base class call sl@0: TParsePtrC serverName(RProcess().FileName()); sl@0: server->StartL(serverName.Name()); sl@0: CleanupStack::Pop(server); sl@0: return server; sl@0: } sl@0: sl@0: static void MainL() sl@0: { sl@0: CActiveScheduler* sched=NULL; sl@0: sched=new(ELeave) CActiveScheduler; sl@0: CActiveScheduler::Install(sched); sl@0: sl@0: #ifdef __WINS__ sl@0: // Construct and destroy a process-wide state object in emulator builds. sl@0: // This will cause initialisation of PLS for EGL and SgDriver sl@0: // and allow checking for leaks in tests sl@0: if(!eglReleaseThread()) sl@0: { sl@0: // Call to eglReleaseThread failed sl@0: User::Leave(KErrGeneral); sl@0: } sl@0: #endif //__WINS__ sl@0: sl@0: CTestEGLRefServer* server = NULL; sl@0: // Create the CTestServer derived server sl@0: TRAPD(err, server = CTestEGLRefServer::NewL()); sl@0: if(!err) sl@0: { sl@0: // Sync with the client and enter the active scheduler sl@0: RProcess::Rendezvous(KErrNone); sl@0: sched->Start(); sl@0: } sl@0: delete server; sl@0: delete sched; sl@0: } sl@0: sl@0: /** sl@0: @return Standard Epoc error code on process exit sl@0: Process entry point. Called by client using RProcess API sl@0: */ sl@0: TInt E32Main() sl@0: { sl@0: __UHEAP_MARK; sl@0: CTrapCleanup* cleanup = CTrapCleanup::New(); sl@0: if(cleanup == NULL) sl@0: { sl@0: return KErrNoMemory; sl@0: } sl@0: TRAPD(err,MainL()); sl@0: sl@0: if (err) sl@0: { sl@0: RDebug::Print(_L("CTestEGLRefServer::MainL - Error: %d"), err); sl@0: User::Panic(KEGLTestServerName,err); sl@0: } sl@0: sl@0: delete cleanup; sl@0: REComSession::FinalClose(); sl@0: __UHEAP_MARKEND; sl@0: return KErrNone; sl@0: }