sysstatemgmt/systemstarter/test/tapstart/src/tapstart_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  @file
       
    18  @test
       
    19  @internalComponent - Internal Symbian test code
       
    20 */
       
    21 
       
    22 #include "tapstart_server.h"
       
    23 #include "tapstart_step.h"
       
    24 
       
    25 _LIT(KServerName, "tapstart_server");
       
    26     
       
    27 static void MainL()
       
    28 	{
       
    29 	CActiveScheduler* sched = new(ELeave) CActiveScheduler;
       
    30 	CleanupStack::PushL(sched);	
       
    31 	CActiveScheduler::Install(sched);
       
    32 	
       
    33 	CApStartTestServer* server = CApStartTestServer::NewLC();
       
    34 	RProcess::Rendezvous(KErrNone);
       
    35 	sched->Start();
       
    36 	
       
    37 	CleanupStack::PopAndDestroy(server);
       
    38 	CleanupStack::PopAndDestroy(sched);
       
    39 	}
       
    40 
       
    41 TInt E32Main()
       
    42 	{
       
    43 	__UHEAP_MARK;
       
    44 	
       
    45 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    46 	TInt err = KErrNoMemory;
       
    47 	if(cleanup)
       
    48 		{
       
    49 		TRAP(err, MainL());
       
    50 		delete cleanup;
       
    51 		}
       
    52 	
       
    53 	__UHEAP_MARKEND;
       
    54 	return err;
       
    55     }
       
    56 
       
    57 CApStartTestServer* CApStartTestServer::NewLC()
       
    58 	{
       
    59 	CApStartTestServer * server = new (ELeave) CApStartTestServer();
       
    60 	CleanupStack::PushL(server);
       
    61 	server->StartL(KServerName);
       
    62 	return server;
       
    63 	}
       
    64 
       
    65 /**
       
    66  * @return - A CTestStep derived instance
       
    67  * Implementation of CTestServer pure virtual
       
    68  */
       
    69 CTestStep* CApStartTestServer::CreateTestStep(const TDesC& aStepName)
       
    70 	{
       
    71 	CTestStep* testStep = NULL;
       
    72 
       
    73 	if (aStepName == KCTestCaseApStart)
       
    74 		{
       
    75 		testStep = new CApStartTestStep();
       
    76 		}
       
    77 	else 
       
    78 		{
       
    79 		RDebug::Printf("Unknown apstart teststep %S", &aStepName);	
       
    80 		}
       
    81 	
       
    82 	return testStep;
       
    83 	}