1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/t_stress/src/test_srv.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,95 @@
1.4 +// Copyright (c) 2008-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 - Internal Symbian test code
1.23 +*/
1.24 +
1.25 +
1.26 +#include "test_srv.h"
1.27 +#include "test_step_comparison.h"
1.28 +
1.29 +
1.30 +CWServTestSrv* CWServTestSrv::NewLC( )
1.31 + {
1.32 + CWServTestSrv* server = new (ELeave) CWServTestSrv();
1.33 + CleanupStack::PushL(server);
1.34 + TParsePtrC serverName(RProcess().FileName());
1.35 + server->StartL(serverName.Name());
1.36 + return server;
1.37 + }
1.38 +
1.39 +static void MainL()
1.40 + {
1.41 + CActiveScheduler* sched = new(ELeave) CActiveScheduler;
1.42 + CleanupStack::PushL (sched);
1.43 + CActiveScheduler::Install (sched);
1.44 +
1.45 + CWServTestSrv* server = CWServTestSrv::NewLC( );
1.46 + RProcess::Rendezvous (KErrNone );
1.47 + sched->Start( );
1.48 +
1.49 + CleanupStack::PopAndDestroy (server );
1.50 + CleanupStack::PopAndDestroy (sched );
1.51 + }
1.52 +
1.53 +/**
1.54 + Process entry point. Called by client using RProcess API
1.55 + @return - Standard Epoc error code on process exit
1.56 + */
1.57 +TInt E32Main(void) //lint -e765 -e714 Suppress 'not referenced' and 'could be static'
1.58 + {
1.59 +
1.60 + //__asm { int 3 };
1.61 + //__DEBUGGER();
1.62 + __UHEAP_MARK;
1.63 + CTrapCleanup* cleanup = CTrapCleanup::New();
1.64 + if(cleanup == NULL)
1.65 + {
1.66 + return KErrNoMemory;
1.67 + }
1.68 + TRAPD(err,MainL());
1.69 + if (err)
1.70 + {
1.71 + _LIT(KMainErrorStatement, "ProjectTestServer::MainL - Error: %d");
1.72 + RDebug::Print(KMainErrorStatement, err);
1.73 + _LIT(KProjectTestServerName, "ProjectTestServer");
1.74 + User::Panic(KProjectTestServerName, err);
1.75 + }
1.76 + delete cleanup;
1.77 +
1.78 + __UHEAP_MARKEND;
1.79 + return KErrNone;
1.80 + }
1.81 +
1.82 +/**
1.83 + @return - A CTestStep derived instance
1.84 + */
1.85 +CTestStep* CWServTestSrv::CreateTestStep(const TDesC& aStepName )
1.86 + {
1.87 + CTestStep* testStep = NULL;
1.88 + if (aStepName == KServStressTest)
1.89 + {
1.90 + testStep = new CWServTestStep();
1.91 + }
1.92 + else
1.93 + {
1.94 + RDebug::Printf ("Unknown test step %S", &aStepName );
1.95 + }
1.96 +
1.97 + return testStep;
1.98 + }