os/persistentdata/traceservices/tracefw/ulogger/unit_test/te-server/te_uloggerservertestsuiteserver.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2005-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 // Example file/test code to demonstrate how to develop a TestExecute Server
    15 // Developers should take this project as a template and substitute their own
    16 // for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
    17 // in the process of the client. The client initialises the server by calling the
    18 // one and only ordinal.
    19 // 
    20 //
    21 
    22 /**
    23  @file Te_UloggerServerTestSuiteServer.cpp
    24  @internalTechnology
    25 */
    26 
    27 #include "te_uloggerservertestsuiteserver.h"
    28 #include "uloggerservertest0step.h"
    29 #include "uloggerservertest1step.h"
    30 #include "uloggerservertest2step.h"
    31 #include "uloggerservertest3step.h"
    32 #include "uloggerservertest4step.h"
    33 #include "uloggerservertest5step.h"
    34 #include "uloggerservertest6step.h"
    35 
    36 using namespace Ulogger;
    37 _LIT(KServerNameTest,"Te_UloggerServerTestSuite");
    38 CTe_UloggerServerTestSuite* CTe_UloggerServerTestSuite::NewL()
    39 /**
    40  * @return - Instance of the test server
    41  * Same code for Secure and non-secure variants
    42  * Called inside the MainL() function to create and start the
    43  * CTestServer derived server.
    44  */
    45 	{
    46 	CTe_UloggerServerTestSuite * server = new (ELeave) CTe_UloggerServerTestSuite();
    47 	CleanupStack::PushL(server);
    48 
    49 	server->ConstructL(KServerNameTest);
    50 	CleanupStack::Pop(server);
    51 	return server;
    52 	}
    53 
    54 
    55 // Secure variants much simpler
    56 // For EKA2, just an E32Main and a MainL()
    57 
    58 LOCAL_C void MainL()
    59 	{
    60 	// Leave the hooks in for platform security
    61 #if (defined __DATA_CAGING__)
    62 	RProcess().DataCaging(RProcess::EDataCagingOn);
    63 	RProcess().DataCaging(RProcess::ESecureApiOn);
    64 #endif
    65 	CActiveScheduler* sched=NULL;
    66 	sched=new(ELeave) CActiveScheduler;
    67 	CActiveScheduler::Install(sched);
    68 	CTe_UloggerServerTestSuite* server = NULL;
    69 	// Create the CTestServer derived server
    70 	TRAPD(err,server = CTe_UloggerServerTestSuite::NewL());
    71 	if(!err)
    72 		{
    73 		// Sync with the client and enter the active scheduler
    74 		RProcess::Rendezvous(KErrNone);
    75 		sched->Start();
    76 		}
    77 	delete server;
    78 	delete sched;
    79 	}
    80 
    81 
    82 
    83 GLDEF_C TInt E32Main()
    84 	{
    85 	__UHEAP_MARK;
    86 	CTrapCleanup* cleanup = CTrapCleanup::New();
    87 	if(cleanup == NULL)
    88 		{
    89 		return KErrNoMemory;
    90 		}
    91 	TRAPD(err,MainL());
    92 	delete cleanup;
    93 	__UHEAP_MARKEND;
    94 	return err;
    95     }
    96 
    97 
    98 CTestStep* CTe_UloggerServerTestSuite::CreateTestStep(const TDesC& aStepName)
    99 /**
   100  * @return - A CTestStep derived instance
   101  * Secure and non-secure variants
   102  * Implementation of CTestServer pure virtual
   103  */
   104 	{
   105 	CTestStep* testStep = NULL;
   106 	
   107               if(aStepName == KUloggerServerTest0Step)
   108                             testStep = new CUloggerServerTest0Step();
   109               else if(aStepName == KUloggerServerTest1Step)
   110                             testStep = new CUloggerServerTest1Step();
   111               else if(aStepName == KUloggerServerTest2Step)
   112                             testStep = new CUloggerServerTest2Step();
   113               else if(aStepName == KUloggerServerTest3Step)
   114             	  			testStep = new CUloggerServerTest3Step();
   115               else if(aStepName == KUloggerServerTest4Step)
   116             	  			testStep = new CUloggerServerTest4Step();
   117               else if(aStepName == KUloggerServerTest5Step)
   118             	  			testStep = new CUloggerServerTest5Step();
   119               else if(aStepName == KUloggerServerTest6Step)
   120             	  			testStep = new CUloggerServerTest6Step();
   121 	return testStep;
   122 	}