1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/lowlevellibsandfws/apputils/test/tef/ssnd/src/Tef_SSndServer.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,130 @@
1.4 +// Copyright (c) 2006-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 + @internalComponent
1.22 +*/
1.23 +
1.24 +#include "Tef_SSndServer.h"
1.25 +#include "ssndteststep.h"
1.26 +
1.27 +/**
1.28 +Called inside the MainL() function to create and start the
1.29 +CTestServer derived server.
1.30 +@return - Instance of the test server
1.31 +*/
1.32 +CSSndTestServer* CSSndTestServer::NewL()
1.33 + {
1.34 + CSSndTestServer * server = new (ELeave) CSSndTestServer();
1.35 + CleanupStack::PushL(server);
1.36 +
1.37 + // This test server uses different name after setcap
1.38 + TFileName exename = RProcess().FileName();
1.39 + TParsePtr pathparser(exename);
1.40 +
1.41 + // CServer base class call
1.42 + server->StartL(pathparser.Name());
1.43 + CleanupStack::Pop(server);
1.44 + return server;
1.45 + }
1.46 +
1.47 +LOCAL_C void MainL()
1.48 + {
1.49 + RProcess().DataCaging(RProcess::EDataCagingOn);
1.50 + RProcess().SecureApi(RProcess::ESecureApiOn);
1.51 +
1.52 + CActiveScheduler* sched=new(ELeave) CActiveScheduler;
1.53 + CActiveScheduler::Install(sched);
1.54 + CSSndTestServer* server = NULL;
1.55 + // Create the CTestServer derived server
1.56 + TRAPD(err,server = CSSndTestServer::NewL());
1.57 + if (KErrNone == err)
1.58 + {
1.59 + // Sync with the client and enter the active scheduler
1.60 + RProcess::Rendezvous(KErrNone);
1.61 + sched->Start();
1.62 + }
1.63 + delete server;
1.64 + delete sched;
1.65 + }
1.66 +
1.67 +
1.68 +GLDEF_C TInt E32Main()
1.69 +/**
1.70 + * @return - Standard Epoc error code on exit
1.71 + */
1.72 + {
1.73 + __UHEAP_MARK;
1.74 +
1.75 + CTrapCleanup* cleanup = CTrapCleanup::New();
1.76 + if(cleanup == NULL)
1.77 + {
1.78 + return KErrNoMemory;
1.79 + }
1.80 + TRAPD(err,MainL());
1.81 + delete cleanup;
1.82 +
1.83 + __UHEAP_MARKEND;
1.84 + return err;
1.85 + }
1.86 +
1.87 +CTestStep* CSSndTestServer::CreateTestStep(const TDesC& aStepName)
1.88 +/**
1.89 + * @return - A CTestStep derived instance
1.90 + * Implementation of CTestServer pure virtual
1.91 + */
1.92 + {
1.93 + CTestStep* testStep = NULL;
1.94 +
1.95 + if (aStepName == KResetDb)
1.96 + {
1.97 + testStep = new CResetDbStep();
1.98 + }
1.99 + else if (aStepName == KGetSound)
1.100 + {
1.101 + testStep = new CGetSoundStep();
1.102 + }
1.103 + else if (aStepName == KSetSound)
1.104 + {
1.105 + testStep = new CSetSoundStep();
1.106 + }
1.107 + else if (aStepName == KCorruptSound)
1.108 + {
1.109 + testStep = new CCorruptSoundStep();
1.110 + }
1.111 + else if (aStepName == KConcurrentSetSound)
1.112 + {
1.113 + testStep = new CConcurrentStep();
1.114 + }
1.115 + else if (aStepName == KLockoutTest)
1.116 + {
1.117 + testStep = new CLockoutTestStep();
1.118 + }
1.119 + else if (aStepName == KSystemSoundFileTest)
1.120 + {
1.121 + testStep = new CSystemSoundFileTestStep();
1.122 + }
1.123 + else if (aStepName == KGapTest)
1.124 + {
1.125 + testStep = new CGapTestStep();
1.126 + }
1.127 + else if (aStepName == KSoundFileNoPathTest)
1.128 + {
1.129 + testStep = new CSoundFileNoPathTestStep();
1.130 + }
1.131 +
1.132 + return testStep;
1.133 + }