cryptomgmtlibs/securitytestfw/test/testhandler_on_testexecute/testexecuteinterface.cpp
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     1 /*
       
     2 * Copyright (c) 2005-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 
       
    25 #include "testexecuteinterface.h"
       
    26 #include "server.h"
       
    27 
       
    28 
       
    29 namespace TestExecuteInterface
       
    30 	{
       
    31 	class TMain
       
    32 		{
       
    33 	public:
       
    34 		TMain(TScriptTests* aTestTypes, const TDesC& aServerName);
       
    35 		void MainL();
       
    36 
       
    37 	private:
       
    38 		void SignalClientL();
       
    39 
       
    40 	private:
       
    41 		TScriptTests* iTestTypes;
       
    42 		TPtrC iServerName;
       
    43 		};
       
    44 }
       
    45 
       
    46 
       
    47 using namespace TestExecuteInterface;
       
    48 
       
    49 EXPORT_C TInt TestExecuteInterface::StartWinsEka1Thread(
       
    50 		TInt (*)(), const TDesC&)
       
    51 	{
       
    52 	// EKA2 version or hardware versions do not implement this
       
    53 	return KErrNone;
       
    54 	}
       
    55 
       
    56 EXPORT_C void TestExecuteInterface::StartWithTestExecuteL(TScriptTests theTestTypes[],
       
    57 														  const TDesC& aServerName)
       
    58 	{
       
    59 	TMain(theTestTypes, aServerName).MainL();
       
    60 	}
       
    61 
       
    62 TMain::TMain(TScriptTests* aTestTypes, const TDesC& aServerName)
       
    63 	: iTestTypes(aTestTypes), iServerName(aServerName)
       
    64 	{
       
    65 	}
       
    66 
       
    67 void TMain::MainL()
       
    68 	{
       
    69 	CActiveScheduler* sched=NULL;
       
    70 	sched=new (ELeave) CActiveScheduler;
       
    71 	CleanupStack::PushL(sched);
       
    72 	CActiveScheduler::Install(sched);
       
    73 	CServer* server = new CServer (iTestTypes);
       
    74 	if(server)
       
    75 		{
       
    76 		CleanupStack::PushL(server);
       
    77 		server->StartL(iServerName);
       
    78 		SignalClientL();
       
    79 		CleanupStack::Pop(server);
       
    80 		sched->Start();
       
    81 		}
       
    82 	CleanupStack::Pop(sched);
       
    83 	delete server;
       
    84 	delete sched;
       
    85 	}
       
    86 
       
    87 void TMain::SignalClientL()
       
    88 	{
       
    89 	RProcess::Rendezvous(KErrNone);
       
    90 	}