os/security/cryptomgmtlibs/securitytestfw/test/testhandler_on_testexecute/testexecuteinterface.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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  @file
    21 */
    22 
    23 #include "testexecuteinterface.h"
    24 #include "server.h"
    25 
    26 
    27 namespace TestExecuteInterface
    28 	{
    29 	class TMain
    30 		{
    31 	public:
    32 		TMain(TScriptTests* aTestTypes, const TDesC& aServerName);
    33 		void MainL();
    34 
    35 	private:
    36 		void SignalClientL();
    37 
    38 	private:
    39 		TScriptTests* iTestTypes;
    40 		TPtrC iServerName;
    41 		};
    42 }
    43 
    44 
    45 using namespace TestExecuteInterface;
    46 
    47 EXPORT_C TInt TestExecuteInterface::StartWinsEka1Thread(
    48 		TInt (*)(), const TDesC&)
    49 	{
    50 	// EKA2 version or hardware versions do not implement this
    51 	return KErrNone;
    52 	}
    53 
    54 EXPORT_C void TestExecuteInterface::StartWithTestExecuteL(TScriptTests theTestTypes[],
    55 														  const TDesC& aServerName)
    56 	{
    57 	TMain(theTestTypes, aServerName).MainL();
    58 	}
    59 
    60 TMain::TMain(TScriptTests* aTestTypes, const TDesC& aServerName)
    61 	: iTestTypes(aTestTypes), iServerName(aServerName)
    62 	{
    63 	}
    64 
    65 void TMain::MainL()
    66 	{
    67 	CActiveScheduler* sched=NULL;
    68 	sched=new (ELeave) CActiveScheduler;
    69 	CleanupStack::PushL(sched);
    70 	CActiveScheduler::Install(sched);
    71 	CServer* server = new CServer (iTestTypes);
    72 	if(server)
    73 		{
    74 		CleanupStack::PushL(server);
    75 		server->StartL(iServerName);
    76 		SignalClientL();
    77 		CleanupStack::Pop(server);
    78 		sched->Start();
    79 		}
    80 	CleanupStack::Pop(sched);
    81 	delete server;
    82 	delete sched;
    83 	}
    84 
    85 void TMain::SignalClientL()
    86 	{
    87 	RProcess::Rendezvous(KErrNone);
    88 	}
    89