os/security/authorisation/userpromptservice/database/test/tupsdb/source/tupsdb.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/authorisation/userpromptservice/database/test/tupsdb/source/tupsdb.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,98 @@
     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 + @file
    1.24 +*/
    1.25 +
    1.26 +#include "tupsdb.h" // TEF Test Server
    1.27 +#include "tupsdbstep.h" // TEF Steps Test Code
    1.28 +
    1.29 +
    1.30 +CTUpsDbServer* CTUpsDbServer::NewL()
    1.31 +/**
    1.32 + * @return - Instance of the test server
    1.33 + * Called inside the MainL() function to create and start the
    1.34 + * CTestServer derived server.
    1.35 + */
    1.36 +	{	
    1.37 +	CTUpsDbServer * server = new (ELeave) CTUpsDbServer();
    1.38 +	CleanupStack::PushL(server);
    1.39 +
    1.40 +	server->ConstructL(KDbServerName);
    1.41 +	CleanupStack::Pop(server);
    1.42 +	return server;
    1.43 +	}
    1.44 +	
    1.45 +
    1.46 +LOCAL_C void MainL()
    1.47 +/**
    1.48 + * Secure variant
    1.49 + * Much simpler, uses the new Rendezvous() call to sync with the client
    1.50 + */
    1.51 +	{
    1.52 +	
    1.53 +	CActiveScheduler *sched = new(ELeave) CActiveScheduler;
    1.54 +	CActiveScheduler::Install(sched);
    1.55 +
    1.56 +	CTUpsDbServer* server = NULL;
    1.57 +	
    1.58 +	// Create the CTestServer derived server
    1.59 +	TRAPD(err,server = CTUpsDbServer::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 +		
    1.67 +	delete server;
    1.68 +	delete sched;
    1.69 +	}
    1.70 +
    1.71 +GLDEF_C TInt E32Main()
    1.72 +/**
    1.73 + * @return - Standard Epoc error code on process exit
    1.74 + * Process entry point. Called by client using RProcess API
    1.75 + */
    1.76 +	{
    1.77 +	__UHEAP_MARK;
    1.78 +	CTrapCleanup* cleanup = CTrapCleanup::New();
    1.79 +	if(cleanup == NULL)
    1.80 +		{
    1.81 +		return KErrNoMemory;
    1.82 +		}
    1.83 +	TRAPD(err,MainL());
    1.84 +	delete cleanup;
    1.85 +	__UHEAP_MARKEND;
    1.86 +	return err;
    1.87 +    }
    1.88 +	
    1.89 +
    1.90 +CTestStep* CTUpsDbServer::CreateTestStep(const TDesC& aStepName)
    1.91 +	{
    1.92 +	// Initialise test step object to NULL if no TEF steps are assigned
    1.93 +	CTestStep* testStep = NULL;
    1.94 +
    1.95 +	if(aStepName == KStepPerformance)
    1.96 +		testStep = new CUpsDbStepPerformance();
    1.97 +	else if (aStepName == KStepUnitTest)
    1.98 +		testStep = new CUpsDbStepUnitTest();
    1.99 +
   1.100 +	return testStep;
   1.101 +	}