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