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