lafagnosticuifoundation/bmpanimation/tef/TBmpAnimTestServer.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 // Non-secure versions will be xxxServer.Dll and require a thread to be started
       
    15 // in the process of the client. The client initialises the server by calling the
       
    16 // one and only ordinal.
       
    17 // 
       
    18 //
       
    19 
       
    20 /**
       
    21  @file
       
    22  @test
       
    23  @internalComponent - Internal Symbian test code
       
    24 */
       
    25 #include "TBmpAnimTestServer.h"
       
    26 #include "TAutoAnStep.h"
       
    27 #include "TBmpAnimStep.h"
       
    28 
       
    29 
       
    30 
       
    31 _LIT(KServerName,"TBmpAnimTestServer");
       
    32 CTBmpAnimTestServer* CTBmpAnimTestServer::NewL()
       
    33 /**
       
    34    @return - Instance of the test server
       
    35    Called inside the MainL() function to create and start the
       
    36    CTestServer derived server.
       
    37  */
       
    38 	{
       
    39 	CTBmpAnimTestServer * server = new (ELeave) CTBmpAnimTestServer();
       
    40 	CleanupStack::PushL(server);
       
    41 	// CServer base class call
       
    42 	server->StartL(KServerName);
       
    43 	CleanupStack::Pop(server);
       
    44 	return server;
       
    45 	}
       
    46 
       
    47 
       
    48 // EKA2 much simpler
       
    49 // Just an E32Main and a MainL()
       
    50 LOCAL_C void MainL()
       
    51 /**
       
    52    Much simpler, uses the new Rendezvous() call to sync with the client
       
    53  */
       
    54 	{
       
    55 	// Leave the hooks in for platform security
       
    56 #if (defined __DATA_CAGING__)
       
    57 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    58 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    59 #endif
       
    60 	CActiveScheduler* sched=NULL;
       
    61 	sched=new(ELeave) CActiveScheduler;
       
    62 	CActiveScheduler::Install(sched);
       
    63 
       
    64 	CTBmpAnimTestServer* server = NULL;
       
    65 	// Create the CTestServer derived server
       
    66 
       
    67 	TRAPD(err,server = CTBmpAnimTestServer::NewL());
       
    68 	if(!err)
       
    69 		{
       
    70 		// Sync with the client and enter the active scheduler
       
    71 		RProcess::Rendezvous(KErrNone);
       
    72 		sched->Start();
       
    73 		}
       
    74 	delete server;
       
    75 	delete sched;
       
    76 	}
       
    77 
       
    78 
       
    79 GLDEF_C TInt E32Main()
       
    80 /**
       
    81    @return - Standard Epoc error code on exit
       
    82  */
       
    83 	{
       
    84 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    85 	if(cleanup == NULL)
       
    86 		{
       
    87 		return KErrNoMemory;
       
    88 		}
       
    89 	TRAP_IGNORE(MainL());
       
    90 	delete cleanup;
       
    91 	return KErrNone;
       
    92     }
       
    93 
       
    94 
       
    95 
       
    96 
       
    97 CTestStep* CTBmpAnimTestServer::CreateTestStep(const TDesC& aStepName)
       
    98 /**
       
    99    @return - A CTestStep derived instance
       
   100    Secure and non-secure variants
       
   101    Implementation of CTestServer pure virtual
       
   102  */
       
   103 	{
       
   104 	CTestStep* testStep = NULL;
       
   105 	if(aStepName == KTAutoAnStep)
       
   106 		testStep = new CTAutoAnStep();
       
   107 	else if(aStepName == KTBmpAnimStep)
       
   108 		testStep = new CTBmpAnimStep();
       
   109 	return testStep;
       
   110 	}