os/persistentdata/traceservices/tracefw/ulogger/unit_test/te-createconfig/te_createconfigserver.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 // User includes
    15 // 
    16 //
    17 
    18 #include "te_createconfigserver.h"
    19 #include "te_createconfigemptystep.h"
    20 #include "te_createconfigfullstep.h"
    21 
    22 _LIT(KServerName,"te_createconfigsuite");
    23 
    24 
    25 /**
    26  * Creates an instance of CTestCreateConfigServer object
    27  * @return a pointer to the new created CTestCreateConfigServer Object
    28  */
    29  
    30 CTestCreateConfigServer* CTestCreateConfigServer::NewL()
    31 	{
    32 	CTestCreateConfigServer* tracer = new (ELeave) CTestCreateConfigServer();
    33 	CleanupStack::PushL(tracer);
    34 	tracer->ConstructL(KServerName);
    35 	CleanupStack::Pop(tracer); 
    36 	return tracer;
    37 	}
    38 
    39 /**
    40  * Creates an instance of CTestStep object
    41  * @return a CTestStep derived instance
    42  * @param Test step name
    43  */
    44 
    45 CTestStep* CTestCreateConfigServer::CreateTestStep(const TDesC& aStepName)
    46 {
    47 	CTestStep* testStep = NULL;
    48 	if(aStepName == KCreateConfigEmptyStep)
    49 		testStep = new CCreateConfigEmptyTestStep();
    50 	else if(aStepName == KCreateConfigFullStep)
    51 		testStep = new CCreateConfigFUllTestStep();
    52 	return testStep;	
    53 }
    54 
    55 /**
    56  * Creates installs and starts the active scheduler 
    57  */
    58  
    59 LOCAL_C void MainL()
    60 	{
    61 	CActiveScheduler* sched=NULL;
    62 	sched=new(ELeave) CActiveScheduler;
    63 	CActiveScheduler::Install(sched);
    64 	
    65 	CTestCreateConfigServer* server = NULL;
    66 	TRAPD(err,server = CTestCreateConfigServer::NewL());
    67 	
    68 	if(!err)
    69 		{
    70  	  	RProcess::Rendezvous(KErrNone);
    71 	  	sched->Start(); 
    72 		}
    73 		
    74 	delete server;
    75 	delete sched;
    76 	}
    77 
    78 /**
    79  *	Entrypoint method, creates a cleanup trap and calls
    80  *  the application start method.
    81  *	@return Standard error code on exit.
    82  */ 
    83 GLDEF_C TInt E32Main()
    84 	{
    85     __UHEAP_MARK;
    86     CTrapCleanup* cleanup = CTrapCleanup::New();
    87    
    88 	if(cleanup == NULL)
    89 		{
    90 		return KErrNoMemory;
    91 		}
    92 	TRAP_IGNORE(MainL());
    93 	delete cleanup;
    94 	__UHEAP_MARKEND;
    95 
    96 	return KErrNone;
    97 	}
    98