kerneltest/f32test/server/clean_prepdc.cpp
changeset 109 b3a1d9898418
parent 0 a41df078684a
child 257 3e88ff8f41d5
equal deleted inserted replaced
102:ef2a444a7410 109:b3a1d9898418
    16 // for the test may be carried out.
    16 // for the test may be carried out.
    17 // 
    17 // 
    18 //
    18 //
    19 
    19 
    20 
    20 
       
    21 #define __E32TEST_EXTENSION__
    21 #include <f32file.h>
    22 #include <f32file.h>
    22 #include <e32test.h>
    23 #include <e32test.h>
    23 #include <e32std.h>
    24 #include <e32std.h>
    24 #include <e32std_private.h>
    25 #include <e32std_private.h>
    25 #include <e32svr.h>
    26 #include <e32svr.h>
    54 //Tidy up after each security test
    55 //Tidy up after each security test
    55 //
    56 //
    56 	{
    57 	{
    57 	CFileMan* fMan=CFileMan::NewL(TheFs);
    58 	CFileMan* fMan=CFileMan::NewL(TheFs);
    58 	TInt r=fMan->RmDir(_L("\\Resource\\"));
    59 	TInt r=fMan->RmDir(_L("\\Resource\\"));
    59 	test(r==KErrNone || r==KErrPathNotFound);
    60 	test_Value(r, r == KErrNone || r==KErrPathNotFound);
    60 	r=fMan->RmDir(_L("\\Sys\\"));
    61 	r=fMan->RmDir(_L("\\Sys\\"));
    61 	test(r==KErrNone || r==KErrPathNotFound);
    62 	test_Value(r, r == KErrNone || r==KErrPathNotFound);
    62 	r=fMan->RmDir(_L("\\Private\\"));
    63 	r=fMan->RmDir(_L("\\Private\\"));
    63 	test(r==KErrNone || r==KErrPathNotFound);
    64 	test_Value(r, r == KErrNone || r==KErrPathNotFound);
    64 	delete fMan;
    65 	delete fMan;
    65 	}
    66 	}
    66 
    67 
    67 GLDEF_C void TestSetup()
    68 GLDEF_C void TestSetup()
    68 //
    69 //
    69 //creates files for each security test
    70 //creates files for each security test
    70 //
    71 //
    71 	{
    72 	{
    72 	TInt r=TheFs.MkDir(_L("\\Resource\\"));
    73 	TInt r=TheFs.MkDir(_L("\\Resource\\"));
    73 	test(r==KErrNone);
    74 	test_KErrNone(r);
    74 	r=TheFs.MkDir(_L("\\Sys\\"));
    75 	r=TheFs.MkDir(_L("\\Sys\\"));
    75 	test(r==KErrNone);
    76 	test_KErrNone(r);
    76 	RFile f;
    77 	RFile f;
    77 	r=f.Create(TheFs,_L("\\Resource\\resourcefile.txt"),EFileWrite);
    78 	r=f.Create(TheFs,_L("\\Resource\\resourcefile.txt"),EFileWrite);
    78 	test(r==KErrNone || r==KErrAlreadyExists);
    79 	test_Value(r, r == KErrNone || r==KErrAlreadyExists);
    79 	f.Close();
    80 	f.Close();
    80 	}	
    81 	}	
    81 
    82 
    82 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/)
    83 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/)
    83 //
    84 //
    84 // Calls all data caging tests after setting up the file system for them
    85 // Calls all data caging tests after setting up the file system for them
    85 //
    86 //
    86 	{
    87 	{
    87 	TBuf<30> tmp;
    88 	TBuf<30> tmp;
    88 	TInt r= TheFs.SessionPath(tmp);
    89 	TInt r= TheFs.SessionPath(tmp);
    89 	test(r==KErrNone);
    90 	test_KErrNone(r);
    90 	RDebug::Print(_L("sessp=%S"),&tmp);
    91 	RDebug::Print(_L("sessp=%S"),&tmp);
    91 	CleanupL();
    92 	CleanupL();
    92 	TestSetup();
    93 	TestSetup();
    93 	}
    94 	}