os/ossrv/lowlevellibsandfws/apputils/test/tef/ssnd/src/Tef_SSndServer.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2006-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  @internalComponent
    19 */
    20 
    21 #include "Tef_SSndServer.h"
    22 #include "ssndteststep.h"
    23 
    24 /**
    25 Called inside the MainL() function to create and start the
    26 CTestServer derived server.
    27 @return - Instance of the test server
    28 */
    29 CSSndTestServer* CSSndTestServer::NewL()
    30 	{
    31 	CSSndTestServer * server = new (ELeave) CSSndTestServer();
    32 	CleanupStack::PushL(server);
    33 
    34 	// This test server uses different name after setcap
    35 	TFileName exename = RProcess().FileName();
    36 	TParsePtr pathparser(exename);
    37 
    38 	// CServer base class call
    39 	server->StartL(pathparser.Name());
    40 	CleanupStack::Pop(server);
    41 	return server;
    42 	}
    43 	
    44 LOCAL_C void MainL()
    45 	{
    46 	RProcess().DataCaging(RProcess::EDataCagingOn);
    47 	RProcess().SecureApi(RProcess::ESecureApiOn);
    48 	
    49 	CActiveScheduler* sched=new(ELeave) CActiveScheduler;
    50 	CActiveScheduler::Install(sched);
    51 	CSSndTestServer* server = NULL;
    52 	// Create the CTestServer derived server
    53 	TRAPD(err,server = CSSndTestServer::NewL());
    54 	if (KErrNone == err)
    55 		{
    56 		// Sync with the client and enter the active scheduler
    57 		RProcess::Rendezvous(KErrNone);
    58 		sched->Start();
    59 		}
    60 	delete server;
    61 	delete sched;
    62 	}
    63 
    64 
    65 GLDEF_C TInt E32Main()
    66 /**
    67  * @return - Standard Epoc error code on exit
    68  */
    69 	{
    70 	__UHEAP_MARK;
    71 
    72 	CTrapCleanup* cleanup = CTrapCleanup::New();
    73 	if(cleanup == NULL)
    74 		{
    75 		return KErrNoMemory;
    76 		}
    77 	TRAPD(err,MainL());
    78 	delete cleanup;
    79 
    80 	__UHEAP_MARKEND;
    81 	return err;
    82     }
    83 
    84 CTestStep* CSSndTestServer::CreateTestStep(const TDesC& aStepName)
    85 /**
    86  * @return - A CTestStep derived instance
    87  * Implementation of CTestServer pure virtual
    88  */
    89 	{
    90 	CTestStep* testStep = NULL;
    91 
    92 	if (aStepName == KResetDb)
    93 		{
    94 		testStep = new CResetDbStep();
    95 		}
    96 	else if (aStepName == KGetSound)
    97 		{
    98 		testStep = new CGetSoundStep();
    99 		}
   100 	else if (aStepName == KSetSound)
   101 		{
   102 		testStep = new CSetSoundStep();
   103 		}
   104 	else if (aStepName == KCorruptSound)
   105 		{
   106 		testStep = new CCorruptSoundStep();
   107 		}
   108 	else if (aStepName == KConcurrentSetSound)
   109 		{
   110 		testStep = new CConcurrentStep();
   111 		}
   112 	else if (aStepName == KLockoutTest)
   113 		{
   114 		testStep = new CLockoutTestStep();
   115 		}
   116 	else if (aStepName == KSystemSoundFileTest)
   117 		{
   118 		testStep = new CSystemSoundFileTestStep();
   119 		}
   120 	else if (aStepName == KGapTest)
   121 		{
   122 		testStep = new CGapTestStep();
   123 		}
   124 	else if (aStepName == KSoundFileNoPathTest)
   125 		{
   126 		testStep = new CSoundFileNoPathTestStep();
   127 		}
   128 
   129 	return testStep;
   130 	}