os/security/cryptomgmtlibs/securitytestfw/test/testhandler_on_testexecute/testexecuteinterface.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptomgmtlibs/securitytestfw/test/testhandler_on_testexecute/testexecuteinterface.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,89 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-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 "testexecuteinterface.h"
    1.27 +#include "server.h"
    1.28 +
    1.29 +
    1.30 +namespace TestExecuteInterface
    1.31 +	{
    1.32 +	class TMain
    1.33 +		{
    1.34 +	public:
    1.35 +		TMain(TScriptTests* aTestTypes, const TDesC& aServerName);
    1.36 +		void MainL();
    1.37 +
    1.38 +	private:
    1.39 +		void SignalClientL();
    1.40 +
    1.41 +	private:
    1.42 +		TScriptTests* iTestTypes;
    1.43 +		TPtrC iServerName;
    1.44 +		};
    1.45 +}
    1.46 +
    1.47 +
    1.48 +using namespace TestExecuteInterface;
    1.49 +
    1.50 +EXPORT_C TInt TestExecuteInterface::StartWinsEka1Thread(
    1.51 +		TInt (*)(), const TDesC&)
    1.52 +	{
    1.53 +	// EKA2 version or hardware versions do not implement this
    1.54 +	return KErrNone;
    1.55 +	}
    1.56 +
    1.57 +EXPORT_C void TestExecuteInterface::StartWithTestExecuteL(TScriptTests theTestTypes[],
    1.58 +														  const TDesC& aServerName)
    1.59 +	{
    1.60 +	TMain(theTestTypes, aServerName).MainL();
    1.61 +	}
    1.62 +
    1.63 +TMain::TMain(TScriptTests* aTestTypes, const TDesC& aServerName)
    1.64 +	: iTestTypes(aTestTypes), iServerName(aServerName)
    1.65 +	{
    1.66 +	}
    1.67 +
    1.68 +void TMain::MainL()
    1.69 +	{
    1.70 +	CActiveScheduler* sched=NULL;
    1.71 +	sched=new (ELeave) CActiveScheduler;
    1.72 +	CleanupStack::PushL(sched);
    1.73 +	CActiveScheduler::Install(sched);
    1.74 +	CServer* server = new CServer (iTestTypes);
    1.75 +	if(server)
    1.76 +		{
    1.77 +		CleanupStack::PushL(server);
    1.78 +		server->StartL(iServerName);
    1.79 +		SignalClientL();
    1.80 +		CleanupStack::Pop(server);
    1.81 +		sched->Start();
    1.82 +		}
    1.83 +	CleanupStack::Pop(sched);
    1.84 +	delete server;
    1.85 +	delete sched;
    1.86 +	}
    1.87 +
    1.88 +void TMain::SignalClientL()
    1.89 +	{
    1.90 +	RProcess::Rendezvous(KErrNone);
    1.91 +	}
    1.92 +