diff -r 9f5ae1728557 -r db3f5fa34ec7 messagingfw/msgtestfw/TestActions/Base/src/CMtfTestActionDeleteMessageStore.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingfw/msgtestfw/TestActions/Base/src/CMtfTestActionDeleteMessageStore.cpp Wed Nov 03 22:41:46 2010 +0530 @@ -0,0 +1,91 @@ +// 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] +// DeleteMessageStore +// [Action Parameters] +// StorePath : Name of the messaging Store path to be deleted. +// [Action Description] +// Deletes specified message Store. +// [APIs Used] +// none. +// __ACTION_INFO_END__ +// +// + +/** + @file +*/ + +#include "CMtfTestActionDeleteMessageStore.h" +#include "CMtfTestCase.h" +#include "CMtfTestActionParameters.h" + +#include + + +CMtfTestAction* CMtfTestActionDeleteMessageStore::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) + { + CMtfTestActionDeleteMessageStore* self = new (ELeave) CMtfTestActionDeleteMessageStore(aTestCase); + CleanupStack::PushL(self); + self->ConstructL(aActionParameters); + CleanupStack::Pop(); + return self; + } + + +CMtfTestActionDeleteMessageStore::CMtfTestActionDeleteMessageStore(CMtfTestCase& aTestCase) + : CMtfSynchronousTestAction(aTestCase) + { + } + + +CMtfTestActionDeleteMessageStore::~CMtfTestActionDeleteMessageStore() + { + } + + +void CMtfTestActionDeleteMessageStore::ExecuteActionL() + { + TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionDeleteMessageStore); + HBufC* paramStorePath = ObtainParameterReferenceL(TestCase(),ActionParameters().Parameter(0)); + + TPtrC Store = paramStorePath->Des(); + RFs fs; + fs.Connect(); + CDictionaryFileStore* store = CDictionaryFileStore::SystemLC(fs); + const TUid KUidMsvMessageDriveStream = {0x1000163E}; + if (store->IsPresentL(KUidMsvMessageDriveStream)) + { + store->RemoveL(KUidMsvMessageDriveStream); + store->CommitL(); + } + CleanupStack::PopAndDestroy(store); + + CFileMan* fileMan = CFileMan::NewL(fs); + CleanupStack::PushL(fileMan); + TInt error; + error = fileMan->RmDir(Store); + error = fs.RmDir(Store); + if (!(error==KErrNotFound||error==KErrNone)) + { + User::Leave(KErrAccessDenied); + } + CleanupStack::PopAndDestroy(fileMan); + fs.Close(); + TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionDeleteMessageStore); + TestCase().ActionCompletedL(*this); + } + +