lafagnosticuifoundation/cone/tef/TMenuTestServer.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 // Copyright (c) 2006-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 "TMenuTestServer.h"
       
    24 #include "TMenu0Step.h"
       
    25 #include "TMenu1Step.h"
       
    26 #include "TVWASTEP.H"
       
    27 
       
    28 
       
    29 _LIT(KServerName,"TMenuTestServer");
       
    30 
       
    31 
       
    32 CTMenuTestServer* CTMenuTestServer::NewL()
       
    33 	{
       
    34 	CTMenuTestServer * server = new (ELeave) CTMenuTestServer();
       
    35 	CleanupStack::PushL(server);
       
    36 	server->StartL(KServerName);
       
    37 	CleanupStack::Pop(server);
       
    38 	return server;
       
    39 	}
       
    40 
       
    41 
       
    42 LOCAL_C void MainL()
       
    43 	{
       
    44 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    45 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    46 	CActiveScheduler* sched=NULL;
       
    47 	sched=new(ELeave) CActiveScheduler;
       
    48 	CActiveScheduler::Install(sched);
       
    49 	CTMenuTestServer* server = NULL;
       
    50 	// Create the CTestServer derived server
       
    51 	TRAPD(err,server = CTMenuTestServer::NewL());
       
    52 	if(!err)
       
    53 		{
       
    54 		// Sync with the client and enter the active scheduler
       
    55 		RProcess::Rendezvous(KErrNone);
       
    56 		sched->Start();
       
    57 		}
       
    58 	delete server;
       
    59 	delete sched;
       
    60 	}
       
    61 
       
    62 GLDEF_C TInt E32Main()
       
    63 	{
       
    64 	__UHEAP_MARK;
       
    65 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    66 	if(cleanup == NULL)
       
    67 		{
       
    68 		return KErrNoMemory;
       
    69 		}
       
    70 	TRAP_IGNORE(MainL());
       
    71 	delete cleanup;
       
    72 	__UHEAP_MARKEND;
       
    73 	return KErrNone;
       
    74     }
       
    75 
       
    76 
       
    77 
       
    78 CTestStep* CTMenuTestServer::CreateTestStep(const TDesC& aStepName)
       
    79 	{
       
    80 	CTestStep* testStep = NULL;
       
    81 
       
    82 	if(aStepName == KTMenu0Step)
       
    83 		{
       
    84 		testStep = new CTMenu0Step();
       
    85 		}
       
    86 	if(aStepName == KTMenu1Step)
       
    87 		{
       
    88 		testStep = new CTMenu1Step();
       
    89 		}
       
    90 	if(aStepName == KTVwaStep)
       
    91 		{
       
    92 		testStep = new CTVwaStep();
       
    93 		}
       
    94 	return testStep;
       
    95 	}