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