107 mkdirname.Zero(); |
108 mkdirname.Zero(); |
108 mkdirname.Append(pritestfalseidname); |
109 mkdirname.Append(pritestfalseidname); |
109 mkdirname.Append(KMkDirSub); |
110 mkdirname.Append(KMkDirSub); |
110 |
111 |
111 r=TheFs.MkDirAll(mkdirname); |
112 r=TheFs.MkDirAll(mkdirname); |
112 test(r==KErrPermissionDenied); |
113 test_Value(r, r == KErrPermissionDenied); |
113 |
114 |
114 r=TheFs.RmDir(mkdirname); |
115 r=TheFs.RmDir(mkdirname); |
115 test(r==KErrPermissionDenied); |
116 test_Value(r, r == KErrPermissionDenied); |
116 |
117 |
117 r=TheFs.SetSubst(pritestfalseidname,EDriveO); |
118 r=TheFs.SetSubst(pritestfalseidname,EDriveO); |
118 test(r==KErrPermissionDenied); |
119 test_Value(r, r == KErrPermissionDenied); |
119 |
120 |
120 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
121 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
121 test(r==KErrNone); |
122 test_KErrNone(r); |
122 |
123 |
123 r=TheFs.SetSessionPath(pritestfalseidname); |
124 r=TheFs.SetSessionPath(pritestfalseidname); |
124 test(r==KErrPermissionDenied); |
125 test_Value(r, r == KErrPermissionDenied); |
125 |
126 |
126 TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname); |
127 TheFs.NotifyChange(ENotifyAll,aStat2,pritestfalseidname); |
127 test(aStat2==KErrPermissionDenied); |
128 test(aStat2==KErrPermissionDenied); |
128 |
129 |
129 |
130 |
135 |
136 |
136 oldName=KOldFile; |
137 oldName=KOldFile; |
137 oldName[0]=(TText)gDriveToTest; |
138 oldName[0]=(TText)gDriveToTest; |
138 |
139 |
139 r=TheFs.GetShortName(pritestfile, shortfilename); |
140 r=TheFs.GetShortName(pritestfile, shortfilename); |
140 test(r==KErrPermissionDenied || r==KErrNotSupported); |
141 test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported); |
141 |
142 |
142 r=TheFs.GetLongName(pritestfile1, longfilename); |
143 r=TheFs.GetLongName(pritestfile1, longfilename); |
143 test(r==KErrPermissionDenied || r==KErrNotSupported); |
144 test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported); |
144 |
145 |
145 r=file1.Create(TheFs,oldName,EFileWrite); |
146 r=file1.Create(TheFs,oldName,EFileWrite); |
146 test(r==KErrNone || r==KErrAlreadyExists); |
147 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
147 file1.Close(); |
148 file1.Close(); |
148 |
149 |
149 r=TheFs.Replace(oldName,pritestfile); |
150 r=TheFs.Replace(oldName,pritestfile); |
150 test(r==KErrPermissionDenied); |
151 test_Value(r, r == KErrPermissionDenied); |
151 |
152 |
152 r=TheFs.Rename(pritestfile,pritestfile1); |
153 r=TheFs.Rename(pritestfile,pritestfile1); |
153 test(r==KErrPermissionDenied); |
154 test_Value(r, r == KErrPermissionDenied); |
154 |
155 |
155 r=TheFs.Entry(pritestfile1,entry); |
156 r=TheFs.Entry(pritestfile1,entry); |
156 test(r==KErrPermissionDenied); |
157 test_Value(r, r == KErrPermissionDenied); |
157 |
158 |
158 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
159 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
159 test(r==KErrPermissionDenied); |
160 test_Value(r, r == KErrPermissionDenied); |
160 |
161 |
161 r=TheFs.Delete(pritestfile1); |
162 r=TheFs.Delete(pritestfile1); |
162 test(r==KErrPermissionDenied); |
163 test_Value(r, r == KErrPermissionDenied); |
163 |
164 |
164 r=TheFs.Delete(oldName); |
165 r=TheFs.Delete(oldName); |
165 test(r==KErrNone); |
166 test_KErrNone(r); |
166 |
167 |
167 __UHEAP_MARKEND; |
168 __UHEAP_MARKEND; |
168 } |
169 } |
169 LOCAL_C void systemRFsTest() |
170 LOCAL_C void systemRFsTest() |
170 // |
171 // |
178 |
179 |
179 mkdirname.Zero(); |
180 mkdirname.Zero(); |
180 mkdirname.Append(systestname); |
181 mkdirname.Append(systestname); |
181 mkdirname.Append(KMkDirSub); |
182 mkdirname.Append(KMkDirSub); |
182 r=TheFs.MkDirAll(mkdirname); |
183 r=TheFs.MkDirAll(mkdirname); |
183 test(r==KErrNone); |
184 test_KErrNone(r); |
184 |
185 |
185 TheFs.RmDir(mkdirname); |
186 TheFs.RmDir(mkdirname); |
186 test(r==KErrNone); |
187 test_KErrNone(r); |
187 |
188 |
188 r=TheFs.SetSubst(systestname,EDriveO); |
189 r=TheFs.SetSubst(systestname,EDriveO); |
189 test(r==KErrNone); |
190 test_KErrNone(r); |
190 |
191 |
191 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
192 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
192 test(r==KErrPermissionDenied); |
193 test_Value(r, r == KErrPermissionDenied); |
193 |
194 |
194 r=TheFs.SetSubst(_L(""),EDriveO); //to unsubst |
195 r=TheFs.SetSubst(_L(""),EDriveO); //to unsubst |
195 test(r==KErrNone); |
196 test_KErrNone(r); |
196 |
197 |
197 r=TheFs.SetSessionPath(systestname); |
198 r=TheFs.SetSessionPath(systestname); |
198 test(r==KErrPermissionDenied); |
199 test_Value(r, r == KErrPermissionDenied); |
199 |
200 |
200 TheFs.NotifyChange(ENotifyAll,aStat1,systestname); |
201 TheFs.NotifyChange(ENotifyAll,aStat1,systestname); |
201 test(aStat1==KErrPermissionDenied); |
202 test(aStat1==KErrPermissionDenied); |
202 |
203 |
203 systestfile=KSystemPath; |
204 systestfile=KSystemPath; |
208 |
209 |
209 oldName=KOldFile; |
210 oldName=KOldFile; |
210 oldName[0]=(TText)gDriveToTest; |
211 oldName[0]=(TText)gDriveToTest; |
211 |
212 |
212 r=TheFs.GetShortName(systestfile, shortfilename); |
213 r=TheFs.GetShortName(systestfile, shortfilename); |
213 test(r==KErrPermissionDenied || r==KErrNotSupported); |
214 test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported); |
214 |
215 |
215 r=TheFs.GetLongName(systestfile1, longfilename); |
216 r=TheFs.GetLongName(systestfile1, longfilename); |
216 test(r==KErrPermissionDenied || r==KErrNotSupported); |
217 test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported); |
217 |
218 |
218 r=file1.Create(TheFs,oldName,EFileWrite); |
219 r=file1.Create(TheFs,oldName,EFileWrite); |
219 test(r==KErrNone || r==KErrAlreadyExists); |
220 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
220 file1.Close(); |
221 file1.Close(); |
221 |
222 |
222 r=TheFs.Replace(oldName,systestfile); |
223 r=TheFs.Replace(oldName,systestfile); |
223 test(r==KErrNone); |
224 test_KErrNone(r); |
224 |
225 |
225 r=TheFs.Delete(systestfile1); |
226 r=TheFs.Delete(systestfile1); |
226 test(r==KErrNone || r==KErrNotFound); |
227 test_Value(r, r == KErrNone || r==KErrNotFound); |
227 |
228 |
228 r=TheFs.Rename(systestfile,systestfile1); |
229 r=TheFs.Rename(systestfile,systestfile1); |
229 test(r==KErrNone); |
230 test_KErrNone(r); |
230 |
231 |
231 r=TheFs.Entry(systestfile1,entry); |
232 r=TheFs.Entry(systestfile1,entry); |
232 test(r==KErrPermissionDenied); |
233 test_Value(r, r == KErrPermissionDenied); |
233 |
234 |
234 r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
235 r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
235 test(r==KErrNone); |
236 test_KErrNone(r); |
236 |
237 |
237 r=TheFs.Delete(systestfile1); |
238 r=TheFs.Delete(systestfile1); |
238 test(r==KErrNone); |
239 test_KErrNone(r); |
239 |
240 |
240 __UHEAP_MARKEND; |
241 __UHEAP_MARKEND; |
241 } |
242 } |
242 |
243 |
243 LOCAL_C void ResourceRFsTest() |
244 LOCAL_C void ResourceRFsTest() |
252 |
253 |
253 mkdirname.Zero(); |
254 mkdirname.Zero(); |
254 mkdirname.Append(restestname); |
255 mkdirname.Append(restestname); |
255 mkdirname.Append(KMkDirSub); |
256 mkdirname.Append(KMkDirSub); |
256 r=TheFs.MkDirAll(mkdirname); |
257 r=TheFs.MkDirAll(mkdirname); |
257 test(r==KErrNone); |
258 test_KErrNone(r); |
258 |
259 |
259 TheFs.RmDir(mkdirname); |
260 TheFs.RmDir(mkdirname); |
260 test(r==KErrNone); |
261 test_KErrNone(r); |
261 |
262 |
262 r=TheFs.SetSubst(restestname,EDriveO); |
263 r=TheFs.SetSubst(restestname,EDriveO); |
263 test(r==KErrNone); |
264 test_KErrNone(r); |
264 |
265 |
265 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
266 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
266 test(r==KErrNone); |
267 test_KErrNone(r); |
267 |
268 |
268 r=TheFs.SetSubst(_L(""),EDriveO); //to unsubst |
269 r=TheFs.SetSubst(_L(""),EDriveO); //to unsubst |
269 test(r==KErrNone); |
270 test_KErrNone(r); |
270 |
271 |
271 r=TheFs.SetSessionPath(restestname); |
272 r=TheFs.SetSessionPath(restestname); |
272 test(r==KErrNone); |
273 test_KErrNone(r); |
273 |
274 |
274 TheFs.NotifyChange(ENotifyAll,aStat4,restestname); |
275 TheFs.NotifyChange(ENotifyAll,aStat4,restestname); |
275 test(aStat4==KRequestPending); |
276 test(aStat4==KRequestPending); |
276 |
277 |
277 restestfile=KResourcePath; |
278 restestfile=KResourcePath; |
282 |
283 |
283 oldName=KOldFile; |
284 oldName=KOldFile; |
284 oldName[0]=(TText)gDriveToTest; |
285 oldName[0]=(TText)gDriveToTest; |
285 |
286 |
286 r=TheFs.GetShortName(restestfile, shortfilename); |
287 r=TheFs.GetShortName(restestfile, shortfilename); |
287 test(r==KErrNone || KErrNotFound || r==KErrNotSupported); |
288 test_Value(r, r == KErrNone || r == KErrNotFound || r==KErrNotSupported); |
288 |
289 |
289 r=TheFs.GetLongName(restestfile1, longfilename); |
290 r=TheFs.GetLongName(restestfile1, longfilename); |
290 test(r==KErrNone || KErrNotFound || r==KErrNotSupported); |
291 test_Value(r, r == KErrNone || r == KErrNotFound || r==KErrNotSupported); |
291 |
292 |
292 r=file1.Create(TheFs,oldName,EFileWrite); |
293 r=file1.Create(TheFs,oldName,EFileWrite); |
293 test(r==KErrNone || r==KErrAlreadyExists); |
294 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
294 file1.Close(); |
295 file1.Close(); |
295 |
296 |
296 r=TheFs.Replace(oldName,restestfile); |
297 r=TheFs.Replace(oldName,restestfile); |
297 test(r==KErrNone); |
298 test_KErrNone(r); |
298 |
299 |
299 r=TheFs.Delete(restestfile1); |
300 r=TheFs.Delete(restestfile1); |
300 test(r==KErrNone || r==KErrNotFound); |
301 test_Value(r, r == KErrNone || r==KErrNotFound); |
301 |
302 |
302 r=TheFs.Rename(restestfile,restestfile1); |
303 r=TheFs.Rename(restestfile,restestfile1); |
303 test(r==KErrNone); |
304 test_KErrNone(r); |
304 |
305 |
305 r=TheFs.Entry(restestfile1,entry); |
306 r=TheFs.Entry(restestfile1,entry); |
306 test(r==KErrNone); |
307 test_KErrNone(r); |
307 |
308 |
308 r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
309 r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
309 test(r==KErrNone); |
310 test_KErrNone(r); |
310 |
311 |
311 r=TheFs.Delete(restestfile1); |
312 r=TheFs.Delete(restestfile1); |
312 test(r==KErrNone); |
313 test_KErrNone(r); |
313 |
314 |
314 |
315 |
315 __UHEAP_MARKEND; |
316 __UHEAP_MARKEND; |
316 } |
317 } |
317 |
318 |
329 mkdirname.Zero(); |
330 mkdirname.Zero(); |
330 mkdirname.Append(pritestname); |
331 mkdirname.Append(pritestname); |
331 mkdirname.Append(KMkDirSub); |
332 mkdirname.Append(KMkDirSub); |
332 |
333 |
333 r=TheFs.MkDirAll(mkdirname); |
334 r=TheFs.MkDirAll(mkdirname); |
334 test(r==KErrPermissionDenied); |
335 test_Value(r, r == KErrPermissionDenied); |
335 |
336 |
336 r=TheFs.RmDir(mkdirname); |
337 r=TheFs.RmDir(mkdirname); |
337 test(r==KErrPermissionDenied); |
338 test_Value(r, r == KErrPermissionDenied); |
338 |
339 |
339 r=TheFs.SetSubst(pritestname,EDriveO); |
340 r=TheFs.SetSubst(pritestname,EDriveO); |
340 test(r==KErrPermissionDenied); |
341 test_Value(r, r == KErrPermissionDenied); |
341 |
342 |
342 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
343 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
343 test(r==KErrNone); |
344 test_KErrNone(r); |
344 |
345 |
345 r=TheFs.SetSessionPath(pritestname); |
346 r=TheFs.SetSessionPath(pritestname); |
346 test(r==KErrPermissionDenied); |
347 test_Value(r, r == KErrPermissionDenied); |
347 |
348 |
348 TheFs.NotifyChange(ENotifyAll,aStat2,pritestname); |
349 TheFs.NotifyChange(ENotifyAll,aStat2,pritestname); |
349 test(aStat2==KErrPermissionDenied); |
350 test(aStat2==KErrPermissionDenied); |
350 |
351 |
351 |
352 |
357 |
358 |
358 oldName=KOldFile; |
359 oldName=KOldFile; |
359 oldName[0]=(TText)gDriveToTest; |
360 oldName[0]=(TText)gDriveToTest; |
360 |
361 |
361 r=TheFs.GetShortName(pritestfile, shortfilename); |
362 r=TheFs.GetShortName(pritestfile, shortfilename); |
362 test(r==KErrPermissionDenied || r==KErrNotSupported); |
363 test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported); |
363 |
364 |
364 r=TheFs.GetLongName(pritestfile1, longfilename); |
365 r=TheFs.GetLongName(pritestfile1, longfilename); |
365 test(r==KErrPermissionDenied || r==KErrNotSupported); |
366 test_Value(r, r == KErrPermissionDenied || r==KErrNotSupported); |
366 |
367 |
367 r=file1.Create(TheFs,oldName,EFileWrite); |
368 r=file1.Create(TheFs,oldName,EFileWrite); |
368 test(r==KErrNone || r==KErrAlreadyExists); |
369 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
369 file1.Close(); |
370 file1.Close(); |
370 |
371 |
371 r=TheFs.Replace(oldName,pritestfile); |
372 r=TheFs.Replace(oldName,pritestfile); |
372 test(r==KErrPermissionDenied); |
373 test_Value(r, r == KErrPermissionDenied); |
373 |
374 |
374 r=TheFs.Rename(pritestfile,pritestfile1); |
375 r=TheFs.Rename(pritestfile,pritestfile1); |
375 test(r==KErrPermissionDenied); |
376 test_Value(r, r == KErrPermissionDenied); |
376 |
377 |
377 r=TheFs.Entry(pritestfile1,entry); |
378 r=TheFs.Entry(pritestfile1,entry); |
378 test(r==KErrPermissionDenied); |
379 test_Value(r, r == KErrPermissionDenied); |
379 |
380 |
380 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
381 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
381 test(r==KErrPermissionDenied); |
382 test_Value(r, r == KErrPermissionDenied); |
382 |
383 |
383 r=TheFs.Delete(pritestfile1); |
384 r=TheFs.Delete(pritestfile1); |
384 test(r==KErrPermissionDenied); |
385 test_Value(r, r == KErrPermissionDenied); |
385 |
386 |
386 |
387 |
387 __UHEAP_MARKEND; |
388 __UHEAP_MARKEND; |
388 } |
389 } |
389 |
390 |
397 |
398 |
398 mkdirname.Zero(); |
399 mkdirname.Zero(); |
399 mkdirname.Append(theprivatepath); |
400 mkdirname.Append(theprivatepath); |
400 mkdirname.Append(KMkDirSub); |
401 mkdirname.Append(KMkDirSub); |
401 r=TheFs.MkDirAll(mkdirname); |
402 r=TheFs.MkDirAll(mkdirname); |
402 test(r==KErrNone); |
403 test_KErrNone(r); |
403 |
404 |
404 r=TheFs.RmDir(mkdirname); |
405 r=TheFs.RmDir(mkdirname); |
405 test(r==KErrNone); |
406 test_KErrNone(r); |
406 |
407 |
407 r=TheFs.SetSubst(theprivatepath,EDriveO); |
408 r=TheFs.SetSubst(theprivatepath,EDriveO); |
408 test(r==KErrNone); |
409 test_KErrNone(r); |
409 |
410 |
410 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
411 r=TheFs.RealName(_L("O:\\File.XXX"),realName); |
411 test(r==KErrNone); |
412 test_KErrNone(r); |
412 |
413 |
413 r=TheFs.SetSubst(_L(""),EDriveO); //to unsubst |
414 r=TheFs.SetSubst(_L(""),EDriveO); //to unsubst |
414 test(r==KErrNone); |
415 test_KErrNone(r); |
415 |
416 |
416 r=TheFs.SetSessionPath(theprivatepath); |
417 r=TheFs.SetSessionPath(theprivatepath); |
417 test(r==KErrNone); |
418 test_KErrNone(r); |
418 |
419 |
419 TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath); |
420 TheFs.NotifyChange(ENotifyAll,aStat3,theprivatepath); |
420 test(aStat3==KRequestPending); |
421 test(aStat3==KRequestPending); |
421 |
422 |
422 pritestfile=theprivatepath; |
423 pritestfile=theprivatepath; |
427 |
428 |
428 oldName=KOldFile; |
429 oldName=KOldFile; |
429 oldName[0]=(TText)gDriveToTest; |
430 oldName[0]=(TText)gDriveToTest; |
430 |
431 |
431 r=TheFs.GetShortName(pritestfile, shortfilename); |
432 r=TheFs.GetShortName(pritestfile, shortfilename); |
432 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported); |
433 test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
433 |
434 |
434 r=TheFs.GetLongName(pritestfile1, longfilename); |
435 r=TheFs.GetLongName(pritestfile1, longfilename); |
435 test(r==KErrNone || r==KErrNotFound || r==KErrNotSupported); |
436 test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrNotSupported); |
436 |
437 |
437 r=file1.Create(TheFs,oldName,EFileWrite); |
438 r=file1.Create(TheFs,oldName,EFileWrite); |
438 test(r==KErrNone || r==KErrAlreadyExists); |
439 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
439 file1.Close(); |
440 file1.Close(); |
440 |
441 |
441 r=TheFs.Replace(oldName,pritestfile); |
442 r=TheFs.Replace(oldName,pritestfile); |
442 test(r==KErrNone); |
443 test_KErrNone(r); |
443 |
444 |
444 r=TheFs.Rename(pritestfile,pritestfile1); |
445 r=TheFs.Rename(pritestfile,pritestfile1); |
445 test(r==KErrNone || r==KErrAlreadyExists); |
446 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
446 |
447 |
447 r=TheFs.Entry(pritestfile1,entry); |
448 r=TheFs.Entry(pritestfile1,entry); |
448 test(r==KErrNone); |
449 test_KErrNone(r); |
449 |
450 |
450 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
451 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
451 test(r==KErrNone); |
452 test_KErrNone(r); |
452 |
453 |
453 r=TheFs.Delete(pritestfile1); |
454 r=TheFs.Delete(pritestfile1); |
454 test(r==KErrNone); |
455 test_KErrNone(r); |
455 |
456 |
456 __UHEAP_MARKEND; |
457 __UHEAP_MARKEND; |
457 } |
458 } |
458 |
459 |
459 |
460 |
463 // |
464 // |
464 { |
465 { |
465 __UHEAP_MARK; |
466 __UHEAP_MARK; |
466 |
467 |
467 r=TheFs.SetSessionPath(systestname); |
468 r=TheFs.SetSessionPath(systestname); |
468 test(r==KErrPermissionDenied); |
469 test_Value(r, r == KErrPermissionDenied); |
469 |
470 |
470 r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite); |
471 r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite); |
471 test(r==KErrNone); |
472 test_KErrNone(r); |
472 file1.Close(); |
473 file1.Close(); |
473 |
474 |
474 systestfile=KSystemPath; |
475 systestfile=KSystemPath; |
475 systestfile[0]=(TText)('A' + gTheDriveNum); |
476 systestfile[0]=(TText)('A' + gTheDriveNum); |
476 systestfile1=systestfile; |
477 systestfile1=systestfile; |
477 systestfile.Append(KFileSys); |
478 systestfile.Append(KFileSys); |
478 systestfile1.Append(KFileSys3); |
479 systestfile1.Append(KFileSys3); |
479 |
480 |
480 r=file1.Create(TheFs,systestfile,EFileWrite); |
481 r=file1.Create(TheFs,systestfile,EFileWrite); |
481 test(r==KErrNone); |
482 test_KErrNone(r); |
482 file1.Close(); |
483 file1.Close(); |
483 |
484 |
484 r=file1.Open(TheFs,systestfile,EFileWrite); |
485 r=file1.Open(TheFs,systestfile,EFileWrite); |
485 test(r==KErrNone); |
486 test_KErrNone(r); |
486 file1.Close(); |
487 file1.Close(); |
487 |
488 |
488 r=file1.Open(TheFs,systestfile,EFileRead); |
489 r=file1.Open(TheFs,systestfile,EFileRead); |
489 test(r==KErrPermissionDenied); |
490 test_Value(r, r == KErrPermissionDenied); |
490 file1.Close(); |
491 file1.Close(); |
491 |
492 |
492 r=file1.Replace(TheFs,systestfile,EFileWrite); |
493 r=file1.Replace(TheFs,systestfile,EFileWrite); |
493 test(r==KErrNone); |
494 test_KErrNone(r); |
494 |
495 |
495 r=file1.Rename(systestfile1); |
496 r=file1.Rename(systestfile1); |
496 test(r==KErrNone); |
497 test_KErrNone(r); |
497 file1.Close(); |
498 file1.Close(); |
498 |
499 |
499 TFindFile finder(TheFs); |
500 TFindFile finder(TheFs); |
500 CDir* dir = NULL; |
501 CDir* dir = NULL; |
501 r=finder.FindWildByDir(KWildFile, KWildPath, dir); |
502 r=finder.FindWildByDir(KWildFile, KWildPath, dir); |
502 if (!(r==KErrPermissionDenied)) |
503 if (!(r==KErrPermissionDenied)) |
503 test.Printf(_L("T_DCTCBDISKADMIN: test find wildcards r = %d (expected KErrPermissionDenied)\n"), r); |
504 test.Printf(_L("T_DCTCBDISKADMIN: test find wildcards r = %d (expected KErrPermissionDenied)\n"), r); |
504 test(r==KErrPermissionDenied); |
505 test_Value(r, r == KErrPermissionDenied); |
505 // delete dir; |
506 // delete dir; |
506 |
507 |
507 r=TheFs.Delete(fromTemp); |
508 r=TheFs.Delete(fromTemp); |
508 test(r==KErrNone); |
509 test_KErrNone(r); |
509 |
510 |
510 r=TheFs.Delete(systestfile1); |
511 r=TheFs.Delete(systestfile1); |
511 test(r==KErrNone); |
512 test_KErrNone(r); |
512 |
513 |
513 |
514 |
514 __UHEAP_MARKEND; |
515 __UHEAP_MARKEND; |
515 } |
516 } |
516 |
517 |
520 // |
521 // |
521 { |
522 { |
522 __UHEAP_MARK; |
523 __UHEAP_MARK; |
523 |
524 |
524 r=TheFs.SetSessionPath(restestname); |
525 r=TheFs.SetSessionPath(restestname); |
525 test(r==KErrNone); |
526 test_KErrNone(r); |
526 |
527 |
527 r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite); |
528 r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite); |
528 test(r==KErrNone); |
529 test_KErrNone(r); |
529 file1.Close(); |
530 file1.Close(); |
530 |
531 |
531 r=file1.Create(TheFs,KFileRes,EFileWrite); |
532 r=file1.Create(TheFs,KFileRes,EFileWrite); |
532 test(r==KErrNone); |
533 test_KErrNone(r); |
533 file1.Close(); |
534 file1.Close(); |
534 |
535 |
535 r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive ); |
536 r=file1.Open(TheFs,KFileRes,EFileWrite|EFileShareExclusive ); |
536 test(r==KErrNone); |
537 test_KErrNone(r); |
537 |
538 |
538 r=file1.Rename(KFileRes3); |
539 r=file1.Rename(KFileRes3); |
539 test(r==KErrNone); |
540 test_KErrNone(r); |
540 file1.Close(); |
541 file1.Close(); |
541 |
542 |
542 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileRead); |
543 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileRead); |
543 test(r==KErrNone); |
544 test_KErrNone(r); |
544 file1.Close(); |
545 file1.Close(); |
545 |
546 |
546 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileWrite); |
547 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOrWriters|EFileWrite); |
547 test(r==KErrNone); |
548 test_KErrNone(r); |
548 file1.Close(); |
549 file1.Close(); |
549 |
550 |
550 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOnly); |
551 r=file1.Open(TheFs,KFileRes3,EFileShareReadersOnly); |
551 test(r==KErrNone); |
552 test_KErrNone(r); |
552 |
553 |
553 r=file1.ChangeMode(EFileShareExclusive); |
554 r=file1.ChangeMode(EFileShareExclusive); |
554 test(r==KErrNone); |
555 test_KErrNone(r); |
555 file1.Close(); |
556 file1.Close(); |
556 |
557 |
557 r=file1.Replace(TheFs,KFileRes,EFileWrite); |
558 r=file1.Replace(TheFs,KFileRes,EFileWrite); |
558 test(r==KErrNone); |
559 test_KErrNone(r); |
559 file1.Close(); |
560 file1.Close(); |
560 |
561 |
561 r=TheFs.Delete(KFileRes); |
562 r=TheFs.Delete(KFileRes); |
562 test(r==KErrNone); |
563 test_KErrNone(r); |
563 |
564 |
564 r=TheFs.Delete(KFileRes3); |
565 r=TheFs.Delete(KFileRes3); |
565 test(r==KErrNone); |
566 test_KErrNone(r); |
566 |
567 |
567 r=TheFs.Delete(fromTemp); |
568 r=TheFs.Delete(fromTemp); |
568 test(r==KErrNone); |
569 test_KErrNone(r); |
569 |
570 |
570 __UHEAP_MARKEND; |
571 __UHEAP_MARKEND; |
571 } |
572 } |
572 |
573 |
573 |
574 |
577 // |
578 // |
578 { |
579 { |
579 __UHEAP_MARK; |
580 __UHEAP_MARK; |
580 |
581 |
581 r=TheFs.SetSessionPath(pritestfalseidname); |
582 r=TheFs.SetSessionPath(pritestfalseidname); |
582 test(r==KErrPermissionDenied); |
583 test_Value(r, r == KErrPermissionDenied); |
583 |
584 |
584 // Since can't set the session path to what is required, so use |
585 // Since can't set the session path to what is required, so use |
585 // an explicit path |
586 // an explicit path |
586 pritestfile=pritestfalseidname; |
587 pritestfile=pritestfalseidname; |
587 pritestfile[0]=(TText)('A' + gTheDriveNum); |
588 pritestfile[0]=(TText)('A' + gTheDriveNum); |
588 pritestfile.Append(KFilePri); |
589 pritestfile.Append(KFilePri); |
589 |
590 |
590 r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite); |
591 r=file1.Temp(TheFs,pritestfalseidname,fromTemp,EFileWrite); |
591 test(r==KErrPermissionDenied); |
592 test_Value(r, r == KErrPermissionDenied); |
592 file1.Close(); |
593 file1.Close(); |
593 |
594 |
594 r=file1.Create(TheFs,pritestfile,EFileWrite); |
595 r=file1.Create(TheFs,pritestfile,EFileWrite); |
595 test(r==KErrPermissionDenied); |
596 test_Value(r, r == KErrPermissionDenied); |
596 file1.Close(); |
597 file1.Close(); |
597 |
598 |
598 r=file1.Open(TheFs,pritestfile,EFileWrite); |
599 r=file1.Open(TheFs,pritestfile,EFileWrite); |
599 test(r==KErrPermissionDenied); |
600 test_Value(r, r == KErrPermissionDenied); |
600 file1.Close(); |
601 file1.Close(); |
601 |
602 |
602 r=file1.Replace(TheFs,pritestfile,EFileWrite); |
603 r=file1.Replace(TheFs,pritestfile,EFileWrite); |
603 test(r==KErrPermissionDenied); |
604 test_Value(r, r == KErrPermissionDenied); |
604 |
605 |
605 // Can't perform this operation since file1 has not been created |
606 // Can't perform this operation since file1 has not been created |
606 /* r=file1.Rename(KFilePri3); |
607 /* r=file1.Rename(KFilePri3); |
607 test(r==KErrPermissionDenied); |
608 test_Value(r, r == KErrPermissionDenied); |
608 file1.Close(); |
609 file1.Close(); |
609 */ |
610 */ |
610 __UHEAP_MARKEND; |
611 __UHEAP_MARKEND; |
611 } |
612 } |
612 |
613 |
618 // |
619 // |
619 { |
620 { |
620 __UHEAP_MARK; |
621 __UHEAP_MARK; |
621 |
622 |
622 r=TheFs.SetSessionPath(pritestname); |
623 r=TheFs.SetSessionPath(pritestname); |
623 test(r==KErrPermissionDenied); |
624 test_Value(r, r == KErrPermissionDenied); |
624 |
625 |
625 r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite); |
626 r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite); |
626 test(r==KErrPermissionDenied); |
627 test_Value(r, r == KErrPermissionDenied); |
627 file1.Close(); |
628 file1.Close(); |
628 |
629 |
629 // Since can't set session path create explicit path |
630 // Since can't set session path create explicit path |
630 pritestfile=KPrivatePath; |
631 pritestfile=KPrivatePath; |
631 pritestfile[0]=(TText)('A' + gTheDriveNum); |
632 pritestfile[0]=(TText)('A' + gTheDriveNum); |
632 pritestfile.Append(KFilePri); |
633 pritestfile.Append(KFilePri); |
633 |
634 |
634 r=file1.Create(TheFs,pritestfile,EFileWrite); |
635 r=file1.Create(TheFs,pritestfile,EFileWrite); |
635 test(r==KErrPermissionDenied); |
636 test_Value(r, r == KErrPermissionDenied); |
636 file1.Close(); |
637 file1.Close(); |
637 |
638 |
638 r=file1.Open(TheFs,pritestfile,EFileWrite); |
639 r=file1.Open(TheFs,pritestfile,EFileWrite); |
639 test(r==KErrPermissionDenied); |
640 test_Value(r, r == KErrPermissionDenied); |
640 file1.Close(); |
641 file1.Close(); |
641 |
642 |
642 r=file1.Open(TheFs,pritestfile,EFileRead); |
643 r=file1.Open(TheFs,pritestfile,EFileRead); |
643 test(r==KErrPermissionDenied); |
644 test_Value(r, r == KErrPermissionDenied); |
644 file1.Close(); |
645 file1.Close(); |
645 |
646 |
646 r=file1.Replace(TheFs,pritestfile,EFileWrite); |
647 r=file1.Replace(TheFs,pritestfile,EFileWrite); |
647 test(r==KErrPermissionDenied); |
648 test_Value(r, r == KErrPermissionDenied); |
648 |
649 |
649 // Can't rename nor delete since file1 not created |
650 // Can't rename nor delete since file1 not created |
650 /* |
651 /* |
651 r=file1.Rename(KFilePri3); |
652 r=file1.Rename(KFilePri3); |
652 test(r==KErrPermissionDenied); |
653 test_Value(r, r == KErrPermissionDenied); |
653 file1.Close(); |
654 file1.Close(); |
654 |
655 |
655 r=TheFs.Delete(fromTemp); |
656 r=TheFs.Delete(fromTemp); |
656 test(r==KErrNone); |
657 test_KErrNone(r); |
657 */ |
658 */ |
658 |
659 |
659 __UHEAP_MARKEND; |
660 __UHEAP_MARKEND; |
660 } |
661 } |
661 |
662 |
667 // |
668 // |
668 { |
669 { |
669 __UHEAP_MARK; |
670 __UHEAP_MARK; |
670 |
671 |
671 r=TheFs.SetSessionToPrivate(gTheDriveNum); |
672 r=TheFs.SetSessionToPrivate(gTheDriveNum); |
672 test(r==KErrNone); |
673 test_KErrNone(r); |
673 |
674 |
674 r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite); |
675 r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite); |
675 test(r==KErrNone); |
676 test_KErrNone(r); |
676 file1.Close(); |
677 file1.Close(); |
677 |
678 |
678 r=file1.Create(TheFs,KFilePri,EFileWrite); |
679 r=file1.Create(TheFs,KFilePri,EFileWrite); |
679 test(r==KErrNone || r==KErrAlreadyExists); |
680 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
680 file1.Close(); |
681 file1.Close(); |
681 |
682 |
682 r=file1.Open(TheFs,KFilePri,EFileWrite); |
683 r=file1.Open(TheFs,KFilePri,EFileWrite); |
683 test(r==KErrNone); |
684 test_KErrNone(r); |
684 file1.Close(); |
685 file1.Close(); |
685 |
686 |
686 r=file1.Open(TheFs,KFilePri,EFileRead); |
687 r=file1.Open(TheFs,KFilePri,EFileRead); |
687 test(r==KErrNone); |
688 test_KErrNone(r); |
688 file1.Close(); |
689 file1.Close(); |
689 |
690 |
690 r=file1.Replace(TheFs,KFilePri,EFileWrite); |
691 r=file1.Replace(TheFs,KFilePri,EFileWrite); |
691 test(r==KErrNone); |
692 test_KErrNone(r); |
692 |
693 |
693 r=file1.Rename(KFilePri3); |
694 r=file1.Rename(KFilePri3); |
694 test(r==KErrNone); |
695 test_KErrNone(r); |
695 file1.Close(); |
696 file1.Close(); |
696 |
697 |
697 r=TheFs.Delete(KFilePri3); |
698 r=TheFs.Delete(KFilePri3); |
698 test(r==KErrNone); |
699 test_KErrNone(r); |
699 |
700 |
700 r=TheFs.Delete(fromTemp); |
701 r=TheFs.Delete(fromTemp); |
701 test(r==KErrNone); |
702 test_KErrNone(r); |
702 |
703 |
703 __UHEAP_MARKEND; |
704 __UHEAP_MARKEND; |
704 } |
705 } |
705 |
706 |
706 LOCAL_C void RDirtest() |
707 LOCAL_C void RDirtest() |
714 //system |
715 //system |
715 CDir* dirEntries; |
716 CDir* dirEntries; |
716 TBuf<30> dirNameBuf(KSystemPath); |
717 TBuf<30> dirNameBuf(KSystemPath); |
717 dirNameBuf[0]=(TText)gDriveToTest; |
718 dirNameBuf[0]=(TText)gDriveToTest; |
718 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
719 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
719 test(r==KErrPermissionDenied); |
720 test_Value(r, r == KErrPermissionDenied); |
720 dir.Close(); |
721 dir.Close(); |
721 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
722 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
722 test(r==KErrPermissionDenied); |
723 test_Value(r, r == KErrPermissionDenied); |
723 dirNameBuf.Zero(); |
724 dirNameBuf.Zero(); |
724 delete dirEntries; |
725 delete dirEntries; |
725 |
726 |
726 //Private |
727 //Private |
727 dirNameBuf=KPrivatePath; |
728 dirNameBuf=KPrivatePath; |
728 dirNameBuf[0]=(TText)gDriveToTest; |
729 dirNameBuf[0]=(TText)gDriveToTest; |
729 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
730 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
730 test(r==KErrPermissionDenied); |
731 test_Value(r, r == KErrPermissionDenied); |
731 dir.Close(); |
732 dir.Close(); |
732 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
733 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
733 test(r==KErrPermissionDenied); |
734 test_Value(r, r == KErrPermissionDenied); |
734 dirNameBuf.Zero(); |
735 dirNameBuf.Zero(); |
735 delete dirEntries; |
736 delete dirEntries; |
736 |
737 |
737 //Private//<wrong ID>// |
738 //Private//<wrong ID>// |
738 dirNameBuf=KPrivateFalseID; |
739 dirNameBuf=KPrivateFalseID; |
739 dirNameBuf[0]=(TText)gDriveToTest; |
740 dirNameBuf[0]=(TText)gDriveToTest; |
740 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
741 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
741 test(r==KErrPermissionDenied); |
742 test_Value(r, r == KErrPermissionDenied); |
742 dir.Close(); |
743 dir.Close(); |
743 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
744 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
744 test(r==KErrPermissionDenied); |
745 test_Value(r, r == KErrPermissionDenied); |
745 dirNameBuf.Zero(); |
746 dirNameBuf.Zero(); |
746 delete dirEntries; |
747 delete dirEntries; |
747 |
748 |
748 //Private/uid |
749 //Private/uid |
749 TheFs.PrivatePath(dirNameBuf); |
750 TheFs.PrivatePath(dirNameBuf); |
750 dirNameBuf.Insert(0,_L("?:")); |
751 dirNameBuf.Insert(0,_L("?:")); |
751 dirNameBuf[0]=(TText)gDriveToTest; |
752 dirNameBuf[0]=(TText)gDriveToTest; |
752 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
753 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
753 test(r==KErrNone); |
754 test_KErrNone(r); |
754 dir.Close(); |
755 dir.Close(); |
755 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
756 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
756 test(r==KErrNone); |
757 test_KErrNone(r); |
757 dirNameBuf.Zero(); |
758 dirNameBuf.Zero(); |
758 delete dirEntries; |
759 delete dirEntries; |
759 //Resource |
760 //Resource |
760 |
761 |
761 dirNameBuf=KResourcePath; |
762 dirNameBuf=KResourcePath; |
762 dirNameBuf[0]=(TText)gDriveToTest; |
763 dirNameBuf[0]=(TText)gDriveToTest; |
763 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
764 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
764 test(r==KErrNone); |
765 test_KErrNone(r); |
765 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
766 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
766 test(r==KErrNone); |
767 test_KErrNone(r); |
767 dir.Close(); |
768 dir.Close(); |
768 delete dirEntries; |
769 delete dirEntries; |
769 |
770 |
770 __UHEAP_MARKEND; |
771 __UHEAP_MARKEND; |
771 } |
772 } |
777 // |
778 // |
778 { |
779 { |
779 __UHEAP_MARK; |
780 __UHEAP_MARK; |
780 |
781 |
781 r=TheFs.FileSystemName(fsname,gTheDriveNum); |
782 r=TheFs.FileSystemName(fsname,gTheDriveNum); |
782 test(r==KErrNone); |
783 test_KErrNone(r); |
783 r = DismountFileSystem(TheFs, fsname, gTheDriveNum); |
784 r = DismountFileSystem(TheFs, fsname, gTheDriveNum); |
784 test(r==KErrNone || r==KErrNotFound); |
785 test_Value(r, r == KErrNone || r==KErrNotFound); |
785 // r=TheFs.RemoveFileSystem(fsname); //can not test due to bug else where fix exists |
786 // r=TheFs.RemoveFileSystem(fsname); //can not test due to bug else where fix exists |
786 // test(r==KErrNone); |
787 // test_KErrNone(r); |
787 // r=TheFs.AddFileSystem(fsname); |
788 // r=TheFs.AddFileSystem(fsname); |
788 // test(r==KErrNone); |
789 // test_KErrNone(r); |
789 r = MountFileSystem(TheFs, fsname, gTheDriveNum); |
790 r = MountFileSystem(TheFs, fsname, gTheDriveNum); |
790 test(r==KErrNone); |
791 test_KErrNone(r); |
791 r=TheFs.SetDriveName(gTheDriveNum,KDriveName); |
792 r=TheFs.SetDriveName(gTheDriveNum,KDriveName); |
792 test(r==KErrNone); |
793 test_KErrNone(r); |
793 #ifndef __WINS__ |
794 #ifndef __WINS__ |
794 r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum); |
795 r=TheFs.SetVolumeLabel(KVolLable, gTheDriveNum); |
795 test(r==KErrNone); |
796 test_KErrNone(r); |
796 #endif |
797 #endif |
797 |
798 |
798 systemRFsTest(); |
799 systemRFsTest(); |
799 ResourceRFsTest(); |
800 ResourceRFsTest(); |
800 privateRFsTest(); |
801 privateRFsTest(); |
816 test(aStat2==KErrPermissionDenied); |
817 test(aStat2==KErrPermissionDenied); |
817 test(aStat3==KErrNone); |
818 test(aStat3==KErrNone); |
818 test(aStat4==KErrNone); |
819 test(aStat4==KErrNone); |
819 |
820 |
820 r=TheFs.SetSessionPath(systestname); |
821 r=TheFs.SetSessionPath(systestname); |
821 test(r==KErrPermissionDenied); |
822 test_Value(r, r == KErrPermissionDenied); |
822 |
823 |
823 //Test RRawDisk class |
824 //Test RRawDisk class |
824 r=rawdisk.Open(TheFs,gTheDriveNum); |
825 r=rawdisk.Open(TheFs,gTheDriveNum); |
825 test(r==KErrNone); |
826 test_KErrNone(r); |
826 rawdisk.Close(); |
827 rawdisk.Close(); |
827 |
828 |
828 RDirtest(); |
829 RDirtest(); |
829 |
830 |
830 #ifdef __WINS__ |
831 #ifdef __WINS__ |
831 if (User::UpperCase(driveBuf[0]) != 'C') |
832 if (User::UpperCase(driveBuf[0]) != 'C') |
832 #endif |
833 #endif |
833 { |
834 { |
834 //Test RFormat class |
835 //Test RFormat class |
835 r=format.Open(TheFs,driveBuf,EHighDensity,count); |
836 r=format.Open(TheFs,driveBuf,EHighDensity,count); |
836 test(r==KErrNone); |
837 test_KErrNone(r); |
837 |
838 |
838 while(count) |
839 while(count) |
839 { |
840 { |
840 TInt r=format.Next(count); |
841 TInt r=format.Next(count); |
841 test(r==KErrNone); |
842 test_KErrNone(r); |
842 } |
843 } |
843 format.Close(); |
844 format.Close(); |
844 } |
845 } |
845 |
846 |
846 driveBuf[0]=(TText)gDriveToTest; |
847 driveBuf[0]=(TText)gDriveToTest; |
847 r=TheFs.ScanDrive(driveBuf); |
848 r=TheFs.ScanDrive(driveBuf); |
848 test(r==KErrNone || r==KErrNotSupported); |
849 test_Value(r, r == KErrNone || r==KErrNotSupported); |
849 r=TheFs.CheckDisk(driveBuf); |
850 r=TheFs.CheckDisk(driveBuf); |
850 test(r==KErrNone || r==KErrNotSupported); |
851 test_Value(r, r == KErrNone || r==KErrNotSupported); |
851 |
852 |
852 __UHEAP_MARKEND; |
853 __UHEAP_MARKEND; |
853 } |
854 } |
854 |
855 |
855 LOCAL_C void TestCaps() |
856 LOCAL_C void TestCaps() |
865 r=RProcess().HasCapability(ECapabilityTCB,ECapabilityDiskAdmin, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg)); |
866 r=RProcess().HasCapability(ECapabilityTCB,ECapabilityDiskAdmin, __PLATSEC_DIAGNOSTIC_STRING(myDiagMsg)); |
866 test(r); |
867 test(r); |
867 |
868 |
868 driveBuf[0]=(TText)gDriveToTest; |
869 driveBuf[0]=(TText)gDriveToTest; |
869 r=TheFs.SessionPath(temp); |
870 r=TheFs.SessionPath(temp); |
870 test(r==KErrNone); |
871 test_KErrNone(r); |
871 |
872 |
872 test.Printf(_L("Session path: %S"),&temp); |
873 test.Printf(_L("Session path: %S"),&temp); |
873 |
874 |
874 r=TheFs.CreatePrivatePath(gTheDriveNum); |
875 r=TheFs.CreatePrivatePath(gTheDriveNum); |
875 test(r==KErrNone || r== KErrAlreadyExists); |
876 test_Value(r, r == KErrNone || r== KErrAlreadyExists); |
876 |
877 |
877 TBuf<18> tempPri; |
878 TBuf<18> tempPri; |
878 r=TheFs.PrivatePath(tempPri); |
879 r=TheFs.PrivatePath(tempPri); |
879 test(r==KErrNone); |
880 test_KErrNone(r); |
880 theprivatepath = _L("?:"); |
881 theprivatepath = _L("?:"); |
881 theprivatepath.Append(tempPri); |
882 theprivatepath.Append(tempPri); |
882 |
883 |
883 TestTcbDiskAdmin(); |
884 TestTcbDiskAdmin(); |
884 |
885 |
885 TFileName thesessionpath; |
886 TFileName thesessionpath; |
886 |
887 |
887 r=TheFs.SetSessionToPrivate(gTheDriveNum); |
888 r=TheFs.SetSessionToPrivate(gTheDriveNum); |
888 test(r==KErrNone); |
889 test_KErrNone(r); |
889 r=TheFs.SessionPath(thesessionpath); |
890 r=TheFs.SessionPath(thesessionpath); |
890 test(r==KErrNone); |
891 test_KErrNone(r); |
891 |
892 |
892 test(thesessionpath == theprivatepath); |
893 test(thesessionpath == theprivatepath); |
893 |
894 |
894 __UHEAP_MARKEND; |
895 __UHEAP_MARKEND; |
895 } |
896 } |
900 // |
901 // |
901 { |
902 { |
902 test.Next(_L("Delete test directory")); |
903 test.Next(_L("Delete test directory")); |
903 CFileMan* fMan=CFileMan::NewL(TheFs); |
904 CFileMan* fMan=CFileMan::NewL(TheFs); |
904 TInt r=fMan->RmDir(gSessionPath); |
905 TInt r=fMan->RmDir(gSessionPath); |
905 test(r==KErrNone || r==KErrPathNotFound); |
906 test_Value(r, r == KErrNone || r==KErrPathNotFound); |
906 |
907 |
907 TBuf<20> delDir; |
908 TBuf<20> delDir; |
908 delDir=KResourcePath; |
909 delDir=KResourcePath; |
909 delDir[0]=(TText)gDriveToTest; |
910 delDir[0]=(TText)gDriveToTest; |
910 r=fMan->RmDir(delDir); |
911 r=fMan->RmDir(delDir); |
911 test(r==KErrNone || r==KErrPathNotFound); |
912 test_Value(r, r == KErrNone || r==KErrPathNotFound); |
912 delete fMan; |
913 delete fMan; |
913 |
914 |
914 delDir=KSystemPath; |
915 delDir=KSystemPath; |
915 delDir[0]=(TText)gDriveToTest; |
916 delDir[0]=(TText)gDriveToTest; |
916 r=TheFs.RmDir(delDir); |
917 r=TheFs.RmDir(delDir); |
917 test(r==KErrNone || r==KErrPathNotFound || r==KErrNotFound); |
918 test_Value(r, r == KErrNone || r==KErrPathNotFound || r==KErrNotFound); |
918 } |
919 } |
919 |
920 |
920 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/) |
921 GLDEF_C void CallTestsL(/*TChar aDriveLetter*/) |
921 // |
922 // |
922 // Do all tests |
923 // Do all tests |
958 //check double mode ie that Defpath still works |
959 //check double mode ie that Defpath still works |
959 RFs fs1; |
960 RFs fs1; |
960 RFs fs2; |
961 RFs fs2; |
961 |
962 |
962 r=fs1.Connect(); |
963 r=fs1.Connect(); |
963 test(r==KErrNone); |
964 test_KErrNone(r); |
964 r=fs1.SessionPath(sesspath); |
965 r=fs1.SessionPath(sesspath); |
965 test(r==KErrNone); |
966 test_KErrNone(r); |
966 test.Printf(_L("session1 Path=%S"),&sesspath); |
967 test.Printf(_L("session1 Path=%S"),&sesspath); |
967 |
968 |
968 TBuf<30> privatepath; |
969 TBuf<30> privatepath; |
969 r=fs1.SetSessionToPrivate(gTheDriveNum); |
970 r=fs1.SetSessionToPrivate(gTheDriveNum); |
970 test(r==KErrNone); |
971 test_KErrNone(r); |
971 r=fs1.PrivatePath(privatepath); |
972 r=fs1.PrivatePath(privatepath); |
972 test(r==KErrNone); |
973 test_KErrNone(r); |
973 r=privatepath.Compare(KExpectedPrivatePath()); |
974 r=privatepath.Compare(KExpectedPrivatePath()); |
974 test(r==0); |
975 test_Value(r, r == 0); |
975 r=fs1.SessionPath(sesspath); |
976 r=fs1.SessionPath(sesspath); |
976 test(r==KErrNone); |
977 test_KErrNone(r); |
977 r=privatepath.Compare(sesspath.Mid(KPathPosition)); |
978 r=privatepath.Compare(sesspath.Mid(KPathPosition)); |
978 test(r==0); |
979 test_Value(r, r == 0); |
979 r=fs1.CreatePrivatePath(gTheDriveNum); |
980 r=fs1.CreatePrivatePath(gTheDriveNum); |
980 test(r==KErrNone); |
981 test_KErrNone(r); |
981 fs1.Close(); |
982 fs1.Close(); |
982 |
983 |
983 r=fs2.Connect(); |
984 r=fs2.Connect(); |
984 test(r==KErrNone); |
985 test_KErrNone(r); |
985 r=fs2.SessionPath(sesspath); |
986 r=fs2.SessionPath(sesspath); |
986 test(r==KErrNone); |
987 test_KErrNone(r); |
987 test.Printf(_L("session2 Path=%S"),&sesspath); |
988 test.Printf(_L("session2 Path=%S"),&sesspath); |
988 fs2.Close(); |
989 fs2.Close(); |
989 |
990 |
990 __UHEAP_MARK; |
991 __UHEAP_MARK; |
991 TestCaps(); |
992 TestCaps(); |