systemhealthmanagement/systemhealthmgr/test/tstartupproperties/src/tstartupproperties_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 "tstartupproperties_server.h"
       
    23 #include "tstartupproperties_stepdefval.h"
       
    24 #include "tstartupproperties_stepinternalexternal.h"
       
    25 
       
    26 _LIT(KServerName, "tstartupproperties_server");
       
    27 
       
    28 CStartupPropertiesTestServer* CStartupPropertiesTestServer::NewLC()
       
    29 	{
       
    30 	CStartupPropertiesTestServer * server = new (ELeave) CStartupPropertiesTestServer();
       
    31 	CleanupStack::PushL(server);
       
    32 	server->StartL(KServerName);
       
    33 	return server;
       
    34 	}
       
    35 	
       
    36 
       
    37 static void MainL()
       
    38 	{
       
    39 	CActiveScheduler* sched = new(ELeave) CActiveScheduler;
       
    40 	CleanupStack::PushL(sched);	
       
    41 	CActiveScheduler::Install(sched);
       
    42 	
       
    43 	// Create the CTestServer derived server
       
    44 	CStartupPropertiesTestServer* server = CStartupPropertiesTestServer::NewLC();
       
    45 	RProcess::Rendezvous(KErrNone);
       
    46 	sched->Start();
       
    47 	
       
    48 	CleanupStack::PopAndDestroy(server);
       
    49 	CleanupStack::PopAndDestroy(sched);
       
    50 	}
       
    51 
       
    52 
       
    53 TInt E32Main()
       
    54 	{
       
    55 	__UHEAP_MARK;
       
    56 	
       
    57 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    58 	TInt err = KErrNoMemory;
       
    59 	if(cleanup)
       
    60 		{
       
    61 		TRAP(err, MainL());
       
    62 		delete cleanup;
       
    63 		}
       
    64 	
       
    65 	__UHEAP_MARKEND;
       
    66 	return err;
       
    67     }//lint -e765 -e714 Suppress 'not referenced' and 'could be static'
       
    68 
       
    69 /**
       
    70  * @return - A CTestStep derived instance
       
    71  * Implementation of CTestServer pure virtual
       
    72  */
       
    73 CTestStep* CStartupPropertiesTestServer::CreateTestStep(const TDesC& aStepName)
       
    74 	{
       
    75 	CTestStep* testStep = NULL;
       
    76 
       
    77 	if (aStepName == KCTestCaseDefVal)
       
    78 		{
       
    79 		testStep = new CStartupPropertiesTestStepDefVal();
       
    80 		}
       
    81 	else if (aStepName == KCTestCaseInternalExternal)
       
    82 		{
       
    83 		testStep = new CStartupPropertiesTestStepInternalExternal();
       
    84 		}
       
    85 	else 
       
    86 		{
       
    87 		RDebug::Printf("Unknown startupproperties teststep %S", &aStepName);	
       
    88 		}
       
    89 	
       
    90 	return testStep;
       
    91 	}
       
    92