sysstatemgmt/systemstarter/test/tsysstart2/src/tsysstart2_server.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2007-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 #include "tsysstart2_server.h"
       
    18 
       
    19 #include "tsysstart2_teststep.h"
       
    20 #include "tsysstart2_procmon.h"
       
    21 #include "tsysstart2_procmondeferred.h"
       
    22 #include "tsysstart2_procstart.h"
       
    23 
       
    24 _LIT(KServerName, "tsysstart2");
       
    25 
       
    26 CAppFwkSysStart2TestServer* CAppFwkSysStart2TestServer::NewL()
       
    27 	{
       
    28 	CAppFwkSysStart2TestServer * server = new (ELeave) CAppFwkSysStart2TestServer();
       
    29 	CleanupStack::PushL(server);
       
    30 	
       
    31 	server->StartL(KServerName);
       
    32 	CleanupStack::Pop(server);
       
    33 	return server;
       
    34 	}
       
    35 	
       
    36 
       
    37 LOCAL_C void MainL()
       
    38 	{
       
    39 	CActiveScheduler* sched=NULL;
       
    40 	sched=new(ELeave) CActiveScheduler;
       
    41 	CActiveScheduler::Install(sched);
       
    42 
       
    43 	// Create the CTestServer derived server, sync with the client and enter the active scheduler
       
    44 	CAppFwkSysStart2TestServer* server = CAppFwkSysStart2TestServer::NewL();
       
    45 	RProcess::Rendezvous(KErrNone);
       
    46 	sched->Start();
       
    47 
       
    48 	delete server;
       
    49 	delete sched;
       
    50 	}
       
    51 
       
    52 
       
    53 GLDEF_C TInt E32Main()
       
    54 	{
       
    55 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    56 	
       
    57 	if( cleanup == NULL )
       
    58 		{
       
    59 		return KErrNoMemory;
       
    60 		}
       
    61 		
       
    62 	TRAPD( err, MainL() );
       
    63 	
       
    64 	if ( KErrNone != err)
       
    65 		{
       
    66 		RDebug::Print( _L("MainL - Error: %d"), err );
       
    67 	   	User::Panic( KServerName, err );
       
    68 		}
       
    69 	
       
    70 	
       
    71 	delete cleanup;
       
    72 	return KErrNone;
       
    73     }
       
    74 
       
    75 
       
    76 
       
    77 CTestStep* CAppFwkSysStart2TestServer::CreateTestStep(const TDesC& aStepName)
       
    78 /**
       
    79  * @return - A CTestStep derived instance
       
    80  * Implementation of CTestServer pure virtual
       
    81  */
       
    82 	{
       
    83 	CTestStep* testStep = NULL;
       
    84 
       
    85 	if (aStepName == KCTestCaseProcMon)
       
    86 		{
       
    87 		testStep = new CAppFwkSysStart2TestStepProcMon();
       
    88 		}
       
    89 	else if (aStepName == KCTestCaseProcMonDeferred)
       
    90 		{
       
    91 		testStep = new CAppFwkSysStart2TestStepProcMonDeferred();
       
    92 		}
       
    93 	else if (aStepName == KCTestCaseProcStart)
       
    94 		{
       
    95 		testStep = new CAppFwkSysStart2TestStepProcStart();
       
    96 		}
       
    97 
       
    98 	return testStep;
       
    99 	}
       
   100