os/graphics/egl/eglrefimpl/test/src/egltestrefserver.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 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 /** @file
    17 	@test
    18  */
    19 
    20 #include <ecom/ecom.h>
    21 
    22 #include "egltestrefserver.h"
    23 #include "egltestrefstep.h"
    24 
    25 
    26 _LIT(KEGLTestServerName,"egltestrefserver");
    27 
    28 
    29 CTestStep* CTestEGLRefServer::CreateTestStep(const TDesC& aStepName)
    30 	{
    31 	return EglTestStepFactory::GetEglTestStep(aStepName);
    32 	}
    33 
    34 CTestEGLRefServer* CTestEGLRefServer::NewL()
    35 	{
    36 	CTestEGLRefServer* server = new(ELeave) CTestEGLRefServer();
    37 	CleanupStack::PushL(server);
    38 	// CServer base class call
    39 	TParsePtrC serverName(RProcess().FileName());	
    40 	server->StartL(serverName.Name());
    41 	CleanupStack::Pop(server);
    42 	return server;
    43 	}
    44 
    45 static void MainL()
    46 	{
    47 	CActiveScheduler* sched=NULL;
    48 	sched=new(ELeave) CActiveScheduler;
    49 	CActiveScheduler::Install(sched);
    50 
    51 #ifdef __WINS__
    52 	// Construct and destroy a process-wide state object in emulator builds.
    53 	// This will cause initialisation of PLS for EGL and SgDriver
    54 	// and allow checking for leaks in tests
    55 	if(!eglReleaseThread())
    56 		{
    57 		// Call to eglReleaseThread failed
    58 		User::Leave(KErrGeneral);
    59 		}
    60 #endif //__WINS__ 
    61 
    62 	CTestEGLRefServer* server = NULL;
    63 	// Create the CTestServer derived server
    64 	TRAPD(err, server = CTestEGLRefServer::NewL());
    65 	if(!err)
    66 		{
    67 		// Sync with the client and enter the active scheduler
    68 		RProcess::Rendezvous(KErrNone);
    69 		sched->Start();
    70 		}
    71 	delete server;
    72 	delete sched;
    73 	}
    74 
    75 /**
    76   @return Standard Epoc error code on process exit
    77   Process entry point. Called by client using RProcess API
    78   */
    79 TInt E32Main()
    80 	{
    81 	__UHEAP_MARK;
    82 	CTrapCleanup* cleanup = CTrapCleanup::New();
    83 	if(cleanup == NULL)
    84 		{
    85 		return KErrNoMemory;
    86 		}
    87 	TRAPD(err,MainL());
    88 	
    89 	if (err)
    90 		{
    91 		RDebug::Print(_L("CTestEGLRefServer::MainL - Error: %d"), err);
    92 	   	User::Panic(KEGLTestServerName,err);
    93 		}
    94 		
    95 	delete cleanup;
    96 	REComSession::FinalClose();	
    97 	__UHEAP_MARKEND;
    98 	return KErrNone;
    99     }