author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 31 Aug 2010 16:34:26 +0300 | |
branch | RCL_3 |
changeset 43 | c1f20ce4abcf |
parent 0 | a41df078684a |
child 44 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
0 | 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 |
// |
|
15 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
16 |
#define __E32TEST_EXTENSION__ |
0 | 17 |
#include <f32file.h> |
18 |
#include <e32test.h> |
|
19 |
#include <e32std.h> |
|
20 |
#include <e32std_private.h> |
|
21 |
#include <e32def.h> |
|
22 |
#include <e32def_private.h> |
|
23 |
#include <e32svr.h> |
|
24 |
#include "t_server.h" |
|
25 |
||
26 |
GLDEF_D RTest test(_L("t_dcallfiles")); |
|
27 |
GLDEF_D TTime gTimeNow; |
|
28 |
LOCAL_D TInt gTheDriveNum; |
|
29 |
||
30 |
//_LIT(KDefPath, "\\Default\\"); |
|
31 |
||
32 |
const TInt KPathPosition = 2; |
|
33 |
_LIT(KExpectedPrivatePath, "\\Private\\00000001\\"); |
|
34 |
||
35 |
_LIT(KResourcePath, "?:\\Resource\\"); |
|
36 |
_LIT(KSystemPath, "?:\\Sys\\"); |
|
37 |
_LIT(KPrivatePath, "?:\\Private\\"); |
|
38 |
_LIT(KPrivateFalseID, "?:\\Private\\FFFFFFFF\\"); |
|
39 |
_LIT(KDriveName, "Billy"); |
|
40 |
//_LIT(KVolLable, "Benny"); |
|
41 |
||
42 |
_LIT(KFileSys, "systemfile.txt"); |
|
43 |
//_LIT(KFileSys2, "systemfile.tmp"); |
|
44 |
_LIT(KFileSys3, "sysfile.rna"); |
|
45 |
||
46 |
_LIT(KFilePri, "privatefile.txt"); |
|
47 |
_LIT(KFilePri2, "privatefile.tmp"); |
|
48 |
_LIT(KFilePri3, "prifile.rna"); |
|
49 |
||
50 |
_LIT(KFileRes, "resourcefile.txt"); |
|
51 |
//_LIT(KFileRes2, "resourcefile.tmp"); |
|
52 |
_LIT(KFileRes3, "resfile.rna"); |
|
53 |
||
54 |
_LIT(KMkDirSub,"Subdir\\"); |
|
55 |
_LIT(KOldFile,"?:\\Anyold.txt"); |
|
56 |
//_LIT(KNullPath, ""); |
|
57 |
//_LIT(KLFFSName, "Lffs"); |
|
58 |
||
59 |
_LIT(KWildPath, "Z:\\SYS\\"); |
|
60 |
_LIT(KWildFile, "*"); |
|
61 |
_LIT(KSysBinFile, "z:\\sys\\bin\\t_findcaptestfile.txt"); |
|
62 |
||
63 |
TInt theDrive=0; |
|
64 |
TCapability TheCaps; |
|
65 |
TBuf<4> driveBuf=_L("?:\\"); |
|
66 |
RFormat format; |
|
67 |
TInt count; |
|
68 |
RRawDisk rawdisk; |
|
69 |
RFile file1; |
|
70 |
RFile file2; |
|
71 |
RDir dir; |
|
72 |
CDir* dirEntries; |
|
73 |
TInt r; |
|
74 |
TBuf<40> fsname; |
|
75 |
TBuf<40> systestname; |
|
76 |
TBuf<40> pritestname; |
|
77 |
TBuf<40> restestname; |
|
78 |
TBuf<40> theprivatepath; |
|
79 |
TBuf<40> pritestfalseidname; |
|
80 |
TBuf<40> mkdirname; |
|
81 |
TFileName fromTemp; |
|
82 |
||
83 |
TBuf<40> shortfilename; |
|
84 |
TBuf<40> longfilename; |
|
85 |
TBuf<30> dirNameBuf; |
|
86 |
||
87 |
TRequestStatus aStat1; |
|
88 |
TRequestStatus aStat2; |
|
89 |
TRequestStatus aStat3; |
|
90 |
TRequestStatus aStat4; |
|
91 |
||
92 |
TBuf<40> systestfile; |
|
93 |
TBuf<40> pritestfile; |
|
94 |
TBuf<40> restestfile; |
|
95 |
TBuf<40> systestfile1; |
|
96 |
TBuf<40> pritestfile1; |
|
97 |
TBuf<40> restestfile1; |
|
98 |
TBuf<30> realName; |
|
99 |
TTime testtime; |
|
100 |
TBuf<20> oldName; |
|
101 |
||
102 |
TBuf<25> temp; |
|
103 |
||
104 |
TEntry entry; |
|
105 |
||
106 |
||
107 |
LOCAL_C void TestPathCheck() |
|
108 |
// |
|
109 |
// This test case is brought in by INC054580 |
|
110 |
// (NTT Renaming sys ¨Cfolder on C -drive on H2 allows user to access sys -files) |
|
111 |
// |
|
112 |
{ |
|
113 |
TInt r = TheFs.Rename(_L("\\sys"), _L("\\sysbad")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
114 |
test_Value(r, r == KErrPermissionDenied); |
0 | 115 |
r = TheFs.Rename(_L("\\resource"), _L("\\resourcebad")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
116 |
test_Value(r, r == KErrPermissionDenied); |
0 | 117 |
r = TheFs.Rename(_L("\\private"), _L("\\privatebad")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
118 |
test_KErrNone(r); |
0 | 119 |
r = TheFs.Rename(_L("\\privatebad"), _L("\\private")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
120 |
test_KErrNone(r); |
0 | 121 |
} |
122 |
||
123 |
LOCAL_C void systemRFstest() |
|
124 |
// |
|
125 |
// |
|
126 |
// |
|
127 |
{ |
|
128 |
//system |
|
129 |
systestname=KSystemPath; |
|
130 |
systestname[0]=(TText)('A' + gTheDriveNum); |
|
131 |
||
132 |
mkdirname.Zero(); |
|
133 |
mkdirname.Append(systestname); |
|
134 |
mkdirname.Append(KMkDirSub); |
|
135 |
r=TheFs.MkDirAll(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
136 |
test_Value(r, r == KErrPermissionDenied); |
0 | 137 |
|
138 |
r=TheFs.RmDir(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
139 |
test_Value(r, r == KErrPermissionDenied); |
0 | 140 |
|
141 |
r=TheFs.SetSubst(systestname,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
142 |
test_Value(r, r == KErrPermissionDenied); |
0 | 143 |
|
144 |
r=TheFs.SetSessionPath(systestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
145 |
test_KErrNone(r); |
0 | 146 |
|
147 |
TheFs.NotifyChange(ENotifyAll,aStat1,systestname); |
|
148 |
test(aStat1==KRequestPending); |
|
149 |
||
150 |
systestfile=KSystemPath; |
|
151 |
systestfile[0]=(TText)('A' + gTheDriveNum); |
|
152 |
systestfile1=systestfile; |
|
153 |
systestfile.Append(KFileSys); |
|
154 |
systestfile1.Append(KFileSys3); |
|
155 |
||
156 |
oldName=KOldFile; |
|
157 |
oldName[0]=(TText)gDriveToTest; |
|
158 |
||
159 |
r=TheFs.GetShortName(systestfile, shortfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
160 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 161 |
|
162 |
r=TheFs.GetLongName(systestfile1, longfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
163 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 164 |
|
165 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
166 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 167 |
file1.Close(); |
168 |
||
169 |
r=TheFs.Replace(oldName,systestfile); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
170 |
test_Value(r, r == KErrPermissionDenied); |
0 | 171 |
|
172 |
r=TheFs.Rename(systestfile,systestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
173 |
test_Value(r, r == KErrPermissionDenied); |
0 | 174 |
|
175 |
r=TheFs.Entry(systestfile1,entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
176 |
test_Value(r, r == KErrNone || r==KErrNotFound); |
0 | 177 |
|
178 |
r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
179 |
test_Value(r, r == KErrPermissionDenied); |
0 | 180 |
|
181 |
r=TheFs.Delete(systestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
182 |
test_Value(r, r == KErrPermissionDenied); |
0 | 183 |
|
184 |
} |
|
185 |
||
186 |
||
187 |
LOCAL_C void resourceRFstest() |
|
188 |
// |
|
189 |
// |
|
190 |
// |
|
191 |
{ |
|
192 |
//resource |
|
193 |
restestname=KResourcePath; |
|
194 |
restestname[0]=(TText)('A' + gTheDriveNum); |
|
195 |
||
196 |
mkdirname.Zero(); |
|
197 |
mkdirname.Append(restestname); |
|
198 |
mkdirname.Append(KMkDirSub); |
|
199 |
r=TheFs.MkDirAll(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
200 |
test_Value(r, r == KErrPermissionDenied); |
0 | 201 |
|
202 |
TheFs.RmDir(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
203 |
test_Value(r, r == KErrPermissionDenied); |
0 | 204 |
|
205 |
||
206 |
r=TheFs.SetSubst(restestname,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
207 |
test_Value(r, r == KErrPermissionDenied); |
0 | 208 |
|
209 |
r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
210 |
test_KErrNone(r); |
0 | 211 |
|
212 |
r=TheFs.SetSessionPath(restestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
213 |
test_KErrNone(r); |
0 | 214 |
|
215 |
TheFs.NotifyChange(ENotifyAll,aStat4,restestname); |
|
216 |
test(aStat4==KRequestPending); |
|
217 |
||
218 |
||
219 |
restestfile=KResourcePath; |
|
220 |
restestfile[0]=(TText)('A' + gTheDriveNum); |
|
221 |
restestfile1=restestfile; |
|
222 |
restestfile.Append(KFileRes); |
|
223 |
restestfile1.Append(KFileRes3); |
|
224 |
||
225 |
oldName=KOldFile; |
|
226 |
oldName[0]=(TText)gDriveToTest; |
|
227 |
||
228 |
r=TheFs.GetShortName(restestfile, shortfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
229 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 230 |
|
231 |
r=TheFs.GetLongName(restestfile1, longfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
232 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 233 |
|
234 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
235 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 236 |
file1.Close(); |
237 |
||
238 |
r=TheFs.Replace(oldName,restestfile); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
239 |
test_Value(r, r == KErrPermissionDenied); |
0 | 240 |
|
241 |
r=TheFs.Rename(restestfile,restestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
242 |
test_Value(r, r == KErrPermissionDenied); |
0 | 243 |
|
244 |
r=TheFs.Entry(restestfile1,entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
245 |
test_Value(r, r == KErrNone || r==KErrNotFound); |
0 | 246 |
|
247 |
r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
248 |
test_Value(r, r == KErrPermissionDenied); |
0 | 249 |
|
250 |
r=TheFs.Delete(restestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
251 |
test_Value(r, r == KErrPermissionDenied); |
0 | 252 |
|
253 |
} |
|
254 |
||
255 |
||
256 |
LOCAL_C void privatefalseIDRFstest() |
|
257 |
// |
|
258 |
// |
|
259 |
// |
|
260 |
{ |
|
261 |
//private//false ID |
|
262 |
pritestfalseidname=KPrivateFalseID; |
|
263 |
pritestfalseidname[0]=(TText)('A' + gTheDriveNum); |
|
264 |
||
265 |
mkdirname.Zero(); |
|
266 |
mkdirname.Append(pritestfalseidname); |
|
267 |
mkdirname.Append(KMkDirSub); |
|
268 |
||
269 |
r=TheFs.MkDirAll(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
270 |
test_KErrNone(r); |
0 | 271 |
|
272 |
r=TheFs.RmDir(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
273 |
test_KErrNone(r); |
0 | 274 |
|
275 |
r=TheFs.SetSubst(pritestfalseidname,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
276 |
test_Value(r, r == KErrPermissionDenied); |
0 | 277 |
|
278 |
r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
279 |
test_KErrNone(r); |
0 | 280 |
|
281 |
r=TheFs.SetSessionPath(pritestfalseidname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
282 |
test_KErrNone(r); |
0 | 283 |
|
284 |
TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname); |
|
285 |
test(aStat2==KRequestPending); |
|
286 |
||
287 |
pritestfile=KPrivateFalseID; |
|
288 |
pritestfile[0]=(TText)('A' + gTheDriveNum); |
|
289 |
pritestfile1=pritestfile; |
|
290 |
pritestfile.Append(KFilePri2); |
|
291 |
pritestfile1.Append(KFilePri3); |
|
292 |
||
293 |
oldName=KOldFile; |
|
294 |
oldName[0]=(TText)gDriveToTest; |
|
295 |
||
296 |
r=TheFs.GetShortName(pritestfile, shortfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
297 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 298 |
|
299 |
r=TheFs.GetLongName(pritestfile1, longfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
300 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 301 |
|
302 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
303 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 304 |
file1.Close(); |
305 |
||
306 |
r=TheFs.Replace(oldName,pritestfile); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
307 |
test_KErrNone(r); |
0 | 308 |
|
309 |
r=TheFs.Rename(pritestfile,pritestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
310 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 311 |
|
312 |
r=TheFs.Entry(pritestfile1,entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
313 |
test_KErrNone(r); |
0 | 314 |
|
315 |
r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
316 |
test_KErrNone(r); |
0 | 317 |
|
318 |
r=TheFs.Delete(pritestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
319 |
test_KErrNone(r); |
0 | 320 |
|
321 |
} |
|
322 |
||
323 |
||
324 |
LOCAL_C void privateRFstest() |
|
325 |
// |
|
326 |
// |
|
327 |
// |
|
328 |
{ |
|
329 |
//private |
|
330 |
pritestname=KPrivatePath; |
|
331 |
pritestname[0]=(TText)('A' + gTheDriveNum); |
|
332 |
||
333 |
mkdirname.Zero(); |
|
334 |
mkdirname.Append(pritestname); |
|
335 |
mkdirname.Append(KMkDirSub); |
|
336 |
||
337 |
r=TheFs.MkDirAll(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
338 |
test_KErrNone(r); |
0 | 339 |
|
340 |
r=TheFs.RmDir(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
341 |
test_KErrNone(r); |
0 | 342 |
|
343 |
r=TheFs.SetSubst(pritestname,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
344 |
test_Value(r, r == KErrPermissionDenied); |
0 | 345 |
|
346 |
r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
347 |
test_KErrNone(r); |
0 | 348 |
|
349 |
r=TheFs.SetSessionPath(pritestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
350 |
test_KErrNone(r); |
0 | 351 |
|
352 |
TheFs.NotifyChange(ENotifyAll,aStat2,pritestname); |
|
353 |
test(aStat2==KRequestPending); |
|
354 |
||
355 |
pritestfile=KPrivatePath; |
|
356 |
pritestfile[0]=(TText)('A' + gTheDriveNum); |
|
357 |
pritestfile1=pritestfile; |
|
358 |
pritestfile.Append(KFilePri2); |
|
359 |
pritestfile1.Append(KFilePri3); |
|
360 |
||
361 |
oldName=KOldFile; |
|
362 |
oldName[0]=(TText)gDriveToTest; |
|
363 |
||
364 |
r=TheFs.GetShortName(pritestfile, shortfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
365 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 366 |
|
367 |
r=TheFs.GetLongName(pritestfile1, longfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
368 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 369 |
|
370 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
371 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 372 |
file1.Close(); |
373 |
||
374 |
r=TheFs.Replace(oldName,pritestfile); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
375 |
test_KErrNone(r); |
0 | 376 |
|
377 |
r=TheFs.Rename(pritestfile,pritestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
378 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 379 |
|
380 |
r=TheFs.Entry(pritestfile1,entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
381 |
test_KErrNone(r); |
0 | 382 |
|
383 |
r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
384 |
test_KErrNone(r); |
0 | 385 |
|
386 |
r=TheFs.Delete(pritestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
387 |
test_KErrNone(r); |
0 | 388 |
|
389 |
} |
|
390 |
||
391 |
||
392 |
LOCAL_C void privateSIDRFstest() |
|
393 |
// |
|
394 |
// |
|
395 |
// |
|
396 |
{ |
|
397 |
//private/UID |
|
398 |
||
399 |
theprivatepath[0]=(TText)gDriveToTest; |
|
400 |
test.Printf(_L("the Private Path = %S"),&theprivatepath); |
|
401 |
||
402 |
mkdirname.Zero(); |
|
403 |
mkdirname.Append(theprivatepath); |
|
404 |
mkdirname.Append(KMkDirSub); |
|
405 |
r=TheFs.MkDirAll(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
406 |
test_KErrNone(r); |
0 | 407 |
|
408 |
r=TheFs.RmDir(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
409 |
test_KErrNone(r); |
0 | 410 |
|
411 |
r=TheFs.SetSubst(theprivatepath,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
412 |
test_Value(r, r == KErrPermissionDenied); |
0 | 413 |
|
414 |
r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
415 |
test_KErrNone(r); |
0 | 416 |
|
417 |
r=TheFs.SetSessionPath(theprivatepath); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
418 |
test_KErrNone(r); |
0 | 419 |
|
420 |
TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath); |
|
421 |
test(aStat3==KRequestPending); |
|
422 |
||
423 |
pritestfile=theprivatepath; |
|
424 |
pritestfile[0]=(TText)('A' + gTheDriveNum); |
|
425 |
pritestfile1=pritestfile; |
|
426 |
pritestfile.Append(KFilePri2); |
|
427 |
pritestfile1.Append(KFilePri3); |
|
428 |
||
429 |
oldName=KOldFile; |
|
430 |
oldName[0]=(TText)gDriveToTest; |
|
431 |
||
432 |
r=TheFs.GetShortName(pritestfile, shortfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
433 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 434 |
|
435 |
r=TheFs.GetLongName(pritestfile1, longfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
436 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 437 |
|
438 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
439 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 440 |
file1.Close(); |
441 |
||
442 |
r=TheFs.Replace(oldName,pritestfile); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
443 |
test_KErrNone(r); |
0 | 444 |
|
445 |
r=TheFs.Rename(pritestfile,pritestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
446 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 447 |
|
448 |
r=TheFs.Entry(pritestfile1,entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
449 |
test_KErrNone(r); |
0 | 450 |
|
451 |
r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
452 |
test_KErrNone(r); |
0 | 453 |
|
454 |
r=TheFs.Delete(pritestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
455 |
test_KErrNone(r); |
0 | 456 |
|
457 |
} |
|
458 |
||
459 |
||
460 |
LOCAL_C void systemRFiletest() |
|
461 |
// |
|
462 |
//RFile testing with session path set to //system// |
|
463 |
// |
|
464 |
{ |
|
465 |
||
466 |
||
467 |
r=TheFs.SetSessionPath(systestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
468 |
test_KErrNone(r); |
0 | 469 |
|
470 |
r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
471 |
test_Value(r, r == KErrPermissionDenied); |
0 | 472 |
|
473 |
||
474 |
TBuf<25> sysfilename; |
|
475 |
sysfilename.Append(systestname); |
|
476 |
sysfilename.Append(KFileSys); |
|
477 |
||
478 |
r=file1.Create(TheFs,sysfilename,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
479 |
test_Value(r, r == KErrPermissionDenied); |
0 | 480 |
|
481 |
r=file1.Open(TheFs,sysfilename,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
482 |
test_Value(r, r == KErrPermissionDenied); |
0 | 483 |
|
484 |
// DEF113117 |
|
485 |
r=file1.Open(TheFs, KSysBinFile, EFileShareReadersOnly | EFileRead | EFileReadBuffered); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
486 |
test_KErrNone(r); |
0 | 487 |
file1.Close(); |
488 |
||
489 |
r=file1.Open(TheFs, KSysBinFile, EFileStreamText | EFileReadBuffered | EFileReadAheadOn); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
490 |
test_KErrNone(r); |
0 | 491 |
file1.Close(); |
492 |
||
493 |
r=file1.Open(TheFs, KSysBinFile, EFileStreamText | EFileShareReadersOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
494 |
test_KErrNone(r); |
0 | 495 |
file1.Close(); |
496 |
||
497 |
r=file1.Open(TheFs,sysfilename,EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
498 |
test_Value(r, r == KErrNone || r==KErrNotFound); |
0 | 499 |
|
500 |
r=file1.Replace(TheFs,sysfilename,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
501 |
test_Value(r, r == KErrPermissionDenied); |
0 | 502 |
|
503 |
TFindFile finder(TheFs); |
|
504 |
CDir* dir = NULL; |
|
505 |
r=finder.FindWildByDir(KWildFile, KWildPath, dir); |
|
506 |
if (!(r==KErrNone)) |
|
507 |
test.Printf(_L("T_DCALLFILES: test find wildcards r = %d (expected KErrNone)\n"), r); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
508 |
test_Value(r, r == KErrNone || r==KErrNotFound); |
0 | 509 |
delete dir; |
510 |
} |
|
511 |
||
512 |
||
513 |
LOCAL_C void resourceRFiletest() |
|
514 |
// |
|
515 |
//RFile testing with session path set to //resource// |
|
516 |
// |
|
517 |
{ |
|
518 |
||
519 |
r=TheFs.SetSessionPath(restestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
520 |
test_KErrNone(r); |
0 | 521 |
|
522 |
r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
523 |
test_Value(r, r == KErrPermissionDenied); |
0 | 524 |
file1.Close(); |
525 |
||
526 |
r=file1.Create(TheFs,KFileRes,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
527 |
test_Value(r, r == KErrPermissionDenied); |
0 | 528 |
file1.Close(); |
529 |
||
530 |
r=file1.Open(TheFs,KFileRes,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
531 |
test_Value(r, r == KErrPermissionDenied); |
0 | 532 |
file1.Close(); |
533 |
||
534 |
r=file1.Open(TheFs,KFileRes,EFileRead|EFileShareReadersOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
535 |
test_Value(r, r == KErrNone || r==KErrNotFound); |
0 | 536 |
file1.Close(); |
537 |
||
538 |
r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
539 |
test_Value(r, r == KErrNone || r==KErrNotFound); |
0 | 540 |
file1.Close(); |
541 |
||
542 |
r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
543 |
test_Value(r, r == KErrPermissionDenied); |
0 | 544 |
file1.Close(); |
545 |
||
546 |
r=file1.Open(TheFs,KFileRes,EFileShareReadersOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
547 |
test_Value(r, r == KErrNone || r==KErrNotFound); |
0 | 548 |
|
549 |
r=file1.ChangeMode(EFileShareExclusive); //this is not illegal though will prevent shared access to resource which is nit my fault but may be desirable to prevent |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
550 |
test_KErrNone(r); |
0 | 551 |
|
552 |
//this operation is prevented as you can not open a file for write access in the resource directory |
|
553 |
r=file1.Rename(KFileRes3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
554 |
test_Value(r, r == KErrPermissionDenied); |
0 | 555 |
file1.Close(); |
556 |
||
557 |
r=file1.Replace(TheFs,KFileRes,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
558 |
test_Value(r, r == KErrPermissionDenied); |
0 | 559 |
file1.Close(); |
560 |
||
561 |
} |
|
562 |
||
563 |
||
564 |
LOCAL_C void privateFalseIDRFiletest() |
|
565 |
// |
|
566 |
//RFile testing with session path set to //Private//FalseID |
|
567 |
// |
|
568 |
{ |
|
569 |
||
570 |
r=TheFs.SetSessionPath(pritestfalseidname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
571 |
test_KErrNone(r); |
0 | 572 |
|
573 |
r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
574 |
test_KErrNone(r); |
0 | 575 |
file1.Close(); |
576 |
||
577 |
r=file1.Create(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
578 |
test_KErrNone(r); |
0 | 579 |
file1.Close(); |
580 |
||
581 |
r=file1.Open(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
582 |
test_KErrNone(r); |
0 | 583 |
file1.Close(); |
584 |
||
585 |
r=file1.Open(TheFs,KFilePri,EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
586 |
test_KErrNone(r); |
0 | 587 |
file1.Close(); |
588 |
||
589 |
r=file1.Replace(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
590 |
test_KErrNone(r); |
0 | 591 |
|
592 |
r=file1.Rename(KFilePri3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
593 |
test_Value(r, r == KErrNone || r== KErrAlreadyExists); |
0 | 594 |
file1.Close(); |
595 |
} |
|
596 |
||
597 |
||
598 |
||
599 |
LOCAL_C void privateRFiletest() |
|
600 |
// |
|
601 |
//RFile testing with session path set to //Private// |
|
602 |
// |
|
603 |
{ |
|
604 |
||
605 |
r=TheFs.SetSessionPath(pritestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
606 |
test_KErrNone(r); |
0 | 607 |
|
608 |
r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
609 |
test_KErrNone(r); |
0 | 610 |
file1.Close(); |
611 |
||
612 |
r=file1.Create(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
613 |
test_KErrNone(r); |
0 | 614 |
file1.Close(); |
615 |
||
616 |
r=file1.Open(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
617 |
test_KErrNone(r); |
0 | 618 |
file1.Close(); |
619 |
||
620 |
r=file1.Open(TheFs,KFilePri,EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
621 |
test_KErrNone(r); |
0 | 622 |
file1.Close(); |
623 |
||
624 |
r=file1.Replace(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
625 |
test_KErrNone(r); |
0 | 626 |
|
627 |
r=file1.Rename(KFilePri3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
628 |
test_Value(r, r == KErrNone || r== KErrAlreadyExists); |
0 | 629 |
file1.Close(); |
630 |
} |
|
631 |
||
632 |
||
633 |
LOCAL_C void privateSIDRFiletest() |
|
634 |
// |
|
635 |
// |
|
636 |
// |
|
637 |
{ |
|
638 |
//Rfile Testing with session path set to //Private//UID// |
|
639 |
||
640 |
r=TheFs.SetSessionToPrivate(gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
641 |
test_KErrNone(r); |
0 | 642 |
|
643 |
r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
644 |
test_KErrNone(r); |
0 | 645 |
file1.Close(); |
646 |
||
647 |
r=file1.Create(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
648 |
test_KErrNone(r); |
0 | 649 |
file1.Close(); |
650 |
||
651 |
r=file1.Open(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
652 |
test_KErrNone(r); |
0 | 653 |
file1.Close(); |
654 |
||
655 |
r=file1.Open(TheFs,KFilePri,EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
656 |
test_KErrNone(r); |
0 | 657 |
file1.Close(); |
658 |
||
659 |
r=file1.Replace(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
660 |
test_KErrNone(r); |
0 | 661 |
|
662 |
r=file1.Rename(KFilePri3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
663 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 664 |
file1.Close(); |
665 |
||
666 |
} |
|
667 |
||
668 |
||
669 |
LOCAL_C void RDirtest() |
|
670 |
// |
|
671 |
// |
|
672 |
// |
|
673 |
{ |
|
674 |
//system |
|
675 |
dirNameBuf.Zero(); |
|
676 |
dirNameBuf = KSystemPath; |
|
677 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
678 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
679 |
test_Value(r, r == KErrNone || r==KErrNotFound); |
0 | 680 |
dir.Close(); |
681 |
||
682 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
683 |
test_KErrNone(r); |
0 | 684 |
delete dirEntries; |
685 |
||
686 |
dirNameBuf.Zero(); |
|
687 |
//Private//falseID |
|
688 |
dirNameBuf=KPrivateFalseID; |
|
689 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
690 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
691 |
test_KErrNone(r); |
0 | 692 |
dir.Close(); |
693 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
694 |
test_KErrNone(r); |
0 | 695 |
dirNameBuf.Zero(); |
696 |
delete dirEntries; |
|
697 |
//Private |
|
698 |
dirNameBuf=KPrivatePath; |
|
699 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
700 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
701 |
test_KErrNone(r); |
0 | 702 |
dir.Close(); |
703 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
704 |
test_KErrNone(r); |
0 | 705 |
dirNameBuf.Zero(); |
706 |
delete dirEntries; |
|
707 |
//Private/uid |
|
708 |
TheFs.PrivatePath(dirNameBuf); |
|
709 |
dirNameBuf.Insert(0,_L("?:")); |
|
710 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
711 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
712 |
test_KErrNone(r); |
0 | 713 |
dir.Close(); |
714 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
715 |
test_KErrNone(r); |
0 | 716 |
dirNameBuf.Zero(); |
717 |
delete dirEntries; |
|
718 |
//Resource |
|
719 |
dirNameBuf=KResourcePath; |
|
720 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
721 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
722 |
test_Value(r, r == KErrNone || r==KErrNotFound); |
0 | 723 |
|
724 |
r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
725 |
test_KErrNone(r); |
0 | 726 |
delete dirEntries; |
727 |
dir.Close(); |
|
728 |
} |
|
729 |
||
730 |
||
731 |
||
732 |
||
733 |
||
734 |
LOCAL_C void testAllFiles() |
|
735 |
// |
|
736 |
// Test with only AllFiles Capability |
|
737 |
// |
|
738 |
{ |
|
739 |
r=TheFs.FileSystemName(fsname,gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
740 |
test_KErrNone(r); |
0 | 741 |
r=TheFs.DismountFileSystem(fsname,gTheDriveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
742 |
test_Value(r, r == KErrPermissionDenied); |
0 | 743 |
// r=TheFs.RemoveFileSystem(fsname); //can not test due to bug else where fix exists |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
744 |
// test_Value(r, r == KErrPermissionDenied); |
0 | 745 |
// r=TheFs.AddFileSystem(fsname); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
746 |
// test_Value(r, r == KErrPermissionDenied); |
0 | 747 |
r=TheFs.MountFileSystem(fsname,gTheDriveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
748 |
test_Value(r, r == KErrPermissionDenied); |
0 | 749 |
r=TheFs.SetDriveName(gTheDriveNum,KDriveName); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
750 |
test_Value(r, r == KErrPermissionDenied); |
0 | 751 |
// r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
752 |
// test_KErrNone(r); |
0 | 753 |
|
754 |
systemRFstest(); |
|
755 |
resourceRFstest(); |
|
756 |
privateRFstest(); |
|
757 |
privateSIDRFstest(); |
|
758 |
privatefalseIDRFstest(); |
|
759 |
||
760 |
systemRFiletest(); |
|
761 |
resourceRFiletest(); |
|
762 |
privateRFiletest(); |
|
763 |
privateSIDRFiletest(); |
|
764 |
privateFalseIDRFiletest(); |
|
765 |
||
766 |
test(aStat1 == KRequestPending); |
|
767 |
TheFs.NotifyChangeCancel(aStat1); |
|
768 |
test(aStat1==KErrCancel); |
|
769 |
||
770 |
test(aStat4 == KRequestPending); |
|
771 |
TheFs.NotifyChangeCancel(aStat4); |
|
772 |
test(aStat4==KErrCancel); |
|
773 |
||
774 |
User::WaitForRequest(aStat2); |
|
775 |
User::WaitForRequest(aStat3); |
|
776 |
||
777 |
test(aStat2==KErrNone); |
|
778 |
test(aStat3==KErrNone); |
|
779 |
||
780 |
||
781 |
r=TheFs.SetSessionPath(systestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
782 |
test_KErrNone(r); |
0 | 783 |
|
784 |
//Test RRawDisk class |
|
785 |
r=rawdisk.Open(TheFs,gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
786 |
test_Value(r, r == KErrPermissionDenied); |
0 | 787 |
|
788 |
r=format.Open(TheFs,driveBuf,EHighDensity,count); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
789 |
test_Value(r, r == KErrPermissionDenied); |
0 | 790 |
|
791 |
RDirtest(); |
|
792 |
||
793 |
driveBuf[0]=(TText)gDriveToTest; |
|
794 |
r=TheFs.ScanDrive(driveBuf); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
795 |
test_Value(r, r == KErrPermissionDenied); |
0 | 796 |
r=TheFs.CheckDisk(driveBuf); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
797 |
test_Value(r, r == KErrPermissionDenied); |
0 | 798 |
} |
799 |
||
800 |
LOCAL_C void TestCaps() |
|
801 |
// |
|
802 |
// test format etc that require certain capabilities |
|
803 |
// |
|
804 |
{ |
|
805 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
806 |
const char myDiagMsg[] = "Capability Check Failure"; |
|
807 |
#endif //!__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
808 |
r=RProcess().HasCapability(ECapabilityAllFiles, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg)); |
|
809 |
test(r); |
|
810 |
||
811 |
driveBuf[0]=(TText)gDriveToTest; |
|
812 |
r=TheFs.SessionPath(temp); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
813 |
test_KErrNone(r); |
0 | 814 |
|
815 |
test.Printf(_L("Session path: %S"),&temp); |
|
816 |
||
817 |
r=TheFs.CreatePrivatePath(gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
818 |
test_Value(r, r == KErrNone || r== KErrAlreadyExists); |
0 | 819 |
|
820 |
TBuf<18> tempPri; |
|
821 |
r=TheFs.PrivatePath(tempPri); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
822 |
test_KErrNone(r); |
0 | 823 |
theprivatepath = _L("?:"); |
824 |
theprivatepath.Append(tempPri); |
|
825 |
||
826 |
testAllFiles(); |
|
827 |
||
828 |
TFileName thesessionpath; |
|
829 |
r=TheFs.SetSessionToPrivate(gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
830 |
test_KErrNone(r); |
0 | 831 |
r=TheFs.SessionPath(thesessionpath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
832 |
test_KErrNone(r); |
0 | 833 |
test(thesessionpath == theprivatepath); |
834 |
} |
|
835 |
||
836 |
TFileName dirName; |
|
837 |
||
838 |
LOCAL_C void ScanDir(const TDesC& aName, CDirScan::TScanDirection aDirection, TInt aError) |
|
839 |
{ |
|
840 |
CDirScan* scanner = NULL; |
|
841 |
TRAP(r, scanner = CDirScan::NewL(TheFs)); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
842 |
test_Value(r, r == KErrNone && scanner); |
0 | 843 |
|
844 |
TRAP(r, scanner->SetScanDataL(aName,KEntryAttDir,ESortByName|EAscending,aDirection)); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
845 |
test_KErrNone(r); |
0 | 846 |
|
847 |
CDir *entryList=NULL; |
|
848 |
for (;;) |
|
849 |
{ |
|
850 |
TRAP(r, scanner->NextL(entryList)); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
851 |
test_Value(r, r == aError); |
0 | 852 |
if (entryList==NULL) |
853 |
break; |
|
854 |
TInt count=entryList->Count(); |
|
855 |
while (count--) |
|
856 |
{ |
|
857 |
TEntry data=(*entryList)[count]; |
|
858 |
TBuf<KMaxFileName> path=scanner->AbbreviatedPath(); |
|
859 |
dirName = path; |
|
860 |
dirName.Append(data.iName); |
|
861 |
test.Printf(_L(" %S\n"),&dirName); |
|
862 |
} |
|
863 |
delete entryList; |
|
864 |
entryList=NULL; |
|
865 |
} |
|
866 |
delete scanner; |
|
867 |
||
868 |
} |
|
869 |
||
870 |
/** |
|
871 |
The following test, tests CFileMan and CDirScan API on folders private and sys |
|
872 |
to confirm that any operation on these folders for any app with incorrect capability |
|
873 |
returns KErrPermissionDenied. This test step was added as a result of DEF051428 |
|
874 |
("PlatSec: Incorrect errors returned by f32") |
|
875 |
*/ |
|
876 |
LOCAL_C void TestCaging() |
|
877 |
{ |
|
878 |
CFileMan* fMan=CFileMan::NewL(TheFs); |
|
879 |
TInt r; |
|
880 |
if(fMan!=NULL) |
|
881 |
{ |
|
882 |
||
883 |
// Checking the private path |
|
884 |
TBuf<30> privatepath; |
|
885 |
r=TheFs.PrivatePath(privatepath); |
|
886 |
test.Printf(_L("Private Path is=%S"),&privatepath); |
|
887 |
||
888 |
r = TheFs.MkDir(_L("\\Caged\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
889 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 890 |
|
891 |
CDir* entryCount=NULL; |
|
892 |
r=TheFs.GetDir(_L("\\*.*"),KEntryAttNormal,ESortNone,entryCount); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
893 |
test_KErrNone(r); |
0 | 894 |
TInt rootCount= entryCount->Count(); |
895 |
||
896 |
delete entryCount; |
|
897 |
entryCount=NULL; |
|
898 |
||
899 |
||
900 |
//Testing Copy |
|
901 |
CDir* entryCount2=NULL; |
|
902 |
r=fMan->Copy(_L("\\sys\\"),_L("\\Caged\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
903 |
test_Value(r, r == KErrNotFound); |
0 | 904 |
r=fMan->Copy(_L("\\*"),_L("\\Caged\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
905 |
test_KErrNone(r); |
0 | 906 |
|
907 |
r=TheFs.GetDir(_L("\\Caged\\*.*"),KEntryAttNormal,ESortNone,entryCount2); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
908 |
test_KErrNone(r); |
0 | 909 |
TInt cagedCount= entryCount2->Count(); |
910 |
||
911 |
test(cagedCount==rootCount); |
|
912 |
||
913 |
delete entryCount2; |
|
914 |
entryCount2=NULL; |
|
915 |
||
916 |
||
917 |
r=fMan->Copy(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
918 |
test_Value(r, r == KErrPathNotFound); |
0 | 919 |
|
920 |
// Create a test file |
|
921 |
RFile testFile; |
|
922 |
r = testFile.Replace(TheFs, _L("\\capTest"),EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
923 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 924 |
testFile.Close(); |
925 |
||
926 |
TFileName name; |
|
927 |
name = privatepath; |
|
928 |
name.Append(_L("privateFile.tst")); |
|
929 |
RFile privateFile; |
|
930 |
r = privateFile.Replace(TheFs, name,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
931 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 932 |
privateFile.Close(); |
933 |
||
934 |
||
935 |
r=fMan->Copy(_L("\\capTest"),_L("\\private\\to\\moo")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
936 |
test_Value(r, r == KErrPathNotFound); |
0 | 937 |
r=fMan->Copy(_L("\\capTest"),_L("\\sys\\bin\\moo")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
938 |
test_Value(r, r == KErrPermissionDenied); |
0 | 939 |
r=fMan->Copy(_L("\\sys\\bin\\capTest"),_L("\\sys\\bin\\moo")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
940 |
test_Value(r, r == KErrPathNotFound); |
0 | 941 |
r=fMan->Copy(_L("\\sys\\*"),_L("\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
942 |
test_Value(r, r == KErrNone || r==KErrNotFound); |
0 | 943 |
r=fMan->Copy(name,_L("\\sys\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
944 |
test_Value(r, r == KErrPermissionDenied); |
0 | 945 |
|
946 |
// Testing Move |
|
947 |
r=fMan->Move(_L("\\capTest"),_L("\\private\\wst\\moo"), CFileMan::ERecurse); // Recurse flag needed as destination path does not exist. |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
948 |
test_KErrNone(r); |
0 | 949 |
r=fMan->Move(_L("\\sys\\bin\\capTest"),_L("\\sys\\bin\\moo")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
950 |
test_Value(r, r == KErrPathNotFound); |
0 | 951 |
r=fMan->Move(_L("\\sys\\*"),_L("\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
952 |
test_Value(r, r == KErrNone || r==KErrNotFound); |
0 | 953 |
r=fMan->Move(name,_L("\\sys\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
954 |
test_Value(r, r == KErrPermissionDenied); |
0 | 955 |
r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
956 |
test_Value(r, r == KErrPathNotFound); |
0 | 957 |
r=fMan->Move(_L("\\private\\two\\moo.."),_L("\\private\\one\\moo")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
958 |
test_Value(r, r == KErrPathNotFound); |
0 | 959 |
r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo..")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
960 |
test_Value(r, r == KErrPathNotFound); |
0 | 961 |
r=fMan->Move(name,_L("\\privateFile.tst")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
962 |
test_KErrNone(r); |
0 | 963 |
r=fMan->Move(_L("\\privateFile.tst"),name); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
964 |
test_KErrNone(r); |
0 | 965 |
|
966 |
||
967 |
// Testing Attribs |
|
968 |
r=fMan->Attribs(_L("\\private\\two\\moo"),KEntryAttReadOnly,0,TTime(0)); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
969 |
test_Value(r, r == KErrPathNotFound); |
0 | 970 |
r=fMan->Attribs(_L("\\private\\moo"),KEntryAttReadOnly,0,TTime(0)); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
971 |
test_Value(r, r == KErrNotFound); |
0 | 972 |
r=fMan->Attribs(name,KEntryAttReadOnly,0,TTime(0)); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
973 |
test_KErrNone(r); |
0 | 974 |
r=fMan->Attribs(name,0,KEntryAttReadOnly,TTime(0)); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
975 |
test_KErrNone(r); |
0 | 976 |
|
977 |
// Testing RmDir |
|
978 |
r=fMan->RmDir(_L("\\private\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
979 |
test_KErrNone(r); |
0 | 980 |
// put it back where it was |
981 |
r = TheFs.MkDirAll(_L("\\private\\00000001\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
982 |
test_KErrNone(r); |
0 | 983 |
r=fMan->RmDir(_L("\\private\\two\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
984 |
test_Value(r, r == KErrPathNotFound); |
0 | 985 |
r=fMan->RmDir(_L("\\private\\tw?\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
986 |
test_Value(r, r == KErrBadName); |
0 | 987 |
r=fMan->RmDir(_L("\\sys\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
988 |
test_Value(r, r == KErrPermissionDenied); |
0 | 989 |
|
990 |
// Testing Rename |
|
991 |
r=fMan->Rename(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
992 |
test_Value(r, r == KErrPathNotFound); |
0 | 993 |
|
994 |
// Testing Delete |
|
995 |
r=fMan->Delete(_L("\\private\\two\\test")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
996 |
test_Value(r, r == KErrPathNotFound); |
0 | 997 |
r=fMan->Delete(_L("\\private\\moo")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
998 |
test_Value(r, r == KErrNotFound); |
0 | 999 |
|
1000 |
//Something that actually exists in Private |
|
1001 |
r=fMan->Rename(name,_L("\\private\\00000001\\moo")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1002 |
test_Value(r, r == KErrNotFound); //deleted the file previously |
0 | 1003 |
r=fMan->Rename(_L("\\private\\00000001\\moo"),name); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1004 |
test_Value(r, r == KErrNotFound); |
0 | 1005 |
r=fMan->Copy(name,_L("\\private\\00000001\\moo")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1006 |
test_Value(r, r == KErrNotFound); |
0 | 1007 |
r=fMan->Delete(_L("\\private\\00000001\\moo")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1008 |
test_Value(r, r == KErrNotFound); |
0 | 1009 |
|
1010 |
// Clean up the test data |
|
1011 |
r=fMan->RmDir(_L("\\Caged\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1012 |
test_KErrNone(r); |
0 | 1013 |
r=fMan->Delete(_L("\\capTest")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1014 |
test_Value(r, r == KErrNone || r == KErrNotFound); |
0 | 1015 |
delete(fMan); |
1016 |
} |
|
1017 |
||
1018 |
// CDirScan tests |
|
1019 |
ScanDir(_L("\\"), CDirScan::EScanUpTree, KErrNone); |
|
1020 |
ScanDir(_L("\\"), CDirScan::EScanDownTree, KErrNone); |
|
1021 |
ScanDir(_L("\\private\\"), CDirScan::EScanDownTree, KErrNone); |
|
1022 |
ScanDir(_L("\\private\\"), CDirScan::EScanUpTree, KErrNone); |
|
1023 |
ScanDir(_L("\\sys\\"), CDirScan::EScanDownTree, KErrNone); |
|
1024 |
ScanDir(_L("\\sys\\"), CDirScan::EScanUpTree,KErrNone); |
|
1025 |
||
1026 |
} |
|
1027 |
LOCAL_C void CleanupL() |
|
1028 |
// |
|
1029 |
// Clean up tests |
|
1030 |
// |
|
1031 |
{ |
|
1032 |
test.Next(_L("Delete test directory")); |
|
1033 |
CFileMan* fMan=CFileMan::NewL(TheFs); |
|
1034 |
TInt r=fMan->RmDir(gSessionPath); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1035 |
test_KErrNone(r); |
0 | 1036 |
delete fMan; |
1037 |
} |
|
1038 |
||
1039 |
GLDEF_C void CallTestsL(/*TChar aDriveLetter*/) |
|
1040 |
// |
|
1041 |
// Do all tests |
|
1042 |
// |
|
1043 |
{ |
|
1044 |
if(!PlatSec::IsCapabilityEnforced(ECapabilityAllFiles)) |
|
1045 |
{ |
|
1046 |
test.Printf(_L("Capability ECapabilityAllFiles not enabled - leaving t_dcallfiles")); |
|
1047 |
test.Printf(_L("\n")); // Prevent overwrite by next print |
|
1048 |
return; |
|
1049 |
} |
|
1050 |
||
1051 |
TurnAllocFailureOff(); |
|
1052 |
TheFs.CharToDrive(gDriveToTest,gTheDriveNum); |
|
1053 |
||
1054 |
TBuf<30> sesspath; |
|
1055 |
sesspath=_L("?:\\"); |
|
1056 |
sesspath[0] = (TText)gDriveToTest; |
|
1057 |
||
1058 |
TInt r= TheFs.SetSessionPath(sesspath); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1059 |
test_KErrNone(r); |
0 | 1060 |
|
1061 |
TBuf<2> cmd; |
|
1062 |
cmd.SetLength(1); |
|
1063 |
cmd[0] = (TText)gDriveToTest; |
|
1064 |
RProcess tp; |
|
1065 |
r=tp.Create(_L("clean_prepdc.exe"),sesspath); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1066 |
test_KErrNone(r); |
0 | 1067 |
{ |
1068 |
TRequestStatus ps; |
|
1069 |
tp.Logon(ps); |
|
1070 |
tp.Resume(); |
|
1071 |
tp.Close(); |
|
1072 |
User::WaitForRequest(ps); |
|
1073 |
} |
|
1074 |
||
1075 |
//check double mode ie that Defpath still works |
|
1076 |
RFs fs1; |
|
1077 |
RFs fs2; |
|
1078 |
||
1079 |
r=fs1.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1080 |
test_KErrNone(r); |
0 | 1081 |
r=fs1.SessionPath(sesspath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1082 |
test_KErrNone(r); |
0 | 1083 |
test.Printf(_L("session1 Path=%S"),&sesspath); |
1084 |
||
1085 |
TBuf<30> privatepath; |
|
1086 |
r=fs1.SetSessionToPrivate(gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1087 |
test_KErrNone(r); |
0 | 1088 |
r=fs1.PrivatePath(privatepath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1089 |
test_KErrNone(r); |
0 | 1090 |
r=privatepath.Compare(KExpectedPrivatePath()); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1091 |
test_Value(r, r == 0); |
0 | 1092 |
r=fs1.SessionPath(sesspath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1093 |
test_KErrNone(r); |
0 | 1094 |
r=privatepath.Compare(sesspath.Mid(KPathPosition)); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1095 |
test_Value(r, r == 0); |
0 | 1096 |
r=fs1.CreatePrivatePath(gTheDriveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1097 |
test_KErrNone(r); |
0 | 1098 |
fs1.Close(); |
1099 |
||
1100 |
r=fs2.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1101 |
test_KErrNone(r); |
0 | 1102 |
r=fs2.SessionPath(sesspath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1103 |
test_KErrNone(r); |
0 | 1104 |
test.Printf(_L("session2 Path=%S"),&sesspath); |
1105 |
fs2.Close(); |
|
1106 |
||
1107 |
TestCaps(); |
|
1108 |
TestCaging(); |
|
1109 |
TestPathCheck(); |
|
1110 |
||
1111 |
test.Printf(_L("No of files open=%d"), TheFs.ResourceCount()); |
|
1112 |
||
1113 |
CleanupL(); |
|
1114 |
} |