diff -r 000000000000 -r af10295192d8 linklayercontrol/nullagt/TS_nullagt/src/NullagentPostDelete.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/linklayercontrol/nullagt/TS_nullagt/src/NullagentPostDelete.cpp Tue Jan 26 15:23:49 2010 +0200 @@ -0,0 +1,79 @@ +// Copyright (c) 2004-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: +// PRECOPY.CPP +// @file +// @internalComponent +// Pre Copy file preparation +// +// + +// EPOC includes +#include +#include + +// GenConn Test system includes +#include "NullAgentTestSteps.h" + +// +// +// Test Pre Copy +/* This New Class is added to move copyfile command from script file + This test does a copy operation +*/ +CNullAgentPostDelete::CNullAgentPostDelete() + { + // store the name of this test case + iTestStepName = _L("PostDeleteTest"); + } + +CNullAgentPostDelete::~CNullAgentPostDelete() + { + } + +// Copy Test Main Code +enum TVerdict CNullAgentPostDelete::doTestStepL( void ) + { + deleteFileL(KDestPath); + return EPass; + } + + +void CNullAgentPostDelete::deleteFileL (const TDesC& aFileName) + { + // create a fileserver + RFs fileSystem; + + User::LeaveIfError(fileSystem.Connect()); + CleanupClosePushL(fileSystem); + + // Remove read only flag + TInt ret = fileSystem.SetAtt(aFileName, 0, KEntryAttReadOnly); + if (ret == KErrNotFound) + { + // If file already removed then no need to delete it + Log(_L("File not found")); + CleanupStack::PopAndDestroy(&fileSystem); + return; + } + User::LeaveIfError(ret); + + Log(_L("Set file to read only")); + + // Delete file + User::LeaveIfError(fileSystem.Delete(aFileName)); + Log(_L("deleted file")); + + // clean up + CleanupStack::PopAndDestroy(&fileSystem); + }