// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//

/**
 @file
 @test
 @internalComponent - Internal Symbian test code  
*/



#include <s32mem.h>
#include "temergencycallrf_adaptationplugin_step.h"

//
// Run the tests
//

CTestEmergencyCallRfAdaptationPlugin::CTestEmergencyCallRfAdaptationPlugin()
	:CAdaptationTestBase(KTCTestEmergencyCallRfAdaptationPlugin)
	{
	
	}

CTestEmergencyCallRfAdaptationPlugin::~CTestEmergencyCallRfAdaptationPlugin()
	{

	}


void CTestEmergencyCallRfAdaptationPlugin::TestActivateRfForEmergencyCall()
	{
	INFO_PRINTF1(_L(" >CTestEmergencyCallRfAdaptationPlugin::TestActivateRfForEmergencyCall"));

	//TRequestStatus status;
	iSsmEmergencyCallRfAdaptation.ActivateRfForEmergencyCall(iStatus);
	User::WaitForRequest(iStatus);

	INFO_PRINTF2(_L("CTestEmergencyCallRfAdaptationPlugin::TestActivateRfForEmergencyCall completed with %d error>"), iStatus.Int());	
	}

void CTestEmergencyCallRfAdaptationPlugin::TestDeactivateRfForEmergencyCall()
	{
	INFO_PRINTF1(_L(" >CTestEmergencyCallRfAdaptationPlugin::TestDeactivateRfForEmergencyCall"));
	
	iSsmEmergencyCallRfAdaptation.DeactivateRfForEmergencyCall(iStatus);
	User::WaitForRequest(iStatus);

	INFO_PRINTF2(_L("CTestEmergencyCallRfAdaptationPlugin::TestDeactivateRfForEmergencyCall completed with %d error>"), iStatus.Int());
	}

void CTestEmergencyCallRfAdaptationPlugin::TestCancel()
	{
	INFO_PRINTF1(_L(" >CTestEmergencyCallRfAdaptationPlugin::TestCancel"));
	iSsmEmergencyCallRfAdaptation.Cancel();
	INFO_PRINTF1(_L(" CTestEmergencyCallRfAdaptationPlugin::TestCancel>"));	
	}



//from CAdaptationTestBase
TVerdict CTestEmergencyCallRfAdaptationPlugin::doTestStepL()
	{
	TInt err = KErrNone;

	__UHEAP_MARK;
	
	TRAP(err, TestActivateRfForEmergencyCall());
	TEST(iStatus.Int() == KErrDisconnected);
	TEST(err == KErrNone);
	TRAP(err, TestDeactivateRfForEmergencyCall());
	TEST(err == KErrNone);
	TEST(iStatus.Int() == KErrDisconnected);
	
	User::LeaveIfError(iSsmEmergencyCallRfAdaptation.Connect());
	

	TRAP(err, TestActivateRfForEmergencyCall());
	TEST(err == KErrNone);
	TEST(iStatus.Int() == KErrNone);
	
	TRAP(err, TestDeactivateRfForEmergencyCall());
	TEST(err == KErrNone);
	TEST(iStatus.Int() == KErrNone);
	TestCancel();
	//TestRelease();			// have to test this part too ...

	__UHEAP_MARKEND;

	return TestStepResult();
	}
