sysstatemgmt/systemstatemgr/test/tcmd/src/tcmd_runcletestserver.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 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 //CmdCleTestServer created to test the commands reconstructed by the CLE
       
    15 
       
    16 /**
       
    17  @file
       
    18  @test
       
    19  @internalComponent - Internal Symbian test code 
       
    20 */
       
    21 
       
    22 #include "tcmd_runcletestserver.h"
       
    23 #include "tcmd_runclecmdtest.h"
       
    24 
       
    25 #include "ssmdebug.h"
       
    26 
       
    27 _LIT(KCmdCleTestServer, "CmdCleTestServer");
       
    28 
       
    29 CCmdCleTestServer* CCmdCleTestServer::NewLC( )
       
    30     {
       
    31     CCmdCleTestServer * server = new (ELeave) CCmdCleTestServer();
       
    32     CleanupStack::PushL(server);
       
    33     TParsePtrC serverName(RProcess().FileName());   
       
    34     server->StartL(serverName.Name());
       
    35     return server;
       
    36     }
       
    37 
       
    38 static void MainL()
       
    39     {
       
    40     CActiveScheduler* sched = new(ELeave) CActiveScheduler;
       
    41     CleanupStack::PushL (sched);
       
    42     CActiveScheduler::Install (sched);
       
    43 
       
    44     CCmdCleTestServer* server = CCmdCleTestServer::NewLC( );
       
    45     RProcess::Rendezvous (KErrNone );
       
    46     sched->Start( );
       
    47 
       
    48     CleanupStack::PopAndDestroy (server );
       
    49     CleanupStack::PopAndDestroy (sched );
       
    50     }
       
    51 
       
    52 /**
       
    53  Process entry point. Called by client using RProcess API
       
    54  @return - Standard Epoc error code on process exit
       
    55  */
       
    56 TInt E32Main(void)
       
    57     {
       
    58     __UHEAP_MARK;
       
    59     CTrapCleanup* cleanup = CTrapCleanup::New();
       
    60     if(cleanup == NULL)
       
    61         {
       
    62         return KErrNoMemory;
       
    63         }
       
    64     TRAPD(err,MainL()); 
       
    65     if (err)
       
    66         {
       
    67         _LIT(KMainErrorStatement, "CCmdCleTestServer::MainL - Error: %d");
       
    68         RDebug::Print(KMainErrorStatement, err);
       
    69         User::Panic(KCmdCleTestServer, err);
       
    70         }       
       
    71     delete cleanup;
       
    72         
       
    73     __UHEAP_MARKEND;
       
    74     return KErrNone;
       
    75     }
       
    76 
       
    77 /**
       
    78  @return - A CTestStep derived instance
       
    79  */
       
    80 CTestStep* CCmdCleTestServer::CreateTestStep(const TDesC& aStepName)
       
    81     {
       
    82     CTestStep* testStep = NULL;
       
    83     if (aStepName == KTCCmdRunCleTest)
       
    84         {
       
    85         testStep = new CCmdRunCleTest();
       
    86         }
       
    87     else
       
    88         {
       
    89         RDebug::Printf ("Unknown CustCmdTest step %S", &aStepName );
       
    90         }
       
    91 
       
    92     return testStep;
       
    93     }
       
    94