Update contrib.
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #include <test/testexecutelog.h>
25 #include "CleanupStep.h"
26 #include "cafserver.h"
28 #include "dirstreamable.h"
29 #include "virtualpathptr.h"
31 #include "attributeset.h"
32 #include "stringattributeset.h"
33 #include "contentIterator.h"
35 using namespace ContentAccess;
37 _LIT(KDelDirTCAF,"C:\\tcaf\\");
38 _LIT(KDelDirTCAFSub,"C:\\tcaf\\testdata\\");
39 _LIT(KDelDirTCAFSub2,"C:\\tcaf\\testdata\\TestAgentPrivateDir\\");
40 _LIT(KDelDirTCAFSub3,"C:\\tcaf\\tmtputils\\");
42 _LIT(KDelDirTSCAF,"C:\\tcaf\\tscaf\\");
43 _LIT(KDelDirTSCAFSub,"C:\\tcaf\\tscaf\\data\\");
45 _LIT(KDelDirRTA,"C:\\rta\\");
46 _LIT(KDelDirRTASub,"C:\\rta\\testdata\\");
49 * This step deletes the test folders and files used in the CAF and RTA tests.
52 CCAFTestCleanupStep::~CCAFTestCleanupStep()
56 CCAFTestCleanupStep::CCAFTestCleanupStep(CCAFServer& aParent) : iParent(aParent)
58 SetTestStepName(KCAFTestCleanupStep);
61 TVerdict CCAFTestCleanupStep::doTestStepL()
65 SetTestStepResult(EPass);
70 CFileMan* fileMan = CFileMan::NewL(fs);
71 CleanupStack::PushL(fileMan);
73 // Make the files writeable
74 MakeFilesWritable(*fileMan, KDelDirTCAFSub2());
75 MakeFilesWritable(*fileMan, KDelDirTCAFSub());
76 MakeFilesWritable(*fileMan, KDelDirTCAFSub3());
77 MakeFilesWritable(*fileMan, KDelDirTSCAFSub());
78 MakeFilesWritable(*fileMan, KDelDirTSCAF());
79 MakeFilesWritable(*fileMan, KDelDirTCAF());
81 // Delete directory using CFileMan
82 err = fileMan->RmDir(KDelDirTCAF);
83 RDebug::Print(_L("CFileMan Delete file %S - err = %d\n"), &KDelDirTCAF, err);
84 if((err!=KErrNone) && (err !=KErrPathNotFound))
85 SetTestStepResult(EFail);
87 // Make the files writeable
88 MakeFilesWritable(*fileMan, KDelDirRTASub());
89 MakeFilesWritable(*fileMan, KDelDirRTA());
91 // Delete directory using CFileMan
92 err = fileMan->RmDir(KDelDirRTA);
93 RDebug::Print(_L("CFileMan Delete file %S - err = %d\n"), &KDelDirRTA, err);
94 if((err!=KErrNone) && (err !=KErrPathNotFound))
95 SetTestStepResult(EFail);
97 CleanupStack::PopAndDestroy(fileMan);
101 return TestStepResult();
104 void CCAFTestCleanupStep::MakeFilesWritable(CFileMan& aFileMan, const TDesC& aDir)
106 TInt err = aFileMan.Attribs(aDir, 0, KEntryAttReadOnly, TTime(0), 0);
107 if((err!=KErrNone) && (err !=KErrPathNotFound))
108 SetTestStepResult(EFail);