changeset 31 | 56f325a607ea |
parent 0 | a41df078684a |
child 80 | 597aaf25e343 |
15:4122176ea935 | 31:56f325a607ea |
---|---|
108 LOCAL_C void Compare(const TDesC& aDir1,const TDesC& aDir2) |
108 LOCAL_C void Compare(const TDesC& aDir1,const TDesC& aDir2) |
109 // |
109 // |
110 // Test that the contents of two directories are identical |
110 // Test that the contents of two directories are identical |
111 // |
111 // |
112 { |
112 { |
113 |
|
114 CDirScan* scanDir1=CDirScan::NewL(TheFs); |
113 CDirScan* scanDir1=CDirScan::NewL(TheFs); |
115 scanDir1->SetScanDataL(aDir1,KEntryAttMaskSupported,ESortByName); |
114 scanDir1->SetScanDataL(aDir1,KEntryAttMaskSupported,ESortByName); |
116 CDirScan* scanDir2=CDirScan::NewL(TheFs); |
115 CDirScan* scanDir2=CDirScan::NewL(TheFs); |
117 scanDir2->SetScanDataL(aDir2,KEntryAttMaskSupported,ESortByName); |
116 scanDir2->SetScanDataL(aDir2,KEntryAttMaskSupported,ESortByName); |
118 |
117 |
239 } |
238 } |
240 RmDir(_L("\\longname1\\")); |
239 RmDir(_L("\\longname1\\")); |
241 return ret; |
240 return ret; |
242 } |
241 } |
243 |
242 |
244 LOCAL_C void TestDelete() |
243 LOCAL_C void TestDelete() |
245 // |
244 // |
246 // Test files are deleted |
245 // Test files are deleted |
247 // |
246 // |
248 { |
247 { |
249 |
248 test.Next(_L("Test delete - Set up files and start deleting")); |
250 test.Next(_L("Set up files and start deleting")); |
|
251 |
249 |
252 MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\")); |
250 MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\")); |
253 MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT")); |
251 MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT")); |
254 MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE2.TXT")); |
252 MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE2.TXT")); |
255 MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE3.TXT")); |
253 MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE3.TXT")); |
389 TFSName f; |
387 TFSName f; |
390 r = TheFs.FileSystemName(f, theDrive); |
388 r = TheFs.FileSystemName(f, theDrive); |
391 test(r == KErrNone || r == KErrNotFound); |
389 test(r == KErrNone || r == KErrNotFound); |
392 if (f.FindF(_L("Fat")) == 0 ) |
390 if (f.FindF(_L("Fat")) == 0 ) |
393 { |
391 { |
392 test.Next(_L("Test wild card matching in short file names")); |
|
394 MakeFile(_L("abcdefghi.txt")); |
393 MakeFile(_L("abcdefghi.txt")); |
395 TInt err = gFileMan->Delete(_L("ABCDEF~*")); |
394 TInt err = gFileMan->Delete(_L("ABCDEF~*")); |
396 test(err == KErrNone); |
395 test(err == KErrNone); |
397 MakeFile(_L("abcdefghi.txt")); |
396 MakeFile(_L("abcdefghi.txt")); |
398 err = gFileMan->Delete(_L("ABCDEF~*.TXT")); |
397 err = gFileMan->Delete(_L("ABCDEF~*.TXT")); |
409 LOCAL_C void TestCopy() |
408 LOCAL_C void TestCopy() |
410 // |
409 // |
411 // Test copy |
410 // Test copy |
412 // |
411 // |
413 { |
412 { |
414 |
|
415 test.Next(_L("Test copy")); |
413 test.Next(_L("Test copy")); |
416 RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\*")); |
414 RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\*")); |
417 |
415 |
418 MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
416 MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
419 MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\")); |
417 MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\")); |
431 |
429 |
432 test.Next(_L("Test copy files to the same directory")); |
430 test.Next(_L("Test copy files to the same directory")); |
433 TInt r; |
431 TInt r; |
434 |
432 |
435 if (testingInvalidPathLengths) |
433 if (testingInvalidPathLengths) |
436 // Create a path of greater 256 characters by renaming a directory and check it can be |
434 // Create a path of greater than 256 characters by renaming a directory and |
437 // manipulated (tests fix to F32) |
435 // check it can be manipulated (tests fix to F32) |
438 { |
436 { |
439 MakeDir(_L("\\START\\LONG\\")); |
437 MakeDir(_L("\\START\\LONG\\")); |
440 MakeDir(_L("\\FINISH\\")); |
438 MakeDir(_L("\\FINISH\\")); |
441 MakeFile(_L("\\START\\LONG\\ABCDEFGH01ABCDEFGH01ABCDEFGH01ABCDEFGH01.txt")); |
439 MakeFile(_L("\\START\\LONG\\ABCDEFGH01ABCDEFGH01ABCDEFGH01ABCDEFGH01.txt")); |
442 MakeFile(_L("\\START\\LONG\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04.txt")); |
440 MakeFile(_L("\\START\\LONG\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04.txt")); |
610 |
608 |
611 r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\AFTER\\RUMBA?.TXT")); |
609 r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\AFTER\\RUMBA?.TXT")); |
612 test(r==KErrNone); |
610 test(r==KErrNone); |
613 r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA?.TXT")); |
611 r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA?.TXT")); |
614 test(r==KErrNone); |
612 test(r==KErrNone); |
615 |
613 } |
616 } |
614 |
617 LOCAL_C void TestDEF121663_Setup(TFileName& aSrcPath) |
615 LOCAL_C void TestDEF121663_Setup(TFileName& aSrcPath) |
618 { |
616 { |
619 RmDir(aSrcPath); |
617 RmDir(aSrcPath); |
620 MakeDir(aSrcPath); |
618 MakeDir(aSrcPath); |
621 |
619 |
628 } |
626 } |
629 } |
627 } |
630 |
628 |
631 LOCAL_C void TestDEF121663() |
629 LOCAL_C void TestDEF121663() |
632 { |
630 { |
633 test.Next(_L("++TestDEF121663")); |
631 test.Next(_L("Test moving directory to its subdirectory (DEF121663)")); |
634 |
632 |
635 gFileMan->SetObserver(NULL); |
633 gFileMan->SetObserver(NULL); |
636 TInt err = 0; |
634 TInt err = 0; |
637 TFileName srcPath = _L("C:\\TestDEF121663\\"); |
635 TFileName srcPath = _L("C:\\TestDEF121663\\"); |
638 |
636 |
692 TestResult(err,KErrInUse,KErrInUse); |
690 TestResult(err,KErrInUse,KErrInUse); |
693 |
691 |
694 gFileMan->SetObserver(gObserver); |
692 gFileMan->SetObserver(gObserver); |
695 // remove previous dirs |
693 // remove previous dirs |
696 RmDir(_L("C:\\TestDEF121663\\")); |
694 RmDir(_L("C:\\TestDEF121663\\")); |
697 test.Next(_L("--TestDEF121663")); |
695 } |
698 } |
696 |
699 |
697 // Test moving directories where source and target have matching subdirectory structures |
700 LOCAL_C void TestDEF123575() |
698 LOCAL_C void TestDEF123575() |
701 { |
699 { |
702 test.Next(_L("++TestDEF123575")); |
700 test.Next(_L("Test moving directories with matching subdirectory structures (DEF123575)")); |
703 TFileName srcPath; |
701 TFileName srcPath; |
704 TFileName destPath; |
702 TFileName destPath; |
705 TInt err; |
703 TInt err; |
706 //setup the initial directory structure |
704 //setup the initial directory structure |
707 srcPath = _L("\\F32-TST\\DEF123575\\SRCDIR\\CommonDIR\\temp\\temp1.1\\"); |
705 srcPath = _L("\\F32-TST\\DEF123575\\SRCDIR\\CommonDIR\\temp\\temp1.1\\"); |
730 MakeFile(_L("\\F32-TST\\DEF123575\\AFTER\\CommonDIR\\temp\\temp1.1\\FILE1.TXT")); |
728 MakeFile(_L("\\F32-TST\\DEF123575\\AFTER\\CommonDIR\\temp\\temp1.1\\FILE1.TXT")); |
731 Compare(_L("\\F32-TST\\DEF123575\\DSTDIR\\*"),_L("\\F32-TST\\DEF123575\\AFTER\\*")); |
729 Compare(_L("\\F32-TST\\DEF123575\\DSTDIR\\*"),_L("\\F32-TST\\DEF123575\\AFTER\\*")); |
732 |
730 |
733 //delete the entire directory structure |
731 //delete the entire directory structure |
734 RmDir(_L("\\F32-TST\\DEF123575\\*")); |
732 RmDir(_L("\\F32-TST\\DEF123575\\*")); |
735 test.Next(_L("--TestDEF123575")); |
|
736 } |
733 } |
737 |
734 |
738 LOCAL_C void TestDEF125570() |
735 LOCAL_C void TestDEF125570() |
739 { |
736 { |
740 test.Next(_L("++TestDEF125570")); |
737 test.Next(_L("Test move when trg has at least one of the src dirs (DEF125570)")); |
741 gFileMan->SetObserver(NULL); |
738 gFileMan->SetObserver(NULL); |
742 TInt err = KErrNone; |
739 TInt err = KErrNone; |
743 TFileName srcPath = _L("C:\\TestDEF125570\\src\\"); |
740 TFileName srcPath = _L("C:\\TestDEF125570\\src\\"); |
744 TFileName trgPath = _L("C:\\TestDEF125570\\trg\\"); |
741 TFileName trgPath = _L("C:\\TestDEF125570\\trg\\"); |
745 |
742 |
772 err = gFileMan->Move(srcPath, trgPath, CFileMan::ERecurse|CFileMan::EOverWrite, gStat); |
769 err = gFileMan->Move(srcPath, trgPath, CFileMan::ERecurse|CFileMan::EOverWrite, gStat); |
773 TestResult(err); |
770 TestResult(err); |
774 gFileMan->SetObserver(gObserver); |
771 gFileMan->SetObserver(gObserver); |
775 // remove previous dirs |
772 // remove previous dirs |
776 RmDir(_L("C:\\TestDEF125570\\")); |
773 RmDir(_L("C:\\TestDEF125570\\")); |
777 test.Next(_L("--TestDEF125570")); |
|
778 } |
774 } |
779 |
775 |
780 LOCAL_C void TestDEF130404() |
776 LOCAL_C void TestDEF130404() |
781 { |
777 { |
782 test.Printf(_L("++TestDEF130404")); |
778 test.Printf(_L("Test move when the src doesn't fully exist (DEF130404)")); |
783 |
779 |
784 TInt r = 0; |
780 TInt r = 0; |
785 TFileName trgPath; |
781 TFileName trgPath; |
786 trgPath.Format(_L("%c:\\TestDEF130404\\Trg\\"), (TUint8)gDriveToTest); |
782 trgPath.Format(_L("%c:\\TestDEF130404\\Trg\\"), (TUint8)gDriveToTest); |
787 TFileName srcPath; |
783 TFileName srcPath; |
803 |
799 |
804 // clean up before leaving |
800 // clean up before leaving |
805 trgPath.Format(_L("%c:\\TestDEF130404\\"), (TUint8)gDriveToTest); |
801 trgPath.Format(_L("%c:\\TestDEF130404\\"), (TUint8)gDriveToTest); |
806 RmDir(trgPath); |
802 RmDir(trgPath); |
807 RmDir(_L("C:\\TestDEF130404\\")); |
803 RmDir(_L("C:\\TestDEF130404\\")); |
808 |
|
809 test.Printf(_L("--TestDEF130404")); |
|
810 } |
804 } |
811 |
805 |
812 |
806 |
813 /** |
807 /** |
814 This is to test that moving files to overwrite folders with the same names |
808 This is to test that moving files to overwrite folders with the same names |
815 returns proper error code. |
809 and moving folders (directories) to overwrite files with the same names |
810 across drives return proper error codes |
|
816 */ |
811 */ |
817 void TestPDEF137716() |
812 void TestPDEF137716() |
818 { |
813 { |
819 test.Next(_L("Test moving files to overwrite folders or folders to files")); |
814 // Do not run tests if we cannot move across different drives |
820 |
815 if (gSessionPath[0]=='C') |
821 TInt err = KErrNone; |
816 return; |
817 |
|
818 // Move FILE to overwrite FOLDER -------------------------------------------------------- |
|
819 test.Next(_L("Test moving files to overwrite folders with the same names")); |
|
822 gFileMan->SetObserver(NULL); |
820 gFileMan->SetObserver(NULL); |
823 |
821 |
824 #if defined(__WINS__) |
822 _LIT(KFixedTargetTestFolder, "\\PDEF137716\\"); |
825 _LIT(KFileToDirTargetName, "Y:\\PDEF137716\\FileToDir_Target\\ITEM"); |
823 _LIT(KFileToDirTargetCreatePath, "\\PDEF137716\\FileToDir_Target\\ITEM\\"); |
826 _LIT(KFileToDirTargetNameWild, "Y:\\PDEF137716\\FileToDir_Target\\"); |
824 _LIT(KFileToDirTargetNameWild, "\\PDEF137716\\FileToDir_Target\\"); |
827 |
825 |
828 _LIT(KFixedTargetTestFolder, "Y:\\PDEF137716\\"); |
826 _LIT(KFixedSourceTestFolder, "C:\\PDEF137716\\"); |
829 _LIT(KFileToDirTargetCreatePath, "Y:\\PDEF137716\\FileToDir_Target\\ITEM\\"); |
827 _LIT(KFileToDirSourceName, "C:\\PDEF137716\\FileToDir_Source\\ITEM"); |
830 #else |
828 _LIT(KFileToDirSourceNameWild, "C:\\PDEF137716\\FileToDir_Source\\"); |
831 _LIT(KFileToDirTargetName, "D:\\PDEF137716\\FileToDir_Target\\ITEM"); |
829 |
832 _LIT(KFileToDirTargetNameWild, "D:\\PDEF137716\\FileToDir_Target\\"); |
|
833 |
|
834 _LIT(KFixedTargetTestFolder, "D:\\PDEF137716\\"); |
|
835 _LIT(KFileToDirTargetCreatePath, "D:\\PDEF137716\\FileToDir_Target\\ITEM\\"); |
|
836 #endif |
|
837 |
|
838 _LIT(KFixedSrouceTestFolder, "\\PDEF137716\\"); |
|
839 _LIT(KFileToDirSourceName, "\\PDEF137716\\FileToDir_Source\\ITEM"); |
|
840 _LIT(KFileToDirSourceNameWild, "\\PDEF137716\\FileToDir_Source\\"); |
|
841 |
|
842 RmDir(KFixedTargetTestFolder); |
830 RmDir(KFixedTargetTestFolder); |
843 RmDir(KFixedSrouceTestFolder); |
831 RmDir(KFixedSourceTestFolder); |
844 MakeDir(KFileToDirTargetCreatePath); |
832 MakeDir(KFileToDirTargetCreatePath); |
845 MakeFile(KFileToDirSourceName); |
833 MakeFile(KFileToDirSourceName); |
846 err = gFileMan->Move(KFileToDirSourceName, KFileToDirTargetNameWild, 0); |
834 TInt err = KErrNone; |
847 test(err == KErrAccessDenied); |
835 |
836 if(!gAsynch) |
|
837 { |
|
838 err = gFileMan->Move(KFileToDirSourceName, KFileToDirTargetNameWild, 0); |
|
839 } |
|
840 else |
|
841 { |
|
842 err = gFileMan->Move(KFileToDirSourceName, KFileToDirTargetNameWild, 0, gStat); |
|
843 } |
|
844 TestResult(err,KErrAccessDenied); |
|
848 |
845 |
849 RmDir(KFixedTargetTestFolder); |
846 RmDir(KFixedTargetTestFolder); |
850 RmDir(KFixedSrouceTestFolder); |
847 RmDir(KFixedSourceTestFolder); |
848 MakeDir(KFileToDirTargetCreatePath); |
|
849 MakeFile(KFileToDirSourceName); |
|
850 if(!gAsynch) |
|
851 { |
|
852 err = gFileMan->Move(KFileToDirSourceName, KFileToDirTargetNameWild, CFileMan::EOverWrite); |
|
853 } |
|
854 else |
|
855 { |
|
856 err = gFileMan->Move(KFileToDirSourceName, KFileToDirTargetNameWild, CFileMan::EOverWrite, gStat); |
|
857 } |
|
858 TestResult(err,KErrAccessDenied); |
|
859 |
|
860 RmDir(KFixedTargetTestFolder); |
|
861 RmDir(KFixedSourceTestFolder); |
|
851 MakeDir(KFileToDirTargetCreatePath); |
862 MakeDir(KFileToDirTargetCreatePath); |
852 MakeFile(KFileToDirSourceName); |
863 MakeFile(KFileToDirSourceName); |
853 err = gFileMan->Move(KFileToDirTargetName, KFileToDirSourceNameWild, CFileMan::EOverWrite); |
864 if(!gAsynch) |
854 test(err == KErrAccessDenied); |
865 { |
866 err = gFileMan->Move(KFileToDirSourceNameWild, KFileToDirTargetNameWild, 0); |
|
867 } |
|
868 else |
|
869 { |
|
870 err = gFileMan->Move(KFileToDirSourceNameWild, KFileToDirTargetNameWild, 0, gStat); |
|
871 } |
|
872 TestResult(err,KErrAccessDenied); |
|
855 |
873 |
856 RmDir(KFixedTargetTestFolder); |
874 RmDir(KFixedTargetTestFolder); |
857 RmDir(KFixedSrouceTestFolder); |
875 RmDir(KFixedSourceTestFolder); |
858 MakeDir(KFileToDirTargetCreatePath); |
876 MakeDir(KFileToDirTargetCreatePath); |
859 MakeFile(KFileToDirSourceName); |
877 MakeFile(KFileToDirSourceName); |
860 err = gFileMan->Move(KFileToDirSourceNameWild, KFileToDirTargetNameWild, 0); |
878 if(!gAsynch) |
861 test(err == KErrAccessDenied); |
879 { |
880 err = gFileMan->Move(KFileToDirSourceNameWild, KFileToDirTargetNameWild, CFileMan::EOverWrite); |
|
881 } |
|
882 else |
|
883 { |
|
884 err = gFileMan->Move(KFileToDirSourceNameWild, KFileToDirTargetNameWild, CFileMan::EOverWrite, gStat); |
|
885 } |
|
886 TestResult(err,KErrAccessDenied); |
|
887 |
|
888 |
|
889 // Move FOLDER to overwrite FILE -------------------------------------------------------- |
|
890 test.Next(_L("Test moving folders to overwrite files with the same names")); |
|
891 |
|
892 _LIT(KDirToFileTargetName, "\\PDEF137716\\DirToFile_Target\\ITEM"); |
|
893 _LIT(KDirToFileTargetNameWild, "\\PDEF137716\\DirToFile_Target\\"); |
|
894 |
|
895 _LIT(KDirToFileSourceName, "C:\\PDEF137716\\DirToFile_Source\\ITEM"); |
|
896 _LIT(KDirToFileSourceNameWild, "C:\\PDEF137716\\DirToFile_Source\\"); |
|
897 |
|
898 _LIT(KDirToFileSourceCreatePath, "C:\\PDEF137716\\DirToFile_Source\\ITEM\\"); |
|
862 |
899 |
863 RmDir(KFixedTargetTestFolder); |
900 RmDir(KFixedTargetTestFolder); |
864 RmDir(KFixedSrouceTestFolder); |
901 RmDir(KFixedSourceTestFolder); |
865 MakeDir(KFileToDirTargetCreatePath); |
|
866 MakeFile(KFileToDirSourceName); |
|
867 err = gFileMan->Move(KFileToDirSourceNameWild, KFileToDirTargetNameWild, CFileMan::EOverWrite); |
|
868 test(err == KErrAccessDenied); |
|
869 |
|
870 #if defined(__WINS__) |
|
871 _LIT(KDirToFileTargetName, "Y:\\PDEF137716\\DirToFile_Target\\ITEM"); |
|
872 _LIT(KDirToFileTargetNameWild, "Y:\\PDEF137716\\DirToFile_Target\\"); |
|
873 #else |
|
874 _LIT(KDirToFileTargetName, "D:\\PDEF137716\\DirToFile_Target\\ITEM"); |
|
875 _LIT(KDirToFileTargetNameWild, "D:\\PDEF137716\\DirToFile_Target\\"); |
|
876 #endif |
|
877 |
|
878 _LIT(KDirToFileSourceName, "\\PDEF137716\\DirToFile_Source\\ITEM"); |
|
879 _LIT(KDirToFileSourceNameWild, "\\PDEF137716\\DirToFile_Source\\"); |
|
880 |
|
881 _LIT(KDirToFileSourceCreatePath, "\\PDEF137716\\DirToFile_Source\\ITEM\\"); |
|
882 |
|
883 RmDir(KFixedTargetTestFolder); |
|
884 RmDir(KFixedSrouceTestFolder); |
|
885 MakeFile(KDirToFileTargetName); |
902 MakeFile(KDirToFileTargetName); |
886 MakeDir(KDirToFileSourceCreatePath); |
903 MakeDir(KDirToFileSourceCreatePath); |
887 err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetName, 0); |
904 if(!gAsynch) |
888 test(err == KErrAccessDenied); |
905 { |
906 err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetName, 0); |
|
907 } |
|
908 else |
|
909 { |
|
910 err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetName, 0, gStat); |
|
911 } |
|
912 TestResult(err,KErrAccessDenied,KErrAccessDenied); |
|
889 |
913 |
890 RmDir(KFixedTargetTestFolder); |
914 RmDir(KFixedTargetTestFolder); |
891 RmDir(KFixedSrouceTestFolder); |
915 RmDir(KFixedSourceTestFolder); |
892 MakeFile(KDirToFileTargetName); |
916 MakeFile(KDirToFileTargetName); |
893 MakeDir(KDirToFileSourceCreatePath); |
917 MakeDir(KDirToFileSourceCreatePath); |
894 err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetName, CFileMan::EOverWrite); |
918 if(!gAsynch) |
895 test(err == KErrAccessDenied); |
919 { |
920 err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetName, CFileMan::EOverWrite); |
|
921 } |
|
922 else |
|
923 { |
|
924 err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetName, CFileMan::EOverWrite, gStat); |
|
925 } |
|
926 TestResult(err,KErrAccessDenied,KErrAccessDenied); |
|
896 |
927 |
897 RmDir(KFixedTargetTestFolder); |
928 RmDir(KFixedTargetTestFolder); |
898 RmDir(KFixedSrouceTestFolder); |
929 RmDir(KFixedSourceTestFolder); |
899 MakeFile(KDirToFileTargetName); |
930 MakeFile(KDirToFileTargetName); |
900 MakeDir(KDirToFileSourceCreatePath); |
931 MakeDir(KDirToFileSourceCreatePath); |
901 err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetNameWild, 0); |
932 if(!gAsynch) |
902 test(err == KErrAccessDenied); |
933 { |
934 err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetNameWild, 0); |
|
935 } |
|
936 else |
|
937 { |
|
938 err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetNameWild, 0, gStat); |
|
939 } |
|
940 TestResult(err,KErrAccessDenied,KErrAccessDenied); |
|
903 |
941 |
904 RmDir(KFixedTargetTestFolder); |
942 RmDir(KFixedTargetTestFolder); |
905 RmDir(KFixedSrouceTestFolder); |
943 RmDir(KFixedSourceTestFolder); |
906 MakeFile(KDirToFileTargetName); |
944 MakeFile(KDirToFileTargetName); |
907 MakeDir(KDirToFileSourceCreatePath); |
945 MakeDir(KDirToFileSourceCreatePath); |
908 err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetNameWild, CFileMan::EOverWrite); |
946 if(!gAsynch) |
909 test(err == KErrAccessDenied); |
947 { |
948 err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetNameWild, CFileMan::EOverWrite); |
|
949 } |
|
950 else |
|
951 { |
|
952 err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetNameWild, CFileMan::EOverWrite, gStat); |
|
953 } |
|
954 TestResult(err,KErrAccessDenied,KErrAccessDenied); |
|
910 |
955 |
911 RmDir(KFixedTargetTestFolder); |
956 RmDir(KFixedTargetTestFolder); |
912 RmDir(KFixedSrouceTestFolder); |
957 RmDir(KFixedSourceTestFolder); |
913 MakeFile(KDirToFileTargetName); |
958 MakeFile(KDirToFileTargetName); |
914 MakeDir(KDirToFileSourceCreatePath); |
959 MakeDir(KDirToFileSourceCreatePath); |
915 err = gFileMan->Move(KDirToFileSourceNameWild, KDirToFileTargetNameWild, 0); |
960 err = gFileMan->Move(KDirToFileSourceNameWild, KDirToFileTargetNameWild, 0); |
916 test(err == KErrNotFound); |
961 if(!gAsynch) |
962 { |
|
963 err = gFileMan->Move(KDirToFileSourceNameWild, KDirToFileTargetNameWild, 0); |
|
964 } |
|
965 else |
|
966 { |
|
967 err = gFileMan->Move(KDirToFileSourceNameWild, KDirToFileTargetNameWild, 0, gStat); |
|
968 } |
|
969 TestResult(err,KErrNotFound); |
|
917 |
970 |
918 RmDir(KFixedTargetTestFolder); |
971 RmDir(KFixedTargetTestFolder); |
919 RmDir(KFixedSrouceTestFolder); |
972 RmDir(KFixedSourceTestFolder); |
920 MakeFile(KDirToFileTargetName); |
973 MakeFile(KDirToFileTargetName); |
921 MakeDir(KDirToFileSourceCreatePath); |
974 MakeDir(KDirToFileSourceCreatePath); |
922 err = gFileMan->Move(KDirToFileSourceNameWild, KDirToFileTargetNameWild, CFileMan::EOverWrite); |
975 if(!gAsynch) |
923 test(err == KErrNotFound); |
976 { |
977 err = gFileMan->Move(KDirToFileSourceNameWild, KDirToFileTargetNameWild, CFileMan::EOverWrite); |
|
978 } |
|
979 else |
|
980 { |
|
981 err = gFileMan->Move(KDirToFileSourceNameWild, KDirToFileTargetNameWild, CFileMan::EOverWrite, gStat); |
|
982 } |
|
983 TestResult(err,KErrNotFound); |
|
924 |
984 |
925 RmDir(KFixedTargetTestFolder); |
985 RmDir(KFixedTargetTestFolder); |
926 RmDir(KFixedSrouceTestFolder); |
986 RmDir(KFixedSourceTestFolder); |
987 gFileMan->SetObserver(gObserver); |
|
927 } |
988 } |
928 |
989 |
929 LOCAL_C void TestMove() |
990 LOCAL_C void TestMove() |
930 // |
991 // |
931 // Test Move |
992 // Test Move |
932 // |
993 // |
933 { |
994 { |
934 |
|
935 test.Next(_L("Test move")); |
995 test.Next(_L("Test move")); |
936 RmDir(_L("\\F32-TST\\TFMAN\\MOVEDIR\\*")); |
996 RmDir(_L("\\F32-TST\\TFMAN\\MOVEDIR\\*")); |
937 |
997 |
938 MakeDir(_L("\\F32-TST\\TFMAN\\MOVEDIR\\")); |
998 MakeDir(_L("\\F32-TST\\TFMAN\\MOVEDIR\\")); |
939 MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\")); |
999 MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\")); |
945 MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\EXE2.BIN")); |
1005 MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\EXE2.BIN")); |
946 |
1006 |
947 TInt r=KErrNone; |
1007 TInt r=KErrNone; |
948 |
1008 |
949 if (testingInvalidPathLengths) |
1009 if (testingInvalidPathLengths) |
950 // Create a path of greater 256 characters by renaming a directory and check it can be |
1010 // Create a path of greater 256 characters by renaming a directory and check it can be |
951 // manipulated (tests fix to F32) |
1011 // manipulated (tests fix to F32) |
952 { |
1012 { |
953 MakeDir(_L("\\START\\LONG\\")); |
1013 MakeDir(_L("\\START\\LONG\\")); |
954 MakeDir(_L("\\FINISH\\")); |
1014 MakeDir(_L("\\FINISH\\")); |
955 MakeFile(_L("\\START\\LONG\\ABCDEFGH01ABCDEFGH01ABCDEFGH01ABCDEFGH01.txt")); |
1015 MakeFile(_L("\\START\\LONG\\ABCDEFGH01ABCDEFGH01ABCDEFGH01ABCDEFGH01.txt")); |
956 MakeFile(_L("\\START\\LONG\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04.txt")); |
1016 MakeFile(_L("\\START\\LONG\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04.txt")); |
957 MakeFile(_L("\\START\\LONG\\DINOSAUR01DINOSAUR02DINOSAUR03DINOSAUR04.txt")); |
1017 MakeFile(_L("\\START\\LONG\\DINOSAUR01DINOSAUR02DINOSAUR03DINOSAUR04.txt")); |
958 MakeFile(_L("\\START\\LONG\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04.txt")); |
1018 MakeFile(_L("\\START\\LONG\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04.txt")); |
959 r=gFileMan->Rename(_L("\\START\\LONG"),_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite); |
1019 r=gFileMan->Rename(_L("\\START\\LONG"),_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite); |
960 test(r==KErrNone); |
1020 test(r==KErrNone); |
961 |
1021 |
962 // Two long directory names - makes paths invalid |
1022 // Two long directory names - makes paths invalid |
963 MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ")); |
1023 MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ")); |
964 MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\")); |
1024 MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\")); |
965 MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04")); |
1025 MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04")); |
966 MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04")); |
1026 MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04")); |
967 r=gFileMan->Rename(_L("\\TEST\\LONG"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),CFileMan::EOverWrite); |
1027 r=gFileMan->Rename(_L("\\TEST\\LONG"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),CFileMan::EOverWrite); |
1116 if (testingInvalidPathLengths) |
1176 if (testingInvalidPathLengths) |
1117 { |
1177 { |
1118 r=gFileMan->RmDir(_L("\\TEST\\")); |
1178 r=gFileMan->RmDir(_L("\\TEST\\")); |
1119 test(r==KErrNone); |
1179 test(r==KErrNone); |
1120 } |
1180 } |
1121 // Test moving directory to its subdirectory |
1181 |
1122 TestDEF121663(); |
1182 TestDEF121663(); // Test moving directory to its subdirectory |
1123 TestDEF123575(); |
1183 TestDEF123575(); // Test moving directories where src and trg have matching subdirectory structures |
1124 //Test Move when trg has at least one of the src dirs |
1184 TestDEF125570(); // Test move when trg has at least one of the src dirs |
1125 TestDEF125570(); |
1185 TestDEF130404(); // Test move when the src doesn't fully exist |
1126 //Test move when the src doesn't fully exist |
1186 if (!IsTestingLFFS()) |
1127 TestDEF130404(); |
1187 TestPDEF137716(); // Test moving files to overwrite folders that have the same names |
1128 |
|
1129 // Test moving files to overwrite folders that have the same names. |
|
1130 TestPDEF137716(); |
|
1131 } |
1188 } |
1132 |
1189 |
1133 LOCAL_C void TestSimultaneous() |
1190 LOCAL_C void TestSimultaneous() |
1134 // |
1191 // |
1135 // Create and run two CFileMen simultaneously |
1192 // Create and run two CFileMen simultaneously |
1136 // |
1193 // |
1137 { |
1194 { |
1138 |
1195 test.Next(_L("Test create and run two CFileMans simultaneously")); |
1139 test.Next(_L("Create and run two CFileMans simultaneously")); |
|
1140 RmDir(_L("\\F32-TST\\TFMAN\\fman2\\")); |
1196 RmDir(_L("\\F32-TST\\TFMAN\\fman2\\")); |
1141 |
1197 |
1142 MakeDir(_L("\\F32-TST\\TFMAN\\FMAN1\\")); |
1198 MakeDir(_L("\\F32-TST\\TFMAN\\FMAN1\\")); |
1143 MakeDir(_L("\\F32-TST\\TFMAN\\FMAN2\\")); |
1199 MakeDir(_L("\\F32-TST\\TFMAN\\FMAN2\\")); |
1144 MakeFile(_L("\\F32-TST\\TFMAN\\FMAN1\\ROD.TXT")); |
1200 MakeFile(_L("\\F32-TST\\TFMAN\\FMAN1\\ROD.TXT")); |
1173 MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FREDRICK.EXT")); |
1229 MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FREDRICK.EXT")); |
1174 MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\PETER.EXT")); |
1230 MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\PETER.EXT")); |
1175 Compare(_L("\\F32-TST\\TFMAN\\After\\*"),_L("\\F32-TST\\TFMAN\\FMAN2\\*")); |
1231 Compare(_L("\\F32-TST\\TFMAN\\After\\*"),_L("\\F32-TST\\TFMAN\\FMAN2\\*")); |
1176 } |
1232 } |
1177 |
1233 |
1234 // Test wildcards are replaced with letters from the matched file (CFileMan::CreateTargetNameFromSource) |
|
1178 LOCAL_C void TestDEF092084() |
1235 LOCAL_C void TestDEF092084() |
1179 { |
1236 { |
1180 if(gAsynch) |
1237 if(gAsynch) |
1181 { |
1238 { |
1182 return; |
1239 return; |
1183 } |
1240 } |
1241 test.Next(_L("Test wildcards are replaced with letters from the matched file (DEF092084)")); |
|
1184 MakeDir(_L("\\DEF092084")); |
1242 MakeDir(_L("\\DEF092084")); |
1185 MakeFile(_L("\\DEF092084\\FILE1.TXT")); |
1243 MakeFile(_L("\\DEF092084\\FILE1.TXT")); |
1186 |
1244 |
1187 TInt r = gFileMan->Rename(_L("\\DEF092084\\*.TXT"),_L("\\DEF092084\\*.DDB"), CFileMan::EOverWrite); |
1245 TInt r = gFileMan->Rename(_L("\\DEF092084\\*.TXT"),_L("\\DEF092084\\*.DDB"), CFileMan::EOverWrite); |
1188 test(r==KErrNone); |
1246 test(r==KErrNone); |
1246 |
1304 |
1247 |
1305 |
1248 /* |
1306 /* |
1249 Test code for INC111038() and executed with Cache enabled and FS_NOT_RUGGED. |
1307 Test code for INC111038() and executed with Cache enabled and FS_NOT_RUGGED. |
1250 */ |
1308 */ |
1251 |
|
1252 LOCAL_C void TestINC111038() |
1309 LOCAL_C void TestINC111038() |
1253 { |
1310 { |
1254 //////////////////////////////////////////////////////// |
|
1255 //// |
|
1256 |
|
1257 TInt r; |
1311 TInt r; |
1258 |
1312 test.Next(_L("Test example of incorrect attribute flushing")); |
1259 test.Next(_L("Example of incorrect attribute flushing")); |
1313 |
1260 //// |
|
1261 //////////////////////////////////////////////////////// |
|
1262 //// |
|
1263 _LIT(KTestFile, "\\TESTFILE.TXT"); |
1314 _LIT(KTestFile, "\\TESTFILE.TXT"); |
1264 |
1315 |
1265 |
1316 test.Printf(_L("1: Create Test File\n")); |
1266 //////////////////////////////////////////////////////// |
|
1267 //// 2: Create Test File |
|
1268 //// |
|
1269 test.Printf(_L("2: Create Test File\n")); |
|
1270 RFile testFile; |
1317 RFile testFile; |
1271 r = testFile.Create(TheFs, KTestFile, EFileRead | EFileWrite); |
1318 r = testFile.Create(TheFs, KTestFile, EFileRead | EFileWrite); |
1272 test(r == KErrNone); |
1319 test(r == KErrNone); |
1273 |
1320 |
1274 //////////////////////////////////////////////////////// |
1321 test.Printf(_L("2: Populate testFile1 Data\n")); |
1275 //// 3: Populate Data |
|
1276 //// |
|
1277 test.Printf(_L("\n3: Populate testFile1 Data\n")); |
|
1278 r = testFile.Write(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); |
1322 r = testFile.Write(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); |
1279 test(r == KErrNone); |
1323 test(r == KErrNone); |
1280 |
1324 |
1281 |
1325 test.Printf(_L("3: Get Initial Attributes\n")); |
1282 //////////////////////////////////////////////////////// |
|
1283 //// 4: Get Initial Attributes |
|
1284 //// |
|
1285 test.Printf(_L("\n4: Get Initial Attributes\n")); |
|
1286 TUint atts = 0; |
1326 TUint atts = 0; |
1287 r = testFile.Att(atts); |
1327 r = testFile.Att(atts); |
1288 test(r == KErrNone); |
1328 test(r == KErrNone); |
1289 test.Printf(_L("\n Attributes: %08x"), atts); |
1329 test.Printf(_L(" Attributes: %08x"), atts); |
1290 |
1330 |
1291 //////////////////////////////////////////////////////// |
1331 test.Printf(_L("4: Set KEntryAttHidden Attribute\n")); |
1292 //// 5: Set KEntryAttHidden Attribute |
|
1293 //// |
|
1294 test.Printf(_L("\n5: Set KEntryAttHidden Attribute")); |
|
1295 r = testFile.SetAtt(KEntryAttHidden, 0); |
1332 r = testFile.SetAtt(KEntryAttHidden, 0); |
1296 test(r == KErrNone); |
1333 test(r == KErrNone); |
1297 |
1334 |
1298 |
1335 test.Printf(_L("5: Verify KEntryAttHidden Attribute is set for testFile1\n")); |
1299 //////////////////////////////////////////////////////// |
|
1300 //// 6: Verify KEntryAttHidden Attribute is set |
|
1301 //// |
|
1302 test.Printf(_L("\n6: Verify KEntryAttHidden Attribute is set for testFile1")); |
|
1303 r = testFile.Att(atts); |
1336 r = testFile.Att(atts); |
1304 test(r == KErrNone); |
1337 test(r == KErrNone); |
1305 test(atts & KEntryAttHidden); |
1338 test(atts & KEntryAttHidden); |
1306 |
1339 |
1307 |
1340 test.Printf(_L("6: Read Data from beginning of file testFile1\n")); |
1308 //////////////////////////////////////////////////////// |
|
1309 //// 7: Read Data from beginning of file |
|
1310 //// |
|
1311 test.Printf(_L("\n7: Read Data from beginning of file testFile1\n")); |
|
1312 TBuf8<4> data; |
1341 TBuf8<4> data; |
1313 r = testFile.Read(0, data); |
1342 r = testFile.Read(0, data); |
1314 test(r == KErrNone); |
1343 test(r == KErrNone); |
1315 |
1344 |
1316 |
1345 test.Printf(_L("7: Close all the testFiles\n")); |
1317 //////////////////////////////////////////////////////// |
|
1318 //// 8: Close file |
|
1319 //// |
|
1320 test.Printf(_L("\n8: Close all the testFiles")); |
|
1321 testFile.Close(); |
1346 testFile.Close(); |
1322 |
1347 |
1323 |
1348 test.Printf(_L("8: Verify KEntryAttHidden is present\n")); |
1324 //////////////////////////////////////////////////////// |
|
1325 //// 9: Verify KEntryAttHidden is present |
|
1326 //// |
|
1327 test.Printf(_L("\n9: Verify KEntryAttHidden is present")); |
|
1328 r = TheFs.Att(KTestFile, atts); |
1349 r = TheFs.Att(KTestFile, atts); |
1329 test(r == KErrNone); |
1350 test(r == KErrNone); |
1330 test.Printf(_L(" \n Finally, attributes are : %08x"), atts); |
1351 test.Printf(_L(" Finally, attributes are : %08x\n"), atts); |
1331 test(atts & KEntryAttHidden); |
1352 test(atts & KEntryAttHidden); |
1332 |
1353 |
1333 |
1354 test.Printf(_L("9: Delete Test File\n")); |
1334 test.Printf(_L("10: Delete Test File")); |
1355 r = TheFs.Delete(KTestFile); |
1335 r = TheFs.Delete(KTestFile); |
|
1336 test(r == KErrNone || r == KErrNotFound); |
1356 test(r == KErrNone || r == KErrNotFound); |
1337 |
|
1338 } |
1357 } |
1339 |
1358 |
1340 LOCAL_C void TestDEF113299() |
1359 LOCAL_C void TestDEF113299() |
1341 { |
1360 { |
1342 test.Next(_L("TestDEF113299")); |
1361 test.Next(_L("Test invalid file rename (DEF113299)")); |
1343 |
1362 |
1344 TInt err =0; |
1363 TInt err =0; |
1345 TFileName srcFileName = _L("C:\\F32-TST\\TFMAN\\DEF113299\\src\\corner.html"); |
1364 TFileName srcFileName = _L("C:\\F32-TST\\TFMAN\\DEF113299\\src\\corner.html"); |
1346 TFileName trgFileName = _L("C:\\F32-TST\\TFMAN\\DEF113299\\src\\mi?d**dle.html"); |
1365 TFileName trgFileName = _L("C:\\F32-TST\\TFMAN\\DEF113299\\src\\mi?d**dle.html"); |
1347 TFileName trgInvalidFileName = _L("C:\\F32-TST\\TFMAN\\DEF113299\\src\\mi?d**dle>.html"); // Invalid filename |
1366 TFileName trgInvalidFileName = _L("C:\\F32-TST\\TFMAN\\DEF113299\\src\\mi?d**dle>.html"); // Invalid filename |
1348 TFileName renamedFileName = _L("C:\\F32-TST\\TFMAN\\DEF113299\\src\\mirderdle.html"); |
1367 TFileName renamedFileName = _L("C:\\F32-TST\\TFMAN\\DEF113299\\src\\mirderdle.html"); |
1349 |
1368 |
1350 RmDir(_L("C:\\F32-TST\\TFMAN\\DEF113299\\")); |
1369 RmDir(_L("C:\\F32-TST\\TFMAN\\DEF113299\\")); |
1351 MakeFile(srcFileName,_L8("Test Data")); |
1370 MakeFile(srcFileName,_L8("Test Data")); |
1371 |
|
1372 // Renaming a file with invalid special characters should fail with error code KErrBadName(-28) |
|
1352 if (!gAsynch) |
1373 if (!gAsynch) |
1353 err = gFileMan->Rename(srcFileName,trgInvalidFileName); |
1374 err = gFileMan->Rename(srcFileName,trgInvalidFileName); |
1354 else |
1375 else |
1355 err = gFileMan->Rename(srcFileName,trgInvalidFileName, 0, gStat); |
1376 err = gFileMan->Rename(srcFileName,trgInvalidFileName, 0, gStat); |
1356 TestResult(err,KErrBadName); |
1377 TestResult(err,KErrBadName); |
1367 LOCAL_C void TestRename() |
1388 LOCAL_C void TestRename() |
1368 // |
1389 // |
1369 // Test rename with wildcards |
1390 // Test rename with wildcards |
1370 // |
1391 // |
1371 { |
1392 { |
1372 |
1393 test.Next(_L("Test rename with wildcards")); |
1373 test.Next(_L("Rename with wildcards")); |
|
1374 RmDir(_L("\\F32-TST\\TFMAN\\rename\\dest\\")); |
1394 RmDir(_L("\\F32-TST\\TFMAN\\rename\\dest\\")); |
1375 |
1395 |
1376 MakeDir(_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\")); |
1396 MakeDir(_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\")); |
1377 MakeDir(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\DirTest\\")); |
1397 MakeDir(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\DirTest\\")); |
1378 MakeFile(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\abcDEF.TXT")); |
1398 MakeFile(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\abcDEF.TXT")); |
1599 Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*")); |
1619 Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*")); |
1600 |
1620 |
1601 err=TheFs.SetSessionPath(sessionPath); |
1621 err=TheFs.SetSessionPath(sessionPath); |
1602 test(err==KErrNone); |
1622 test(err==KErrNone); |
1603 |
1623 |
1604 TestINC109754(); |
1624 TestINC109754(); // Test empty source directory should exist after contents being renamed |
1605 TestDEF092084(); |
1625 TestDEF092084(); // Test wildcards are replaced with letters from the matched file |
1606 TestDEF113299(); |
1626 TestDEF113299(); // Test invalid file rename |
1607 } |
1627 } |
1608 |
1628 |
1609 LOCAL_C void TestAttribs() |
1629 LOCAL_C void TestAttribs() |
1610 // |
1630 // |
1611 // Test attribs |
1631 // Test attribs |
1612 // |
1632 // |
1613 { |
1633 { |
1614 |
1634 test.Next(_L("Test set file attributes")); |
1615 test.Next(_L("Set file attributes")); |
|
1616 MakeFile(_L("\\F32-TST\\TFMAN\\ATTRIBS\\Attrib1.AT")); |
1635 MakeFile(_L("\\F32-TST\\TFMAN\\ATTRIBS\\Attrib1.AT")); |
1617 MakeFile(_L("\\F32-TST\\TFMAN\\ATTRIBS\\Attrib2.at")); |
1636 MakeFile(_L("\\F32-TST\\TFMAN\\ATTRIBS\\Attrib2.at")); |
1618 |
1637 |
1619 TUint legalAttMask=KEntryAttMaskSupported&~(KEntryAttDir|KEntryAttVolume); |
1638 TUint legalAttMask=KEntryAttMaskSupported&~(KEntryAttDir|KEntryAttVolume); |
1620 TUint setMask=KEntryAttReadOnly; |
1639 TUint setMask=KEntryAttReadOnly; |
1679 test(entry.iName.MatchF(_L("attrib2.AT"))!=KErrNotFound); |
1698 test(entry.iName.MatchF(_L("attrib2.AT"))!=KErrNotFound); |
1680 test(entry.iAtt==0); |
1699 test(entry.iAtt==0); |
1681 test(entry.iModified==time); |
1700 test(entry.iModified==time); |
1682 delete entryList; |
1701 delete entryList; |
1683 delete scan; |
1702 delete scan; |
1684 TestINC111038(); |
1703 |
1704 TestINC111038(); // Test example of incorrect attribute flushing |
|
1685 } |
1705 } |
1686 |
1706 |
1687 LOCAL_C void TestINC091841() |
1707 LOCAL_C void TestINC091841() |
1688 { |
1708 { |
1689 if(gAsynch) |
1709 if(gAsynch) |
1690 { |
1710 { |
1691 return; |
1711 return; |
1692 } |
1712 } |
1693 |
1713 |
1714 test.Next(_L("Test delete long fullnames (INC091841)")); |
|
1694 MakeDir(_L("\\12345678\\Book\\12345678\\")); |
1715 MakeDir(_L("\\12345678\\Book\\12345678\\")); |
1695 TFileName longname; |
1716 TFileName longname; |
1696 longname.Copy(_L("\\12345678\\Book\\12345678\\12345678901234567890123456789012345678901234567890.x")); |
1717 longname.Copy(_L("\\12345678\\Book\\12345678\\12345678901234567890123456789012345678901234567890.x")); |
1697 MakeFile(longname); |
1718 MakeFile(longname); |
1698 TFileName oldname = longname; |
1719 TFileName oldname = longname; |
1730 LOCAL_C void TestRmDir() |
1751 LOCAL_C void TestRmDir() |
1731 // |
1752 // |
1732 // Test rmdir function |
1753 // Test rmdir function |
1733 // |
1754 // |
1734 { |
1755 { |
1735 |
|
1736 test.Next(_L("Test rmdir function")); |
1756 test.Next(_L("Test rmdir function")); |
1737 |
1757 |
1738 MakeDir(_L("\\F32-TST\\TFMAN\\RMDIR\\EMPTY\\")); |
1758 MakeDir(_L("\\F32-TST\\TFMAN\\RMDIR\\EMPTY\\")); |
1739 MakeFile(_L("\\F32-TST\\TFMAN\\RMDIR\\ALFRED.txt")); |
1759 MakeFile(_L("\\F32-TST\\TFMAN\\RMDIR\\ALFRED.txt")); |
1740 MakeFile(_L("\\F32-TST\\TFMAN\\RMDIR\\RICHARD.txt")); |
1760 MakeFile(_L("\\F32-TST\\TFMAN\\RMDIR\\RICHARD.txt")); |
1809 { |
1829 { |
1810 r=gFileMan->RmDir(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\"),gStat); |
1830 r=gFileMan->RmDir(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\"),gStat); |
1811 test(r==KErrNone); |
1831 test(r==KErrNone); |
1812 WaitForSuccess(); |
1832 WaitForSuccess(); |
1813 } |
1833 } |
1814 |
|
1815 } |
1834 } |
1816 |
1835 |
1817 TEntry entry; |
1836 TEntry entry; |
1818 r=TheFs.Entry(_L("\\F32-TST\\TFMAN\\RMDIR"),entry); |
1837 r=TheFs.Entry(_L("\\F32-TST\\TFMAN\\RMDIR"),entry); |
1819 test(r==KErrNotFound); |
1838 test(r==KErrNotFound); |
1862 test(r==KErrNone); |
1881 test(r==KErrNone); |
1863 MakeDir(_L("\\F32-TST\\TFMAN\\")); |
1882 MakeDir(_L("\\F32-TST\\TFMAN\\")); |
1864 |
1883 |
1865 if(testingInvalidPathLengths) |
1884 if(testingInvalidPathLengths) |
1866 { |
1885 { |
1867 TestINC091841(); |
1886 TestINC091841(); // Test delete long fullnames |
1868 } |
1887 } |
1869 |
1888 |
1870 //--------------------------------------------- |
1889 //--------------------------------------------- |
1871 //! @SYMTestCaseID PBASE-T_FMAN-0316 |
1890 //! @SYMTestCaseID PBASE-T_FMAN-0316 |
1872 //! @SYMTestType UT |
1891 //! @SYMTestType UT |
1876 //! @SYMTestExpectedResults The operation completes with the error code KErrInUse. |
1895 //! @SYMTestExpectedResults The operation completes with the error code KErrInUse. |
1877 //! @SYMTestPriority High |
1896 //! @SYMTestPriority High |
1878 //! @SYMTestStatus Implemented |
1897 //! @SYMTestStatus Implemented |
1879 //--------------------------------------------- |
1898 //--------------------------------------------- |
1880 |
1899 |
1900 test.Next(_L("Test delete directory containing open files")); |
|
1881 gFileMan->SetObserver(NULL); |
1901 gFileMan->SetObserver(NULL); |
1882 |
1902 |
1883 MakeDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\")); |
1903 MakeDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\")); |
1884 MakeFile(_L("\\F32-TST\\TFMAN\\OPENFILE\\FILE.TXT")); |
1904 MakeFile(_L("\\F32-TST\\TFMAN\\OPENFILE\\FILE.TXT")); |
1885 |
1905 |
1916 LOCAL_C void TestRecursiveCopy() |
1936 LOCAL_C void TestRecursiveCopy() |
1917 // |
1937 // |
1918 // Test the recursive copy function |
1938 // Test the recursive copy function |
1919 // |
1939 // |
1920 { |
1940 { |
1921 |
|
1922 test.Next(_L("Test recursive copy")); |
1941 test.Next(_L("Test recursive copy")); |
1923 RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
1942 RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
1924 |
1943 |
1925 MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
1944 MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
1926 MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\")); |
1945 MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\")); |
1992 LOCAL_C void TestRecursiveAttribs() |
2011 LOCAL_C void TestRecursiveAttribs() |
1993 // |
2012 // |
1994 // Test set attribs recursively |
2013 // Test set attribs recursively |
1995 // |
2014 // |
1996 { |
2015 { |
1997 |
|
1998 test.Next(_L("Test recursive attribs")); |
2016 test.Next(_L("Test recursive attribs")); |
1999 MakeFile(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\Attrib1.AT")); |
2017 MakeFile(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\Attrib1.AT")); |
2000 MakeFile(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\Attrib2.at")); |
2018 MakeFile(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\Attrib2.at")); |
2001 MakeFile(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\SUBDIR\\ATFILE.TXT")); |
2019 MakeFile(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\SUBDIR\\ATFILE.TXT")); |
2002 |
2020 |
2090 LOCAL_C void TestRecursiveDelete() |
2108 LOCAL_C void TestRecursiveDelete() |
2091 // |
2109 // |
2092 // Test Recursive delete |
2110 // Test Recursive delete |
2093 // |
2111 // |
2094 { |
2112 { |
2095 |
|
2096 test.Next(_L("Test recursive delete")); |
2113 test.Next(_L("Test recursive delete")); |
2097 MakeFile(_L("\\F32-TST\\TFMAN\\RECDELETE\\FULL\\GRAPE.TXT")); |
2114 MakeFile(_L("\\F32-TST\\TFMAN\\RECDELETE\\FULL\\GRAPE.TXT")); |
2098 MakeFile(_L("\\F32-TST\\TFMAN\\RECDELETE\\FULL\\GRAPE.PLP")); |
2115 MakeFile(_L("\\F32-TST\\TFMAN\\RECDELETE\\FULL\\GRAPE.PLP")); |
2099 MakeFile(_L("\\F32-TST\\TFMAN\\RECDELETE\\GRAPE.PLP")); |
2116 MakeFile(_L("\\F32-TST\\TFMAN\\RECDELETE\\GRAPE.PLP")); |
2100 MakeFile(_L("\\F32-TST\\TFMAN\\RECDELETE\\FILE1.TXT")); |
2117 MakeFile(_L("\\F32-TST\\TFMAN\\RECDELETE\\FILE1.TXT")); |
2118 } |
2135 } |
2119 |
2136 |
2120 LOCAL_C void TestINC108401() |
2137 LOCAL_C void TestINC108401() |
2121 { |
2138 { |
2122 |
2139 |
2123 test.Next(_L("Test INC108401 : starts")); |
2140 test.Next(_L("Test synchronous and asynchronous move operations (INC108401)")); |
2124 TInt err = 0; |
2141 TInt err = 0; |
2125 |
2142 |
2126 TFileName trgPath = _L("?:\\F32-TST\\"); |
2143 TFileName trgPath = _L("?:\\F32-TST\\"); |
2127 |
2144 |
2128 if (gSessionPath[0]!='D'&& gSessionPath[0]!='Y') |
2145 if (gSessionPath[0]!='D'&& gSessionPath[0]!='Y') |
2256 |
2273 |
2257 // cleanup for the current drive |
2274 // cleanup for the current drive |
2258 RmDir(trgPath); |
2275 RmDir(trgPath); |
2259 RmDir(_L("\\F32-TST\\")); |
2276 RmDir(_L("\\F32-TST\\")); |
2260 |
2277 |
2261 test.Next(_L("Test INC108401 : ends")); |
2278 test.Printf(_L("Test INC108401 : ends\n")); |
2262 } |
2279 } |
2263 |
2280 |
2264 LOCAL_C void TestINC089638() |
2281 LOCAL_C void TestINC089638() |
2265 { |
2282 { |
2266 if(gAsynch) |
2283 if(gAsynch) |
2267 { |
2284 { |
2268 return; |
2285 return; |
2269 } |
2286 } |
2287 |
|
2288 test.Next(_L("Test all items removed from source directory after recursive moving (INC089638)")); |
|
2270 RmDir(_L("\\INC089638\\source\\")); |
2289 RmDir(_L("\\INC089638\\source\\")); |
2271 RmDir(_L("\\INC089638\\dest\\")); |
2290 RmDir(_L("\\INC089638\\dest\\")); |
2272 MakeFile(_L("\\INC089638\\source\\file1")); |
2291 MakeFile(_L("\\INC089638\\source\\file1")); |
2273 MakeFile(_L("\\INC089638\\source\\file2")); |
2292 MakeFile(_L("\\INC089638\\source\\file2")); |
2274 MakeFile(_L("\\INC089638\\source\\subdir1\\file3")); |
2293 MakeFile(_L("\\INC089638\\source\\subdir1\\file3")); |
2287 RmDir(_L("\\INC089638\\")); |
2306 RmDir(_L("\\INC089638\\")); |
2288 } |
2307 } |
2289 |
2308 |
2290 void TestINC101379() |
2309 void TestINC101379() |
2291 { |
2310 { |
2311 test.Next(_L("Test moving of directory to its subdirectory recursively and not recursively (INC101379)")); |
|
2292 TInt err; |
2312 TInt err; |
2293 _LIT(KSourceDir,"\\INC101379\\dir\\"); |
2313 _LIT(KSourceDir,"\\INC101379\\dir\\"); |
2294 _LIT(KFile1, "\\INC101379\\dir\\file1.txt"); |
2314 _LIT(KFile1, "\\INC101379\\dir\\file1.txt"); |
2295 _LIT(KFile2, "\\INC101379\\dir\\subdir\\file2.txt"); |
2315 _LIT(KFile2, "\\INC101379\\dir\\subdir\\file2.txt"); |
2296 _LIT(KFile3, "\\INC101379\\dir\\other\\file3.txt"); |
2316 _LIT(KFile3, "\\INC101379\\dir\\other\\file3.txt"); |
2327 RmDir(_L("\\INC101379\\")); |
2347 RmDir(_L("\\INC101379\\")); |
2328 } |
2348 } |
2329 |
2349 |
2330 void TestINC099600() // and INC101061 |
2350 void TestINC099600() // and INC101061 |
2331 { |
2351 { |
2352 // Test move files from the internal drive to an external one (INC099600) |
|
2353 // Test move files with system (KEntryAttSystem) or hidden (KEntryAttHidden) attributes (INC101061) |
|
2354 test.Next(_L("Test move files from internal drive to external with system and hidden attributes")); |
|
2332 _LIT(KDest,"C:\\DEST099600\\"); |
2355 _LIT(KDest,"C:\\DEST099600\\"); |
2333 TBuf<64> source; |
2356 TBuf<64> source; |
2334 source.Format(_L("%c:\\INC099600\\"), (TUint) gDriveToTest); |
2357 source.Format(_L("%c:\\INC099600\\"), (TUint) gDriveToTest); |
2335 TBuf<64> src; |
2358 TBuf<64> src; |
2336 TInt r; |
2359 TInt r; |
2681 else |
2704 else |
2682 err = gFileMan->Copy(_L("\\F32-TST\\TFMAN\\INC106735\\*.TXT"), _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\"), CFileMan::ERecurse, gStat); |
2705 err = gFileMan->Copy(_L("\\F32-TST\\TFMAN\\INC106735\\*.TXT"), _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\"), CFileMan::ERecurse, gStat); |
2683 TestResult(err, KErrNone); |
2706 TestResult(err, KErrNone); |
2684 Compare(_L("\\F32-TST\\TFMAN\\INC106735\\"), _L("\\F32-TST\\TFMAN\\INC106735_COM\\")); |
2707 Compare(_L("\\F32-TST\\TFMAN\\INC106735\\"), _L("\\F32-TST\\TFMAN\\INC106735_COM\\")); |
2685 |
2708 |
2686 TestINC089638(); |
2709 TestINC089638(); // Test all items removed from source directory after recursive moving |
2687 TestINC101379(); |
2710 TestINC101379(); // Test moving of directory to its subdirectory recursively and not recursively |
2688 TestINC099600(); // and INC101061 |
2711 TestINC099600(); // and INC101061, Test move files from internal drive to external with system |
2712 // and hidden attributes |
|
2689 } |
2713 } |
2690 |
2714 |
2691 |
2715 |
2692 // |
2716 // |
2693 // A complex test directory structure... |
2717 // A complex test directory structure... |
2738 LOCAL_C void TestRecursiveMoveAcrossDrives() |
2762 LOCAL_C void TestRecursiveMoveAcrossDrives() |
2739 // |
2763 // |
2740 // Test recursive move across drives |
2764 // Test recursive move across drives |
2741 // |
2765 // |
2742 { |
2766 { |
2743 |
|
2744 test.Next(_L("Test recursive move across drives")); |
2767 test.Next(_L("Test recursive move across drives")); |
2745 |
2768 |
2746 TFileName trgDir = _L("\\F32-TST\\TFMAN\\RECMOVE2\\"); |
2769 TFileName trgDir = _L("\\F32-TST\\TFMAN\\RECMOVE2\\"); |
2747 TFileName trgSpec = _L("\\F32-TST\\TFMAN\\RECMOVE2\\*"); |
2770 TFileName trgSpec = _L("\\F32-TST\\TFMAN\\RECMOVE2\\*"); |
2748 |
|
2749 |
2771 |
2750 if (gSessionPath[0]=='C') |
2772 if (gSessionPath[0]=='C') |
2751 { |
2773 { |
2752 #if !defined(__WINS__) |
2774 #if !defined(__WINS__) |
2753 trgDir = _L("D:\\F32-TST\\TFMAN\\RECMOVE2\\"); |
2775 trgDir = _L("D:\\F32-TST\\TFMAN\\RECMOVE2\\"); |
2769 TInt err; |
2791 TInt err; |
2770 if (!gAsynch) |
2792 if (!gAsynch) |
2771 err=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\*.PLP"),trgDir,CFileMan::ERecurse); |
2793 err=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\*.PLP"),trgDir,CFileMan::ERecurse); |
2772 else |
2794 else |
2773 err=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\*.PLP"),trgDir,CFileMan::ERecurse,gStat); |
2795 err=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\*.PLP"),trgDir,CFileMan::ERecurse,gStat); |
2796 test.Printf(_L("TestRecursiveMoveAcrossDrives(),gFileMan->Move(),err=%d\n"),err); |
|
2774 TestResult(err); |
2797 TestResult(err); |
2775 |
2798 |
2776 RmDir(_L("C:\\F32-TST\\TFMAN\\after\\")); |
2799 RmDir(_L("C:\\F32-TST\\TFMAN\\after\\")); |
2777 MakeFile(_L("C:\\F32-TST\\TFMAN\\AFTER\\FULL\\FILE2.PLP")); |
2800 MakeFile(_L("C:\\F32-TST\\TFMAN\\AFTER\\FULL\\FILE2.PLP")); |
2778 MakeFile(_L("C:\\F32-TST\\TFMAN\\AFTER\\FULL\\FILE3.PLP")); |
2801 MakeFile(_L("C:\\F32-TST\\TFMAN\\AFTER\\FULL\\FILE3.PLP")); |
2801 |
2824 |
2802 //--------------------------------------------- |
2825 //--------------------------------------------- |
2803 //! @SYMTestCaseID PBASE-T_FMAN-0571 |
2826 //! @SYMTestCaseID PBASE-T_FMAN-0571 |
2804 //! @SYMTestType UT |
2827 //! @SYMTestType UT |
2805 //! @SYMREQ INC108401 |
2828 //! @SYMREQ INC108401 |
2806 //! @SYMTestCaseDesc This testcase tests the synchronous and asynchronous move operations exhaustively with flags set as 0, CFileMan::EOverWrite, |
2829 //! @SYMTestCaseDesc This testcase tests the synchronous and asynchronous move operations |
2807 //! CFileMan::ERecurse on the SAME and ACROSS drives without trailing slash at the end of source dir path. |
2830 //! exhaustively with flags set as 0, CFileMan::EOverWrite, CFileMan::ERecurse |
2831 //! on the SAME and ACROSS drives without trailing slash at the end of source |
|
2832 //! dir path. |
|
2808 //! @SYMTestActions 1. Copy directory structures to another directory across drive. |
2833 //! @SYMTestActions 1. Copy directory structures to another directory across drive. |
2809 //! 2. Copy directory structures to another directory across drive overwriting duplicate files. |
2834 //! 2. Copy directory structures to another directory across drive overwriting |
2835 //! duplicate files. |
|
2810 //! 3. Copy directory structures to another directory across drive. |
2836 //! 3. Copy directory structures to another directory across drive. |
2811 //! 4. Copy directory structures to another directory on same drive. |
2837 //! 4. Copy directory structures to another directory on same drive. |
2812 //! 5. Copy directory structures to another directory on same drive overwriting duplicate files. |
2838 //! 5. Copy directory structures to another directory on same drive overwriting |
2839 //! duplicate files. |
|
2813 //! 6. Copy directory structures to another directory on same drive. |
2840 //! 6. Copy directory structures to another directory on same drive. |
2814 //! @SYMTestExpectedResults 1. Completes with no error, the last directory and its contents are moved from the src directory to the destination directory. |
2841 //! @SYMTestExpectedResults 1. Completes with no error, the last directory and its contents are moved |
2815 //! 2. Completes with no error, the last directory and its contents are moved from the src directory to the destination directory, duplicate files are updated. |
2842 //! from the src directory to the destination directory. |
2816 //! 3. Completes with no error, the last directory and its contents are moved from the src directory to the destination directory. |
2843 //! 2. Completes with no error, the last directory and its contents are moved |
2817 //! 4. Completes with no error, the last directory and its contents are moved from the src directory to the destination directory. |
2844 //! from the src directory to the destination directory, duplicate files are updated. |
2818 //! 5. Completes with no error, the last directory and its contents are moved from the src directory to the destination directory, duplicate files are updated. |
2845 //! 3. Completes with no error, the last directory and its contents are moved |
2819 //! 6. Completes with no error, the last directory and its contents are moved from the src directory to the destination directory. |
2846 //! from the src directory to the destination directory. |
2847 //! 4. Completes with no error, the last directory and its contents are moved |
|
2848 //! from the src directory to the destination directory. |
|
2849 //! 5. Completes with no error, the last directory and its contents are moved |
|
2850 //! from the src directory to the destination directory, duplicate files are updated. |
|
2851 //! 6. Completes with no error, the last directory and its contents are moved |
|
2852 //! from the src directory to the destination directory. |
|
2820 //! @SYMTestPriority High |
2853 //! @SYMTestPriority High |
2821 //! @SYMTestStatus Implemented |
2854 //! @SYMTestStatus Implemented |
2822 //--------------------------------------------- |
2855 //--------------------------------------------- |
2823 |
2856 |
2824 TestINC108401(); |
2857 TestINC108401(); |
2978 CFileManCopyAllCancel::CFileManCopyAllCancel(CFileMan* aFileMan) |
3011 CFileManCopyAllCancel::CFileManCopyAllCancel(CFileMan* aFileMan) |
2979 // |
3012 // |
2980 // Constructor |
3013 // Constructor |
2981 // |
3014 // |
2982 { |
3015 { |
2983 |
|
2984 __DECLARE_NAME(_S("CFileManCopyAllCancel")); |
3016 __DECLARE_NAME(_S("CFileManCopyAllCancel")); |
2985 iFileMan=aFileMan; |
3017 iFileMan=aFileMan; |
2986 } |
3018 } |
2987 |
3019 |
2988 MFileManObserver::TControl CFileManCopyAllCancel::NotifyFileManStarted() |
3020 MFileManObserver::TControl CFileManCopyAllCancel::NotifyFileManStarted() |
2989 // |
3021 // |
2990 // Observer for TestCopyAllCancel tests |
3022 // Observer for TestCopyAllCancel tests |
2991 // |
3023 // |
2992 { |
3024 { |
2993 |
|
2994 return(MFileManObserver::ECancel); |
3025 return(MFileManObserver::ECancel); |
2995 } |
3026 } |
2996 |
3027 |
2997 MFileManObserver::TControl CFileManCopyAllCancel::NotifyFileManEnded() |
3028 MFileManObserver::TControl CFileManCopyAllCancel::NotifyFileManEnded() |
2998 // |
3029 // |
2999 // Observer for TestCopyAllCancel tests |
3030 // Observer for TestCopyAllCancel tests |
3000 // |
3031 // |
3001 { |
3032 { |
3002 |
|
3003 return(MFileManObserver::EContinue); |
3033 return(MFileManObserver::EContinue); |
3004 } |
3034 } |
3005 |
3035 |
3006 |
3036 |
3007 |
3037 |
3008 LOCAL_C void TestCopyAllCancel() |
3038 LOCAL_C void TestCopyAllCancel() |
3009 // |
3039 // |
3010 // Test copy ( all cancel) |
3040 // Test copy (all cancel) |
3011 // |
3041 // |
3012 { |
3042 { |
3013 |
|
3014 test.Next(_L("Test copy all cancel")); |
3043 test.Next(_L("Test copy all cancel")); |
3015 |
3044 |
3016 RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\*")); |
3045 RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\*")); |
3017 CFileManCopyAllCancel* fManObserver=new(ELeave) CFileManCopyAllCancel(gFileMan); |
3046 CFileManCopyAllCancel* fManObserver=new(ELeave) CFileManCopyAllCancel(gFileMan); |
3018 CleanupStack::PushL(fManObserver); |
3047 CleanupStack::PushL(fManObserver); |
3019 gFileMan->SetObserver(fManObserver); |
3048 gFileMan->SetObserver(fManObserver); |
3020 |
3049 |
3021 |
|
3022 MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
3050 MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
3023 MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\")); |
3051 MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\")); |
3024 MakeFile(_L("\\F32-TST\\TFMAN\\NewDir\\ABC.DEF")); |
3052 MakeFile(_L("\\F32-TST\\TFMAN\\NewDir\\ABC.DEF")); |
3025 MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT")); |
3053 MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT")); |
3026 MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE2.TXT")); |
3054 MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE2.TXT")); |
3047 else |
3075 else |
3048 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.txt"),_L("\\F32-TST\\TFMAN\\file1.txt"),0,gStat); |
3076 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.txt"),_L("\\F32-TST\\TFMAN\\file1.txt"),0,gStat); |
3049 TestResult(r,KErrCancel); |
3077 TestResult(r,KErrCancel); |
3050 gFileMan->SetObserver(gObserver); |
3078 gFileMan->SetObserver(gObserver); |
3051 CleanupStack::PopAndDestroy(); |
3079 CleanupStack::PopAndDestroy(); |
3052 |
|
3053 } |
3080 } |
3054 |
3081 |
3055 class CFileManObserverOverWrite : public CBase, public MFileManObserver |
3082 class CFileManObserverOverWrite : public CBase, public MFileManObserver |
3056 { |
3083 { |
3057 public: |
3084 public: |
3065 CFileManObserverOverWrite::CFileManObserverOverWrite(CFileMan* aFileMan) |
3092 CFileManObserverOverWrite::CFileManObserverOverWrite(CFileMan* aFileMan) |
3066 // |
3093 // |
3067 // Constructor |
3094 // Constructor |
3068 // |
3095 // |
3069 { |
3096 { |
3070 |
|
3071 __DECLARE_NAME(_S("CFileManObserverOverWrite")); |
3097 __DECLARE_NAME(_S("CFileManObserverOverWrite")); |
3072 iFileMan=aFileMan; |
3098 iFileMan=aFileMan; |
3073 } |
3099 } |
3074 |
3100 |
3075 |
3101 |
3076 MFileManObserver::TControl CFileManObserverOverWrite::NotifyFileManEnded() |
3102 MFileManObserver::TControl CFileManObserverOverWrite::NotifyFileManEnded() |
3077 // |
3103 // |
3078 // Observer for testoverwrite tests |
3104 // Observer for testoverwrite tests |
3079 // |
3105 // |
3080 { |
3106 { |
3081 |
|
3082 TInt lastError=iFileMan->GetLastError(); |
3107 TInt lastError=iFileMan->GetLastError(); |
3083 if (lastError!=KErrNone) |
3108 if (lastError!=KErrNone) |
3084 { |
3109 { |
3085 test(lastError==KErrAlreadyExists); |
3110 test(lastError==KErrAlreadyExists); |
3086 if (gAsynch==EFalse) |
3111 if (gAsynch==EFalse) |
3095 LOCAL_C void TestOverWrite() |
3120 LOCAL_C void TestOverWrite() |
3096 // |
3121 // |
3097 // Test overwrite for copy and rename |
3122 // Test overwrite for copy and rename |
3098 // |
3123 // |
3099 { |
3124 { |
3100 |
|
3101 test.Next(_L("Test overwrite option")); |
3125 test.Next(_L("Test overwrite option")); |
3102 RmDir(_L("\\F32-TST\\TFMAN\\OVERWRITE\\")); |
3126 RmDir(_L("\\F32-TST\\TFMAN\\OVERWRITE\\")); |
3103 CFileManObserverOverWrite* fManObserver=new(ELeave) CFileManObserverOverWrite(gFileMan); |
3127 CFileManObserverOverWrite* fManObserver=new(ELeave) CFileManObserverOverWrite(gFileMan); |
3104 CleanupStack::PushL(fManObserver); |
3128 CleanupStack::PushL(fManObserver); |
3105 gFileMan->SetObserver(fManObserver); |
3129 gFileMan->SetObserver(fManObserver); |
3200 LOCAL_C void TestErrorHandling() |
3224 LOCAL_C void TestErrorHandling() |
3201 // |
3225 // |
3202 // Test bad paths etc |
3226 // Test bad paths etc |
3203 // |
3227 // |
3204 { |
3228 { |
3205 |
|
3206 test.Next(_L("Test error handling")); |
3229 test.Next(_L("Test error handling")); |
3207 if (!gAsynch) |
3230 if (!gAsynch) |
3208 { |
3231 { |
3209 TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\BADPATH\\*")); |
3232 TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\BADPATH\\*")); |
3210 test(r==KErrPathNotFound); |
3233 test(r==KErrPathNotFound); |
3338 RmDir(_L("\\EMPTYSRC\\")); |
3361 RmDir(_L("\\EMPTYSRC\\")); |
3339 RmDir(_L("\\EMPTYTRG\\")); |
3362 RmDir(_L("\\EMPTYTRG\\")); |
3340 |
3363 |
3341 |
3364 |
3342 MakeFile(_L("Dummyfile")); |
3365 MakeFile(_L("Dummyfile")); |
3343 test.Next(_L("Illegal names")); |
3366 test.Next(_L("Test illegal names")); |
3344 r=gFileMan->Attribs(_L(":C:"),0,0,TTime(0),0); |
3367 r=gFileMan->Attribs(_L(":C:"),0,0,TTime(0),0); |
3345 test(r==KErrBadName); |
3368 test(r==KErrBadName); |
3346 r=gFileMan->Copy(_L(":C:"),_L("newname"),0); |
3369 r=gFileMan->Copy(_L(":C:"),_L("newname"),0); |
3347 test(r==KErrBadName); |
3370 test(r==KErrBadName); |
3348 r=gFileMan->Copy(_L("Dummyfile"),_L(":C:"),0); |
3371 r=gFileMan->Copy(_L("Dummyfile"),_L(":C:"),0); |
3389 LOCAL_C void TestNameMangling() |
3412 LOCAL_C void TestNameMangling() |
3390 // |
3413 // |
3391 // Synchronous test of name mangling |
3414 // Synchronous test of name mangling |
3392 // |
3415 // |
3393 { |
3416 { |
3394 |
3417 test.Next(_L("Test name mangling")); |
3395 gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\")); |
3418 gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\")); |
3396 MakeDir(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\")); |
3419 MakeDir(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\")); |
3397 MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\abc.def")); |
3420 MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\abc.def")); |
3398 MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\abcdefghijk.def")); |
3421 MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\abcdefghijk.def")); |
3399 MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\abc.defgh")); |
3422 MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\abc.defgh")); |
3466 r=gFileMan->RmDir(longRootDirNameB); |
3489 r=gFileMan->RmDir(longRootDirNameB); |
3467 test(r==KErrPathNotFound); |
3490 test(r==KErrPathNotFound); |
3468 r=gFileMan->RmDir(longRootDirNameA); |
3491 r=gFileMan->RmDir(longRootDirNameA); |
3469 test(r==KErrNone); |
3492 test(r==KErrNone); |
3470 |
3493 |
3471 |
|
3472 TFileName longSubDirName=_L("\\Files\\"); |
3494 TFileName longSubDirName=_L("\\Files\\"); |
3473 TPtrC longSubDirFileName(longFileNameA.Ptr(),longFilePtrLength-longSubDirName.Length()); |
3495 TPtrC longSubDirFileName(longFileNameA.Ptr(),longFilePtrLength-longSubDirName.Length()); |
3474 longSubDirName+=longSubDirFileName; |
3496 longSubDirName+=longSubDirFileName; |
3475 longSubDirName+=_L("\\"); |
3497 longSubDirName+=_L("\\"); |
3476 r=TheFs.MkDirAll(longSubDirName); |
3498 r=TheFs.MkDirAll(longSubDirName); |
3480 r=TheFs.GetDir(longSubDirName,KEntryAttMaskSupported,0,dirList); |
3502 r=TheFs.GetDir(longSubDirName,KEntryAttMaskSupported,0,dirList); |
3481 test(r==KErrNone); |
3503 test(r==KErrNone); |
3482 test(dirList->Count()==0); |
3504 test(dirList->Count()==0); |
3483 delete dirList; |
3505 delete dirList; |
3484 |
3506 |
3485 |
|
3486 TPtrC ptrLongSubDirSrc(longSubDirName.Ptr(),longSubDirName.Length()-1); |
3507 TPtrC ptrLongSubDirSrc(longSubDirName.Ptr(),longSubDirName.Length()-1); |
3487 TPtrC ptrLongSubDirTrg(longRootDirNameA.Ptr(),longRootDirNameA.Length()-1); |
3508 TPtrC ptrLongSubDirTrg(longRootDirNameA.Ptr(),longRootDirNameA.Length()-1); |
3488 r=gFileMan->Copy(ptrLongSubDirSrc,ptrLongSubDirTrg); |
3509 r=gFileMan->Copy(ptrLongSubDirSrc,ptrLongSubDirTrg); |
3489 test(r==KErrNone); |
3510 test(r==KErrNone); |
3490 r=TheFs.MkDir(longRootDirNameB); |
3511 r=TheFs.MkDir(longRootDirNameB); |
3501 LOCAL_C void TestFileAttributes() |
3522 LOCAL_C void TestFileAttributes() |
3502 // |
3523 // |
3503 // Test file attributes are copied and new settings |
3524 // Test file attributes are copied and new settings |
3504 // |
3525 // |
3505 { |
3526 { |
3506 |
3527 test.Next(_L("Test file attributes are copied")); |
3507 gFileMan->Delete(_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*.*")); |
3528 gFileMan->Delete(_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*.*")); |
3508 MakeDir(_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\")); |
3529 MakeDir(_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\")); |
3509 MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\readonly.def"),KEntryAttReadOnly); |
3530 MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\readonly.def"),KEntryAttReadOnly); |
3510 MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\readonlyhidden.def"),KEntryAttReadOnly|KEntryAttHidden); |
3531 MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\readonlyhidden.def"),KEntryAttReadOnly|KEntryAttHidden); |
3511 MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\hiddensystem.def"),KEntryAttHidden|KEntryAttSystem); |
3532 MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\hiddensystem.def"),KEntryAttHidden|KEntryAttSystem); |
3535 CFileManObserverContinue::CFileManObserverContinue(CFileMan* aFileMan) |
3556 CFileManObserverContinue::CFileManObserverContinue(CFileMan* aFileMan) |
3536 // |
3557 // |
3537 // Constructor |
3558 // Constructor |
3538 // |
3559 // |
3539 { |
3560 { |
3540 |
|
3541 __DECLARE_NAME(_S("CFileManObserverOverWrite")); |
3561 __DECLARE_NAME(_S("CFileManObserverOverWrite")); |
3542 iFileMan=aFileMan; |
3562 iFileMan=aFileMan; |
3543 } |
3563 } |
3544 |
3564 |
3545 |
3565 |
3546 MFileManObserver::TControl CFileManObserverContinue::NotifyFileManEnded() |
3566 MFileManObserver::TControl CFileManObserverContinue::NotifyFileManEnded() |
3547 // |
3567 // |
3548 // Observer for testoverwrite tests |
3568 // Observer for testoverwrite tests |
3549 // |
3569 // |
3550 { |
3570 { |
3551 |
|
3552 return(MFileManObserver::EContinue); |
3571 return(MFileManObserver::EContinue); |
3553 } |
3572 } |
3554 |
3573 |
3555 LOCAL_C void TestCopyOpenFile() |
3574 LOCAL_C void TestCopyOpenFile() |
3556 // |
3575 // |
3557 // Copy a file while it is open |
3576 // Copy a file while it is open |
3558 // |
3577 // |
3559 { |
3578 { |
3560 |
3579 test.Next(_L("Test copying open files")); |
3561 test.Next(_L("Copying open files")); |
|
3562 |
3580 |
3563 CFileManObserverContinue* fManObserver=new(ELeave) CFileManObserverContinue(gFileMan); |
3581 CFileManObserverContinue* fManObserver=new(ELeave) CFileManObserverContinue(gFileMan); |
3564 gFileMan->SetObserver(fManObserver); |
3582 gFileMan->SetObserver(fManObserver); |
3565 |
3583 |
3566 TBuf<256> contents; |
3584 TBuf<256> contents; |
3598 delete fManObserver; |
3616 delete fManObserver; |
3599 } |
3617 } |
3600 |
3618 |
3601 void TestINC101844() |
3619 void TestINC101844() |
3602 { |
3620 { |
3621 test.Next(_L("Test move files and subdirs with different attributes (INC101844)")); |
|
3603 _LIT(KDest,"C:\\DEST101844\\"); |
3622 _LIT(KDest,"C:\\DEST101844\\"); |
3604 TBuf<64> source; |
3623 TBuf<64> source; |
3605 source.Format(_L("%c:\\INC101844\\"), (TUint) gDriveToTest); |
3624 source.Format(_L("%c:\\INC101844\\"), (TUint) gDriveToTest); |
3606 TBuf<64> src; |
3625 TBuf<64> src; |
3607 RmDir(source); |
3626 RmDir(source); |
3608 RmDir(KDest); |
3627 RmDir(KDest); |
3609 MakeDir(KDest); |
3628 MakeDir(KDest); |
3610 TInt r; |
3629 TInt r; |
3611 |
3630 |
3631 // Create files and subdirs with different attributes |
|
3612 src = source; |
3632 src = source; |
3613 src.Append(_L("file1")); |
3633 src.Append(_L("file1")); |
3614 MakeFile(src, _L8("blah")); |
3634 MakeFile(src, _L8("blah")); |
3615 TheFs.SetAtt(src, KEntryAttReadOnly, 0); |
3635 TheFs.SetAtt(src, KEntryAttReadOnly, 0); |
3616 src = source; |
3636 src = source; |
3627 TheFs.SetAtt(src, KEntryAttArchive, 0); |
3647 TheFs.SetAtt(src, KEntryAttArchive, 0); |
3628 src = source; |
3648 src = source; |
3629 src.Append(_L("subdir1")); |
3649 src.Append(_L("subdir1")); |
3630 TheFs.SetAtt(src, KEntryAttSystem | KEntryAttHidden, KEntryAttArchive); |
3650 TheFs.SetAtt(src, KEntryAttSystem | KEntryAttHidden, KEntryAttArchive); |
3631 |
3651 |
3652 // Move directory containing files and subdirs with different attributes |
|
3632 r = gFileMan->Move(source, KDest, 0); |
3653 r = gFileMan->Move(source, KDest, 0); |
3633 test(r==KErrNone); |
3654 test(r==KErrNone); |
3634 |
3655 |
3656 // Check that the files and subdirs have moved and have the correct attributes |
|
3635 TEntry entry; |
3657 TEntry entry; |
3636 src = KDest; |
3658 src = KDest; |
3637 src.Append(_L("file1")); |
3659 src.Append(_L("file1")); |
3638 r = TheFs.Entry(src, entry); |
3660 r = TheFs.Entry(src, entry); |
3639 test(r == KErrNone); |
3661 test(r == KErrNone); |
3670 LOCAL_C void TestMoveAcrossDrives() |
3692 LOCAL_C void TestMoveAcrossDrives() |
3671 // |
3693 // |
3672 // Move a file from C: to the target drive |
3694 // Move a file from C: to the target drive |
3673 // |
3695 // |
3674 { |
3696 { |
3675 |
3697 test.Next(_L("Test move across drives")); |
3676 test.Next(_L("Move across drives")); |
|
3677 |
3698 |
3678 TFileName trgDrive = _L("\\"); |
3699 TFileName trgDrive = _L("\\"); |
3679 TFileName trgFile = _L("\\Sketch"); |
3700 TFileName trgFile = _L("\\Sketch"); |
3680 TFileName trgDir = _L("\\DRIVEMOVE\\"); |
3701 TFileName trgDir = _L("\\DRIVEMOVE\\"); |
3681 TFileName trgDirFile = _L("\\DRIVEMOVE\\Sketch"); |
3702 TFileName trgDirFile = _L("\\DRIVEMOVE\\Sketch"); |
3699 RmDir(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\")); |
3720 RmDir(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\")); |
3700 |
3721 |
3701 MakeFile(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch")); |
3722 MakeFile(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch")); |
3702 |
3723 |
3703 // Move Sketch from the source to target |
3724 // Move Sketch from the source to target |
3704 gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch"),trgDrive); |
3725 TInt r = gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch"),trgDrive); |
3726 test.Printf(_L("TestMoveAcrossDrives(),gFileMan->Move(),r=%d\n"),r); |
|
3705 // Check Sketch no longer exists on source drive |
3727 // Check Sketch no longer exists on source drive |
3706 CheckFileExists(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch"),KErrNotFound); |
3728 CheckFileExists(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch"),KErrNotFound); |
3707 // Check Sketch exists on target drive |
3729 // Check Sketch exists on target drive |
3708 CheckFileExists(trgFile,KErrNone); |
3730 CheckFileExists(trgFile,KErrNone); |
3709 |
3731 |
3710 MakeFile(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch")); |
3732 MakeFile(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch")); |
3711 // Move Directory DRIVEMOVE from the source to target |
3733 // Move Directory DRIVEMOVE from the source to target |
3712 gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE"),trgDrive); |
3734 r = gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE"),trgDrive); |
3735 test.Printf(_L("TestMoveAcrossDrives(),gFileMan->Move(),r=%d\n"),r); |
|
3713 // Check DRIVEMOVE no longer exists on source drive |
3736 // Check DRIVEMOVE no longer exists on source drive |
3714 CheckFileExists(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch"),KErrPathNotFound); |
3737 CheckFileExists(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch"),KErrPathNotFound); |
3715 // Check Sketch exists on target drive |
3738 // Check Sketch exists on target drive |
3716 CheckFileExists(trgDirFile,KErrNone); |
3739 CheckFileExists(trgDirFile,KErrNone); |
3717 |
3740 |
3718 RmDir(trgDir); |
3741 RmDir(trgDir); |
3719 test(TheFs.Delete(trgFile) == KErrNone); |
3742 test(TheFs.Delete(trgFile) == KErrNone); |
3720 |
3743 |
3721 TestINC101844(); |
3744 TestINC101844(); // Test move files and subdirs with different attributes |
3722 } |
3745 } |
3723 |
3746 |
3724 class CFileManObserverCopyAbort : public CBase, public MFileManObserver |
3747 class CFileManObserverCopyAbort : public CBase, public MFileManObserver |
3725 { |
3748 { |
3726 public: |
3749 public: |
3756 MFileManObserver::TControl CFileManObserverCopyAbort::NotifyFileManEnded() |
3779 MFileManObserver::TControl CFileManObserverCopyAbort::NotifyFileManEnded() |
3757 // |
3780 // |
3758 // Observer for testoverwrite tests |
3781 // Observer for testoverwrite tests |
3759 // |
3782 // |
3760 { |
3783 { |
3761 |
|
3762 TInt lastError = iFileMan->GetLastError(); |
3784 TInt lastError = iFileMan->GetLastError(); |
3763 test(lastError == KErrNone); |
3785 test(lastError == KErrNone); |
3764 |
3786 |
3765 TFileName srcfile; |
3787 TFileName srcfile; |
3766 iFileMan->GetCurrentSource(srcfile); |
3788 iFileMan->GetCurrentSource(srcfile); |
3774 return(iCurrentStep ? MFileManObserver::EContinue : MFileManObserver::EAbort); |
3796 return(iCurrentStep ? MFileManObserver::EContinue : MFileManObserver::EAbort); |
3775 } |
3797 } |
3776 |
3798 |
3777 LOCAL_C void TestAbortedMoveAcrossDrives() |
3799 LOCAL_C void TestAbortedMoveAcrossDrives() |
3778 // |
3800 // |
3779 // Move a file from C: to Y:, and test various cancel conditions |
3801 // Move a file from C: to D: or Y:, and test various cancel conditions |
3780 // |
3802 // |
3781 { |
3803 { |
3782 |
3804 test.Next(_L("Test cancel move across drives")); |
3783 test.Next(_L("Cancel Move across drives")); |
|
3784 |
3805 |
3785 const TInt KNumFiles = 5; |
3806 const TInt KNumFiles = 5; |
3786 |
3807 |
3787 TFileName trgDirRoot = _L("\\F32-TST\\TFMAN\\"); |
3808 TFileName trgDirRoot = _L("\\F32-TST\\TFMAN\\"); |
3788 TFileName trgDirFull = _L("\\F32-TST\\TFMAN\\CANCELMOVE\\"); |
3809 TFileName trgDirFull = _L("\\F32-TST\\TFMAN\\CANCELMOVE\\"); |
3804 gFileMan->RmDir(_L("C:\\F32-TST\\TFMAN\\CANCELMOVE\\")); |
3825 gFileMan->RmDir(_L("C:\\F32-TST\\TFMAN\\CANCELMOVE\\")); |
3805 |
3826 |
3806 CFileManObserverCopyAbort* fManObserver=new(ELeave) CFileManObserverCopyAbort(gFileMan); |
3827 CFileManObserverCopyAbort* fManObserver=new(ELeave) CFileManObserverCopyAbort(gFileMan); |
3807 CleanupStack::PushL(fManObserver); |
3828 CleanupStack::PushL(fManObserver); |
3808 |
3829 |
3809 // Check that source files exist when interrupting the copy step |
3830 // Check that source files exist when interrupting the copy step |
3810 TInt step = 0; |
3831 TInt step = 0; |
3811 TInt i = 0; |
3832 TInt i = 0; |
3812 for(step = 1; step <= KNumFiles+1; ++step) |
3833 for(step = 1; step <= KNumFiles+1; ++step) |
3813 { |
3834 { |
3814 for (i = 0; i < KNumFiles; i++) |
3835 for (i = 0; i < KNumFiles; i++) |
3828 if (!gAsynch) |
3849 if (!gAsynch) |
3829 r=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\CANCELMOVE"),trgDirRoot, CFileMan::EOverWrite); |
3850 r=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\CANCELMOVE"),trgDirRoot, CFileMan::EOverWrite); |
3830 else |
3851 else |
3831 r=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\CANCELMOVE"),trgDirRoot, CFileMan::EOverWrite, gStat); |
3852 r=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\CANCELMOVE"),trgDirRoot, CFileMan::EOverWrite, gStat); |
3832 |
3853 |
3854 test.Printf(_L("TestAbortedMoveAcrossDrives(),gFileMan->Move(),r=%d\n"),r); |
|
3833 TestResult(r, (step <= KNumFiles) ? KErrCancel : KErrNone); |
3855 TestResult(r, (step <= KNumFiles) ? KErrCancel : KErrNone); |
3834 |
3856 |
3835 gFileMan->SetObserver(NULL); |
3857 gFileMan->SetObserver(NULL); |
3836 |
3858 |
3837 // Check that the expected target files exist... |
3859 // Check that the expected target files exist... |
3869 LOCAL_C void TestMoveEmptyDirectory() |
3891 LOCAL_C void TestMoveEmptyDirectory() |
3870 // |
3892 // |
3871 // "Try to move an empty directory C:\F32-TST\TFMAN\DRIVEMOVE\ to C:\" |
3893 // "Try to move an empty directory C:\F32-TST\TFMAN\DRIVEMOVE\ to C:\" |
3872 // |
3894 // |
3873 { |
3895 { |
3874 |
3896 test.Next(_L("Test move empty directory")); |
3875 test.Next(_L("Move empty directory")); |
|
3876 |
3897 |
3877 #if !defined(__WINS__) |
3898 #if !defined(__WINS__) |
3878 TFileName trgDrive=_L("D:\\"); |
3899 TFileName trgDrive=_L("D:\\"); |
3879 #else |
3900 #else |
3880 if (gSessionPath[0]!='C') |
3901 if (gSessionPath[0]!='C') |
3882 TFileName trgDrive=_L("C:\\"); |
3903 TFileName trgDrive=_L("C:\\"); |
3883 #endif |
3904 #endif |
3884 |
3905 |
3885 MakeDir(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\")); |
3906 MakeDir(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\")); |
3886 TInt r=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\*"),trgDrive,CFileMan::ERecurse); |
3907 TInt r=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\*"),trgDrive,CFileMan::ERecurse); |
3908 test.Printf(_L("TestMoveEmptyDirectory(),gFileMan->Move(),r=%d\n"),r); |
|
3887 test (r==KErrNotFound); |
3909 test (r==KErrNotFound); |
3888 } |
3910 } |
3889 |
3911 |
3890 LOCAL_C void TestCopyAndRename() |
3912 LOCAL_C void TestCopyAndRename() |
3891 // |
3913 // |
3892 // Rename while copying files and directories |
3914 // Rename while copying files and directories |
3893 // |
3915 // |
3894 { |
3916 { |
3895 test.Next(_L("Rename while copying files and directories")); |
3917 test.Next(_L("Test rename while copying files and directories")); |
3896 gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\CPMV")); |
3918 gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\CPMV")); |
3897 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\ONE_1.TXT")); |
3919 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\ONE_1.TXT")); |
3898 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\ONE_2.TXT")); |
3920 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\ONE_2.TXT")); |
3899 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\ONE_3.TXT")); |
3921 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\ONE_3.TXT")); |
3900 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\TWOTWO.TWO")); |
3922 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\TWOTWO.TWO")); |
3914 test(r==KErrNone); |
3936 test(r==KErrNone); |
3915 |
3937 |
3916 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\TWO__1.TXT")); |
3938 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\TWO__1.TXT")); |
3917 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\TWO__2.TXT")); |
3939 MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\TWO__2.TXT")); |
3918 |
3940 |
3919 // copy and rename dir |
3941 // copy and rename dir |
3920 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE"), CFileMan::ERecurse); |
3942 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE"), CFileMan::ERecurse); |
3921 test(r==KErrNone); |
3943 test(r==KErrNone); |
3922 Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\*")); |
3944 Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\*")); |
3923 |
3945 |
3924 // copy and move into another dir |
3946 // copy and move into another dir |
3925 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO"), CFileMan::ERecurse); |
3947 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO"), CFileMan::ERecurse); |
3926 test(r==KErrNone); |
3948 test(r==KErrNone); |
3927 Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO\\*")); |
3949 Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO\\*")); |
3928 |
3950 |
3929 // copy and rename files and dirs in current dir |
3951 // copy and rename files and dirs in current dir |
3930 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE*"), CFileMan::ERecurse); |
3952 r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE*"), CFileMan::ERecurse); |
3931 test(r==KErrNone); |
3953 test(r==KErrNone); |
3932 // Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE2\\*")); |
3954 // Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE2\\*")); |
3933 |
3955 |
3934 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\THREEO.TWO"), KErrNone); |
3956 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\THREEO.TWO"), KErrNone); |
3935 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO__1.TXT"), KErrNone); |
3957 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO__1.TXT"), KErrNone); |
3936 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO__2.TXT"), KErrNone); |
3958 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO__2.TXT"), KErrNone); |
3937 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.TXT"), KErrNone); |
3959 CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.TXT"), KErrNone); |
4014 LOCAL_C void InitialiseL() |
4036 LOCAL_C void InitialiseL() |
4015 // |
4037 // |
4016 // Set up test variables |
4038 // Set up test variables |
4017 // |
4039 // |
4018 { |
4040 { |
4019 |
|
4020 gFileMan=CFileMan::NewL(TheFs); |
4041 gFileMan=CFileMan::NewL(TheFs); |
4021 gObserver=new(ELeave) CFileManObserver(gFileMan); |
4042 gObserver=new(ELeave) CFileManObserver(gFileMan); |
4022 gFileMan->SetObserver(gObserver); |
4043 gFileMan->SetObserver(gObserver); |
4023 } |
4044 } |
4024 |
4045 |
4025 LOCAL_C void Cleanup() |
4046 LOCAL_C void Cleanup() |
4026 // |
4047 // |
4027 // Cleanup test variables |
4048 // Cleanup test variables |
4028 // |
4049 // |
4029 { |
4050 { |
4030 |
|
4031 delete gFileMan; |
4051 delete gFileMan; |
4032 delete gObserver; |
4052 delete gObserver; |
4033 } |
4053 } |
4034 |
4054 |
4035 LOCAL_C void SetupDirStructure(TFileName& aSrcPath,TFileName& aTrgPath) |
4055 LOCAL_C void SetupDirStructure(TFileName& aSrcPath,TFileName& aTrgPath) |
4113 MakeFile(tmpName); |
4133 MakeFile(tmpName); |
4114 } |
4134 } |
4115 |
4135 |
4116 LOCAL_C void TestPDEF112148() |
4136 LOCAL_C void TestPDEF112148() |
4117 { |
4137 { |
4118 test.Next(_L("++TestPDEF112148 : \n")); |
4138 test.Next(_L("Test recursive and non-recursive move across drives (PDEF112148)")); |
4119 |
4139 |
4120 TInt err = 0; |
4140 TInt err = 0; |
4121 |
4141 |
4122 TFileName trgPath; |
4142 TFileName trgPath; |
4123 trgPath.Format(_L("%c:\\F32-TST\\TFMAN\\PDEF112148\\dest\\"), (TUint8)gDriveToTest); |
4143 trgPath.Format(_L("%c:\\F32-TST\\TFMAN\\PDEF112148\\dest\\"), (TUint8)gDriveToTest); |
4191 delete dir; |
4211 delete dir; |
4192 |
4212 |
4193 // clean up before leaving |
4213 // clean up before leaving |
4194 RmDir(srcPath); |
4214 RmDir(srcPath); |
4195 RmDir(trgPath); |
4215 RmDir(trgPath); |
4196 |
|
4197 test.Next(_L("--TestPDEF112148 : \n")); |
|
4198 } |
4216 } |
4199 //--------------------------------------------- |
4217 //--------------------------------------------- |
4200 //! @SYMTestCaseID PBASE-T_FMAN-2398 |
4218 //! @SYMTestCaseID PBASE-T_FMAN-2398 |
4201 //! @SYMTestType UT |
4219 //! @SYMTestType UT |
4202 //! @SYMREQ DEF130678 |
4220 //! @SYMREQ DEF130678 |
4205 //! @SYMTestExpectedResults Test completes without any crash and hence without any memory leak. |
4223 //! @SYMTestExpectedResults Test completes without any crash and hence without any memory leak. |
4206 //! @SYMTestPriority High |
4224 //! @SYMTestPriority High |
4207 //! @SYMTestStatus Implemented |
4225 //! @SYMTestStatus Implemented |
4208 //--------------------------------------------- |
4226 //--------------------------------------------- |
4209 void TestDEF130678() |
4227 void TestDEF130678() |
4210 { |
4228 { |
4211 test.Next(_L("++TestDEF130678\n")); |
4229 test.Next(_L("Test CFileMan::Move does not leak any memory")); |
4212 |
|
4213 _LIT(KFromFile,"C:\\TestDEF130678\\FROM\\from_"); |
4230 _LIT(KFromFile,"C:\\TestDEF130678\\FROM\\from_"); |
4214 _LIT(KToFile,"C:\\TestDEF130678\\TO\\"); |
4231 _LIT(KToFile,"C:\\TestDEF130678\\TO\\"); |
4215 |
4232 |
4216 TInt run; |
4233 TInt run; |
4217 // choose a number that certainly tests all memory allocations. |
4234 // choose a number that certainly tests all memory allocations. |
4264 __UHEAP_RESET; |
4281 __UHEAP_RESET; |
4265 __UHEAP_MARKEND; |
4282 __UHEAP_MARKEND; |
4266 } // End of OOM loop |
4283 } // End of OOM loop |
4267 |
4284 |
4268 // cleanup |
4285 // cleanup |
4269 RmDir(_L("C:\\TestDEF130678\\")); |
4286 RmDir(_L("C:\\TestDEF130678\\")); |
4270 test.Next(_L("--TestDEF130678\n")); |
4287 } |
4271 } |
|
4272 |
4288 |
4273 GLDEF_C void CallTestsL() |
4289 GLDEF_C void CallTestsL() |
4274 // |
4290 // |
4275 // Do tests |
4291 // Do tests |
4276 // |
4292 // |
4284 CreateTestDirectory(_L("\\F32-TST\\TFMAN\\")); |
4300 CreateTestDirectory(_L("\\F32-TST\\TFMAN\\")); |
4285 // May not be able to test handling of invalid path lengths because F32 fix |
4301 // May not be able to test handling of invalid path lengths because F32 fix |
4286 // to prevent paths >256 ever being created |
4302 // to prevent paths >256 ever being created |
4287 testingInvalidPathLengths = CheckIfShortPathsAreSupported(); |
4303 testingInvalidPathLengths = CheckIfShortPathsAreSupported(); |
4288 |
4304 |
4305 //----------------------------------------------------------------------------------- |
|
4306 // Asynchronous tests |
|
4307 // |
|
4289 gAsynch=ETrue; |
4308 gAsynch=ETrue; |
4290 |
|
4291 test.Next(_L("Asynchronous tests ...")); |
4309 test.Next(_L("Asynchronous tests ...")); |
4292 TheFs.SetAllocFailure(gAllocFailOff); |
4310 TheFs.SetAllocFailure(gAllocFailOff); |
4293 |
4311 |
4294 TInt uid; |
4312 TInt uid; |
4295 test(HAL::Get(HAL::EMachineUid,uid)==KErrNone); |
4313 test(HAL::Get(HAL::EMachineUid,uid)==KErrNone); |
4302 { |
4320 { |
4303 TestMoveAcrossDrives(); |
4321 TestMoveAcrossDrives(); |
4304 TestRecursiveMoveAcrossDrives(); |
4322 TestRecursiveMoveAcrossDrives(); |
4305 TestMoveEmptyDirectory(); |
4323 TestMoveEmptyDirectory(); |
4306 TestAbortedMoveAcrossDrives(); |
4324 TestAbortedMoveAcrossDrives(); |
4307 TestPDEF112148(); |
4325 TestPDEF112148(); // Test recursive and non-recursive move across drives |
4308 } |
4326 } |
4309 |
4327 |
4310 TestOverWrite(); |
4328 TestOverWrite(); |
4311 TestRename(); |
4329 TestRename(); |
4312 TestErrorHandling(); |
4330 TestErrorHandling(); |
4323 if (!IsTestingLFFS()) |
4341 if (!IsTestingLFFS()) |
4324 TestCopy(); // ??? |
4342 TestCopy(); // ??? |
4325 TestMove(); |
4343 TestMove(); |
4326 TestCopyAllCancel(); |
4344 TestCopyAllCancel(); |
4327 |
4345 |
4346 //----------------------------------------------------------------------------------- |
|
4347 // Synchronous tests |
|
4348 // |
|
4328 gAsynch=EFalse; |
4349 gAsynch=EFalse; |
4329 test.Next(_L("Synchronous tests ...")); |
4350 test.Next(_L("Synchronous tests ...")); |
4330 TheFs.SetAllocFailure(gAllocFailOn); |
4351 TheFs.SetAllocFailure(gAllocFailOn); |
4331 |
4352 |
4332 if (doTargetTests) |
4353 if (doTargetTests) |
4333 { |
4354 { |
4334 TestMoveAcrossDrives(); |
4355 TestMoveAcrossDrives(); |
4335 TestRecursiveMoveAcrossDrives(); |
4356 TestRecursiveMoveAcrossDrives(); |
4336 TestMoveEmptyDirectory(); |
4357 TestMoveEmptyDirectory(); |
4337 TestAbortedMoveAcrossDrives(); |
4358 TestAbortedMoveAcrossDrives(); |
4338 TestPDEF112148(); |
4359 TestPDEF112148(); // Test recursive and non-recursive move across drives |
4339 } |
4360 } |
4340 |
4361 |
4341 TestCopyOpenFile(); |
4362 TestCopyOpenFile(); |
4342 if(testingInvalidPathLengths) |
4363 if(testingInvalidPathLengths) |
4343 TestLongNames(); |
4364 TestLongNames(); |
4357 TestCopy(); |
4378 TestCopy(); |
4358 TestMove(); |
4379 TestMove(); |
4359 TestCopyAndRename(); |
4380 TestCopyAndRename(); |
4360 TestCopyAllCancel(); |
4381 TestCopyAllCancel(); |
4361 |
4382 |
4362 // OOM testing |
4383 TestDEF130678(); // Test CFileMan::Move does not leak any memory |
4363 TestDEF130678(); |
|
4364 #ifndef __WINS__ |
4384 #ifndef __WINS__ |
4365 RThread t; |
4385 RThread t; |
4366 TThreadStackInfo stack; |
4386 TThreadStackInfo stack; |
4367 test(t.StackInfo(stack)==KErrNone); |
4387 test(t.StackInfo(stack)==KErrNone); |
4368 TestStackUsage(0, stack); |
4388 TestStackUsage(0, stack); |