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 |
// f32test\server\t_dcdiskadminallfiles.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
18 |
#define __E32TEST_EXTENSION__ |
0 | 19 |
#include <f32file.h> |
20 |
#include <e32test.h> |
|
21 |
#include <e32std.h> |
|
22 |
#include <e32std_private.h> |
|
23 |
#include <e32def.h> |
|
24 |
#include <e32def_private.h> |
|
25 |
#include <e32svr.h> |
|
26 |
#include "t_server.h" |
|
27 |
||
28 |
GLDEF_D RTest test(_L("T_DCDISKADMINALLFILES")); |
|
29 |
GLDEF_D TTime gTimeNow; |
|
30 |
LOCAL_D TInt gTheDriveNum; |
|
31 |
||
32 |
||
33 |
const TInt KPathPosition = 2; |
|
34 |
_LIT(KExpectedPrivatePath, "\\Private\\00000001\\"); |
|
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 |
_LIT(KFileSys, "systemfile.txt"); |
|
42 |
_LIT(KFileSys3, "sysfile.rna"); |
|
43 |
_LIT(KFilePri, "privatefile.txt"); |
|
44 |
_LIT(KFilePri2, "privatefile.tmp"); |
|
45 |
_LIT(KFilePri3, "prifile.rna"); |
|
46 |
_LIT(KFileRes, "resourcefile.txt"); |
|
47 |
_LIT(KFileRes3, "resfile.rna"); |
|
48 |
_LIT(KMkDirSub,"Subdir\\"); |
|
49 |
_LIT(KOldFile,"?:\\Anyold.txt"); |
|
50 |
||
51 |
#ifndef __WINS__ |
|
52 |
_LIT(KWildPath, "Z:\\SYSTEM\\"); // Until Loader is modified to use /Sys/ |
|
53 |
#else |
|
54 |
_LIT(KWildPath, "Z:\\SYS\\"); |
|
55 |
#endif |
|
56 |
_LIT(KWildFile, "*"); |
|
57 |
||
58 |
TCapability TheCaps; |
|
59 |
TBuf<4> driveBuf=_L("?:\\"); |
|
60 |
RFormat format; |
|
61 |
TInt count; |
|
62 |
RRawDisk rawdisk; |
|
63 |
RFile file1; |
|
64 |
RFile file2; |
|
65 |
RDir dir; |
|
66 |
||
67 |
TInt r; |
|
68 |
TBuf<40> fsname; |
|
69 |
TBuf<40> systestname; |
|
70 |
TBuf<40> pritestname; |
|
71 |
TBuf<40> restestname; |
|
72 |
TBuf<40> theprivatepath; |
|
73 |
TBuf<40> pritestfalseidname; |
|
74 |
TBuf<40> mkdirname; |
|
75 |
TFileName fromTemp; |
|
76 |
||
77 |
TBuf<25> sysfilename; |
|
78 |
TBuf<30> realName; |
|
79 |
TBuf<40> shortfilename; |
|
80 |
TBuf<40> longfilename; |
|
81 |
||
82 |
TRequestStatus aStat1; |
|
83 |
TRequestStatus aStat2; |
|
84 |
TRequestStatus aStat3; |
|
85 |
TRequestStatus aStat4; |
|
86 |
||
87 |
TBuf<40> systestfile; |
|
88 |
TBuf<40> pritestfile; |
|
89 |
TBuf<40> restestfile; |
|
90 |
TBuf<40> systestfile1; |
|
91 |
TBuf<40> pritestfile1; |
|
92 |
TBuf<40> restestfile1; |
|
93 |
||
94 |
TTime testtime; |
|
95 |
TBuf<20> oldName; |
|
96 |
||
97 |
TBuf<25> temp; |
|
98 |
||
99 |
TEntry entry; |
|
100 |
||
101 |
||
102 |
LOCAL_C void systemRFsTest() |
|
103 |
// |
|
104 |
// RFs test on system Directory |
|
105 |
// |
|
106 |
{ |
|
107 |
systestname=KSystemPath; |
|
108 |
systestname[0]=(TText)('A' + gTheDriveNum); |
|
109 |
||
110 |
mkdirname.Zero(); |
|
111 |
mkdirname.Append(systestname); |
|
112 |
mkdirname.Append(KMkDirSub); |
|
113 |
r=TheFs.MkDirAll(mkdirname); |
|
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 |
|
116 |
TheFs.RmDir(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
117 |
test_Value(r, r == KErrPermissionDenied); |
0 | 118 |
|
119 |
r=TheFs.SetSubst(systestname,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
120 |
test_Value(r, r == KErrPermissionDenied); |
0 | 121 |
|
122 |
r=TheFs.SetSessionPath(systestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
123 |
test_KErrNone(r); |
0 | 124 |
|
125 |
TheFs.NotifyChange(ENotifyAll,aStat1,systestname); |
|
126 |
test(aStat1==KRequestPending); |
|
127 |
||
128 |
systestfile=KSystemPath; |
|
129 |
systestfile[0]=(TText)('A' + gTheDriveNum); |
|
130 |
systestfile1=systestfile; |
|
131 |
systestfile.Append(KFileSys); |
|
132 |
systestfile1.Append(KFileSys3); |
|
133 |
||
134 |
oldName=KOldFile; |
|
135 |
oldName[0]=(TText)gDriveToTest; |
|
136 |
||
137 |
r=TheFs.GetShortName(systestfile, shortfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
138 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 139 |
|
140 |
r=TheFs.GetLongName(systestfile1, longfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
141 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 142 |
|
143 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
144 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 145 |
file1.Close(); |
146 |
||
147 |
r=TheFs.Replace(oldName,systestfile); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
148 |
test_Value(r, r == KErrPermissionDenied); |
0 | 149 |
|
150 |
r=TheFs.Rename(systestfile,systestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
151 |
test_Value(r, r == KErrPermissionDenied); |
0 | 152 |
|
153 |
r=TheFs.Entry(systestfile1,entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
154 |
test_Value(r, r == KErrNone || r == KErrNotFound); |
0 | 155 |
|
156 |
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
|
157 |
test_Value(r, r == KErrPermissionDenied); |
0 | 158 |
|
159 |
r=TheFs.Delete(systestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
160 |
test_Value(r, r == KErrPermissionDenied); |
0 | 161 |
} |
162 |
||
163 |
LOCAL_C void ResourceRFsTest() |
|
164 |
// |
|
165 |
// |
|
166 |
// |
|
167 |
{ |
|
168 |
restestname=KResourcePath; |
|
169 |
restestname[0]=(TText)('A' + gTheDriveNum); |
|
170 |
||
171 |
mkdirname.Zero(); |
|
172 |
mkdirname.Append(restestname); |
|
173 |
mkdirname.Append(KMkDirSub); |
|
174 |
r=TheFs.MkDirAll(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
175 |
test_Value(r, r == KErrPermissionDenied); |
0 | 176 |
|
177 |
TheFs.RmDir(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
178 |
test_Value(r, r == KErrPermissionDenied); |
0 | 179 |
|
180 |
// Change due to defect DEF099546 fix |
|
181 |
// TCB capability is required for following operation. |
|
182 |
r=TheFs.SetSubst(restestname,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
183 |
//test_KErrNone(r); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
184 |
test_Value(r, r == KErrPermissionDenied); |
0 | 185 |
|
186 |
// SetSubst will fail. |
|
187 |
//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
|
188 |
//test_KErrNone(r); |
0 | 189 |
|
190 |
//r=TheFs.SetSubst(_L(""),EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
191 |
//test_KErrNone(r); |
0 | 192 |
|
193 |
r=TheFs.SetSessionPath(restestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
194 |
test_KErrNone(r); |
0 | 195 |
|
196 |
TheFs.NotifyChange(ENotifyAll,aStat4,restestname); |
|
197 |
test(aStat4==KRequestPending); |
|
198 |
||
199 |
restestfile=KResourcePath; |
|
200 |
restestfile[0]=(TText)('A' + gTheDriveNum); |
|
201 |
restestfile1=restestfile; |
|
202 |
restestfile.Append(KFileRes); |
|
203 |
restestfile1.Append(KFileRes3); |
|
204 |
||
205 |
oldName=KOldFile; |
|
206 |
oldName[0]=(TText)gDriveToTest; |
|
207 |
||
208 |
r=TheFs.GetShortName(restestfile, shortfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
209 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 210 |
|
211 |
r=TheFs.GetLongName(restestfile1, longfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
212 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 213 |
|
214 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
215 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 216 |
file1.Close(); |
217 |
||
218 |
r=TheFs.Replace(oldName,restestfile); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
219 |
test_Value(r, r == KErrPermissionDenied); |
0 | 220 |
|
221 |
r=TheFs.Rename(restestfile,restestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
222 |
test_Value(r, r == KErrPermissionDenied); |
0 | 223 |
|
224 |
r=TheFs.Entry(restestfile1,entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
225 |
test_Value(r, r == KErrNone || r==KErrPathNotFound || r==KErrNotFound); |
0 | 226 |
|
227 |
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
|
228 |
test_Value(r, r == KErrPermissionDenied); |
0 | 229 |
|
230 |
r=TheFs.Delete(restestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
231 |
test_Value(r, r == KErrPermissionDenied); |
0 | 232 |
|
233 |
} |
|
234 |
||
235 |
||
236 |
LOCAL_C void privatefalseIDRFsTest() |
|
237 |
// |
|
238 |
// |
|
239 |
// |
|
240 |
{ |
|
241 |
pritestfalseidname=KPrivateFalseID; |
|
242 |
pritestfalseidname[0]=(TText)('A' + gTheDriveNum); |
|
243 |
||
244 |
mkdirname.Zero(); |
|
245 |
mkdirname.Append(pritestfalseidname); |
|
246 |
mkdirname.Append(KMkDirSub); |
|
247 |
||
248 |
r=TheFs.MkDirAll(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
249 |
test_KErrNone(r); |
0 | 250 |
|
251 |
r=TheFs.RmDir(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
252 |
test_KErrNone(r); |
0 | 253 |
|
254 |
r=TheFs.SetSubst(pritestfalseidname,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
255 |
test_KErrNone(r); |
0 | 256 |
|
257 |
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
|
258 |
test_KErrNone(r); |
0 | 259 |
|
260 |
r=TheFs.SetSubst(_L(""),EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
261 |
test_KErrNone(r); |
0 | 262 |
|
263 |
r=TheFs.SetSessionPath(pritestfalseidname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
264 |
test_KErrNone(r); |
0 | 265 |
|
266 |
TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname); |
|
267 |
test(aStat2==KRequestPending); |
|
268 |
||
269 |
||
270 |
pritestfile=KPrivateFalseID; |
|
271 |
pritestfile[0]=(TText)('A' + gTheDriveNum); |
|
272 |
pritestfile1=pritestfile; |
|
273 |
pritestfile.Append(KFilePri2); |
|
274 |
pritestfile1.Append(KFilePri3); |
|
275 |
||
276 |
oldName=KOldFile; |
|
277 |
oldName[0]=(TText)gDriveToTest; |
|
278 |
||
279 |
r=TheFs.GetShortName(pritestfile, shortfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
280 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 281 |
|
282 |
r=TheFs.GetLongName(pritestfile1, longfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
283 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 284 |
|
285 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
286 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 287 |
file1.Close(); |
288 |
||
289 |
r=TheFs.Replace(oldName,pritestfile); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
290 |
test_KErrNone(r); |
0 | 291 |
|
292 |
r=TheFs.Rename(pritestfile,pritestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
293 |
test_KErrNone(r); |
0 | 294 |
|
295 |
r=TheFs.Entry(pritestfile1,entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
296 |
test_KErrNone(r); |
0 | 297 |
|
298 |
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
|
299 |
test_KErrNone(r); |
0 | 300 |
|
301 |
r=TheFs.Delete(pritestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
302 |
test_KErrNone(r); |
0 | 303 |
|
304 |
} |
|
305 |
||
306 |
||
307 |
LOCAL_C void privateRFsTest() |
|
308 |
// |
|
309 |
// |
|
310 |
// |
|
311 |
{ |
|
312 |
//private |
|
313 |
pritestname=KPrivatePath; |
|
314 |
pritestname[0]=(TText)('A' + gTheDriveNum); |
|
315 |
||
316 |
mkdirname.Zero(); |
|
317 |
mkdirname.Append(pritestname); |
|
318 |
mkdirname.Append(KMkDirSub); |
|
319 |
||
320 |
r=TheFs.MkDirAll(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
321 |
test_KErrNone(r); |
0 | 322 |
|
323 |
r=TheFs.RmDir(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
324 |
test_KErrNone(r); |
0 | 325 |
|
326 |
r=TheFs.SetSubst(pritestname,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
327 |
test_KErrNone(r); |
0 | 328 |
|
329 |
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
|
330 |
test_KErrNone(r); |
0 | 331 |
|
332 |
r=TheFs.SetSubst(_L(""),EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
333 |
test_KErrNone(r); |
0 | 334 |
|
335 |
r=TheFs.SetSessionPath(pritestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
336 |
test_KErrNone(r); |
0 | 337 |
|
338 |
TheFs.NotifyChange(ENotifyAll,aStat2,pritestname); |
|
339 |
test(aStat2==KRequestPending); |
|
340 |
||
341 |
||
342 |
pritestfile=KPrivatePath; |
|
343 |
pritestfile[0]=(TText)('A' + gTheDriveNum); |
|
344 |
pritestfile1=pritestfile; |
|
345 |
pritestfile.Append(KFilePri2); |
|
346 |
pritestfile1.Append(KFilePri3); |
|
347 |
||
348 |
oldName=KOldFile; |
|
349 |
oldName[0]=(TText)gDriveToTest; |
|
350 |
||
351 |
r=TheFs.GetShortName(pritestfile, shortfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
352 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 353 |
|
354 |
r=TheFs.GetLongName(pritestfile1, longfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
355 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 356 |
|
357 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
358 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 359 |
file1.Close(); |
360 |
||
361 |
r=TheFs.Replace(oldName,pritestfile); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
362 |
test_Value(r, r == KErrNone || r==KErrNotFound); |
0 | 363 |
|
364 |
r=TheFs.Rename(pritestfile,pritestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
365 |
test_KErrNone(r); |
0 | 366 |
|
367 |
r=TheFs.Entry(pritestfile1,entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
368 |
test_KErrNone(r); |
0 | 369 |
|
370 |
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
|
371 |
test_KErrNone(r); |
0 | 372 |
|
373 |
r=TheFs.Delete(pritestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
374 |
test_KErrNone(r); |
0 | 375 |
|
376 |
} |
|
377 |
||
378 |
||
379 |
LOCAL_C void privateSIDRFstest() |
|
380 |
{ |
|
381 |
theprivatepath[0]=(TText)gDriveToTest; |
|
382 |
test.Printf(_L("the Private Path = %S"),&theprivatepath); |
|
383 |
||
384 |
mkdirname.Zero(); |
|
385 |
mkdirname.Append(theprivatepath); |
|
386 |
mkdirname.Append(KMkDirSub); |
|
387 |
r=TheFs.MkDirAll(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
388 |
test_KErrNone(r); |
0 | 389 |
|
390 |
r=TheFs.RmDir(mkdirname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
391 |
test_KErrNone(r); |
0 | 392 |
|
393 |
r=TheFs.SetSubst(theprivatepath,EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
394 |
test_KErrNone(r); |
0 | 395 |
|
396 |
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
|
397 |
test_KErrNone(r); |
0 | 398 |
|
399 |
r=TheFs.SetSubst(_L(""),EDriveO); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
400 |
test_KErrNone(r); |
0 | 401 |
|
402 |
r=TheFs.SetSessionPath(theprivatepath); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
403 |
test_KErrNone(r); |
0 | 404 |
|
405 |
TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath); |
|
406 |
test(aStat3==KRequestPending); |
|
407 |
||
408 |
pritestfile=theprivatepath; |
|
409 |
pritestfile[0]=(TText)('A' + gTheDriveNum); |
|
410 |
pritestfile1=pritestfile; |
|
411 |
pritestfile.Append(KFilePri2); |
|
412 |
pritestfile1.Append(KFilePri3); |
|
413 |
||
414 |
oldName=KOldFile; |
|
415 |
oldName[0]=(TText)gDriveToTest; |
|
416 |
||
417 |
r=TheFs.GetShortName(pritestfile, shortfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
418 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 419 |
|
420 |
r=TheFs.GetLongName(pritestfile1, longfilename); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
421 |
test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
0 | 422 |
|
423 |
r=file1.Create(TheFs,oldName,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
424 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 425 |
file1.Close(); |
426 |
||
427 |
r=TheFs.Replace(oldName,pritestfile); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
428 |
test_KErrNone(r); |
0 | 429 |
|
430 |
r=TheFs.Rename(pritestfile,pritestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
431 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 432 |
|
433 |
r=TheFs.Entry(pritestfile1,entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
434 |
test_KErrNone(r); |
0 | 435 |
|
436 |
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
|
437 |
test_KErrNone(r); |
0 | 438 |
|
439 |
r=TheFs.Delete(pritestfile1); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
440 |
test_KErrNone(r); |
0 | 441 |
} |
442 |
||
443 |
||
444 |
LOCAL_C void systemRFiletest() |
|
445 |
// |
|
446 |
//RFile testing with session path set to //system// |
|
447 |
// |
|
448 |
{ |
|
449 |
||
450 |
r=TheFs.SetSessionPath(systestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
451 |
test_KErrNone(r); |
0 | 452 |
|
453 |
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
|
454 |
test_Value(r, r == KErrPermissionDenied); |
0 | 455 |
file1.Close(); |
456 |
||
457 |
systestfile=systestname; |
|
458 |
systestfile.Append(KFileSys); |
|
459 |
r=file1.Create(TheFs,systestfile,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
460 |
test_Value(r, r == KErrPermissionDenied); |
0 | 461 |
file1.Close(); |
462 |
||
463 |
r=file1.Open(TheFs,systestfile,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
464 |
test_Value(r, r == KErrPermissionDenied); |
0 | 465 |
|
466 |
r=file1.Open(TheFs,systestfile,EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
467 |
test_Value(r, r == KErrNone|| r==KErrNotFound); |
0 | 468 |
|
469 |
r=file1.Replace(TheFs,systestfile,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
470 |
test_Value(r, r == KErrPermissionDenied); |
0 | 471 |
|
472 |
TFindFile finder(TheFs); |
|
473 |
CDir* dir = NULL; |
|
474 |
r=finder.FindWildByDir(KWildFile, KWildPath, dir); |
|
475 |
if (!(r==KErrNone)) |
|
476 |
test.Printf(_L("T_DCDISKADMINALLFILES: 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
|
477 |
test_KErrNone(r); |
0 | 478 |
delete dir; |
479 |
} |
|
480 |
||
481 |
LOCAL_C void resourceRFiletest() |
|
482 |
// |
|
483 |
//RFile testing with session path set to //resource// |
|
484 |
// |
|
485 |
{ |
|
486 |
r=TheFs.SetSessionPath(restestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
487 |
test_KErrNone(r); |
0 | 488 |
|
489 |
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
|
490 |
test_Value(r, r == KErrPermissionDenied); |
0 | 491 |
file1.Close(); |
492 |
||
493 |
r=file1.Create(TheFs,KFileRes,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
494 |
test_Value(r, r == KErrPermissionDenied); |
0 | 495 |
file1.Close(); |
496 |
||
497 |
r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive ); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
498 |
test_Value(r, r == KErrPermissionDenied); |
0 | 499 |
|
500 |
r=file1.Open(TheFs,KFileRes,EFileShareReadersOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
501 |
test_Value(r, r == KErrNone || r == KErrPathNotFound || r == KErrNotFound); |
0 | 502 |
file1.Close(); |
503 |
||
504 |
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
|
505 |
test_Value(r, r == KErrNone || r == KErrPathNotFound || r == KErrNotFound); |
0 | 506 |
file1.Close(); |
507 |
||
508 |
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
|
509 |
test_Value(r, r == KErrPermissionDenied); |
0 | 510 |
file1.Close(); |
511 |
||
512 |
r=file1.Replace(TheFs,KFileRes3,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
513 |
test_Value(r, r == KErrPermissionDenied); |
0 | 514 |
file1.Close(); |
515 |
} |
|
516 |
||
517 |
||
518 |
LOCAL_C void privatefalseIDRFiletest() |
|
519 |
// |
|
520 |
//RFile testing with session path set to //Private//false ID |
|
521 |
// |
|
522 |
{ |
|
523 |
r=TheFs.SetSessionPath(pritestfalseidname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
524 |
test_KErrNone(r); |
0 | 525 |
|
526 |
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
|
527 |
test_KErrNone(r); |
0 | 528 |
file1.Close(); |
529 |
||
530 |
r=file1.Create(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
531 |
test_KErrNone(r); |
0 | 532 |
file1.Close(); |
533 |
||
534 |
r=file1.Open(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
535 |
test_KErrNone(r); |
0 | 536 |
file1.Close(); |
537 |
||
538 |
r=file1.Open(TheFs,KFilePri,EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
539 |
test_KErrNone(r); |
0 | 540 |
file1.Close(); |
541 |
||
542 |
r=file1.Replace(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
543 |
test_KErrNone(r); |
0 | 544 |
|
545 |
r=file1.Rename(KFilePri3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
546 |
test_KErrNone(r); |
0 | 547 |
file1.Close(); |
548 |
} |
|
549 |
||
550 |
||
551 |
LOCAL_C void privateRFiletest() |
|
552 |
// |
|
553 |
//RFile testing with session path set to //Private// |
|
554 |
// |
|
555 |
{ |
|
556 |
r=TheFs.SetSessionPath(pritestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
557 |
test_KErrNone(r); |
0 | 558 |
|
559 |
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
|
560 |
test_KErrNone(r); |
0 | 561 |
file1.Close(); |
562 |
||
563 |
r=file1.Create(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
564 |
test_KErrNone(r); |
0 | 565 |
file1.Close(); |
566 |
||
567 |
r=file1.Open(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
568 |
test_KErrNone(r); |
0 | 569 |
file1.Close(); |
570 |
||
571 |
r=file1.Open(TheFs,KFilePri,EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
572 |
test_KErrNone(r); |
0 | 573 |
file1.Close(); |
574 |
||
575 |
r=file1.Replace(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
576 |
test_KErrNone(r); |
0 | 577 |
|
578 |
r=file1.Rename(KFilePri3); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
579 |
test_KErrNone(r); |
0 | 580 |
file1.Close(); |
581 |
} |
|
582 |
||
583 |
||
584 |
LOCAL_C void privateSIDRFiletest() |
|
585 |
// |
|
586 |
//Rfile Testing with session path set to //Private//UID// |
|
587 |
// |
|
588 |
{ |
|
589 |
r=TheFs.SetSessionToPrivate(gTheDriveNum); |
|
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.Temp(TheFs,theprivatepath,fromTemp,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
593 |
test_KErrNone(r); |
0 | 594 |
file1.Close(); |
595 |
||
596 |
r=file1.Create(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
597 |
test_KErrNone(r); |
0 | 598 |
file1.Close(); |
599 |
||
600 |
r=file1.Open(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
601 |
test_KErrNone(r); |
0 | 602 |
file1.Close(); |
603 |
||
604 |
r=file1.Open(TheFs,KFilePri,EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
605 |
test_KErrNone(r); |
0 | 606 |
file1.Close(); |
607 |
||
608 |
||
609 |
r=file1.Replace(TheFs,KFilePri,EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
610 |
test_KErrNone(r); |
0 | 611 |
|
612 |
r=file1.Rename(KFilePri3); |
|
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 |
||
617 |
LOCAL_C void RDirtest() |
|
618 |
// |
|
619 |
// |
|
620 |
// |
|
621 |
{ |
|
622 |
||
623 |
//system |
|
624 |
CDir* dirEntries; |
|
625 |
TBuf<30> dirNameBuf(KSystemPath); |
|
626 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
627 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
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==KErrPathNotFound || r==KErrNotFound); |
0 | 629 |
dir.Close(); |
630 |
if(r==KErrNone) |
|
631 |
{ |
|
632 |
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
|
633 |
test_KErrNone(r); |
0 | 634 |
delete dirEntries; |
635 |
} |
|
636 |
dirNameBuf.Zero(); |
|
637 |
//Private//falseID |
|
638 |
dirNameBuf=KPrivateFalseID; |
|
639 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
640 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
641 |
test_KErrNone(r); |
0 | 642 |
dir.Close(); |
643 |
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
|
644 |
test_KErrNone(r); |
0 | 645 |
dirNameBuf.Zero(); |
646 |
delete dirEntries; |
|
647 |
//Private |
|
648 |
dirNameBuf=KPrivatePath; |
|
649 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
650 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
651 |
test_KErrNone(r); |
0 | 652 |
dir.Close(); |
653 |
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
|
654 |
test_KErrNone(r); |
0 | 655 |
dirNameBuf.Zero(); |
656 |
delete dirEntries; |
|
657 |
//Private/uid |
|
658 |
TheFs.PrivatePath(dirNameBuf); |
|
659 |
dirNameBuf.Insert(0,_L("?:")); |
|
660 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
661 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
662 |
test_KErrNone(r); |
0 | 663 |
dir.Close(); |
664 |
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
|
665 |
test_KErrNone(r); |
0 | 666 |
dirNameBuf.Zero(); |
667 |
delete dirEntries; |
|
668 |
//Resource |
|
669 |
dirNameBuf=KResourcePath; |
|
670 |
dirNameBuf[0]=(TText)gDriveToTest; |
|
671 |
r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
672 |
test_Value(r, r == KErrNone || r==KErrPathNotFound); |
0 | 673 |
if(r==KErrNone) |
674 |
{ |
|
675 |
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
|
676 |
test_KErrNone(r); |
0 | 677 |
dir.Close(); |
678 |
delete dirEntries; |
|
679 |
} |
|
680 |
} |
|
681 |
||
682 |
||
683 |
LOCAL_C void TestDiskAdminAllfiles() |
|
684 |
// |
|
685 |
// Test with root capabilities |
|
686 |
// |
|
687 |
{ |
|
688 |
r=TheFs.FileSystemName(fsname,gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
689 |
test_KErrNone(r); |
0 | 690 |
r = DismountFileSystem(TheFs, fsname, gTheDriveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
691 |
test_KErrNone(r); |
0 | 692 |
// 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
|
693 |
// test_KErrNone(r); |
0 | 694 |
// r=TheFs.AddFileSystem(fsname); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
695 |
// test_KErrNone(r); |
0 | 696 |
r = MountFileSystem(TheFs, fsname, gTheDriveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
697 |
test_KErrNone(r); |
0 | 698 |
r=TheFs.SetDriveName(gTheDriveNum,KDriveName); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
699 |
test_KErrNone(r); |
0 | 700 |
#ifndef __WINS__ |
701 |
r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
702 |
test_KErrNone(r); |
0 | 703 |
#endif |
704 |
||
705 |
systemRFsTest(); |
|
706 |
ResourceRFsTest(); |
|
707 |
privateRFsTest(); |
|
708 |
privateSIDRFstest(); |
|
709 |
privatefalseIDRFsTest(); |
|
710 |
||
711 |
systemRFiletest(); |
|
712 |
resourceRFiletest(); |
|
713 |
privateRFiletest(); |
|
714 |
privateSIDRFiletest(); |
|
715 |
privatefalseIDRFiletest(); |
|
716 |
||
717 |
//check notifier return values set in rfs testing |
|
718 |
//User::WaitForRequest(aStat1); |
|
719 |
User::WaitForRequest(aStat2); |
|
720 |
User::WaitForRequest(aStat3); |
|
721 |
//User::WaitForRequest(aStat4); |
|
722 |
test(aStat2==KErrNone); |
|
723 |
test(aStat3==KErrNone); |
|
724 |
||
725 |
test(aStat1 == KRequestPending); |
|
726 |
TheFs.NotifyChangeCancel(aStat1); |
|
727 |
test(aStat1==KErrCancel); |
|
728 |
||
729 |
test(aStat4 == KRequestPending); |
|
730 |
TheFs.NotifyChangeCancel(aStat4); |
|
731 |
test(aStat4==KErrCancel); |
|
732 |
||
733 |
r=TheFs.SetSessionPath(systestname); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
734 |
test_KErrNone(r); |
0 | 735 |
|
736 |
//Test RRawDisk class |
|
737 |
r=rawdisk.Open(TheFs,gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
738 |
test_Value(r, r == KErrPermissionDenied); |
0 | 739 |
rawdisk.Close(); |
740 |
||
741 |
RDirtest(); |
|
742 |
||
743 |
#ifdef __WINS__ |
|
744 |
if (User::UpperCase(driveBuf[0]) != 'C') |
|
745 |
#endif |
|
746 |
{ |
|
747 |
//Test RFormat class |
|
748 |
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
|
749 |
test_KErrNone(r); |
0 | 750 |
while(count) |
751 |
{ |
|
752 |
TInt r=format.Next(count); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
753 |
test_KErrNone(r); |
0 | 754 |
} |
755 |
format.Close(); |
|
756 |
} |
|
757 |
||
758 |
driveBuf[0]=(TText)gDriveToTest; |
|
759 |
r=TheFs.ScanDrive(driveBuf); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
760 |
test_Value(r, r == KErrNone || r==KErrNotSupported || r == KErrInUse); |
0 | 761 |
r=TheFs.CheckDisk(driveBuf); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
762 |
test_Value(r, r == KErrNone || r==KErrNotSupported || r == KErrInUse); |
0 | 763 |
} |
764 |
||
765 |
LOCAL_C void TestCaps() |
|
766 |
// |
|
767 |
// test format etc that require certain capabilities |
|
768 |
// |
|
769 |
{ |
|
770 |
#ifndef __REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
771 |
const char myDiagMsg[] = "Capability Check Failure"; |
|
772 |
#endif //__REMOVE_PLATSEC_DIAGNOSTIC_STRINGS__ |
|
773 |
r=RProcess().HasCapability(ECapabilityAllFiles, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg)); |
|
774 |
test(r); |
|
775 |
r=RProcess().HasCapability(ECapabilityDiskAdmin, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg)); |
|
776 |
test(r); |
|
777 |
||
778 |
driveBuf[0]=(TText)gDriveToTest; |
|
779 |
r=TheFs.SessionPath(temp); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
780 |
test_KErrNone(r); |
0 | 781 |
|
782 |
test.Printf(_L("Session path: %S"),&temp); |
|
783 |
||
784 |
r=TheFs.CreatePrivatePath(gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
785 |
test_Value(r, r == KErrNone || r== KErrAlreadyExists); |
0 | 786 |
|
787 |
TBuf<18> tempPri; |
|
788 |
r=TheFs.PrivatePath(tempPri); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
789 |
test_KErrNone(r); |
0 | 790 |
theprivatepath = _L("?:"); |
791 |
theprivatepath.Append(tempPri); |
|
792 |
||
793 |
TestDiskAdminAllfiles(); |
|
794 |
||
795 |
TFileName thesessionpath; |
|
796 |
r=TheFs.SetSessionToPrivate(gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
797 |
test_KErrNone(r); |
0 | 798 |
r=TheFs.SessionPath(thesessionpath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
799 |
test_KErrNone(r); |
0 | 800 |
test(thesessionpath == theprivatepath); |
801 |
} |
|
802 |
||
803 |
||
804 |
LOCAL_C void CleanupL() |
|
805 |
// |
|
806 |
// Clean up tests |
|
807 |
// |
|
808 |
{ |
|
809 |
test.Next(_L("Delete test directory")); |
|
810 |
CFileMan* fMan=CFileMan::NewL(TheFs); |
|
811 |
TInt r=fMan->RmDir(gSessionPath); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
812 |
test_Value(r, r == KErrNone || r == KErrPathNotFound); |
0 | 813 |
delete fMan; |
814 |
} |
|
815 |
||
816 |
GLDEF_C void CallTestsL(/*TChar aDriveLetter*/) |
|
817 |
// |
|
818 |
// Do all tests |
|
819 |
// |
|
820 |
{ |
|
821 |
if( !PlatSec::IsCapabilityEnforced(ECapabilityAllFiles) || |
|
822 |
!PlatSec::IsCapabilityEnforced(ECapabilityDiskAdmin)) |
|
823 |
{ |
|
824 |
test.Printf(_L("Capabilities insufficient - leaving t_dcdiskadminallfiles")); |
|
825 |
test.Printf(_L("\n")); // Prevent overwrite by next print |
|
826 |
return; |
|
827 |
} |
|
828 |
TurnAllocFailureOff(); |
|
829 |
TheFs.CharToDrive(gDriveToTest,gTheDriveNum); |
|
830 |
||
831 |
TBuf<30> sesspath; |
|
832 |
sesspath=_L("?:\\"); |
|
833 |
sesspath[0] = (TText)gDriveToTest; |
|
834 |
||
835 |
TInt r= TheFs.SetSessionPath(sesspath); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
836 |
test_KErrNone(r); |
0 | 837 |
|
838 |
TBuf<2> cmd; |
|
839 |
cmd.SetLength(1); |
|
840 |
cmd[0] = (TText)gDriveToTest; |
|
841 |
RProcess tp; |
|
842 |
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
|
843 |
test_KErrNone(r); |
0 | 844 |
{ |
845 |
TRequestStatus ps; |
|
846 |
tp.Logon(ps); |
|
847 |
tp.Resume(); |
|
848 |
tp.Close(); |
|
849 |
User::WaitForRequest(ps); |
|
850 |
} |
|
851 |
||
852 |
//check double mode ie that Defpath still works |
|
853 |
RFs fs1; |
|
854 |
RFs fs2; |
|
855 |
||
856 |
r=fs1.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
857 |
test_KErrNone(r); |
0 | 858 |
r=fs1.SessionPath(sesspath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
859 |
test_KErrNone(r); |
0 | 860 |
test.Printf(_L("session1 Path=%S"),&sesspath); |
861 |
||
862 |
TBuf<30> privatepath; |
|
863 |
r=fs1.SetSessionToPrivate(gTheDriveNum); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
864 |
test_KErrNone(r); |
0 | 865 |
r=fs1.PrivatePath(privatepath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
866 |
test_KErrNone(r); |
0 | 867 |
r=privatepath.Compare(KExpectedPrivatePath()); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
868 |
test_Value(r, r == 0); |
0 | 869 |
r=fs1.SessionPath(sesspath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
870 |
test_KErrNone(r); |
0 | 871 |
r=privatepath.Compare(sesspath.Mid(KPathPosition)); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
872 |
test_Value(r, r == 0); |
0 | 873 |
r=fs1.CreatePrivatePath(gTheDriveNum); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
874 |
test_KErrNone(r); |
0 | 875 |
fs1.Close(); |
876 |
||
877 |
r=fs2.Connect(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
878 |
test_KErrNone(r); |
0 | 879 |
r=fs2.SessionPath(sesspath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
880 |
test_KErrNone(r); |
0 | 881 |
test.Printf(_L("session2 Path=%S"),&sesspath); |
882 |
fs2.Close(); |
|
883 |
||
884 |
TestCaps(); |
|
885 |
||
886 |
test.Printf(_L("No of files open=%d"), TheFs.ResourceCount()); |
|
887 |
||
888 |
CleanupL(); |
|
889 |
} |