os/security/cryptomgmtlibs/securitytestfw/test/captestframework/captestframeworkserver.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptomgmtlibs/securitytestfw/test/captestframework/captestframeworkserver.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,100 @@
1.4 +/*
1.5 +* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +
1.23 +
1.24 +/**
1.25 + @file
1.26 +*/
1.27 +#include "captestframeworkserver.h"
1.28 +#include "captestframeworkstep.h"
1.29 +
1.30 +_LIT(KServerName,"captestframework");
1.31 +
1.32 +CCapTestFrameworkServer* CCapTestFrameworkServer::NewL()
1.33 +/**
1.34 + * @return - Instance of the test server
1.35 + * Called inside the MainL() function to create and start the
1.36 + * CTestServer derived server.
1.37 + */
1.38 + {
1.39 + CCapTestFrameworkServer * server = new (ELeave) CCapTestFrameworkServer();
1.40 + CleanupStack::PushL(server);
1.41 +
1.42 + server->ConstructL(KServerName);
1.43 + CleanupStack::Pop(server);
1.44 + return server;
1.45 + }
1.46 +
1.47 +LOCAL_C void MainL()
1.48 + {
1.49 + // Leave the hooks in for platform security
1.50 +#if (defined __DATA_CAGING__)
1.51 + RProcess().DataCaging(RProcess::EDataCagingOn);
1.52 + RProcess().SecureApi(RProcess::ESecureApiOn);
1.53 +#endif
1.54 + CActiveScheduler* sched=NULL;
1.55 + sched=new(ELeave) CActiveScheduler;
1.56 + CActiveScheduler::Install(sched);
1.57 + CCapTestFrameworkServer* server = NULL;
1.58 + // Create the CTestServer derived server
1.59 + TRAPD(err,server = CCapTestFrameworkServer::NewL());
1.60 + if(!err)
1.61 + {
1.62 + // Sync with the client and enter the active scheduler
1.63 + RProcess::Rendezvous(KErrNone);
1.64 + sched->Start();
1.65 + }
1.66 + delete server;
1.67 + delete sched;
1.68 + }
1.69 +
1.70 +GLDEF_C TInt E32Main()
1.71 +/**
1.72 + * @return - Standard Epoc error code on exit
1.73 + */
1.74 + {
1.75 + CTrapCleanup* cleanup = CTrapCleanup::New();
1.76 + if(cleanup == NULL)
1.77 + {
1.78 + return KErrNoMemory;
1.79 + }
1.80 +
1.81 + TRAPD(err,MainL());
1.82 + delete cleanup;
1.83 + return err;
1.84 + }
1.85 +
1.86 +CTestStep* CCapTestFrameworkServer::CreateTestStep(const TDesC& aStepName)
1.87 +/**
1.88 + * @return - A CTestStep derived instance
1.89 + * Implementation of CTestServer pure virtual
1.90 + */
1.91 + {
1.92 + if (aStepName == KRunBasicCapabilityChecks)
1.93 + {
1.94 + return new CCapTestFrameworkStep(CCapTestFrameworkStep::EBasicChecks);
1.95 + }
1.96 + else if (aStepName == KRunThoroughCapabilityChecks)
1.97 + {
1.98 + return new CCapTestFrameworkStep(CCapTestFrameworkStep::EThoroughChecks);
1.99 + }
1.100 +
1.101 + return NULL;
1.102 + }
1.103 +