|
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // f32test\server\clean_prepdc.cpp |
|
15 // This test call all the other datacaging tests so that the relevant configuration and cleanup |
|
16 // for the test may be carried out. |
|
17 // |
|
18 // |
|
19 |
|
20 |
|
21 #include <f32file.h> |
|
22 #include <e32test.h> |
|
23 #include <e32std.h> |
|
24 #include <e32std_private.h> |
|
25 #include <e32svr.h> |
|
26 #include <hal.h> |
|
27 #include "t_server.h" |
|
28 |
|
29 GLDEF_D RTest test(_L("clean_prepdc")); |
|
30 |
|
31 //_LIT(KResourcePath, "?:\\Resource\\"); |
|
32 #ifndef __WINS__ |
|
33 //_LIT(KSystemPath, "?:\\System\\"); |
|
34 #else |
|
35 //_LIT(KSystemPath, "?:\\Sys\\"); |
|
36 #endif |
|
37 //_LIT(KPrivatePath, "?:\\Private\\"); |
|
38 |
|
39 //_LIT(Kt_dcroot, "t_dcroot"); |
|
40 //_LIT(Kt_dctcb, "t_dctcb"); |
|
41 //_LIT(Kt_dcnone, "t_dcnone"); |
|
42 //_LIT(Kt_dcallfiles, "t_dcallfiles"); |
|
43 //_LIT(Kt_dcdiskadmin, "t_dcdiskadmin"); |
|
44 //_LIT(Kt_dcrootallfiles, "t_dcrootallfiles"); |
|
45 //_LIT(Kt_dctcballfiles, "t_dctcballfiles"); |
|
46 //_LIT(Kt_dcrootdiskadmin, "t_dcrootdiskadmin"); |
|
47 //_LIT(Kt_dctcbdiskadmin, "t_dctcbdiskadmin"); |
|
48 //_LIT(Kt_dcdiskadminallfiles, "t_dcdiskadminallfiles"); |
|
49 |
|
50 |
|
51 |
|
52 GLDEF_C void CleanupL() |
|
53 // |
|
54 //Tidy up after each security test |
|
55 // |
|
56 { |
|
57 CFileMan* fMan=CFileMan::NewL(TheFs); |
|
58 TInt r=fMan->RmDir(_L("\\Resource\\")); |
|
59 test(r==KErrNone || r==KErrPathNotFound); |
|
60 r=fMan->RmDir(_L("\\Sys\\")); |
|
61 test(r==KErrNone || r==KErrPathNotFound); |
|
62 r=fMan->RmDir(_L("\\Private\\")); |
|
63 test(r==KErrNone || r==KErrPathNotFound); |
|
64 delete fMan; |
|
65 } |
|
66 |
|
67 GLDEF_C void TestSetup() |
|
68 // |
|
69 //creates files for each security test |
|
70 // |
|
71 { |
|
72 TInt r=TheFs.MkDir(_L("\\Resource\\")); |
|
73 test(r==KErrNone); |
|
74 r=TheFs.MkDir(_L("\\Sys\\")); |
|
75 test(r==KErrNone); |
|
76 RFile f; |
|
77 r=f.Create(TheFs,_L("\\Resource\\resourcefile.txt"),EFileWrite); |
|
78 test(r==KErrNone || r==KErrAlreadyExists); |
|
79 f.Close(); |
|
80 } |
|
81 |
|
82 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/) |
|
83 // |
|
84 // Calls all data caging tests after setting up the file system for them |
|
85 // |
|
86 { |
|
87 TBuf<30> tmp; |
|
88 TInt r= TheFs.SessionPath(tmp); |
|
89 test(r==KErrNone); |
|
90 RDebug::Print(_L("sessp=%S"),&tmp); |
|
91 CleanupL(); |
|
92 TestSetup(); |
|
93 } |