cryptomgmtlibs/securitytestfw/test/captestframework/captestframeworkserver.cpp
changeset 8 35751d3474b7
equal deleted inserted replaced
2:675a964f4eb5 8:35751d3474b7
       
     1 /*
       
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 /**
       
    22  @file 
       
    23 */
       
    24 #include "captestframeworkserver.h"
       
    25 #include "captestframeworkstep.h"
       
    26 
       
    27 _LIT(KServerName,"captestframework");
       
    28 
       
    29 CCapTestFrameworkServer* CCapTestFrameworkServer::NewL()
       
    30 /**
       
    31  * @return - Instance of the test server
       
    32  * Called inside the MainL() function to create and start the
       
    33  * CTestServer derived server.
       
    34  */
       
    35 	{
       
    36 	CCapTestFrameworkServer * server = new (ELeave) CCapTestFrameworkServer();
       
    37 	CleanupStack::PushL(server);
       
    38 	
       
    39 	server->ConstructL(KServerName);
       
    40 	CleanupStack::Pop(server);
       
    41 	return server;
       
    42 	}
       
    43 
       
    44 LOCAL_C void MainL()
       
    45 	{
       
    46 	// Leave the hooks in for platform security
       
    47 #if (defined __DATA_CAGING__)
       
    48 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    49 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    50 #endif
       
    51 	CActiveScheduler* sched=NULL;
       
    52 	sched=new(ELeave) CActiveScheduler;
       
    53 	CActiveScheduler::Install(sched);
       
    54 	CCapTestFrameworkServer* server = NULL;
       
    55 	// Create the CTestServer derived server
       
    56 	TRAPD(err,server = CCapTestFrameworkServer::NewL());
       
    57 	if(!err)
       
    58 		{
       
    59 		// Sync with the client and enter the active scheduler
       
    60 		RProcess::Rendezvous(KErrNone);
       
    61 		sched->Start();
       
    62 		}
       
    63 	delete server;
       
    64 	delete sched;
       
    65 	}
       
    66 
       
    67 GLDEF_C TInt E32Main()
       
    68 /**
       
    69  * @return - Standard Epoc error code on exit
       
    70  */
       
    71 	{
       
    72 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    73 	if(cleanup == NULL)
       
    74 		{
       
    75 		return KErrNoMemory;
       
    76 		}
       
    77 	
       
    78 	TRAPD(err,MainL());
       
    79 	delete cleanup;
       
    80 	return err;
       
    81 	}
       
    82 
       
    83 CTestStep* CCapTestFrameworkServer::CreateTestStep(const TDesC& aStepName)
       
    84 /**
       
    85  * @return - A CTestStep derived instance
       
    86  * Implementation of CTestServer pure virtual
       
    87  */
       
    88 	{
       
    89 	if (aStepName == KRunBasicCapabilityChecks)
       
    90 		{
       
    91 		return new CCapTestFrameworkStep(CCapTestFrameworkStep::EBasicChecks);
       
    92 		}
       
    93 	else if (aStepName == KRunThoroughCapabilityChecks)
       
    94 		{
       
    95 		return new CCapTestFrameworkStep(CCapTestFrameworkStep::EThoroughChecks);
       
    96 		}
       
    97 
       
    98 	return NULL;
       
    99 	}
       
   100