1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/f32test/server/clean_prepdc.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,93 @@
1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// f32test\server\clean_prepdc.cpp
1.18 +// This test call all the other datacaging tests so that the relevant configuration and cleanup
1.19 +// for the test may be carried out.
1.20 +//
1.21 +//
1.22 +
1.23 +
1.24 +#include <f32file.h>
1.25 +#include <e32test.h>
1.26 +#include <e32std.h>
1.27 +#include <e32std_private.h>
1.28 +#include <e32svr.h>
1.29 +#include <hal.h>
1.30 +#include "t_server.h"
1.31 +
1.32 +GLDEF_D RTest test(_L("clean_prepdc"));
1.33 +
1.34 +//_LIT(KResourcePath, "?:\\Resource\\");
1.35 +#ifndef __WINS__
1.36 +//_LIT(KSystemPath, "?:\\System\\");
1.37 +#else
1.38 +//_LIT(KSystemPath, "?:\\Sys\\");
1.39 +#endif
1.40 +//_LIT(KPrivatePath, "?:\\Private\\");
1.41 +
1.42 +//_LIT(Kt_dcroot, "t_dcroot");
1.43 +//_LIT(Kt_dctcb, "t_dctcb");
1.44 +//_LIT(Kt_dcnone, "t_dcnone");
1.45 +//_LIT(Kt_dcallfiles, "t_dcallfiles");
1.46 +//_LIT(Kt_dcdiskadmin, "t_dcdiskadmin");
1.47 +//_LIT(Kt_dcrootallfiles, "t_dcrootallfiles");
1.48 +//_LIT(Kt_dctcballfiles, "t_dctcballfiles");
1.49 +//_LIT(Kt_dcrootdiskadmin, "t_dcrootdiskadmin");
1.50 +//_LIT(Kt_dctcbdiskadmin, "t_dctcbdiskadmin");
1.51 +//_LIT(Kt_dcdiskadminallfiles, "t_dcdiskadminallfiles");
1.52 +
1.53 +
1.54 +
1.55 +GLDEF_C void CleanupL()
1.56 +//
1.57 +//Tidy up after each security test
1.58 +//
1.59 + {
1.60 + CFileMan* fMan=CFileMan::NewL(TheFs);
1.61 + TInt r=fMan->RmDir(_L("\\Resource\\"));
1.62 + test(r==KErrNone || r==KErrPathNotFound);
1.63 + r=fMan->RmDir(_L("\\Sys\\"));
1.64 + test(r==KErrNone || r==KErrPathNotFound);
1.65 + r=fMan->RmDir(_L("\\Private\\"));
1.66 + test(r==KErrNone || r==KErrPathNotFound);
1.67 + delete fMan;
1.68 + }
1.69 +
1.70 +GLDEF_C void TestSetup()
1.71 +//
1.72 +//creates files for each security test
1.73 +//
1.74 + {
1.75 + TInt r=TheFs.MkDir(_L("\\Resource\\"));
1.76 + test(r==KErrNone);
1.77 + r=TheFs.MkDir(_L("\\Sys\\"));
1.78 + test(r==KErrNone);
1.79 + RFile f;
1.80 + r=f.Create(TheFs,_L("\\Resource\\resourcefile.txt"),EFileWrite);
1.81 + test(r==KErrNone || r==KErrAlreadyExists);
1.82 + f.Close();
1.83 + }
1.84 +
1.85 +GLDEF_C void CallTestsL(/*TChar aDriveLetter*/)
1.86 +//
1.87 +// Calls all data caging tests after setting up the file system for them
1.88 +//
1.89 + {
1.90 + TBuf<30> tmp;
1.91 + TInt r= TheFs.SessionPath(tmp);
1.92 + test(r==KErrNone);
1.93 + RDebug::Print(_L("sessp=%S"),&tmp);
1.94 + CleanupL();
1.95 + TestSetup();
1.96 + }