1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/t_integ/src/t_wservintegserver.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,132 @@
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 + @internalComponent
1.23 +*/
1.24 +
1.25 +// User Includes
1.26 +#include "t_wservintegserver.h"
1.27 +#include "t_wservintegstepbase.h"
1.28 +#include "t_wservintegstepbasic.h"
1.29 +#include "t_wservintegstepdsa.h"
1.30 +#include "t_wservintegstepsurface.h"
1.31 +#include "t_wservintegstepfps.h"
1.32 +
1.33 +CT_WServIntegServer* CT_WServIntegServer::NewL()
1.34 +/**
1.35 + * @return - Instance of the test server
1.36 + * Same code for Secure and non-secure variants
1.37 + * Called inside the MainL() function to create and start the
1.38 + * CTestServer derived server.
1.39 + */
1.40 + {
1.41 + CT_WServIntegServer* server = new (ELeave) CT_WServIntegServer();
1.42 + CleanupStack::PushL(server);
1.43 + server->ConstructL();
1.44 + CleanupStack::Pop(server);
1.45 + return server;
1.46 + }
1.47 +
1.48 +void CT_WServIntegServer::ConstructL()
1.49 + {
1.50 + RProcess handle = RProcess();
1.51 + TParsePtrC serverName(handle.FileName());
1.52 + CTestServer::ConstructL(serverName.Name());
1.53 + }
1.54 +
1.55 +LOCAL_C void MainL()
1.56 +/**
1.57 + * Secure variant
1.58 + * Much simpler, uses the new Rendezvous() call to sync with the client
1.59 + */
1.60 + {
1.61 +#if (defined __DATA_CAGING__)
1.62 + RProcess().DataCaging(RProcess::EDataCagingOn);
1.63 + RProcess().SecureApi(RProcess::ESecureApiOn);
1.64 +#endif
1.65 + CActiveScheduler* sched=NULL;
1.66 + sched=new(ELeave) CActiveScheduler;
1.67 + CActiveScheduler::Install(sched);
1.68 + CT_WServIntegServer* server = NULL;
1.69 + // Create the CTestServer derived server
1.70 + TRAPD(err,server = CT_WServIntegServer::NewL());
1.71 + if(!err)
1.72 + {
1.73 + // Sync with the client and enter the active scheduler
1.74 + RProcess::Rendezvous(KErrNone);
1.75 + sched->Start();
1.76 + }
1.77 + delete server;
1.78 + delete sched;
1.79 + }
1.80 +
1.81 +GLDEF_C TInt E32Main()
1.82 +/**
1.83 + * @return - Standard Epoc error code on process exit
1.84 + * Secure variant only
1.85 + * Process entry point. Called by client using RProcess Integ
1.86 + */
1.87 + {
1.88 + __UHEAP_MARK;
1.89 + CTrapCleanup* cleanup = CTrapCleanup::New();
1.90 + if(cleanup == NULL)
1.91 + {
1.92 + return KErrNoMemory;
1.93 + }
1.94 +#if (defined TRAP_IGNORE)
1.95 + TRAP_IGNORE(MainL());
1.96 +#else
1.97 + TRAPD(err,MainL());
1.98 +#endif
1.99 + delete cleanup;
1.100 + __UHEAP_MARKEND;
1.101 + return KErrNone;
1.102 + }
1.103 +
1.104 +CTestStep* CT_WServIntegServer::CreateTestStep(const TDesC& aStepName)
1.105 +/**
1.106 + * @return - A CTestStep derived instance
1.107 + * Secure and non-secure variants
1.108 + * Implementation of CTestServer pure virtual
1.109 + */
1.110 + {
1.111 + CTestStep* testStep = NULL;
1.112 +
1.113 + if ( aStepName==KT_WServIntegStep )
1.114 + {
1.115 + testStep=new CT_WServIntegStep();
1.116 + }
1.117 + else if ( aStepName==KT_WServIntegStepDsa )
1.118 + {
1.119 + testStep= new CT_WServIntegStepDsa();
1.120 + }
1.121 + else if ( aStepName==KT_WServIntegStepSurface )
1.122 + {
1.123 + testStep= new CT_WServIntegStepSurface();
1.124 + }
1.125 + else if ( aStepName==KT_WServIntegStepBasic )
1.126 + {
1.127 + testStep= new CT_WServIntegStepBasic();
1.128 + }
1.129 + else if ( aStepName==KT_WServIntegStepFps )
1.130 + {
1.131 + testStep= new CT_WServIntegStepFps();
1.132 + }
1.133 +
1.134 + return testStep;
1.135 + }