160 |
158 |
161 oldName=KOldFile; |
159 oldName=KOldFile; |
162 oldName[0]=(TText)gDriveToTest; |
160 oldName[0]=(TText)gDriveToTest; |
163 |
161 |
164 r=TheFs.GetShortName(systestfile, shortfilename); |
162 r=TheFs.GetShortName(systestfile, shortfilename); |
165 test(r==KErrPermissionDenied); |
163 test_Value(r, r == KErrPermissionDenied); |
166 |
164 |
167 r=TheFs.GetLongName(systestfile1, longfilename); |
165 r=TheFs.GetLongName(systestfile1, longfilename); |
168 test(r==KErrPermissionDenied); |
166 test_Value(r, r == KErrPermissionDenied); |
169 |
167 |
170 r=file1.Create(TheFs,oldName,EFileWrite); |
168 r=file1.Create(TheFs,oldName,EFileWrite); |
171 test(r==KErrNone || r==KErrAlreadyExists); |
169 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
172 file1.Close(); |
170 file1.Close(); |
173 |
171 |
174 r=TheFs.Replace(oldName,systestfile); |
172 r=TheFs.Replace(oldName,systestfile); |
175 test(r==KErrPermissionDenied); |
173 test_Value(r, r == KErrPermissionDenied); |
176 |
174 |
177 r=TheFs.Rename(systestfile,systestfile1); |
175 r=TheFs.Rename(systestfile,systestfile1); |
178 test(r==KErrPermissionDenied); |
176 test_Value(r, r == KErrPermissionDenied); |
179 |
177 |
180 // check that the entry for the system directory itself can be retrieved with no error |
178 // check that the entry for the system directory itself can be retrieved with no error |
181 // - with or without a slash |
179 // - with or without a slash |
182 TPtrC restrictedDir(systestname.Ptr(), systestname.Length()); |
180 TPtrC restrictedDir(systestname.Ptr(), systestname.Length()); |
183 r=TheFs.Entry(restrictedDir, entry); |
181 r=TheFs.Entry(restrictedDir, entry); |
184 test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDir, r); |
182 test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDir, r); |
185 test(r==KErrNone); |
183 test_KErrNone(r); |
186 test (entry.iAtt & KEntryAttDir); |
184 test (entry.iAtt & KEntryAttDir); |
187 |
185 |
188 TPtrC restrictedDirWithNoBackSlash(restrictedDir.Ptr(), restrictedDir.Length()-1); |
186 TPtrC restrictedDirWithNoBackSlash(restrictedDir.Ptr(), restrictedDir.Length()-1); |
189 r=TheFs.Entry(restrictedDirWithNoBackSlash,entry); |
187 r=TheFs.Entry(restrictedDirWithNoBackSlash,entry); |
190 test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDirWithNoBackSlash, r); |
188 test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDirWithNoBackSlash, r); |
191 test(r==KErrNone); |
189 test_KErrNone(r); |
192 |
190 |
193 r=TheFs.Entry(systestfile1,entry); |
191 r=TheFs.Entry(systestfile1,entry); |
194 test(r==KErrPermissionDenied); |
192 test_Value(r, r == KErrPermissionDenied); |
195 |
193 |
196 r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
194 r=TheFs.SetEntry(systestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
197 test(r==KErrPermissionDenied); |
195 test_Value(r, r == KErrPermissionDenied); |
198 |
196 |
199 r=TheFs.Delete(systestfile1); |
197 r=TheFs.Delete(systestfile1); |
200 test(r==KErrPermissionDenied); |
198 test_Value(r, r == KErrPermissionDenied); |
201 |
199 |
202 } |
200 } |
203 |
201 |
204 |
202 |
205 LOCAL_C void resourceRFstest() |
203 LOCAL_C void resourceRFstest() |
241 |
239 |
242 oldName=KOldFile; |
240 oldName=KOldFile; |
243 oldName[0]=(TText)gDriveToTest; |
241 oldName[0]=(TText)gDriveToTest; |
244 |
242 |
245 r=TheFs.GetShortName(restestfile, shortfilename); |
243 r=TheFs.GetShortName(restestfile, shortfilename); |
246 test(r==KErrNone || KErrPathNotFound); |
244 // test_Value(r, r == KErrNone || r == KErrPathNotFound); |
|
245 test(r == KErrNone || KErrPathNotFound); |
247 |
246 |
248 r=TheFs.GetLongName(restestfile1, longfilename); |
247 r=TheFs.GetLongName(restestfile1, longfilename); |
249 test(r==KErrNone || KErrPathNotFound); |
248 // test_Value(r, r == KErrNone || r == KErrPathNotFound); |
|
249 test(r == KErrNone || KErrPathNotFound); |
250 |
250 |
251 r=file1.Create(TheFs,oldName,EFileWrite); |
251 r=file1.Create(TheFs,oldName,EFileWrite); |
252 test(r==KErrNone || r==KErrAlreadyExists); |
252 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
253 file1.Close(); |
253 file1.Close(); |
254 |
254 |
255 r=TheFs.Replace(oldName,restestfile); |
255 r=TheFs.Replace(oldName,restestfile); |
256 test(r==KErrPermissionDenied); |
256 test_Value(r, r == KErrPermissionDenied); |
257 |
257 |
258 r=TheFs.Rename(restestfile,restestfile1); |
258 r=TheFs.Rename(restestfile,restestfile1); |
259 test(r==KErrPermissionDenied); |
259 test_Value(r, r == KErrPermissionDenied); |
260 |
260 |
261 // check that the entry for the resource directory itself can be retrieved with no error |
261 // check that the entry for the resource directory itself can be retrieved with no error |
262 // - with or without a slash |
262 // - with or without a slash |
263 TPtrC restrictedDir(restestname.Ptr(), restestname.Length()); |
263 TPtrC restrictedDir(restestname.Ptr(), restestname.Length()); |
264 r=TheFs.Entry(restrictedDir, entry); |
264 r=TheFs.Entry(restrictedDir, entry); |
265 test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDir, r); |
265 test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDir, r); |
266 test(r==KErrNone); |
266 test_KErrNone(r); |
267 test (entry.iAtt & KEntryAttDir); |
267 test (entry.iAtt & KEntryAttDir); |
268 |
268 |
269 TPtrC restrictedDirWithNoBackSlash(restrictedDir.Ptr(), restrictedDir.Length()-1); |
269 TPtrC restrictedDirWithNoBackSlash(restrictedDir.Ptr(), restrictedDir.Length()-1); |
270 r=TheFs.Entry(restrictedDirWithNoBackSlash,entry); |
270 r=TheFs.Entry(restrictedDirWithNoBackSlash,entry); |
271 test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDirWithNoBackSlash, r); |
271 test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDirWithNoBackSlash, r); |
272 test(r==KErrNone); |
272 test_KErrNone(r); |
273 |
273 |
274 r=TheFs.Entry(restestfile1,entry); |
274 r=TheFs.Entry(restestfile1,entry); |
275 test(r==KErrNone || r==KErrNotFound); |
275 test_Value(r, r == KErrNone || r==KErrNotFound); |
276 |
276 |
277 r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
277 r=TheFs.SetEntry(restestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
278 test(r==KErrPermissionDenied); |
278 test_Value(r, r == KErrPermissionDenied); |
279 |
279 |
280 r=TheFs.Delete(restestfile1); |
280 r=TheFs.Delete(restestfile1); |
281 test(r==KErrPermissionDenied); |
281 test_Value(r, r == KErrPermissionDenied); |
282 |
282 |
283 } |
283 } |
284 |
284 |
285 |
285 |
286 LOCAL_C void privatefalseIDRFstest() |
286 LOCAL_C void privatefalseIDRFstest() |
379 |
379 |
380 oldName=KOldFile; |
380 oldName=KOldFile; |
381 oldName[0]=(TText)gDriveToTest; |
381 oldName[0]=(TText)gDriveToTest; |
382 |
382 |
383 r=TheFs.GetShortName(pritestfile, shortfilename); |
383 r=TheFs.GetShortName(pritestfile, shortfilename); |
384 test(r==KErrPermissionDenied); |
384 test_Value(r, r == KErrPermissionDenied); |
385 |
385 |
386 r=TheFs.GetLongName(pritestfile1, longfilename); |
386 r=TheFs.GetLongName(pritestfile1, longfilename); |
387 test(r==KErrPermissionDenied); |
387 test_Value(r, r == KErrPermissionDenied); |
388 |
388 |
389 r=file1.Create(TheFs,oldName,EFileWrite); |
389 r=file1.Create(TheFs,oldName,EFileWrite); |
390 test(r==KErrNone || r==KErrAlreadyExists); |
390 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
391 file1.Close(); |
391 file1.Close(); |
392 |
392 |
393 r=TheFs.Replace(oldName,pritestfile); |
393 r=TheFs.Replace(oldName,pritestfile); |
394 test(r==KErrPermissionDenied); |
394 test_Value(r, r == KErrPermissionDenied); |
395 |
395 |
396 r=TheFs.Rename(pritestfile,pritestfile1); |
396 r=TheFs.Rename(pritestfile,pritestfile1); |
397 test(r==KErrPermissionDenied); |
397 test_Value(r, r == KErrPermissionDenied); |
398 |
398 |
399 r=TheFs.Entry(pritestfile1,entry); |
399 r=TheFs.Entry(pritestfile1,entry); |
400 test(r==KErrPermissionDenied); |
400 test_Value(r, r == KErrPermissionDenied); |
401 |
401 |
402 // check that the entry for the private directory itself can be retrieved with no error |
402 // check that the entry for the private directory itself can be retrieved with no error |
403 // - with or without a slash |
403 // - with or without a slash |
404 TPtrC restrictedDir(pritestname.Ptr(), pritestname.Length()); |
404 TPtrC restrictedDir(pritestname.Ptr(), pritestname.Length()); |
405 r=TheFs.Entry(restrictedDir, entry); |
405 r=TheFs.Entry(restrictedDir, entry); |
406 test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDir, r); |
406 test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDir, r); |
407 test(r==KErrNone); |
407 test_KErrNone(r); |
408 test (entry.iAtt & KEntryAttDir); |
408 test (entry.iAtt & KEntryAttDir); |
409 |
409 |
410 TPtrC restrictedDirWithNoBackSlash(restrictedDir.Ptr(), restrictedDir.Length()-1); |
410 TPtrC restrictedDirWithNoBackSlash(restrictedDir.Ptr(), restrictedDir.Length()-1); |
411 r=TheFs.Entry(restrictedDirWithNoBackSlash,entry); |
411 r=TheFs.Entry(restrictedDirWithNoBackSlash,entry); |
412 test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDirWithNoBackSlash, r); |
412 test.Printf(_L("RFs::Entry(%S) returned %d"), &restrictedDirWithNoBackSlash, r); |
413 test(r==KErrNone); |
413 test_KErrNone(r); |
414 |
414 |
415 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
415 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
416 test(r==KErrPermissionDenied); |
416 test_Value(r, r == KErrPermissionDenied); |
417 |
417 |
418 r=TheFs.Delete(pritestfile1); |
418 r=TheFs.Delete(pritestfile1); |
419 test(r==KErrPermissionDenied); |
419 test_Value(r, r == KErrPermissionDenied); |
420 |
420 |
421 } |
421 } |
422 |
422 |
423 |
423 |
424 LOCAL_C void privateSIDRFstest() |
424 LOCAL_C void privateSIDRFstest() |
459 |
459 |
460 oldName=KOldFile; |
460 oldName=KOldFile; |
461 oldName[0]=(TText)gDriveToTest; |
461 oldName[0]=(TText)gDriveToTest; |
462 |
462 |
463 r=TheFs.GetShortName(pritestfile, shortfilename); |
463 r=TheFs.GetShortName(pritestfile, shortfilename); |
464 test(r==KErrNone || KErrPathNotFound); |
464 // test_Value(r, r == KErrNone || r == KErrPathNotFound); |
|
465 test(r == KErrNone || KErrPathNotFound); |
465 |
466 |
466 r=TheFs.GetLongName(pritestfile1, longfilename); |
467 r=TheFs.GetLongName(pritestfile1, longfilename); |
467 test(r==KErrNone || KErrPathNotFound); |
468 // test_Value(r, r == KErrNone || r == KErrPathNotFound); |
|
469 test(r == KErrNone || KErrPathNotFound); |
468 |
470 |
469 r=file1.Create(TheFs,oldName,EFileWrite); |
471 r=file1.Create(TheFs,oldName,EFileWrite); |
470 test(r==KErrNone || r==KErrAlreadyExists); |
472 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
471 file1.Close(); |
473 file1.Close(); |
472 |
474 |
473 r=TheFs.Replace(oldName,pritestfile); |
475 r=TheFs.Replace(oldName,pritestfile); |
474 test(r==KErrNone); |
476 test_KErrNone(r); |
475 |
477 |
476 r=TheFs.Rename(pritestfile,pritestfile1); |
478 r=TheFs.Rename(pritestfile,pritestfile1); |
477 test(r==KErrNone || r==KErrAlreadyExists); |
479 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
478 |
480 |
479 r=TheFs.Entry(pritestfile1,entry); |
481 r=TheFs.Entry(pritestfile1,entry); |
480 test(r==KErrNone); |
482 test_KErrNone(r); |
481 |
483 |
482 //Test Entry with correct SID |
484 //Test Entry with correct SID |
483 r=TheFs.Entry(theprivatepath,entry); |
485 r=TheFs.Entry(theprivatepath,entry); |
484 test(r==KErrNone); |
486 test_KErrNone(r); |
485 |
487 |
486 //Test Entry with correct SID and without "//" appended |
488 //Test Entry with correct SID and without "//" appended |
487 r=TheFs.Entry(KPrivatePathTest1,entry); |
489 r=TheFs.Entry(KPrivatePathTest1,entry); |
488 test(r==KErrNone); |
490 test_KErrNone(r); |
489 |
491 |
490 //Test Entry with invalid SID, without // appended |
492 //Test Entry with invalid SID, without // appended |
491 r=TheFs.Entry(KPrivatePathTest2,entry); |
493 r=TheFs.Entry(KPrivatePathTest2,entry); |
492 test(r==KErrPermissionDenied); |
494 test_Value(r, r == KErrPermissionDenied); |
493 |
495 |
494 //Test Entry with invalid SID |
496 //Test Entry with invalid SID |
495 r=TheFs.Entry(KPrivatePathTest3,entry); |
497 r=TheFs.Entry(KPrivatePathTest3,entry); |
496 test(r==KErrPermissionDenied); |
498 test_Value(r, r == KErrPermissionDenied); |
497 |
499 |
498 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
500 r=TheFs.SetEntry(pritestfile1,testtime,KEntryAttNormal,KEntryAttReadOnly); |
499 test(r==KErrNone); |
501 test_KErrNone(r); |
500 |
502 |
501 r=TheFs.Delete(pritestfile1); |
503 r=TheFs.Delete(pritestfile1); |
502 test(r==KErrNone); |
504 test_KErrNone(r); |
503 |
505 |
504 } |
506 } |
505 |
507 |
506 |
508 |
507 LOCAL_C void systemRFiletest() |
509 LOCAL_C void systemRFiletest() |
508 // |
510 // |
509 // |
511 // |
510 // |
512 // |
511 { |
513 { |
512 r=TheFs.SetSessionPath(systestname); |
514 r=TheFs.SetSessionPath(systestname); |
513 test(r==KErrPermissionDenied); |
515 test_Value(r, r == KErrPermissionDenied); |
514 |
516 |
515 r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite); |
517 r=file1.Temp(TheFs,systestname,fromTemp,EFileWrite); |
516 test(r==KErrPermissionDenied); |
518 test_Value(r, r == KErrPermissionDenied); |
517 |
519 |
518 |
520 |
519 TBuf<25> sysfilename; |
521 TBuf<25> sysfilename; |
520 sysfilename.Append(systestname); |
522 sysfilename.Append(systestname); |
521 sysfilename.Append(KFileSys); |
523 sysfilename.Append(KFileSys); |
522 |
524 |
523 r=file1.Create(TheFs,sysfilename,EFileWrite); |
525 r=file1.Create(TheFs,sysfilename,EFileWrite); |
524 test(r==KErrPermissionDenied); |
526 test_Value(r, r == KErrPermissionDenied); |
525 |
527 |
526 r=file1.Open(TheFs,sysfilename,EFileWrite); |
528 r=file1.Open(TheFs,sysfilename,EFileWrite); |
527 test(r==KErrPermissionDenied); |
529 test_Value(r, r == KErrPermissionDenied); |
528 |
530 |
529 r=file1.Open(TheFs,sysfilename,EFileRead); |
531 r=file1.Open(TheFs,sysfilename,EFileRead); |
530 test(r==KErrPermissionDenied); |
532 test_Value(r, r == KErrPermissionDenied); |
531 |
533 |
532 r=file1.Replace(TheFs,sysfilename,EFileWrite); |
534 r=file1.Replace(TheFs,sysfilename,EFileWrite); |
533 test(r==KErrPermissionDenied); |
535 test_Value(r, r == KErrPermissionDenied); |
534 |
536 |
535 TFindFile finder(TheFs); |
537 TFindFile finder(TheFs); |
536 CDir* dir = NULL; |
538 CDir* dir = NULL; |
537 r=finder.FindWildByDir(KWildFile, KWildPath, dir); |
539 r=finder.FindWildByDir(KWildFile, KWildPath, dir); |
538 if (!(r==KErrPermissionDenied)) |
540 if (!(r==KErrPermissionDenied)) |
539 test.Printf(_L("T_DCNONE: test find wildcards r = %d (expected KErrPermissionDenied)\n"), r); |
541 test.Printf(_L("T_DCNONE: test find wildcards r = %d (expected KErrPermissionDenied)\n"), r); |
540 test(r==KErrPermissionDenied); |
542 test_Value(r, r == KErrPermissionDenied); |
541 delete dir; |
543 delete dir; |
542 } |
544 } |
543 |
545 |
544 LOCAL_C void resourceRFiletest() |
546 LOCAL_C void resourceRFiletest() |
545 // |
547 // |
546 // |
548 // |
547 // |
549 // |
548 { |
550 { |
549 r=TheFs.SetSessionPath(restestname); |
551 r=TheFs.SetSessionPath(restestname); |
550 test(r==KErrNone); |
552 test_KErrNone(r); |
551 |
553 |
552 r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite); |
554 r=file1.Temp(TheFs,restestname,fromTemp,EFileWrite); |
553 test(r==KErrPermissionDenied); |
555 test_Value(r, r == KErrPermissionDenied); |
554 file1.Close(); |
556 file1.Close(); |
555 |
557 |
556 r=file1.Create(TheFs,KFileRes,EFileWrite); |
558 r=file1.Create(TheFs,KFileRes,EFileWrite); |
557 test(r==KErrPermissionDenied); |
559 test_Value(r, r == KErrPermissionDenied); |
558 file1.Close(); |
560 file1.Close(); |
559 |
561 |
560 r=file1.Open(TheFs,KFileRes,EFileWrite); |
562 r=file1.Open(TheFs,KFileRes,EFileWrite); |
561 test(r==KErrPermissionDenied); |
563 test_Value(r, r == KErrPermissionDenied); |
562 file1.Close(); |
564 file1.Close(); |
563 |
565 |
564 r=file1.Open(TheFs,KFileRes,EFileRead|EFileShareReadersOnly); |
566 r=file1.Open(TheFs,KFileRes,EFileRead|EFileShareReadersOnly); |
565 test(r==KErrNone || r==KErrPathNotFound); |
567 test_Value(r, r == KErrNone || r==KErrPathNotFound); |
566 file1.Close(); |
568 file1.Close(); |
567 |
569 |
568 r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileRead); |
570 r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileRead); |
569 test(r==KErrNone || r==KErrPathNotFound); |
571 test_Value(r, r == KErrNone || r==KErrPathNotFound); |
570 file1.Close(); |
572 file1.Close(); |
571 |
573 |
572 r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileWrite); |
574 r=file1.Open(TheFs,KFileRes,EFileShareReadersOrWriters|EFileWrite); |
573 test(r==KErrPermissionDenied); |
575 test_Value(r, r == KErrPermissionDenied); |
574 file1.Close(); |
576 file1.Close(); |
575 |
577 |
576 r=file1.Open(TheFs,KFileRes,EFileShareReadersOnly); |
578 r=file1.Open(TheFs,KFileRes,EFileShareReadersOnly); |
577 test(r==KErrNone || r==KErrPathNotFound); |
579 test_Value(r, r == KErrNone || r==KErrPathNotFound); |
578 |
580 |
579 r=file1.ChangeMode(EFileShareExclusive); //this is not illegal though will prevent shared access to resource which is nit my fault but may be desirable to prevent |
581 r=file1.ChangeMode(EFileShareExclusive); //this is not illegal though will prevent shared access to resource which is nit my fault but may be desirable to prevent |
580 test(r==KErrNone || r==KErrPathNotFound); |
582 test_Value(r, r == KErrNone || r==KErrPathNotFound); |
581 |
583 |
582 //this operation is prevented as you can not open a file for write access in the resource directory |
584 //this operation is prevented as you can not open a file for write access in the resource directory |
583 r=file1.Rename(KFileRes3); |
585 r=file1.Rename(KFileRes3); |
584 test(r==KErrPermissionDenied || r==KErrAccessDenied); |
586 test_Value(r, r == KErrPermissionDenied || r==KErrAccessDenied); |
585 |
587 |
586 file1.Close(); |
588 file1.Close(); |
587 |
589 |
588 r=file1.Replace(TheFs,KFileRes,EFileWrite); |
590 r=file1.Replace(TheFs,KFileRes,EFileWrite); |
589 test(r==KErrPermissionDenied); |
591 test_Value(r, r == KErrPermissionDenied); |
590 file1.Close(); |
592 file1.Close(); |
591 |
593 |
592 } |
594 } |
593 |
595 |
594 |
596 |
631 // |
633 // |
632 // |
634 // |
633 { |
635 { |
634 |
636 |
635 r=TheFs.SetSessionPath(pritestname); |
637 r=TheFs.SetSessionPath(pritestname); |
636 test(r==KErrPermissionDenied); |
638 test_Value(r, r == KErrPermissionDenied); |
637 |
639 |
638 r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite); |
640 r=file1.Temp(TheFs,pritestname,fromTemp,EFileWrite); |
639 test(r==KErrPermissionDenied); |
641 test_Value(r, r == KErrPermissionDenied); |
640 |
642 |
641 TBuf<25> prifilename; |
643 TBuf<25> prifilename; |
642 prifilename.Append(pritestname); |
644 prifilename.Append(pritestname); |
643 prifilename.Append(KFileSys); |
645 prifilename.Append(KFileSys); |
644 |
646 |
645 r=file1.Create(TheFs,prifilename,EFileWrite); |
647 r=file1.Create(TheFs,prifilename,EFileWrite); |
646 test(r==KErrPermissionDenied); |
648 test_Value(r, r == KErrPermissionDenied); |
647 |
649 |
648 |
650 |
649 r=file1.Open(TheFs,prifilename,EFileWrite); |
651 r=file1.Open(TheFs,prifilename,EFileWrite); |
650 test(r==KErrPermissionDenied); |
652 test_Value(r, r == KErrPermissionDenied); |
651 |
653 |
652 |
654 |
653 r=file1.Open(TheFs,prifilename,EFileRead); |
655 r=file1.Open(TheFs,prifilename,EFileRead); |
654 test(r==KErrPermissionDenied); |
656 test_Value(r, r == KErrPermissionDenied); |
655 |
657 |
656 |
658 |
657 r=file1.Replace(TheFs,prifilename,EFileWrite); |
659 r=file1.Replace(TheFs,prifilename,EFileWrite); |
658 test(r==KErrPermissionDenied); |
660 test_Value(r, r == KErrPermissionDenied); |
659 |
661 |
660 } |
662 } |
661 |
663 |
662 LOCAL_C void privateSIDRFiletest() |
664 LOCAL_C void privateSIDRFiletest() |
663 // |
665 // |
664 // |
666 // |
665 // |
667 // |
666 { |
668 { |
667 |
669 |
668 r=TheFs.SetSessionToPrivate(gTheDriveNum); |
670 r=TheFs.SetSessionToPrivate(gTheDriveNum); |
669 test(r==KErrNone); |
671 test_KErrNone(r); |
670 |
672 |
671 r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite); |
673 r=file1.Temp(TheFs,theprivatepath,fromTemp,EFileWrite); |
672 test(r==KErrNone); |
674 test_KErrNone(r); |
673 file1.Close(); |
675 file1.Close(); |
674 r=file1.Create(TheFs,KFilePri,EFileWrite); |
676 r=file1.Create(TheFs,KFilePri,EFileWrite); |
675 test(r==KErrNone || r==KErrAlreadyExists); |
677 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
676 file1.Close(); |
678 file1.Close(); |
677 r=file1.Open(TheFs,KFilePri,EFileWrite); |
679 r=file1.Open(TheFs,KFilePri,EFileWrite); |
678 test(r==KErrNone); |
680 test_KErrNone(r); |
679 file1.Close(); |
681 file1.Close(); |
680 r=file1.Open(TheFs,KFilePri,EFileRead); |
682 r=file1.Open(TheFs,KFilePri,EFileRead); |
681 test(r==KErrNone); |
683 test_KErrNone(r); |
682 file1.Close(); |
684 file1.Close(); |
683 r=file1.Replace(TheFs,KFilePri,EFileWrite); |
685 r=file1.Replace(TheFs,KFilePri,EFileWrite); |
684 test(r==KErrNone); |
686 test_KErrNone(r); |
685 r=file1.Rename(KFilePri3); |
687 r=file1.Rename(KFilePri3); |
686 test(r==KErrNone || r==KErrAlreadyExists); |
688 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
687 file1.Close(); |
689 file1.Close(); |
688 |
690 |
689 } |
691 } |
690 |
692 |
691 |
693 |
697 //system |
699 //system |
698 |
700 |
699 TBuf<30> dirNameBuf(KSystemPath); |
701 TBuf<30> dirNameBuf(KSystemPath); |
700 dirNameBuf[0]=(TText)gDriveToTest; |
702 dirNameBuf[0]=(TText)gDriveToTest; |
701 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
703 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
702 test(r==KErrPermissionDenied); |
704 test_Value(r, r == KErrPermissionDenied); |
703 dir.Close(); |
705 dir.Close(); |
704 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
706 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
705 test(r==KErrPermissionDenied); |
707 test_Value(r, r == KErrPermissionDenied); |
706 dirNameBuf.Zero(); |
708 dirNameBuf.Zero(); |
707 delete dirEntries; |
709 delete dirEntries; |
708 |
710 |
709 dirNameBuf=KPrivateFalseID; |
711 dirNameBuf=KPrivateFalseID; |
710 dirNameBuf[0]=(TText)gDriveToTest; |
712 dirNameBuf[0]=(TText)gDriveToTest; |
711 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
713 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
712 test(r==KErrPermissionDenied); |
714 test_Value(r, r == KErrPermissionDenied); |
713 dir.Close(); |
715 dir.Close(); |
714 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
716 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
715 test(r==KErrPermissionDenied); |
717 test_Value(r, r == KErrPermissionDenied); |
716 dirNameBuf.Zero(); |
718 dirNameBuf.Zero(); |
717 delete dirEntries; |
719 delete dirEntries; |
718 |
720 |
719 //Private |
721 //Private |
720 dirNameBuf=KPrivatePath; |
722 dirNameBuf=KPrivatePath; |
721 dirNameBuf[0]=(TText)gDriveToTest; |
723 dirNameBuf[0]=(TText)gDriveToTest; |
722 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
724 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
723 test(r==KErrPermissionDenied); |
725 test_Value(r, r == KErrPermissionDenied); |
724 dir.Close(); |
726 dir.Close(); |
725 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
727 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
726 test(r==KErrPermissionDenied); |
728 test_Value(r, r == KErrPermissionDenied); |
727 dirNameBuf.Zero(); |
729 dirNameBuf.Zero(); |
728 delete dirEntries; |
730 delete dirEntries; |
729 //Private/uid |
731 //Private/uid |
730 TheFs.PrivatePath(dirNameBuf); |
732 TheFs.PrivatePath(dirNameBuf); |
731 dirNameBuf.Insert(0,_L("?:")); |
733 dirNameBuf.Insert(0,_L("?:")); |
732 dirNameBuf[0]=(TText)gDriveToTest; |
734 dirNameBuf[0]=(TText)gDriveToTest; |
733 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
735 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
734 test(r==KErrNone); |
736 test_KErrNone(r); |
735 dir.Close(); |
737 dir.Close(); |
736 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
738 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
737 test(r==KErrNone); |
739 test_KErrNone(r); |
738 dirNameBuf.Zero(); |
740 dirNameBuf.Zero(); |
739 delete dirEntries; |
741 delete dirEntries; |
740 //Resource |
742 //Resource |
741 dirNameBuf=KResourcePath; |
743 dirNameBuf=KResourcePath; |
742 dirNameBuf[0]=(TText)gDriveToTest; |
744 dirNameBuf[0]=(TText)gDriveToTest; |
743 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
745 r=dir.Open(TheFs,dirNameBuf,KEntryAttNormal); |
744 test(r==KErrNone); |
746 test_KErrNone(r); |
745 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
747 r=TheFs.GetDir(dirNameBuf,KEntryAttMatchMask,ESortByName,dirEntries); |
746 test(r==KErrNone); |
748 test_KErrNone(r); |
747 dir.Close(); |
749 dir.Close(); |
748 delete dirEntries; |
750 delete dirEntries; |
749 } |
751 } |
750 |
752 |
751 |
753 |
860 // Create system and private directories for scan with and without DC |
862 // Create system and private directories for scan with and without DC |
861 // |
863 // |
862 { |
864 { |
863 TInt r; |
865 TInt r; |
864 r = TheFs.MkDir(_L("\\normal\\")); |
866 r = TheFs.MkDir(_L("\\normal\\")); |
865 test(r == KErrNone || r == KErrAlreadyExists); |
867 test_Value(r, r == KErrNone || r == KErrAlreadyExists); |
866 r = TheFs.MkDir(_L("\\normal\\one\\")); |
868 r = TheFs.MkDir(_L("\\normal\\one\\")); |
867 test(r == KErrNone || r == KErrAlreadyExists); |
869 test_Value(r, r == KErrNone || r == KErrAlreadyExists); |
868 r = TheFs.MkDir(_L("\\normal\\two\\")); |
870 r = TheFs.MkDir(_L("\\normal\\two\\")); |
869 test(r == KErrNone || r == KErrAlreadyExists); |
871 test_Value(r, r == KErrNone || r == KErrAlreadyExists); |
870 r = TheFs.MkDir(_L("\\sys\\")); |
872 r = TheFs.MkDir(_L("\\sys\\")); |
871 test(r == KErrPermissionDenied); |
873 test_Value(r, r == KErrPermissionDenied); |
872 r = TheFs.MkDir(_L("\\sys\\one\\")); |
874 r = TheFs.MkDir(_L("\\sys\\one\\")); |
873 test(r == KErrPermissionDenied); |
875 test_Value(r, r == KErrPermissionDenied); |
874 r = TheFs.MkDir(_L("\\sys\\two\\")); |
876 r = TheFs.MkDir(_L("\\sys\\two\\")); |
875 test(r == KErrPermissionDenied); |
877 test_Value(r, r == KErrPermissionDenied); |
876 r = TheFs.MkDir(_L("\\private\\")); |
878 r = TheFs.MkDir(_L("\\private\\")); |
877 test(r == KErrPermissionDenied); |
879 test_Value(r, r == KErrPermissionDenied); |
878 r = TheFs.MkDir(_L("\\private\\one\\")); |
880 r = TheFs.MkDir(_L("\\private\\one\\")); |
879 test(r == KErrPermissionDenied); |
881 test_Value(r, r == KErrPermissionDenied); |
880 r = TheFs.MkDir(_L("\\private\\two\\")); |
882 r = TheFs.MkDir(_L("\\private\\two\\")); |
881 test(r == KErrPermissionDenied); |
883 test_Value(r, r == KErrPermissionDenied); |
882 r = TheFs.MkDir(_L("\\ZZZZZZ\\")); |
884 r = TheFs.MkDir(_L("\\ZZZZZZ\\")); |
883 test(r == KErrNone || r == KErrAlreadyExists); |
885 test_Value(r, r == KErrNone || r == KErrAlreadyExists); |
884 } |
886 } |
885 |
887 |
886 TFileName dirName; |
888 TFileName dirName; |
887 |
889 |
888 LOCAL_C void ScanDir(const TDesC& aName, CDirScan::TScanDirection aDirection, TInt aError) |
890 LOCAL_C void ScanDir(const TDesC& aName, CDirScan::TScanDirection aDirection, TInt aError) |
889 { |
891 { |
890 CDirScan* scanner = NULL; |
892 CDirScan* scanner = NULL; |
891 TRAP(r, scanner = CDirScan::NewL(TheFs)); |
893 TRAP(r, scanner = CDirScan::NewL(TheFs)); |
892 test(r == KErrNone && scanner); |
894 test_Value(r, r == KErrNone && scanner); |
893 |
895 |
894 TRAP(r, scanner->SetScanDataL(aName,KEntryAttDir,ESortByName|EAscending,aDirection)); |
896 TRAP(r, scanner->SetScanDataL(aName,KEntryAttDir,ESortByName|EAscending,aDirection)); |
895 test(r == KErrNone); |
897 test_KErrNone(r); |
896 |
898 |
897 CDir *entryList=NULL; |
899 CDir *entryList=NULL; |
898 for (;;) |
900 for (;;) |
899 { |
901 { |
900 TRAP(r, scanner->NextL(entryList)); |
902 TRAP(r, scanner->NextL(entryList)); |
901 test(r == aError); |
903 test_Value(r, r == aError); |
902 if (entryList==NULL) |
904 if (entryList==NULL) |
903 break; |
905 break; |
904 TInt count=entryList->Count(); |
906 TInt count=entryList->Count(); |
905 while (count--) |
907 while (count--) |
906 { |
908 { |
935 TBuf<30> privatepath; |
937 TBuf<30> privatepath; |
936 r=TheFs.PrivatePath(privatepath); |
938 r=TheFs.PrivatePath(privatepath); |
937 test.Printf(_L("Private Path is=%S"),&privatepath); |
939 test.Printf(_L("Private Path is=%S"),&privatepath); |
938 |
940 |
939 r = TheFs.MkDir(_L("\\Caged\\")); |
941 r = TheFs.MkDir(_L("\\Caged\\")); |
940 test(r==KErrNone || r==KErrAlreadyExists); |
942 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
941 |
943 |
942 CDir* entryCount=NULL; |
944 CDir* entryCount=NULL; |
943 r=TheFs.GetDir(_L("\\*.*"),KEntryAttNormal,ESortNone,entryCount); |
945 r=TheFs.GetDir(_L("\\*.*"),KEntryAttNormal,ESortNone,entryCount); |
944 test(r==KErrNone); |
946 test_KErrNone(r); |
945 TInt rootCount= entryCount->Count(); |
947 TInt rootCount= entryCount->Count(); |
946 |
948 |
947 delete entryCount; |
949 delete entryCount; |
948 entryCount=NULL; |
950 entryCount=NULL; |
949 |
951 |
950 |
952 |
951 //Testing Copy |
953 //Testing Copy |
952 CDir* entryCount2=NULL; |
954 CDir* entryCount2=NULL; |
953 r=fMan->Copy(_L("\\sys\\"),_L("\\Caged\\")); |
955 r=fMan->Copy(_L("\\sys\\"),_L("\\Caged\\")); |
954 test(r == KErrPermissionDenied); |
956 test_Value(r, r == KErrPermissionDenied); |
955 r=fMan->Copy(_L("\\*"),_L("\\Caged\\")); |
957 r=fMan->Copy(_L("\\*"),_L("\\Caged\\")); |
956 test(r == KErrNone); |
958 test_KErrNone(r); |
957 |
959 |
958 r=TheFs.GetDir(_L("\\Caged\\*.*"),KEntryAttNormal,ESortNone,entryCount2); |
960 r=TheFs.GetDir(_L("\\Caged\\*.*"),KEntryAttNormal,ESortNone,entryCount2); |
959 test(r==KErrNone); |
961 test_KErrNone(r); |
960 TInt cagedCount= entryCount2->Count(); |
962 TInt cagedCount= entryCount2->Count(); |
961 |
963 |
962 test(cagedCount==rootCount); |
964 test(cagedCount==rootCount); |
963 |
965 |
964 delete entryCount2; |
966 delete entryCount2; |
965 entryCount2=NULL; |
967 entryCount2=NULL; |
966 |
968 |
967 // Check if both copied sys and private are empty (no information is exposed) |
969 // Check if both copied sys and private are empty (no information is exposed) |
968 CDir* entryCount3=NULL; |
970 CDir* entryCount3=NULL; |
969 r=TheFs.GetDir(_L("\\Caged\\private\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount3); |
971 r=TheFs.GetDir(_L("\\Caged\\private\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount3); |
970 test(r==KErrPathNotFound); |
972 test_Value(r, r == KErrPathNotFound); |
971 delete entryCount3; |
973 delete entryCount3; |
972 entryCount3=NULL; |
974 entryCount3=NULL; |
973 |
975 |
974 CDir* entryCount4=NULL; |
976 CDir* entryCount4=NULL; |
975 r=TheFs.GetDir(_L("\\Caged\\sys\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount4); |
977 r=TheFs.GetDir(_L("\\Caged\\sys\\*.*"),KEntryAttNormal|KEntryAttDir,ESortNone,entryCount4); |
976 test(r==KErrPathNotFound); |
978 test_Value(r, r == KErrPathNotFound); |
977 delete entryCount4; |
979 delete entryCount4; |
978 entryCount4=NULL; |
980 entryCount4=NULL; |
979 |
981 |
980 |
982 |
981 r=fMan->Copy(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); |
983 r=fMan->Copy(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); |
982 test(r == KErrPermissionDenied); |
984 test_Value(r, r == KErrPermissionDenied); |
983 |
985 |
984 // Create a test file |
986 // Create a test file |
985 RFile testFile; |
987 RFile testFile; |
986 r = testFile.Replace(TheFs, _L("\\capTest"),EFileWrite); |
988 r = testFile.Replace(TheFs, _L("\\capTest"),EFileWrite); |
987 test(r==KErrNone || r==KErrAlreadyExists); |
989 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
988 testFile.Close(); |
990 testFile.Close(); |
989 |
991 |
990 TFileName name; |
992 TFileName name; |
991 name = privatepath; |
993 name = privatepath; |
992 name.Append(_L("privateFile.tst")); |
994 name.Append(_L("privateFile.tst")); |
993 RFile privateFile; |
995 RFile privateFile; |
994 r = privateFile.Replace(TheFs, name,EFileWrite); |
996 r = privateFile.Replace(TheFs, name,EFileWrite); |
995 test(r==KErrNone || r==KErrAlreadyExists); |
997 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
996 privateFile.Close(); |
998 privateFile.Close(); |
997 |
999 |
998 |
1000 |
999 r=fMan->Copy(_L("\\capTest"),_L("\\private\\two\\moo")); |
1001 r=fMan->Copy(_L("\\capTest"),_L("\\private\\two\\moo")); |
1000 test(r == KErrPermissionDenied); |
1002 test_Value(r, r == KErrPermissionDenied); |
1001 r=fMan->Copy(_L("\\capTest"),_L("\\sys\\bin\\moo")); |
1003 r=fMan->Copy(_L("\\capTest"),_L("\\sys\\bin\\moo")); |
1002 test(r == KErrPermissionDenied); |
1004 test_Value(r, r == KErrPermissionDenied); |
1003 r=fMan->Copy(_L("\\sys\\bin\\capTest"),_L("\\sys\\bin\\moo")); |
1005 r=fMan->Copy(_L("\\sys\\bin\\capTest"),_L("\\sys\\bin\\moo")); |
1004 test(r == KErrPermissionDenied); |
1006 test_Value(r, r == KErrPermissionDenied); |
1005 r=fMan->Copy(_L("\\sys\\*"),_L("\\")); |
1007 r=fMan->Copy(_L("\\sys\\*"),_L("\\")); |
1006 test (r==KErrPermissionDenied); |
1008 test_Value(r, r == KErrPermissionDenied); |
1007 r=fMan->Copy(name,_L("\\sys\\")); |
1009 r=fMan->Copy(name,_L("\\sys\\")); |
1008 test(r==KErrPermissionDenied); |
1010 test_Value(r, r == KErrPermissionDenied); |
1009 |
1011 |
1010 // Testing Move |
1012 // Testing Move |
1011 r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo")); |
1013 r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo")); |
1012 test(r == KErrPermissionDenied); |
1014 test_Value(r, r == KErrPermissionDenied); |
1013 r=fMan->Move(_L("\\private\\two\\moo.."),_L("\\private\\one\\moo")); |
1015 r=fMan->Move(_L("\\private\\two\\moo.."),_L("\\private\\one\\moo")); |
1014 test(r == KErrPermissionDenied); |
1016 test_Value(r, r == KErrPermissionDenied); |
1015 r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo..")); |
1017 r=fMan->Move(_L("\\private\\two\\moo"),_L("\\private\\one\\moo..")); |
1016 test(r == KErrPermissionDenied); |
1018 test_Value(r, r == KErrPermissionDenied); |
1017 r=fMan->Move(name,_L("\\privateFile.tst")); |
1019 r=fMan->Move(name,_L("\\privateFile.tst")); |
1018 test(r == KErrNone); |
1020 test_KErrNone(r); |
1019 r=fMan->Move(_L("\\privateFile.tst"),name); |
1021 r=fMan->Move(_L("\\privateFile.tst"),name); |
1020 test(r == KErrNone); |
1022 test_KErrNone(r); |
1021 r=fMan->Move(_L("\\capTest"),_L("\\private\\two\\moo")); |
1023 r=fMan->Move(_L("\\capTest"),_L("\\private\\two\\moo")); |
1022 test(r == KErrPermissionDenied); |
1024 test_Value(r, r == KErrPermissionDenied); |
1023 r=fMan->Move(_L("\\capTest"),_L("\\sys\\bin\\moo")); |
1025 r=fMan->Move(_L("\\capTest"),_L("\\sys\\bin\\moo")); |
1024 test(r == KErrPermissionDenied); |
1026 test_Value(r, r == KErrPermissionDenied); |
1025 r=fMan->Move(_L("\\sys\\bin\\capTest"),_L("\\sys\\bin\\moo")); |
1027 r=fMan->Move(_L("\\sys\\bin\\capTest"),_L("\\sys\\bin\\moo")); |
1026 test(r == KErrPermissionDenied); |
1028 test_Value(r, r == KErrPermissionDenied); |
1027 r=fMan->Move(_L("\\sys\\*"),_L("\\")); |
1029 r=fMan->Move(_L("\\sys\\*"),_L("\\")); |
1028 test (r==KErrPermissionDenied); |
1030 test_Value(r, r == KErrPermissionDenied); |
1029 r=fMan->Move(name,_L("\\sys\\")); |
1031 r=fMan->Move(name,_L("\\sys\\")); |
1030 test(r==KErrPermissionDenied); |
1032 test_Value(r, r == KErrPermissionDenied); |
1031 |
1033 |
1032 |
1034 |
1033 // Testing Attribs |
1035 // Testing Attribs |
1034 r=fMan->Attribs(_L("\\private\\two\\moo"),KEntryAttReadOnly,0,TTime(0)); |
1036 r=fMan->Attribs(_L("\\private\\two\\moo"),KEntryAttReadOnly,0,TTime(0)); |
1035 test(r == KErrPermissionDenied); |
1037 test_Value(r, r == KErrPermissionDenied); |
1036 r=fMan->Attribs(_L("\\private\\moo"),KEntryAttReadOnly,0,TTime(0)); |
1038 r=fMan->Attribs(_L("\\private\\moo"),KEntryAttReadOnly,0,TTime(0)); |
1037 test(r == KErrPermissionDenied); |
1039 test_Value(r, r == KErrPermissionDenied); |
1038 r=fMan->Attribs(name,KEntryAttReadOnly,0,TTime(0)); |
1040 r=fMan->Attribs(name,KEntryAttReadOnly,0,TTime(0)); |
1039 test(r == KErrNone); |
1041 test_KErrNone(r); |
1040 r=fMan->Attribs(name,0,KEntryAttReadOnly,TTime(0)); |
1042 r=fMan->Attribs(name,0,KEntryAttReadOnly,TTime(0)); |
1041 test(r == KErrNone); |
1043 test_KErrNone(r); |
1042 |
1044 |
1043 |
1045 |
1044 // Testing RmDir |
1046 // Testing RmDir |
1045 r=fMan->RmDir(_L("\\private\\")); |
1047 r=fMan->RmDir(_L("\\private\\")); |
1046 test(r == KErrPermissionDenied); |
1048 test_Value(r, r == KErrPermissionDenied); |
1047 r=fMan->RmDir(_L("\\private\\two\\")); |
1049 r=fMan->RmDir(_L("\\private\\two\\")); |
1048 test(r == KErrPermissionDenied); |
1050 test_Value(r, r == KErrPermissionDenied); |
1049 r=fMan->RmDir(_L("\\private\\tw?\\")); |
1051 r=fMan->RmDir(_L("\\private\\tw?\\")); |
1050 test(r == KErrPermissionDenied); |
1052 test_Value(r, r == KErrPermissionDenied); |
1051 r=fMan->RmDir(_L("\\sys\\")); |
1053 r=fMan->RmDir(_L("\\sys\\")); |
1052 test(r == KErrPermissionDenied); |
1054 test_Value(r, r == KErrPermissionDenied); |
1053 |
1055 |
1054 |
1056 |
1055 // Testing Rename |
1057 // Testing Rename |
1056 r=fMan->Rename(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); |
1058 r=fMan->Rename(_L("\\private\\two\\moo"),_L("\\private\\two\\mew")); |
1057 test(r == KErrPermissionDenied); |
1059 test_Value(r, r == KErrPermissionDenied); |
1058 |
1060 |
1059 // Testing Delete |
1061 // Testing Delete |
1060 r=fMan->Delete(_L("\\private\\two\\test")); |
1062 r=fMan->Delete(_L("\\private\\two\\test")); |
1061 test(r == KErrPermissionDenied); |
1063 test_Value(r, r == KErrPermissionDenied); |
1062 r=fMan->Delete(_L("\\private\\moo")); |
1064 r=fMan->Delete(_L("\\private\\moo")); |
1063 test(r == KErrPermissionDenied); |
1065 test_Value(r, r == KErrPermissionDenied); |
1064 r=fMan->Delete(_L("\\sys\\moo")); |
1066 r=fMan->Delete(_L("\\sys\\moo")); |
1065 test(r == KErrPermissionDenied); |
1067 test_Value(r, r == KErrPermissionDenied); |
1066 |
1068 |
1067 |
1069 |
1068 //Something that actually exists in Private |
1070 //Something that actually exists in Private |
1069 r=fMan->Rename(name,_L("\\private\\00000001\\moo")); |
1071 r=fMan->Rename(name,_L("\\private\\00000001\\moo")); |
1070 test(r == KErrNone); |
1072 test_KErrNone(r); |
1071 r=fMan->Rename(_L("\\private\\00000001\\moo"),name); |
1073 r=fMan->Rename(_L("\\private\\00000001\\moo"),name); |
1072 test(r == KErrNone); |
1074 test_KErrNone(r); |
1073 r=fMan->Copy(name,_L("\\private\\00000001\\moo")); |
1075 r=fMan->Copy(name,_L("\\private\\00000001\\moo")); |
1074 test(r == KErrNone); |
1076 test_KErrNone(r); |
1075 r=fMan->Delete(_L("\\private\\00000001\\moo")); |
1077 r=fMan->Delete(_L("\\private\\00000001\\moo")); |
1076 test(r == KErrNone); |
1078 test_KErrNone(r); |
1077 |
1079 |
1078 // Clean up the test data |
1080 // Clean up the test data |
1079 r=fMan->RmDir(_L("\\Caged\\")); |
1081 r=fMan->RmDir(_L("\\Caged\\")); |
1080 test(r == KErrNone); |
1082 test_KErrNone(r); |
1081 r=fMan->Delete(_L("\\capTest")); |
1083 r=fMan->Delete(_L("\\capTest")); |
1082 test(r == KErrNone); |
1084 test_KErrNone(r); |
1083 r=fMan->Delete(name); |
1085 r=fMan->Delete(name); |
1084 test(r == KErrNone); |
1086 test_KErrNone(r); |
1085 delete(fMan); |
1087 delete(fMan); |
1086 } |
1088 } |
1087 |
1089 |
1088 // CDirScan tests |
1090 // CDirScan tests |
1089 ScanDir(_L("\\"), CDirScan::EScanUpTree, KErrNone); |
1091 ScanDir(_L("\\"), CDirScan::EScanUpTree, KErrNone); |