os/graphics/windowing/windowserver/test/t_integ/src/t_wservintegserver.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2007-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 /**
    17  @file
    18  @test
    19  @internalComponent
    20 */
    21 
    22 //	User Includes
    23 #include "t_wservintegserver.h"
    24 #include "t_wservintegstepbase.h"
    25 #include "t_wservintegstepbasic.h"
    26 #include "t_wservintegstepdsa.h"
    27 #include "t_wservintegstepsurface.h"
    28 #include "t_wservintegstepfps.h"
    29 
    30 CT_WServIntegServer* CT_WServIntegServer::NewL()
    31 /**
    32  * @return - Instance of the test server
    33  * Same code for Secure and non-secure variants
    34  * Called inside the MainL() function to create and start the
    35  * CTestServer derived server.
    36  */
    37 	{
    38 	CT_WServIntegServer*	server = new (ELeave) CT_WServIntegServer();
    39 	CleanupStack::PushL(server);
    40 	server->ConstructL();
    41 	CleanupStack::Pop(server);
    42 	return server;
    43 	}
    44 
    45 void CT_WServIntegServer::ConstructL()
    46 	{
    47 	RProcess	handle = RProcess();
    48 	TParsePtrC	serverName(handle.FileName());
    49 	CTestServer::ConstructL(serverName.Name());
    50 	}
    51 
    52 LOCAL_C void MainL()
    53 /**
    54  * Secure variant
    55  * Much simpler, uses the new Rendezvous() call to sync with the client
    56  */
    57 	{
    58 #if (defined __DATA_CAGING__)
    59 	RProcess().DataCaging(RProcess::EDataCagingOn);
    60 	RProcess().SecureApi(RProcess::ESecureApiOn);
    61 #endif
    62 	CActiveScheduler*		sched=NULL;
    63 	sched=new(ELeave) CActiveScheduler;
    64 	CActiveScheduler::Install(sched);
    65 	CT_WServIntegServer*	server = NULL;
    66 	// Create the CTestServer derived server
    67 	TRAPD(err,server = CT_WServIntegServer::NewL());
    68 	if(!err)
    69 		{
    70 		// Sync with the client and enter the active scheduler
    71 		RProcess::Rendezvous(KErrNone);
    72 		sched->Start();
    73 		}
    74 	delete server;
    75 	delete sched;
    76 	}
    77 
    78 GLDEF_C TInt E32Main()
    79 /**
    80  * @return - Standard Epoc error code on process exit
    81  * Secure variant only
    82  * Process entry point. Called by client using RProcess Integ
    83  */
    84 	{
    85 	__UHEAP_MARK;
    86 	CTrapCleanup* cleanup = CTrapCleanup::New();
    87 	if(cleanup == NULL)
    88 		{
    89 		return KErrNoMemory;
    90 		}
    91 #if (defined TRAP_IGNORE)
    92 	TRAP_IGNORE(MainL());
    93 #else
    94 	TRAPD(err,MainL());
    95 #endif
    96 	delete cleanup;
    97 	__UHEAP_MARKEND;
    98 	return KErrNone;
    99     }
   100 
   101 CTestStep* CT_WServIntegServer::CreateTestStep(const TDesC& aStepName)
   102 /**
   103  * @return - A CTestStep derived instance
   104  * Secure and non-secure variants
   105  * Implementation of CTestServer pure virtual
   106  */
   107 	{
   108 	CTestStep*	testStep = NULL;
   109 
   110 	if ( aStepName==KT_WServIntegStep )
   111 		{
   112 		testStep=new CT_WServIntegStep();
   113 		}
   114 	else if ( aStepName==KT_WServIntegStepDsa )
   115 		{
   116 		testStep= new CT_WServIntegStepDsa();
   117 		}
   118 	else if ( aStepName==KT_WServIntegStepSurface )
   119 		{
   120 		testStep= new CT_WServIntegStepSurface();
   121 		}
   122 	else if ( aStepName==KT_WServIntegStepBasic )
   123 		{
   124 		testStep= new CT_WServIntegStepBasic();
   125 		}
   126 	else if ( aStepName==KT_WServIntegStepFps )
   127 		{
   128 		testStep= new CT_WServIntegStepFps();		
   129 		}
   130 
   131 	return testStep;
   132 	}