1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicsdeviceinterface/screendriver/tsrc/TScdvServer.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,133 @@
1.4 +// Copyright (c) 2005-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 +#include "TScdvServer.h"
1.26 +#include "Tlld.h"
1.27 +#include "TScdvScaling.h"
1.28 +#include "TScdvTest.h"
1.29 +#include "TRWindows.h"
1.30 +
1.31 +#if defined(SYMBIAN_GRAPHICS_GCE)
1.32 +#include "TDirectScreenBitmap.h"
1.33 +#include "tscdvdevorientation.h"
1.34 +#endif //SYMBIAN_GRAPHICS_GCE
1.35 +
1.36 +/*
1.37 +z:\GraphicsTest\scdvtest.script
1.38 +*/
1.39 +
1.40 +_LIT(KServerName,"TScdvServer");
1.41 +
1.42 +CTScdvServer* CTScdvServer::NewL()
1.43 +/**
1.44 + @return - Instance of the test server
1.45 + Same code for Secure and non-secure variants
1.46 + Called inside the MainL() function to create and start the
1.47 + CTestServer derived server.
1.48 + */
1.49 + {
1.50 + CTScdvServer * server = new (ELeave) CTScdvServer();
1.51 + CleanupStack::PushL(server);
1.52 + // CServer base class call
1.53 + server->StartL(KServerName);
1.54 + CleanupStack::Pop(server);
1.55 + return server;
1.56 + }
1.57 +
1.58 +
1.59 +LOCAL_C void MainL()
1.60 +//
1.61 +// Secure variant
1.62 +// Much simpler, uses the new Rendezvous() call to sync with the client
1.63 +//
1.64 + {
1.65 +#if (defined __DATA_CAGING__)
1.66 + RProcess().DataCaging(RProcess::EDataCagingOn);
1.67 + RProcess().SecureApi(RProcess::ESecureApiOn);
1.68 +#endif
1.69 + CActiveScheduler* sched=NULL;
1.70 + sched=new(ELeave) CActiveScheduler;
1.71 + CActiveScheduler::Install(sched);
1.72 + CTScdvServer* server = NULL;
1.73 + // Create the CTestServer derived server
1.74 + TRAPD(err,server = CTScdvServer::NewL());
1.75 + if(!err)
1.76 + {
1.77 + // Sync with the client and enter the active scheduler
1.78 + RProcess::Rendezvous(KErrNone);
1.79 + sched->Start();
1.80 + }
1.81 + delete server;
1.82 + delete sched;
1.83 + }
1.84 +
1.85 +GLDEF_C TInt E32Main()
1.86 +
1.87 +/** @return - Standard Epoc error code on process exit
1.88 + Secure variant only
1.89 + Process entry point. Called by client using RProcess API
1.90 +*/
1.91 + {
1.92 + __UHEAP_MARK;
1.93 + CTrapCleanup* cleanup = CTrapCleanup::New();
1.94 + if(cleanup == NULL)
1.95 + {
1.96 + return KErrNoMemory;
1.97 + }
1.98 + TRAPD(err,MainL());
1.99 + // This if statement is here just to shut up RVCT, which would otherwise warn
1.100 + // that err was set but never used
1.101 + if (err)
1.102 + {
1.103 + err = KErrNone;
1.104 + }
1.105 + delete cleanup;
1.106 + __UHEAP_MARKEND;
1.107 + return KErrNone;
1.108 + }
1.109 +
1.110 +CTestStep* CTScdvServer::CreateTestStep(const TDesC& aStepName)
1.111 +/**
1.112 + @return - A CTestStep derived instance
1.113 + Secure and non-secure variants
1.114 + Implementation of CTestServer pure virtual
1.115 + */
1.116 + {
1.117 + CTestStep* testStep = NULL;
1.118 + if(aStepName == KTLowLevelStep)
1.119 + testStep = new CTLowLevelStep();
1.120 + else if(aStepName == KTLowLevel1Step)
1.121 + testStep = new CTLowLevel1Step();
1.122 + else if(aStepName == KTRWindowsStep)
1.123 + testStep = new CTRWindowsStep();
1.124 + else if(aStepName == KTScalingStep)
1.125 + testStep = new CTScalingStep();
1.126 + else if(aStepName == KTScdvStep)
1.127 + testStep = new CTScdvStep();
1.128 +#if defined(SYMBIAN_GRAPHICS_GCE)
1.129 + else if (aStepName == KTDevOrientationStep)
1.130 + testStep = new CTDevOrientationStep();
1.131 + else if(aStepName == KTDirectScreenBitmapStep)
1.132 + testStep = new CTDirectScreenBitmapStep();
1.133 +#endif //SYMBIAN_GRAPHICS_GCE
1.134 +
1.135 + return testStep;
1.136 + }