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.
sl@0
     1
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/** @file
sl@0
    17
	@test
sl@0
    18
 */
sl@0
    19
sl@0
    20
#include <ecom/ecom.h>
sl@0
    21
sl@0
    22
#include "egltestrefserver.h"
sl@0
    23
#include "egltestrefstep.h"
sl@0
    24
sl@0
    25
sl@0
    26
_LIT(KEGLTestServerName,"egltestrefserver");
sl@0
    27
sl@0
    28
sl@0
    29
CTestStep* CTestEGLRefServer::CreateTestStep(const TDesC& aStepName)
sl@0
    30
	{
sl@0
    31
	return EglTestStepFactory::GetEglTestStep(aStepName);
sl@0
    32
	}
sl@0
    33
sl@0
    34
CTestEGLRefServer* CTestEGLRefServer::NewL()
sl@0
    35
	{
sl@0
    36
	CTestEGLRefServer* server = new(ELeave) CTestEGLRefServer();
sl@0
    37
	CleanupStack::PushL(server);
sl@0
    38
	// CServer base class call
sl@0
    39
	TParsePtrC serverName(RProcess().FileName());	
sl@0
    40
	server->StartL(serverName.Name());
sl@0
    41
	CleanupStack::Pop(server);
sl@0
    42
	return server;
sl@0
    43
	}
sl@0
    44
sl@0
    45
static void MainL()
sl@0
    46
	{
sl@0
    47
	CActiveScheduler* sched=NULL;
sl@0
    48
	sched=new(ELeave) CActiveScheduler;
sl@0
    49
	CActiveScheduler::Install(sched);
sl@0
    50
sl@0
    51
#ifdef __WINS__
sl@0
    52
	// Construct and destroy a process-wide state object in emulator builds.
sl@0
    53
	// This will cause initialisation of PLS for EGL and SgDriver
sl@0
    54
	// and allow checking for leaks in tests
sl@0
    55
	if(!eglReleaseThread())
sl@0
    56
		{
sl@0
    57
		// Call to eglReleaseThread failed
sl@0
    58
		User::Leave(KErrGeneral);
sl@0
    59
		}
sl@0
    60
#endif //__WINS__ 
sl@0
    61
sl@0
    62
	CTestEGLRefServer* server = NULL;
sl@0
    63
	// Create the CTestServer derived server
sl@0
    64
	TRAPD(err, server = CTestEGLRefServer::NewL());
sl@0
    65
	if(!err)
sl@0
    66
		{
sl@0
    67
		// Sync with the client and enter the active scheduler
sl@0
    68
		RProcess::Rendezvous(KErrNone);
sl@0
    69
		sched->Start();
sl@0
    70
		}
sl@0
    71
	delete server;
sl@0
    72
	delete sched;
sl@0
    73
	}
sl@0
    74
sl@0
    75
/**
sl@0
    76
  @return Standard Epoc error code on process exit
sl@0
    77
  Process entry point. Called by client using RProcess API
sl@0
    78
  */
sl@0
    79
TInt E32Main()
sl@0
    80
	{
sl@0
    81
	__UHEAP_MARK;
sl@0
    82
	CTrapCleanup* cleanup = CTrapCleanup::New();
sl@0
    83
	if(cleanup == NULL)
sl@0
    84
		{
sl@0
    85
		return KErrNoMemory;
sl@0
    86
		}
sl@0
    87
	TRAPD(err,MainL());
sl@0
    88
	
sl@0
    89
	if (err)
sl@0
    90
		{
sl@0
    91
		RDebug::Print(_L("CTestEGLRefServer::MainL - Error: %d"), err);
sl@0
    92
	   	User::Panic(KEGLTestServerName,err);
sl@0
    93
		}
sl@0
    94
		
sl@0
    95
	delete cleanup;
sl@0
    96
	REComSession::FinalClose();	
sl@0
    97
	__UHEAP_MARKEND;
sl@0
    98
	return KErrNone;
sl@0
    99
    }