diff -r 9f5ae1728557 -r db3f5fa34ec7 messagingfw/msgtestfw/TestActions/Base/src/CMtfTestActionExecuteMtmCommand.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingfw/msgtestfw/TestActions/Base/src/CMtfTestActionExecuteMtmCommand.cpp Wed Nov 03 22:41:46 2010 +0530 @@ -0,0 +1,105 @@ +// Copyright (c) 2003-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: +// __ACTION_INFO_BEGIN__ +// [Action Name] +// ExecuteMtmCommand +// [Action Parameters] +// Command : Value of the command. +// Mtm : Reference to the client MTM. +// Selection : Reference to the selection. +// CommandParameters : Reference to the command parameters. +// (SynchronousFlag) : Value of the flag which specifies if the command is executed synchronously. +// Default is false (asynchronous). +// [Action Description] +// Executes the specific MTM command. +// [APIs Used] +// __ACTION_INFO_END__ +// +// + +/** + @file +*/ + + +#include "CMtfTestActionExecuteMtmCommand.h" +#include "CMtfTestCase.h" +#include "CMtfTestActionParameters.h" +#include "MtfTestActionUtilsUser.h" + +#include + + +CMtfTestAction* CMtfTestActionExecuteMtmCommand::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) + { + CMtfTestActionExecuteMtmCommand* self = new (ELeave) CMtfTestActionExecuteMtmCommand(aTestCase); + CleanupStack::PushL(self); + self->ConstructL(aActionParameters); + CleanupStack::Pop(); + return self; + } + + +CMtfTestActionExecuteMtmCommand::CMtfTestActionExecuteMtmCommand(CMtfTestCase& aTestCase) + : CMtfTestAction(aTestCase) + { + } + + +CMtfTestActionExecuteMtmCommand::~CMtfTestActionExecuteMtmCommand() + { + } + + +void CMtfTestActionExecuteMtmCommand::ExecuteActionL() + { + TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionExecuteMtmCommand); + TInt paramCommand = ObtainValueParameterL(TestCase(),ActionParameters().Parameter(0)); + CBaseMtm* paramMtm = ObtainParameterReferenceL(TestCase(),ActionParameters().Parameter(1)); + CMsvEntrySelection* paramSelection = ObtainParameterReferenceL(TestCase(),ActionParameters().Parameter(2)); + HBufC8* paramCommandParameters = ObtainParameterReferenceL(TestCase(),ActionParameters().Parameter(3)); + TInt paramSynchronousFlag = ObtainValueParameterL(TestCase(),ActionParameters().Parameter(4),EFalse); + + TPtr8 commandParameters = paramCommandParameters->Des(); + + if (paramSynchronousFlag) + { + paramMtm->InvokeSyncFunctionL(paramCommand,*paramSelection,commandParameters); + TestCase().ActionCompletedL(*this); + } + else + { + iOperation = paramMtm->InvokeAsyncFunctionL(paramCommand,*paramSelection,commandParameters,iStatus); + CActiveScheduler::Add(this); + SetActive(); + } + TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionExecuteMtmCommand); + } + + +void CMtfTestActionExecuteMtmCommand::DoCancel() + { + iOperation->Cancel(); + } + + +void CMtfTestActionExecuteMtmCommand::RunL() + { + TInt err = MtfTestActionUtilsUser::FinalProgressStatus(*iOperation,iStatus); + delete iOperation; + User::LeaveIfError(err); + + TestCase().ActionCompletedL(*this); + } +