sysstatemgmt/systemstatemgr/test/tcle/src/tcle_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 
       
    23 #include "tcle_server.h"
       
    24 #include "tcle_step_rclesession.h"
       
    25 #include "tcle_step_rclesessionfail.h"
       
    26 #include "tcle_step_pause.h"
       
    27 #include "tcle_step_dwfs_bad.h"
       
    28 #include "tcle_step_dwfs_bad_norend.h"
       
    29 #include "tcle_step_dwfs_good.h"
       
    30 #include "tcle_step_fandf_bad.h"
       
    31 #include "tcle_step_fandf_good.h"
       
    32 #include "tcle_step_wfs_bad.h"
       
    33 #include "tcle_step_wfs_good.h"
       
    34 
       
    35 
       
    36 _LIT(KCleTestServerName, "CleTestServer");
       
    37 
       
    38 CCleTestServer* CCleTestServer::NewLC( )
       
    39 	{
       
    40 	CCleTestServer * server = new (ELeave) CCleTestServer();
       
    41 	CleanupStack::PushL(server);
       
    42 	TParsePtrC serverName(RProcess().FileName());	
       
    43 	server->StartL(serverName.Name());
       
    44 	return server;
       
    45 	}
       
    46 
       
    47 static void MainL()
       
    48 	{
       
    49 	CActiveScheduler* sched = new(ELeave) CActiveScheduler;
       
    50 	CleanupStack::PushL (sched);
       
    51 	CActiveScheduler::Install (sched);
       
    52 
       
    53 	CCleTestServer* server = CCleTestServer::NewLC( );
       
    54 	RProcess::Rendezvous (KErrNone );
       
    55 	sched->Start( );
       
    56 
       
    57 	CleanupStack::PopAndDestroy (server );
       
    58 	CleanupStack::PopAndDestroy (sched );
       
    59 	}
       
    60 
       
    61 /**
       
    62  Process entry point. Called by client using RProcess API
       
    63  @return - Standard Epoc error code on process exit
       
    64  */
       
    65 TInt E32Main(void)
       
    66 	{
       
    67 	__UHEAP_MARK;
       
    68 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    69 	if(cleanup == NULL)
       
    70 		{
       
    71 		return KErrNoMemory;
       
    72 		}
       
    73 	TRAPD(err,MainL());	
       
    74 	if (err)
       
    75 		{
       
    76 		_LIT(KMainErrorStatement, "CleTestServer::MainL - Error: %d");
       
    77 		RDebug::Print(KMainErrorStatement, err);
       
    78 	   	User::Panic(KCleTestServerName, err);
       
    79 		}		
       
    80 	delete cleanup;
       
    81 		
       
    82 	__UHEAP_MARKEND;
       
    83 	return KErrNone;
       
    84 	}
       
    85 
       
    86 /**
       
    87  @return - A CTestStep derived instance
       
    88  */
       
    89 CTestStep* CCleTestServer::CreateTestStep(const TDesC& aStepName )
       
    90 	{
       
    91 	CTestStep* testStep = NULL;
       
    92 	if (aStepName == KTCleRCleSessionStep)
       
    93 		{
       
    94 		testStep = new CCleRCleSessionTest();
       
    95 		}
       
    96 	else if (aStepName == KTClePauseStep)
       
    97 		{
       
    98 		testStep = new CClePauseTest();
       
    99 		}
       
   100 	else if (aStepName == KTCleFandFGoodStep)
       
   101 		{
       
   102 		testStep = new CCleFandFGoodStep();
       
   103 		}
       
   104 	else if (aStepName == KTCleFandFBadStep)
       
   105 		{
       
   106 		testStep = new CCleFandFBadStep();
       
   107 		}
       
   108 	else if (aStepName == KTCleWfsGoodStep)
       
   109 		{
       
   110 		testStep = new CCleWfsGoodStep();
       
   111 		}
       
   112 	else if (aStepName == KTCleWfsBadStep)
       
   113 		{
       
   114 		testStep = new CCleWfsBadStep();
       
   115 		}
       
   116 	else if (aStepName == KTCleDwfsGoodStep)
       
   117 		{
       
   118 		testStep = new CCleDwfsGoodStep();
       
   119 		}
       
   120 	else if (aStepName == KTCleDwfsBadStep)
       
   121 		{
       
   122 		testStep = new CCleDwfsBadStep();
       
   123 		}
       
   124 	else if (aStepName == KTCleDwfsBadNoRendStep)
       
   125 		{
       
   126 		testStep = new CCleDwfsBadNoRendStep();
       
   127 		}
       
   128 	else if (aStepName == KTCleRCleSessionFailStep)
       
   129 		{
       
   130 		testStep = new CCleRCleSessionFailTest();
       
   131 		}
       
   132 	else
       
   133 		{
       
   134 		RDebug::Printf ("Unknown CleTest step %S", &aStepName );
       
   135 		}
       
   136 
       
   137 	return testStep;
       
   138 	}