installationservices/swidevicetools/test/tswiconsole/tswiconsolestep.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 11 Jun 2010 13:45:18 +0300
changeset 42 d17dc5398051
parent 0 ba25891c3a9e
permissions -rw-r--r--
Revision: 201021 Kit: 2010123

/*
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "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: 
* This file provides implementation for CTSwiConsoleStep
*
*/


#include <test/testexecutelog.h>
#include "tswiconsolestep.h"

_LIT(KOption, "option");
_LIT(KExpectedResult, "ExpectedResult");
_LIT(KSwiConsole, "z:\\sys\\bin\\swiconsole.exe");

CTSwiConsoleStep::CTSwiConsoleStep()
	{
	SetTestStepName(KTSwiConsoleStep);
	}

TVerdict CTSwiConsoleStep::doTestStepL()
	{
	SetTestStepResult(EFail);
	
	TPtrC appOption;
	if(!GetStringFromConfig(ConfigSection(),KOption, appOption))
		{
		ERR_PRINTF1(_L("Missing Option"));
		SetTestStepError(KErrBadName);
		return EFail;
		}
		
	TInt expectedResult = KErrNone;
	if(!GetIntFromConfig(ConfigSection(),KExpectedResult, expectedResult))
		{
		ERR_PRINTF1(_L("Missing Expected result"));
		SetTestStepError(KErrBadName);
		return EFail;
		}
	
	RProcess process;
	TInt err = process.Create(KSwiConsole, appOption);
	process.Resume();
	
	TRequestStatus status;
	process.Logon(status);
	User::WaitForRequest(status);
	
	TInt exitReason = process.ExitReason();
	
	INFO_PRINTF3(_L("Returned Result %d is compare with expected Result %d"), &exitReason,&expectedResult);
	
	if(exitReason == expectedResult)
		{
		SetTestStepResult(EPass);
		}
	else 
		{
		SetTestStepError(exitReason);
		SetTestStepResult(EFail);
		}
	
	process.Close();
	
	
	return TestStepResult();
	}