747 { |
748 { |
748 test.Next(_L("Test Request Ahead")); |
749 test.Next(_L("Test Request Ahead")); |
749 // First a simple example |
750 // First a simple example |
750 |
751 |
751 TInt r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\")); |
752 TInt r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\")); |
752 test_Value(r, (r == KErrNotFound)||(r==KErrPathNotFound)||(r==KErrNone)); |
753 test((r==KErrNotFound)||(r==KErrPathNotFound)||(r==KErrNone)); |
753 |
754 |
754 TFileName path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\"); |
755 TFileName path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\"); |
755 TRequestStatus reqStat(KRequestPending); |
756 TRequestStatus reqStat(KRequestPending); |
756 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
757 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
757 test_Value(reqStat.Int(), reqStat==KRequestPending); |
758 test(reqStat==KRequestPending); |
758 |
759 |
759 r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\")); |
760 r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\")); |
760 test_KErrNone(r); |
761 test(r==KErrNone); |
761 |
762 |
762 User::WaitForRequest(reqStat); |
763 User::WaitForRequest(reqStat); |
763 test_KErrNone(reqStat.Int()); |
764 test(reqStat==KErrNone); |
764 |
765 |
765 path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\PayNoAttention.man"); |
766 path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\PayNoAttention.man"); |
766 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
767 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
767 test_Value(reqStat.Int(), reqStat==KRequestPending); |
768 test(reqStat==KRequestPending); |
768 |
769 |
769 RFile file; |
770 RFile file; |
770 r=file.Replace(TheFs,path,EFileStream); |
771 r=file.Replace(TheFs,path,EFileStream); |
771 test_KErrNone(r); |
772 test(r==KErrNone); |
772 file.Close(); |
773 file.Close(); |
773 |
774 |
774 User::WaitForRequest(reqStat); |
775 User::WaitForRequest(reqStat); |
775 test_KErrNone(reqStat.Int()); |
776 test(reqStat==KErrNone); |
776 |
777 |
777 r=TheFs.Delete(path); |
778 r=TheFs.Delete(path); |
778 test_KErrNone(r); |
779 test(r==KErrNone); |
779 |
780 |
780 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
781 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
781 test_Value(reqStat.Int(), reqStat==KRequestPending); |
782 test(reqStat==KRequestPending); |
782 // Now cancel the outstanding request |
783 // Now cancel the outstanding request |
783 TheFs.NotifyChangeCancel(reqStat); |
784 TheFs.NotifyChangeCancel(reqStat); |
784 User::WaitForRequest(reqStat); |
785 User::WaitForRequest(reqStat); |
785 test_Value(reqStat.Int(), reqStat==KErrCancel); |
786 test(reqStat==KErrCancel); |
786 |
787 |
787 // Repeat with a ENotifyFile request |
788 // Repeat with a ENotifyFile request |
788 TheFs.NotifyChange(ENotifyFile,reqStat,path); |
789 TheFs.NotifyChange(ENotifyFile,reqStat,path); |
789 test_Value(reqStat.Int(), reqStat==KRequestPending); |
790 test(reqStat==KRequestPending); |
790 |
791 |
791 r=file.Replace(TheFs,path,EFileStream); |
792 r=file.Replace(TheFs,path,EFileStream); |
792 test_KErrNone(r); |
793 test(r==KErrNone); |
793 file.Close(); |
794 file.Close(); |
794 |
795 |
795 User::WaitForRequest(reqStat); |
796 User::WaitForRequest(reqStat); |
796 test_KErrNone(reqStat.Int()); |
797 test(reqStat==KErrNone); |
797 |
798 |
798 r=TheFs.Delete(path); |
799 r=TheFs.Delete(path); |
799 test_KErrNone(r); |
800 test(r==KErrNone); |
800 |
801 |
801 TheFs.NotifyChange(ENotifyFile,reqStat,path); |
802 TheFs.NotifyChange(ENotifyFile,reqStat,path); |
802 test_Value(reqStat.Int(), reqStat==KRequestPending); |
803 test(reqStat==KRequestPending); |
803 // Now cancel the outstanding request |
804 // Now cancel the outstanding request |
804 TheFs.NotifyChangeCancel(reqStat); |
805 TheFs.NotifyChangeCancel(reqStat); |
805 User::WaitForRequest(reqStat); |
806 User::WaitForRequest(reqStat); |
806 test_Value(reqStat.Int(), reqStat==KErrCancel); |
807 test(reqStat==KErrCancel); |
807 |
808 |
808 // Repeat with an ENotifyAttributes request |
809 // Repeat with an ENotifyAttributes request |
809 TheFs.NotifyChange(ENotifyAttributes,reqStat,path); |
810 TheFs.NotifyChange(ENotifyAttributes,reqStat,path); |
810 test_Value(reqStat.Int(), reqStat==KRequestPending); |
811 test(reqStat==KRequestPending); |
811 |
812 |
812 r=file.Replace(TheFs,path,EFileStream); |
813 r=file.Replace(TheFs,path,EFileStream); |
813 test_KErrNone(r); |
814 test(r==KErrNone); |
814 file.Close(); |
815 file.Close(); |
815 |
816 |
816 User::WaitForRequest(reqStat); |
817 User::WaitForRequest(reqStat); |
817 test_KErrNone(reqStat.Int()); // Monitoring attributes but informed anyway |
818 test(reqStat==KErrNone); // Monitoring attributes but informed anyway |
818 |
819 |
819 r=TheFs.Delete(path); |
820 r=TheFs.Delete(path); |
820 test_KErrNone(r); |
821 test(r==KErrNone); |
821 |
822 |
822 TheFs.NotifyChange(ENotifyAttributes,reqStat,path); |
823 TheFs.NotifyChange(ENotifyAttributes,reqStat,path); |
823 test_Value(reqStat.Int(), reqStat==KRequestPending); |
824 test(reqStat==KRequestPending); |
824 // Now cancel the outstanding request |
825 // Now cancel the outstanding request |
825 TheFs.NotifyChangeCancel(reqStat); |
826 TheFs.NotifyChangeCancel(reqStat); |
826 User::WaitForRequest(reqStat); |
827 User::WaitForRequest(reqStat); |
827 test_Value(reqStat.Int(), reqStat==KErrCancel); |
828 test(reqStat==KErrCancel); |
828 |
829 |
829 // Repeat with an ENotifyWrite request |
830 // Repeat with an ENotifyWrite request |
830 TheFs.NotifyChange(ENotifyWrite,reqStat,path); |
831 TheFs.NotifyChange(ENotifyWrite,reqStat,path); |
831 test_Value(reqStat.Int(), reqStat==KRequestPending); |
832 test(reqStat==KRequestPending); |
832 |
833 |
833 r=file.Replace(TheFs,path,EFileStream); |
834 r=file.Replace(TheFs,path,EFileStream); |
834 test_KErrNone(r); |
835 test(r==KErrNone); |
835 file.Close(); |
836 file.Close(); |
836 |
837 |
837 User::WaitForRequest(reqStat); |
838 User::WaitForRequest(reqStat); |
838 test_KErrNone(reqStat.Int()); // Monitoring file writing but informed anyway |
839 test(reqStat==KErrNone); // Monitoring file writing but informed anyway |
839 |
840 |
840 r=TheFs.Delete(path); |
841 r=TheFs.Delete(path); |
841 test_KErrNone(r); |
842 test(r==KErrNone); |
842 |
843 |
843 TheFs.NotifyChange(ENotifyWrite,reqStat,path); |
844 TheFs.NotifyChange(ENotifyWrite,reqStat,path); |
844 test_Value(reqStat.Int(), reqStat==KRequestPending); |
845 test(reqStat==KRequestPending); |
845 // Now cancel the outstanding request |
846 // Now cancel the outstanding request |
846 TheFs.NotifyChangeCancel(reqStat); |
847 TheFs.NotifyChangeCancel(reqStat); |
847 User::WaitForRequest(reqStat); |
848 User::WaitForRequest(reqStat); |
848 test_Value(reqStat.Int(), reqStat==KErrCancel); |
849 test(reqStat==KErrCancel); |
849 |
850 |
850 // Repeat with an ENotifyDisk request |
851 // Repeat with an ENotifyDisk request |
851 TheFs.NotifyChange(ENotifyDisk,reqStat,path); |
852 TheFs.NotifyChange(ENotifyDisk,reqStat,path); |
852 test_Value(reqStat.Int(), reqStat==KRequestPending); |
853 test(reqStat==KRequestPending); |
853 |
854 |
854 r=file.Replace(TheFs,path,EFileStream); |
855 r=file.Replace(TheFs,path,EFileStream); |
855 test_KErrNone(r); |
856 test(r==KErrNone); |
856 file.Close(); |
857 file.Close(); |
857 |
858 |
858 User::WaitForRequest(reqStat); |
859 User::WaitForRequest(reqStat); |
859 test_KErrNone(reqStat.Int()); // Monitoring disk activity but informed anyway |
860 test(reqStat==KErrNone); // Monitoring disk activity but informed anyway |
860 |
861 |
861 r=TheFs.Delete(path); |
862 r=TheFs.Delete(path); |
862 test_KErrNone(r); |
863 test(r==KErrNone); |
863 |
864 |
864 TheFs.NotifyChange(ENotifyAttributes,reqStat,path); |
865 TheFs.NotifyChange(ENotifyAttributes,reqStat,path); |
865 test_Value(reqStat.Int(), reqStat==KRequestPending); |
866 test(reqStat==KRequestPending); |
866 // Now cancel the outstanding request |
867 // Now cancel the outstanding request |
867 TheFs.NotifyChangeCancel(reqStat); |
868 TheFs.NotifyChangeCancel(reqStat); |
868 User::WaitForRequest(reqStat); |
869 User::WaitForRequest(reqStat); |
869 test_Value(reqStat.Int(), reqStat==KErrCancel); |
870 test(reqStat==KErrCancel); |
870 |
871 |
871 // Now do much the same with directory monitoring |
872 // Now do much the same with directory monitoring |
872 path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\"); |
873 path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\"); |
873 TheFs.RmDir(path); |
874 TheFs.RmDir(path); |
874 |
875 |
875 TheFs.NotifyChange(ENotifyDir,reqStat,path); |
876 TheFs.NotifyChange(ENotifyDir,reqStat,path); |
876 test_Value(reqStat.Int(), reqStat==KRequestPending); |
877 test(reqStat==KRequestPending); |
877 |
878 |
878 TheFs.MkDir(path); |
879 TheFs.MkDir(path); |
879 test_KErrNone(r); |
880 test(r==KErrNone); |
880 |
881 |
881 User::WaitForRequest(reqStat); |
882 User::WaitForRequest(reqStat); |
882 test_KErrNone(reqStat.Int()); |
883 test(reqStat==KErrNone); |
883 |
884 |
884 TheFs.RmDir(path); |
885 TheFs.RmDir(path); |
885 test_KErrNone(r); |
886 test(r==KErrNone); |
886 |
887 |
887 TheFs.NotifyChange(ENotifyDir,reqStat,path); |
888 TheFs.NotifyChange(ENotifyDir,reqStat,path); |
888 test_KErrNone(r); |
889 test(r==KErrNone); |
889 test_Value(reqStat.Int(), reqStat==KRequestPending); |
890 test(reqStat==KRequestPending); |
890 |
891 |
891 // Now cancel the outstanding request |
892 // Now cancel the outstanding request |
892 TheFs.NotifyChangeCancel(reqStat); |
893 TheFs.NotifyChangeCancel(reqStat); |
893 User::WaitForRequest(reqStat); |
894 User::WaitForRequest(reqStat); |
894 test_Value(reqStat.Int(), reqStat==KErrCancel); |
895 test(reqStat==KErrCancel); |
895 |
896 |
896 TheFs.NotifyChange(ENotifyDir,reqStat,path); |
897 TheFs.NotifyChange(ENotifyDir,reqStat,path); |
897 test_KErrNone(r); |
898 test(r==KErrNone); |
898 test_Value(reqStat.Int(), reqStat==KRequestPending); |
899 test(reqStat==KRequestPending); |
899 |
900 |
900 // Get a separate thread to create the directory |
901 // Get a separate thread to create the directory |
901 RThread thread; |
902 RThread thread; |
902 thread.Create(_L("RequestAheadyThready"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest10); |
903 thread.Create(_L("RequestAheadyThready"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest10); |
903 TRequestStatus thrdStat(KRequestPending); |
904 TRequestStatus thrdStat(KRequestPending); |
904 thread.Logon(thrdStat); |
905 thread.Logon(thrdStat); |
905 thread.Resume(); |
906 thread.Resume(); |
906 thread.Close(); |
907 thread.Close(); |
907 |
908 |
908 User::WaitForRequest(thrdStat); |
909 User::WaitForRequest(thrdStat); |
909 test_KErrNone(thrdStat.Int()); |
910 test(thrdStat==KErrNone); |
910 User::WaitForRequest(reqStat); |
911 User::WaitForRequest(reqStat); |
911 test_KErrNone(reqStat.Int()); |
912 test(reqStat==KErrNone); |
912 |
913 |
913 TheFs.RmDir(path); |
914 TheFs.RmDir(path); |
914 test_KErrNone(r); |
915 test(r==KErrNone); |
915 |
916 |
916 // Check that notification is not received for a non-existent file if only the previously |
917 // Check that notification is not received for a non-existent file if only the previously |
917 // non existent directory that contains it is created |
918 // non existent directory that contains it is created |
918 path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\PayNoAttention.man"); |
919 path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\PayNoAttention.man"); |
919 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
920 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
920 test_KErrNone(r); |
921 test(r==KErrNone); |
921 test_Value(reqStat.Int(), reqStat==KRequestPending); |
922 test(reqStat==KRequestPending); |
922 |
923 |
923 thread.Create(_L("RequestAheadThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest10); |
924 thread.Create(_L("RequestAheadThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest10); |
924 thread.Logon(thrdStat); |
925 thread.Logon(thrdStat); |
925 thread.Resume(); |
926 thread.Resume(); |
926 thread.Close(); |
927 thread.Close(); |
927 |
928 |
928 User::WaitForRequest(thrdStat); |
929 User::WaitForRequest(thrdStat); |
929 test_KErrNone(thrdStat.Int()); |
930 test(thrdStat==KErrNone); |
930 test_Value(reqStat.Int(), reqStat==KRequestPending); |
931 test(reqStat==KRequestPending); |
931 |
932 |
932 // Now get a thread to create the file |
933 // Now get a thread to create the file |
933 thread.Create(_L("RequestAhead"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest11); |
934 thread.Create(_L("RequestAhead"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest11); |
934 thread.Logon(thrdStat); |
935 thread.Logon(thrdStat); |
935 thread.Resume(); |
936 thread.Resume(); |
936 User::WaitForRequest(thrdStat); |
937 User::WaitForRequest(thrdStat); |
937 test_KErrNone(thrdStat.Int()); |
938 test(thrdStat==KErrNone); |
938 thread.Close(); |
939 thread.Close(); |
939 |
940 |
940 User::WaitForRequest(reqStat); |
941 User::WaitForRequest(reqStat); |
941 test_KErrNone(reqStat.Int()); |
942 test(reqStat==KErrNone); |
942 |
943 |
943 TheFs.Delete(path); |
944 TheFs.Delete(path); |
944 test_KErrNone(r); |
945 test(r==KErrNone); |
945 |
946 |
946 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
947 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
947 test_KErrNone(r); |
948 test(r==KErrNone); |
948 test_Value(reqStat.Int(), reqStat==KRequestPending); |
949 test(reqStat==KRequestPending); |
949 |
950 |
950 // Now cancel the outstanding request |
951 // Now cancel the outstanding request |
951 TheFs.NotifyChangeCancel(reqStat); |
952 TheFs.NotifyChangeCancel(reqStat); |
952 User::WaitForRequest(reqStat); |
953 User::WaitForRequest(reqStat); |
953 test_Value(reqStat.Int(), reqStat==KErrCancel); |
954 test(reqStat==KErrCancel); |
954 |
955 |
955 path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\"); |
956 path=_L("\\F32-TST\\NOTIFY\\BehindTheCurtain\\"); |
956 TheFs.RmDir(path); |
957 TheFs.RmDir(path); |
957 test_KErrNone(r); |
958 test(r==KErrNone); |
958 } |
959 } |
959 |
960 |
960 |
961 |
961 static void Test8() |
962 static void Test8() |
962 // |
963 // |
968 TRequestStatus reqStat(KRequestPending); |
969 TRequestStatus reqStat(KRequestPending); |
969 TRequestStatus thrdStat(KRequestPending); |
970 TRequestStatus thrdStat(KRequestPending); |
970 TFileName path=(_L("\\F32-TST\\")); |
971 TFileName path=(_L("\\F32-TST\\")); |
971 |
972 |
972 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
973 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
973 test_Value(reqStat.Int(), reqStat==KRequestPending); |
974 test(reqStat==KRequestPending); |
974 RThread thread; |
975 RThread thread; |
975 TInt r=thread.Create(_L("MyThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
976 TInt r=thread.Create(_L("MyThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
976 test_KErrNone(r); |
977 test(r==KErrNone); |
977 thread.Logon(thrdStat); |
978 thread.Logon(thrdStat); |
978 thread.Resume(); |
979 thread.Resume(); |
979 User::WaitForRequest(thrdStat); |
980 User::WaitForRequest(thrdStat); |
980 test_KErrNone(thrdStat.Int()); |
981 test(thrdStat==KErrNone); |
981 User::WaitForRequest(reqStat); |
982 User::WaitForRequest(reqStat); |
982 test_KErrNone(reqStat.Int()); |
983 test(reqStat==KErrNone); |
983 thread.Close(); |
984 thread.Close(); |
984 |
985 |
985 // Repeat the test |
986 // Repeat the test |
986 test.Next(_L("Repeat Test notification of an entry change")); |
987 test.Next(_L("Repeat Test notification of an entry change")); |
987 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
988 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
988 test_Value(reqStat.Int(), reqStat==KRequestPending); |
989 test(reqStat==KRequestPending); |
989 r=thread.Create(_L("MyThread2"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
990 r=thread.Create(_L("MyThread2"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
990 test_KErrNone(r); |
991 test(r==KErrNone); |
991 thread.Logon(thrdStat); |
992 thread.Logon(thrdStat); |
992 thread.Resume(); |
993 thread.Resume(); |
993 User::WaitForRequest(thrdStat); |
994 User::WaitForRequest(thrdStat); |
994 test_KErrNone(thrdStat.Int()); |
995 test(thrdStat==KErrNone); |
995 User::WaitForRequest(reqStat); |
996 User::WaitForRequest(reqStat); |
996 test_KErrNone(reqStat.Int()); |
997 test(reqStat==KErrNone); |
997 thread.Close(); |
998 thread.Close(); |
998 |
999 |
999 // Test it can be cancelled |
1000 // Test it can be cancelled |
1000 test.Next(_L("Test Notify cancel")); |
1001 test.Next(_L("Test Notify cancel")); |
1001 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1002 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1002 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1003 test(reqStat==KRequestPending); |
1003 TheFs.NotifyChangeCancel(); |
1004 TheFs.NotifyChangeCancel(); |
1004 User::WaitForRequest(reqStat); |
1005 User::WaitForRequest(reqStat); |
1005 test_Value(reqStat.Int(), reqStat==KErrCancel); |
1006 test(reqStat==KErrCancel); |
1006 |
1007 |
1007 // Test it can be notified again |
1008 // Test it can be notified again |
1008 test.Next(_L("Test notification still works")); |
1009 test.Next(_L("Test notification still works")); |
1009 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1010 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1010 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1011 test(reqStat==KRequestPending); |
1011 r=thread.Create(_L("MyThread3"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
1012 r=thread.Create(_L("MyThread3"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
1012 test_KErrNone(r); |
1013 test(r==KErrNone); |
1013 thread.Logon(thrdStat); |
1014 thread.Logon(thrdStat); |
1014 thread.Resume(); |
1015 thread.Resume(); |
1015 User::WaitForRequest(thrdStat); |
1016 User::WaitForRequest(thrdStat); |
1016 test_KErrNone(thrdStat.Int()); |
1017 test(thrdStat==KErrNone); |
1017 User::WaitForRequest(reqStat); |
1018 User::WaitForRequest(reqStat); |
1018 test_KErrNone(reqStat.Int()); |
1019 test(reqStat==KErrNone); |
1019 thread.Close(); |
1020 thread.Close(); |
1020 |
1021 |
1021 // Test notification doesn't occur when a change occurs above the directory monitored |
1022 // Test notification doesn't occur when a change occurs above the directory monitored |
1022 // (Notification of rename events occurring above the directory which affect the path |
1023 // (Notification of rename events occurring above the directory which affect the path |
1023 // will occur - this is tested for in Test18()) |
1024 // will occur - this is tested for in Test18()) |
1024 test.Next(_L("Test changing above monitored directory")); |
1025 test.Next(_L("Test changing above monitored directory")); |
1025 r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\")); |
1026 r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\")); |
1026 test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists)); |
1027 test((r==KErrNone)||(r==KErrAlreadyExists)); |
1027 path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"); |
1028 path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"); |
1028 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1029 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1029 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1030 test(reqStat==KRequestPending); |
1030 r=thread.Create(_L("MyThread4"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
1031 r=thread.Create(_L("MyThread4"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
1031 test_KErrNone(r); |
1032 test(r==KErrNone); |
1032 thread.Logon(thrdStat); |
1033 thread.Logon(thrdStat); |
1033 thread.Resume(); |
1034 thread.Resume(); |
1034 User::WaitForRequest(thrdStat); |
1035 User::WaitForRequest(thrdStat); |
1035 test_KErrNone(thrdStat.Int()); |
1036 test(thrdStat==KErrNone); |
1036 User::After(500000); |
1037 User::After(500000); |
1037 thread.Close(); |
1038 thread.Close(); |
1038 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1039 test(reqStat==KRequestPending); |
1039 TheFs.NotifyChangeCancel(); |
1040 TheFs.NotifyChangeCancel(); |
1040 User::WaitForRequest(reqStat); |
1041 User::WaitForRequest(reqStat); |
1041 test_Value(reqStat.Int(), reqStat==KErrCancel); |
1042 test(reqStat==KErrCancel); |
1042 |
1043 |
1043 // Test notification occurs when a change is made to the subdirectory monitored |
1044 // Test notification occurs when a change is made to the subdirectory monitored |
1044 test.Next(_L("Create a file in monitored subdirectory")); |
1045 test.Next(_L("Create a file in monitored subdirectory")); |
1045 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1046 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1046 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1047 test(reqStat==KRequestPending); |
1047 r=thread.Create(_L("MyThread5"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest2); |
1048 r=thread.Create(_L("MyThread5"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest2); |
1048 test_KErrNone(r); |
1049 test(r==KErrNone); |
1049 thread.Logon(thrdStat); |
1050 thread.Logon(thrdStat); |
1050 thread.Resume(); |
1051 thread.Resume(); |
1051 User::WaitForRequest(thrdStat); |
1052 User::WaitForRequest(thrdStat); |
1052 test_KErrNone(thrdStat.Int()); |
1053 test(thrdStat==KErrNone); |
1053 User::WaitForRequest(reqStat); |
1054 User::WaitForRequest(reqStat); |
1054 test_KErrNone(reqStat.Int()); |
1055 test(reqStat==KErrNone); |
1055 thread.Close(); |
1056 thread.Close(); |
1056 |
1057 |
1057 test.Next(_L("Create a directory in monitored subdirectory")); |
1058 test.Next(_L("Create a directory in monitored subdirectory")); |
1058 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1059 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1059 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1060 test(reqStat==KRequestPending); |
1060 r=thread.Create(_L("MyThread6"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest3); |
1061 r=thread.Create(_L("MyThread6"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest3); |
1061 test_KErrNone(r); |
1062 test(r==KErrNone); |
1062 thread.Logon(thrdStat); |
1063 thread.Logon(thrdStat); |
1063 thread.Resume(); |
1064 thread.Resume(); |
1064 User::WaitForRequest(thrdStat); |
1065 User::WaitForRequest(thrdStat); |
1065 test_KErrNone(thrdStat.Int()); |
1066 test(thrdStat==KErrNone); |
1066 User::WaitForRequest(reqStat); |
1067 User::WaitForRequest(reqStat); |
1067 test_KErrNone(reqStat.Int()); |
1068 test(reqStat==KErrNone); |
1068 thread.Close(); |
1069 thread.Close(); |
1069 |
1070 |
1070 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1071 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1071 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1072 test(reqStat==KRequestPending); |
1072 r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\TINMAN\\")); |
1073 r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\TINMAN\\")); |
1073 test_KErrNone(r); |
1074 test(r==KErrNone); |
1074 User::WaitForRequest(reqStat); |
1075 User::WaitForRequest(reqStat); |
1075 test_KErrNone(reqStat.Int()); |
1076 test(reqStat==KErrNone); |
1076 |
1077 |
1077 |
1078 |
1078 r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\TINMAN\\")); |
1079 r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\TINMAN\\")); |
1079 test_KErrNone(r); |
1080 test(r==KErrNone); |
1080 r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\")); |
1081 r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\SCARECROW\\")); |
1081 test_KErrNone(r); |
1082 test(r==KErrNone); |
1082 |
1083 |
1083 // Test again that notification doesn't occur above the subdirectory being monitored |
1084 // Test again that notification doesn't occur above the subdirectory being monitored |
1084 test.Next(_L("Test changing above monitored directory")); |
1085 test.Next(_L("Test changing above monitored directory")); |
1085 r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\")); |
1086 r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\")); |
1086 test_Value(r, (r == KErrNone)||(r==KErrAlreadyExists)); |
1087 test((r==KErrNone)||(r==KErrAlreadyExists)); |
1087 path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"); |
1088 path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"); |
1088 |
1089 |
1089 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1090 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1090 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1091 test(reqStat==KRequestPending); |
1091 r=thread.Create(_L("MyThread7"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
1092 r=thread.Create(_L("MyThread7"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest1); |
1092 test_KErrNone(r); |
1093 test(r==KErrNone); |
1093 thread.Logon(thrdStat); |
1094 thread.Logon(thrdStat); |
1094 thread.Resume(); |
1095 thread.Resume(); |
1095 User::WaitForRequest(thrdStat); |
1096 User::WaitForRequest(thrdStat); |
1096 test_KErrNone(thrdStat.Int()); |
1097 test(thrdStat==KErrNone); |
1097 User::After(500000); |
1098 User::After(500000); |
1098 thread.Close(); |
1099 thread.Close(); |
1099 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1100 test(reqStat==KRequestPending); |
1100 TheFs.NotifyChangeCancel(); |
1101 TheFs.NotifyChangeCancel(); |
1101 User::WaitForRequest(reqStat); |
1102 User::WaitForRequest(reqStat); |
1102 test_Value(reqStat.Int(), reqStat==KErrCancel); |
1103 test(reqStat==KErrCancel); |
1103 |
1104 |
1104 // Test notification occurs when a change is made to the subdirectory monitored |
1105 // Test notification occurs when a change is made to the subdirectory monitored |
1105 test.Next(_L("Delete a file in monitored subdirectory")); |
1106 test.Next(_L("Delete a file in monitored subdirectory")); |
1106 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1107 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1107 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1108 test(reqStat==KRequestPending); |
1108 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc")); |
1109 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc")); |
1109 test_KErrNone(r); |
1110 test(r==KErrNone); |
1110 User::WaitForRequest(reqStat); |
1111 User::WaitForRequest(reqStat); |
1111 test_KErrNone(reqStat.Int()); |
1112 test(reqStat==KErrNone); |
1112 |
1113 |
1113 RFile file; |
1114 RFile file; |
1114 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.msg"),EFileStream); |
1115 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.msg"),EFileStream); |
1115 test_KErrNone(r); |
1116 test(r==KErrNone); |
1116 file.Close(); |
1117 file.Close(); |
1117 |
1118 |
1118 // Test notification on a specific file |
1119 // Test notification on a specific file |
1119 test.Next(_L("Monitor changes to a specific file")); |
1120 test.Next(_L("Monitor changes to a specific file")); |
1120 path+=_L("WickedWitch.msg"); |
1121 path+=_L("WickedWitch.msg"); |
1121 TheFs.NotifyChange(ENotifyAll,reqStat,path); |
1122 TheFs.NotifyChange(ENotifyAll,reqStat,path); |
1122 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1123 test(reqStat==KRequestPending); |
1123 r=thread.Create(_L("MyThread8"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest8); |
1124 r=thread.Create(_L("MyThread8"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest8); |
1124 test_KErrNone(r); |
1125 test(r==KErrNone); |
1125 thread.Logon(thrdStat); |
1126 thread.Logon(thrdStat); |
1126 thread.Resume(); |
1127 thread.Resume(); |
1127 User::WaitForRequest(thrdStat); |
1128 User::WaitForRequest(thrdStat); |
1128 test_KErrNone(thrdStat.Int()); |
1129 test(thrdStat==KErrNone); |
1129 User::WaitForRequest(reqStat); |
1130 User::WaitForRequest(reqStat); |
1130 test_KErrNone(reqStat.Int()); |
1131 test(reqStat==KErrNone); |
1131 thread.Close(); |
1132 thread.Close(); |
1132 |
1133 |
1133 // Test notification does not occur if a change is made above the file |
1134 // Test notification does not occur if a change is made above the file |
1134 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1135 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1135 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1136 test(reqStat==KRequestPending); |
1136 thread.Create(_L("MyThread9"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest2); |
1137 thread.Create(_L("MyThread9"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest2); |
1137 thread.Logon(thrdStat); |
1138 thread.Logon(thrdStat); |
1138 thread.Resume(); |
1139 thread.Resume(); |
1139 User::WaitForRequest(thrdStat); |
1140 User::WaitForRequest(thrdStat); |
1140 test_KErrNone(thrdStat.Int()); |
1141 test(thrdStat==KErrNone); |
1141 User::After(500000); |
1142 User::After(500000); |
1142 thread.Close(); |
1143 thread.Close(); |
1143 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1144 test(reqStat==KRequestPending); |
1144 TheFs.NotifyChangeCancel(); |
1145 TheFs.NotifyChangeCancel(); |
1145 User::WaitForRequest(reqStat); |
1146 User::WaitForRequest(reqStat); |
1146 test_Value(reqStat.Int(), reqStat==KErrCancel); |
1147 test(reqStat==KErrCancel); |
1147 |
1148 |
1148 // Test notification occurs when a change is made to the file |
1149 // Test notification occurs when a change is made to the file |
1149 test.Next(_L("Delete monitored file")); |
1150 test.Next(_L("Delete monitored file")); |
1150 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1151 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1151 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1152 test(reqStat==KRequestPending); |
1152 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.Msg")); |
1153 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\WickedWitch.Msg")); |
1153 test_KErrNone(r); |
1154 test(r==KErrNone); |
1154 User::WaitForRequest(reqStat); |
1155 User::WaitForRequest(reqStat); |
1155 test_KErrNone(reqStat.Int()); |
1156 test(reqStat==KErrNone); |
1156 |
1157 |
1157 // Test notification request is now submitted on the non existent path successfully |
1158 // Test notification request is now submitted on the non existent path successfully |
1158 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1159 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1159 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1160 test(reqStat==KRequestPending); |
1160 TheFs.NotifyChangeCancel(reqStat); |
1161 TheFs.NotifyChangeCancel(reqStat); |
1161 User::WaitForRequest(reqStat); |
1162 User::WaitForRequest(reqStat); |
1162 test_Value(reqStat.Int(), reqStat==KErrCancel); |
1163 test(reqStat==KErrCancel); |
1163 |
1164 |
1164 path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc"); |
1165 path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc"); |
1165 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1166 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1166 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1167 test(reqStat==KRequestPending); |
1167 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc")); |
1168 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc")); |
1168 test_KErrNone(r); |
1169 test(r==KErrNone); |
1169 User::WaitForRequest(reqStat); |
1170 User::WaitForRequest(reqStat); |
1170 test_KErrNone(reqStat.Int()); |
1171 test(reqStat==KErrNone); |
1171 |
1172 |
1172 path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"); |
1173 path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"); |
1173 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1174 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1174 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1175 test(reqStat==KRequestPending); |
1175 r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\")); |
1176 r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\")); |
1176 test_KErrNone(r); |
1177 test(r==KErrNone); |
1177 User::WaitForRequest(reqStat); |
1178 User::WaitForRequest(reqStat); |
1178 test_KErrNone(reqStat.Int()); |
1179 test(reqStat==KErrNone); |
1179 |
1180 |
1180 // Submit a request for a path which does not yet exist |
1181 // Submit a request for a path which does not yet exist |
1181 path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\"); |
1182 path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\"); |
1182 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1183 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1183 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1184 test(reqStat==KRequestPending); |
1184 // Now create the directory we are waiting on |
1185 // Now create the directory we are waiting on |
1185 r=TheFs.MkDir(path); |
1186 r=TheFs.MkDir(path); |
1186 test_KErrNone(r); |
1187 test(r==KErrNone); |
1187 // Make sure the notification has now been received |
1188 // Make sure the notification has now been received |
1188 User::WaitForRequest(reqStat); |
1189 User::WaitForRequest(reqStat); |
1189 test_KErrNone(reqStat.Int()); |
1190 test(reqStat==KErrNone); |
1190 |
1191 |
1191 // Submit a request for a file which does not yet exist |
1192 // Submit a request for a file which does not yet exist |
1192 path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\Red-Shoes.red"); |
1193 path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\Red-Shoes.red"); |
1193 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1194 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1194 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1195 test(reqStat==KRequestPending); |
1195 // Now create the file we are waiting on |
1196 // Now create the file we are waiting on |
1196 r=file.Replace(TheFs,path,EFileStream); |
1197 r=file.Replace(TheFs,path,EFileStream); |
1197 test_KErrNone(r); |
1198 test(r==KErrNone); |
1198 file.Close(); |
1199 file.Close(); |
1199 // Make sure the notification has now been received |
1200 // Make sure the notification has now been received |
1200 User::WaitForRequest(reqStat); |
1201 User::WaitForRequest(reqStat); |
1201 test_KErrNone(reqStat.Int()); |
1202 test(reqStat==KErrNone); |
1202 // Submit another notification request and delete the file |
1203 // Submit another notification request and delete the file |
1203 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1204 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1204 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1205 test(reqStat==KRequestPending); |
1205 r=TheFs.Delete(path); |
1206 r=TheFs.Delete(path); |
1206 test_KErrNone(r); |
1207 test(r==KErrNone); |
1207 User::WaitForRequest(reqStat); |
1208 User::WaitForRequest(reqStat); |
1208 test_KErrNone(reqStat.Int()); |
1209 test(reqStat==KErrNone); |
1209 path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\"); |
1210 path=_L("\\F32-TST\\NOTIFY\\GOOD_WITCH\\"); |
1210 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1211 TheFs.NotifyChange(ENotifyEntry,reqStat,path); |
1211 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1212 test(reqStat==KRequestPending); |
1212 r=TheFs.RmDir(path); |
1213 r=TheFs.RmDir(path); |
1213 test_KErrNone(r); |
1214 test(r==KErrNone); |
1214 User::WaitForRequest(reqStat); |
1215 User::WaitForRequest(reqStat); |
1215 test_KErrNone(reqStat.Int()); |
1216 test(reqStat==KErrNone); |
1216 // test passing in an empty string |
1217 // test passing in an empty string |
1217 TheFs.NotifyChange(ENotifyEntry,reqStat,_L("")); |
1218 TheFs.NotifyChange(ENotifyEntry,reqStat,_L("")); |
1218 User::WaitForRequest(reqStat); |
1219 User::WaitForRequest(reqStat); |
1219 test_Value(reqStat.Int(), reqStat==KErrArgument); |
1220 test(reqStat==KErrArgument); |
1220 } |
1221 } |
1221 |
1222 |
1222 static void Test9() |
1223 static void Test9() |
1223 // |
1224 // |
1224 // Test notify for multiple clients |
1225 // Test notify for multiple clients |
1247 TFileName path6=_L("?:\\F32-TST\\"); |
1248 TFileName path6=_L("?:\\F32-TST\\"); |
1248 |
1249 |
1249 TRequestStatus reqStat1(KRequestPending); |
1250 TRequestStatus reqStat1(KRequestPending); |
1250 RFs fs1; |
1251 RFs fs1; |
1251 r=fs1.Connect(); |
1252 r=fs1.Connect(); |
1252 test_KErrNone(r); |
1253 test(r==KErrNone); |
1253 r=fs1.SetSessionPath(gSessionPath); |
1254 r=fs1.SetSessionPath(gSessionPath); |
1254 test_KErrNone(r); |
1255 test(r==KErrNone); |
1255 fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
1256 fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
1256 |
1257 |
1257 TRequestStatus reqStat2(KRequestPending); |
1258 TRequestStatus reqStat2(KRequestPending); |
1258 RFs fs2; |
1259 RFs fs2; |
1259 r=fs2.Connect(); |
1260 r=fs2.Connect(); |
1260 test_KErrNone(r); |
1261 test(r==KErrNone); |
1261 r=fs2.SetSessionPath(gSessionPath); |
1262 r=fs2.SetSessionPath(gSessionPath); |
1262 test_KErrNone(r); |
1263 test(r==KErrNone); |
1263 fs2.NotifyChange(ENotifyEntry,reqStat2,path2); |
1264 fs2.NotifyChange(ENotifyEntry,reqStat2,path2); |
1264 |
1265 |
1265 TRequestStatus reqStat3(KRequestPending); |
1266 TRequestStatus reqStat3(KRequestPending); |
1266 RFs fs3; |
1267 RFs fs3; |
1267 r=fs3.Connect(); |
1268 r=fs3.Connect(); |
1268 test_KErrNone(r); |
1269 test(r==KErrNone); |
1269 r=fs3.SetSessionPath(gSessionPath); |
1270 r=fs3.SetSessionPath(gSessionPath); |
1270 test_KErrNone(r); |
1271 test(r==KErrNone); |
1271 fs3.NotifyChange(ENotifyEntry,reqStat3,path3); |
1272 fs3.NotifyChange(ENotifyEntry,reqStat3,path3); |
1272 |
1273 |
1273 TRequestStatus reqStat4(KRequestPending); |
1274 TRequestStatus reqStat4(KRequestPending); |
1274 RFs fs4; |
1275 RFs fs4; |
1275 r=fs4.Connect(); |
1276 r=fs4.Connect(); |
1276 test_KErrNone(r); |
1277 test(r==KErrNone); |
1277 r=fs4.SetSessionPath(gSessionPath); |
1278 r=fs4.SetSessionPath(gSessionPath); |
1278 test_KErrNone(r); |
1279 test(r==KErrNone); |
1279 fs4.NotifyChange(ENotifyEntry,reqStat4,path4); |
1280 fs4.NotifyChange(ENotifyEntry,reqStat4,path4); |
1280 |
1281 |
1281 TRequestStatus reqStat5(KRequestPending); |
1282 TRequestStatus reqStat5(KRequestPending); |
1282 RFs fs5; |
1283 RFs fs5; |
1283 r=fs5.Connect(); |
1284 r=fs5.Connect(); |
1284 test_KErrNone(r); |
1285 test(r==KErrNone); |
1285 r=fs5.SetSessionPath(gSessionPath); |
1286 r=fs5.SetSessionPath(gSessionPath); |
1286 test_KErrNone(r); |
1287 test(r==KErrNone); |
1287 fs5.NotifyChange(ENotifyEntry,reqStat5,path5); |
1288 fs5.NotifyChange(ENotifyEntry,reqStat5,path5); |
1288 |
1289 |
1289 TRequestStatus reqStat6(KRequestPending); |
1290 TRequestStatus reqStat6(KRequestPending); |
1290 RFs fs6; |
1291 RFs fs6; |
1291 r=fs6.Connect(); |
1292 r=fs6.Connect(); |
1292 test_KErrNone(r); |
1293 test(r==KErrNone); |
1293 r=fs6.SetSessionPath(gSessionPath); |
1294 r=fs6.SetSessionPath(gSessionPath); |
1294 test_KErrNone(r); |
1295 test(r==KErrNone); |
1295 fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
1296 fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
1296 |
1297 |
1297 test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
1298 test(reqStat1==KRequestPending); |
1298 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
1299 test(reqStat2==KRequestPending); |
1299 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
1300 test(reqStat3==KRequestPending); |
1300 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
1301 test(reqStat4==KRequestPending); |
1301 test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
1302 test(reqStat5==KRequestPending); |
1302 test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
1303 test(reqStat6==KRequestPending); |
1303 |
1304 |
1304 // Make a change a the top level and check that only the session monitoring |
1305 // Make a change a the top level and check that only the session monitoring |
1305 // that level is notified |
1306 // that level is notified |
1306 test.Next(_L("Test only client monitoring top level is notified")); |
1307 test.Next(_L("Test only client monitoring top level is notified")); |
1307 r=file.Replace(TheFs,_L("\\F32-TST\\NewFile.txt"),EFileStream); |
1308 r=file.Replace(TheFs,_L("\\F32-TST\\NewFile.txt"),EFileStream); |
1308 test_KErrNone(r); |
1309 test(r==KErrNone); |
1309 file.Close(); |
1310 file.Close(); |
1310 User::WaitForRequest(reqStat1); |
1311 User::WaitForRequest(reqStat1); |
1311 test_KErrNone(reqStat1.Int()); |
1312 test(reqStat1==KErrNone); |
1312 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
1313 test(reqStat2==KRequestPending); |
1313 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
1314 test(reqStat3==KRequestPending); |
1314 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
1315 test(reqStat4==KRequestPending); |
1315 test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
1316 test(reqStat5==KRequestPending); |
1316 User::WaitForRequest(reqStat6); |
1317 User::WaitForRequest(reqStat6); |
1317 test_KErrNone(reqStat6.Int()); |
1318 test(reqStat6==KErrNone); |
1318 |
1319 |
1319 r=TheFs.Delete(_L("\\F32-TST\\NewFile.txt")); |
1320 r=TheFs.Delete(_L("\\F32-TST\\NewFile.txt")); |
1320 test_KErrNone(r); |
1321 test(r==KErrNone); |
1321 |
1322 |
1322 // Renew the notify request at the top level and make a change one step lower |
1323 // Renew the notify request at the top level and make a change one step lower |
1323 fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
1324 fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
1324 fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
1325 fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
1325 test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
1326 test(reqStat1==KRequestPending); |
1326 test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
1327 test(reqStat6==KRequestPending); |
1327 |
1328 |
1328 test.Next(_L("Test clients monitoring levels 1 and 2 are notified")); |
1329 test.Next(_L("Test clients monitoring levels 1 and 2 are notified")); |
1329 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileStream); |
1330 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileStream); |
1330 test_KErrNone(r); |
1331 test(r==KErrNone); |
1331 file.Close(); |
1332 file.Close(); |
1332 |
1333 |
1333 User::WaitForRequest(reqStat1); |
1334 User::WaitForRequest(reqStat1); |
1334 User::WaitForRequest(reqStat2); |
1335 User::WaitForRequest(reqStat2); |
1335 test_KErrNone(reqStat1.Int()); |
1336 test(reqStat1==KErrNone); |
1336 test_KErrNone(reqStat2.Int()); |
1337 test(reqStat2==KErrNone); |
1337 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
1338 test(reqStat3==KRequestPending); |
1338 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
1339 test(reqStat4==KRequestPending); |
1339 test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
1340 test(reqStat5==KRequestPending); |
1340 User::WaitForRequest(reqStat6); |
1341 User::WaitForRequest(reqStat6); |
1341 test_KErrNone(reqStat6.Int()); |
1342 test(reqStat6==KErrNone); |
1342 |
1343 |
1343 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\NewFile.txt")); |
1344 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\NewFile.txt")); |
1344 test_KErrNone(r); |
1345 test(r==KErrNone); |
1345 |
1346 |
1346 // Renew the notify request at the top and second levels and make a change |
1347 // Renew the notify request at the top and second levels and make a change |
1347 // one step lower still |
1348 // one step lower still |
1348 fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
1349 fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
1349 fs2.NotifyChange(ENotifyEntry,reqStat2,path2); |
1350 fs2.NotifyChange(ENotifyEntry,reqStat2,path2); |
1350 fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
1351 fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
1351 test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
1352 test(reqStat1==KRequestPending); |
1352 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
1353 test(reqStat2==KRequestPending); |
1353 test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
1354 test(reqStat6==KRequestPending); |
1354 |
1355 |
1355 test.Next(_L("Test clients monitoring levels 1,2 and 3 are notified")); |
1356 test.Next(_L("Test clients monitoring levels 1,2 and 3 are notified")); |
1356 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\ANIMAL\\NewFile.txt"),EFileStream); |
1357 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\ANIMAL\\NewFile.txt"),EFileStream); |
1357 test_KErrNone(r); |
1358 test(r==KErrNone); |
1358 file.Close(); |
1359 file.Close(); |
1359 |
1360 |
1360 User::WaitForRequest(reqStat1); |
1361 User::WaitForRequest(reqStat1); |
1361 User::WaitForRequest(reqStat2); |
1362 User::WaitForRequest(reqStat2); |
1362 User::WaitForRequest(reqStat3); |
1363 User::WaitForRequest(reqStat3); |
1363 test_KErrNone(reqStat1.Int()); |
1364 test(reqStat1==KErrNone); |
1364 test_KErrNone(reqStat2.Int()); |
1365 test(reqStat2==KErrNone); |
1365 test_KErrNone(reqStat3.Int()); |
1366 test(reqStat3==KErrNone); |
1366 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
1367 test(reqStat4==KRequestPending); |
1367 test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
1368 test(reqStat5==KRequestPending); |
1368 User::WaitForRequest(reqStat6); |
1369 User::WaitForRequest(reqStat6); |
1369 test_KErrNone(reqStat6.Int()); |
1370 test(reqStat6==KErrNone); |
1370 |
1371 |
1371 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\NewFile.txt")); |
1372 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\NewFile.txt")); |
1372 test_KErrNone(r); |
1373 test(r==KErrNone); |
1373 |
1374 |
1374 // Renew the notify request at the top, second and third levels and make a change |
1375 // Renew the notify request at the top, second and third levels and make a change |
1375 // one step lower still |
1376 // one step lower still |
1376 fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
1377 fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
1377 fs2.NotifyChange(ENotifyEntry,reqStat2,path2); |
1378 fs2.NotifyChange(ENotifyEntry,reqStat2,path2); |
1378 fs3.NotifyChange(ENotifyEntry,reqStat3,path3); |
1379 fs3.NotifyChange(ENotifyEntry,reqStat3,path3); |
1379 fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
1380 fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
1380 test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
1381 test(reqStat1==KRequestPending); |
1381 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
1382 test(reqStat2==KRequestPending); |
1382 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
1383 test(reqStat3==KRequestPending); |
1383 test_Value(reqStat4.Int(), reqStat6==KRequestPending); |
1384 test(reqStat6==KRequestPending); |
1384 |
1385 |
1385 test.Next(_L("Test clients monitoring levels 1 - 4 are notified")); |
1386 test.Next(_L("Test clients monitoring levels 1 - 4 are notified")); |
1386 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\cat.txt")); |
1387 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\cat.txt")); |
1387 test_KErrNone(r); |
1388 test(r==KErrNone); |
1388 User::WaitForRequest(reqStat1); |
1389 User::WaitForRequest(reqStat1); |
1389 User::WaitForRequest(reqStat2); |
1390 User::WaitForRequest(reqStat2); |
1390 User::WaitForRequest(reqStat3); |
1391 User::WaitForRequest(reqStat3); |
1391 User::WaitForRequest(reqStat4); |
1392 User::WaitForRequest(reqStat4); |
1392 test_KErrNone(reqStat1.Int()); |
1393 test(reqStat1==KErrNone); |
1393 test_KErrNone(reqStat2.Int()); |
1394 test(reqStat2==KErrNone); |
1394 test_KErrNone(reqStat3.Int()); |
1395 test(reqStat3==KErrNone); |
1395 test_KErrNone(reqStat4.Int()); |
1396 test(reqStat4==KErrNone); |
1396 test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
1397 test(reqStat5==KRequestPending); |
1397 User::WaitForRequest(reqStat6); |
1398 User::WaitForRequest(reqStat6); |
1398 test_KErrNone(reqStat6.Int()); |
1399 test(reqStat6==KErrNone); |
1399 |
1400 |
1400 // Renew the notify request at the top, second and third levels and on the file deleted above |
1401 // Renew the notify request at the top, second and third levels and on the file deleted above |
1401 // which will be successful, but will not complete (for obvious reasons) |
1402 // which will be successful, but will not complete (for obvious reasons) |
1402 |
1403 |
1403 // Make a change one step lower still |
1404 // Make a change one step lower still |
1404 fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
1405 fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
1405 fs2.NotifyChange(ENotifyEntry,reqStat2,path2); |
1406 fs2.NotifyChange(ENotifyEntry,reqStat2,path2); |
1406 fs3.NotifyChange(ENotifyEntry,reqStat3,path3); |
1407 fs3.NotifyChange(ENotifyEntry,reqStat3,path3); |
1407 fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
1408 fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
1408 fs4.NotifyChange(ENotifyEntry,reqStat4,path4); |
1409 fs4.NotifyChange(ENotifyEntry,reqStat4,path4); |
1409 test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
1410 test(reqStat1==KRequestPending); |
1410 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
1411 test(reqStat2==KRequestPending); |
1411 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
1412 test(reqStat3==KRequestPending); |
1412 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
1413 test(reqStat4==KRequestPending); |
1413 test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
1414 test(reqStat6==KRequestPending); |
1414 |
1415 |
1415 test.Next(_L("Test clients monitoring levels 1 - 3 and 5 are notified")); |
1416 test.Next(_L("Test clients monitoring levels 1 - 3 and 5 are notified")); |
1416 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\dog.txt")); |
1417 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\ANIMAL\\dog.txt")); |
1417 test_KErrNone(r); |
1418 test(r==KErrNone); |
1418 User::WaitForRequest(reqStat1); |
1419 User::WaitForRequest(reqStat1); |
1419 User::WaitForRequest(reqStat2); |
1420 User::WaitForRequest(reqStat2); |
1420 User::WaitForRequest(reqStat3); |
1421 User::WaitForRequest(reqStat3); |
1421 // Don't wait for reqStat4 |
1422 // Don't wait for reqStat4 |
1422 User::WaitForRequest(reqStat5); |
1423 User::WaitForRequest(reqStat5); |
1423 User::WaitForRequest(reqStat6); |
1424 User::WaitForRequest(reqStat6); |
1424 test_KErrNone(reqStat1.Int()); |
1425 test(reqStat1==KErrNone); |
1425 test_KErrNone(reqStat2.Int()); |
1426 test(reqStat2==KErrNone); |
1426 test_KErrNone(reqStat3.Int()); |
1427 test(reqStat3==KErrNone); |
1427 test_Value(reqStat4.Int(), reqStat4==KRequestPending); // File does not exist |
1428 test(reqStat4==KRequestPending); // File does not exist |
1428 test_KErrNone(reqStat5.Int()); |
1429 test(reqStat5==KErrNone); |
1429 test_KErrNone(reqStat6.Int()); |
1430 test(reqStat6==KErrNone); |
1430 |
1431 |
1431 fs4.NotifyChangeCancel(reqStat4); |
1432 fs4.NotifyChangeCancel(reqStat4); |
1432 User::WaitForRequest(reqStat4); |
1433 User::WaitForRequest(reqStat4); |
1433 test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
1434 test(reqStat4==KErrCancel); |
1434 // Renew the notify request at the top, second and third levels and attempt to renew |
1435 // Renew the notify request at the top, second and third levels and attempt to renew |
1435 // the request on the files deleted above (which will fail). |
1436 // the request on the files deleted above (which will fail). |
1436 |
1437 |
1437 test.Next(_L("Test clients monitoring levels 1 - 3 are notified")); |
1438 test.Next(_L("Test clients monitoring levels 1 - 3 are notified")); |
1438 fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
1439 fs1.NotifyChange(ENotifyEntry,reqStat1,path1); |
1439 fs2.NotifyChange(ENotifyEntry,reqStat2,path2); |
1440 fs2.NotifyChange(ENotifyEntry,reqStat2,path2); |
1440 fs3.NotifyChange(ENotifyEntry,reqStat3,path3); |
1441 fs3.NotifyChange(ENotifyEntry,reqStat3,path3); |
1441 fs4.NotifyChange(ENotifyEntry,reqStat4,path4); |
1442 fs4.NotifyChange(ENotifyEntry,reqStat4,path4); |
1442 fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
1443 fs6.NotifyChange(ENotifyEntry,reqStat6,path6); |
1443 fs5.NotifyChange(ENotifyEntry,reqStat5,path5); |
1444 fs5.NotifyChange(ENotifyEntry,reqStat5,path5); |
1444 test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
1445 test(reqStat1==KRequestPending); |
1445 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
1446 test(reqStat2==KRequestPending); |
1446 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
1447 test(reqStat3==KRequestPending); |
1447 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
1448 test(reqStat4==KRequestPending); |
1448 test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
1449 test(reqStat5==KRequestPending); |
1449 test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
1450 test(reqStat6==KRequestPending); |
1450 |
1451 |
1451 r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\ANIMAL\\")); |
1452 r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\ANIMAL\\")); |
1452 test_KErrNone(r); |
1453 test(r==KErrNone); |
1453 User::WaitForRequest(reqStat1); |
1454 User::WaitForRequest(reqStat1); |
1454 User::WaitForRequest(reqStat2); |
1455 User::WaitForRequest(reqStat2); |
1455 User::WaitForRequest(reqStat3); |
1456 User::WaitForRequest(reqStat3); |
1456 test_KErrNone(reqStat1.Int()); |
1457 test(reqStat1==KErrNone); |
1457 test_KErrNone(reqStat2.Int()); |
1458 test(reqStat2==KErrNone); |
1458 test_KErrNone(reqStat3.Int()); |
1459 test(reqStat3==KErrNone); |
1459 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
1460 test(reqStat4==KRequestPending); |
1460 test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
1461 test(reqStat5==KRequestPending); |
1461 User::WaitForRequest(reqStat6); |
1462 User::WaitForRequest(reqStat6); |
1462 test_KErrNone(reqStat6.Int()); |
1463 test(reqStat6==KErrNone); |
1463 |
1464 |
1464 // Renew the notify request at the top and second levels on the third level |
1465 // Renew the notify request at the top and second levels on the third level |
1465 // which was removed - it'll succeed but won't complete. |
1466 // which was removed - it'll succeed but won't complete. |
1466 |
1467 |
1467 test.Next(_L("Test clients monitoring levels 1 and 2 are notified")); |
1468 test.Next(_L("Test clients monitoring levels 1 and 2 are notified")); |
1877 // Test notification request succeeds with all RFile and RFs operations which result in |
1878 // Test notification request succeeds with all RFile and RFs operations which result in |
1878 // notifications |
1879 // notifications |
1879 // |
1880 // |
1880 RFs fs; |
1881 RFs fs; |
1881 TInt r=fs.Connect(); // Session to be notified of any changes |
1882 TInt r=fs.Connect(); // Session to be notified of any changes |
1882 test_KErrNone(r); |
1883 test(r==KErrNone); |
1883 r=fs.SetSessionPath(gSessionPath); |
1884 r=fs.SetSessionPath(gSessionPath); |
1884 test_KErrNone(r); |
1885 test(r==KErrNone); |
1885 |
1886 |
1886 // RFile::Write() to a file within the monitored directory |
1887 // RFile::Write() to a file within the monitored directory |
1887 test.Next(_L("RFile::Write()")); |
1888 test.Next(_L("RFile::Write()")); |
1888 TFileName path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc"); |
1889 TFileName path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.Doc"); |
1889 TRequestStatus reqStat(KRequestPending); |
1890 TRequestStatus reqStat(KRequestPending); |
1890 |
1891 |
1891 RFile file; |
1892 RFile file; |
1892 |
1893 |
1893 fs.NotifyChange(ENotifyAll,reqStat,path); |
1894 fs.NotifyChange(ENotifyAll,reqStat,path); |
1894 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1895 test(reqStat==KRequestPending); |
1895 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
1896 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
1896 test_KErrNone(r); |
1897 test(r==KErrNone); |
1897 User::WaitForRequest(reqStat); |
1898 User::WaitForRequest(reqStat); |
1898 test_KErrNone(reqStat.Int()); |
1899 test(reqStat==KErrNone); |
1899 fs.NotifyChange(ENotifyAll,reqStat,path); |
1900 fs.NotifyChange(ENotifyAll,reqStat,path); |
1900 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1901 test(reqStat==KRequestPending); |
1901 r=file.Write(0,_L8("Pay no attention to the man behind the curtain")); |
1902 r=file.Write(0,_L8("Pay no attention to the man behind the curtain")); |
1902 test_KErrNone(r); |
1903 test(r==KErrNone); |
1903 file.Close(); |
1904 file.Close(); |
1904 User::WaitForRequest(reqStat); |
1905 User::WaitForRequest(reqStat); |
1905 test_KErrNone(reqStat.Int()); |
1906 test(reqStat==KErrNone); |
1906 |
1907 |
1907 // RFile::Read() a file within the monitored directory - no notification for reads |
1908 // RFile::Read() a file within the monitored directory - no notification for reads |
1908 path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"); |
1909 path=_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"); |
1909 TBuf8<100> temp; |
1910 TBuf8<100> temp; |
1910 fs.NotifyChange(ENotifyAll,reqStat,path); |
1911 fs.NotifyChange(ENotifyAll,reqStat,path); |
1911 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1912 test(reqStat==KRequestPending); |
1912 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
1913 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
1913 test_KErrNone(r); |
1914 test(r==KErrNone); |
1914 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1915 test(reqStat==KRequestPending); |
1915 r=file.Read(0,temp,100); |
1916 r=file.Read(0,temp,100); |
1916 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1917 test(reqStat==KRequestPending); |
1917 |
1918 |
1918 // RFile::SetAtt() of a file within the monitored directory |
1919 // RFile::SetAtt() of a file within the monitored directory |
1919 test.Next(_L("RFile::SetAtt()")); |
1920 test.Next(_L("RFile::SetAtt()")); |
1920 r=file.SetAtt(KEntryAttSystem,KEntryAttNormal); |
1921 r=file.SetAtt(KEntryAttSystem,KEntryAttNormal); |
1921 test_KErrNone(r); |
1922 test(r==KErrNone); |
1922 User::WaitForRequest(reqStat); |
1923 User::WaitForRequest(reqStat); |
1923 test_KErrNone(reqStat.Int()); |
1924 test(reqStat==KErrNone); |
1924 fs.NotifyChange(ENotifyAll,reqStat,path); |
1925 fs.NotifyChange(ENotifyAll,reqStat,path); |
1925 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1926 test(reqStat==KRequestPending); |
1926 |
1927 |
1927 // RFile::SetSize() of a file within the monitored directory |
1928 // RFile::SetSize() of a file within the monitored directory |
1928 test.Next(_L("RFile::SetSize()")); |
1929 test.Next(_L("RFile::SetSize()")); |
1929 r=file.SetSize(256); |
1930 r=file.SetSize(256); |
1930 test_KErrNone(r); |
1931 test(r==KErrNone); |
1931 User::WaitForRequest(reqStat); |
1932 User::WaitForRequest(reqStat); |
1932 test_KErrNone(reqStat.Int()); |
1933 test(reqStat==KErrNone); |
1933 file.Close(); |
1934 file.Close(); |
1934 |
1935 |
1935 // RFile::Temp() to create a temp file within the monitored directory |
1936 // RFile::Temp() to create a temp file within the monitored directory |
1936 test.Next(_L("RFile::Temp()")); |
1937 test.Next(_L("RFile::Temp()")); |
1937 fs.NotifyChange(ENotifyAll,reqStat,path); |
1938 fs.NotifyChange(ENotifyAll,reqStat,path); |
1938 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1939 test(reqStat==KRequestPending); |
1939 TFileName fileName; |
1940 TFileName fileName; |
1940 r=file.Temp(TheFs,path,fileName,EFileWrite); |
1941 r=file.Temp(TheFs,path,fileName,EFileWrite); |
1941 test_KErrNone(r); |
1942 test(r==KErrNone); |
1942 User::WaitForRequest(reqStat); |
1943 User::WaitForRequest(reqStat); |
1943 test_KErrNone(reqStat.Int()); |
1944 test(reqStat==KErrNone); |
1944 file.Close(); |
1945 file.Close(); |
1945 |
1946 |
1946 // RFile::SetModified() to change modification time of a file within monitored dir |
1947 // RFile::SetModified() to change modification time of a file within monitored dir |
1947 test.Next(_L("RFile::SetModified()")); |
1948 test.Next(_L("RFile::SetModified()")); |
1948 fs.NotifyChange(ENotifyAll,reqStat,path); |
1949 fs.NotifyChange(ENotifyAll,reqStat,path); |
1949 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1950 test(reqStat==KRequestPending); |
1950 TTime now; |
1951 TTime now; |
1951 now.HomeTime(); |
1952 now.HomeTime(); |
1952 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
1953 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
1953 test_KErrNone(r); |
1954 test(r==KErrNone); |
1954 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1955 test(reqStat==KRequestPending); |
1955 file.SetModified(now); |
1956 file.SetModified(now); |
1956 file.Close(); |
1957 file.Close(); |
1957 User::WaitForRequest(reqStat); |
1958 User::WaitForRequest(reqStat); |
1958 test_KErrNone(reqStat.Int()); |
1959 test(reqStat==KErrNone); |
1959 |
1960 |
1960 // RFs::SetEntry() to change a directory entry within the monitored directory |
1961 // RFs::SetEntry() to change a directory entry within the monitored directory |
1961 test.Next(_L("RFs::SetEntry()")); |
1962 test.Next(_L("RFs::SetEntry()")); |
1962 TEntry entry; |
1963 TEntry entry; |
1963 fs.NotifyChange(ENotifyAll,reqStat,path); |
1964 fs.NotifyChange(ENotifyAll,reqStat,path); |
1964 r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry); |
1965 r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry); |
1965 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1966 test(reqStat==KRequestPending); |
1966 now.HomeTime(); |
1967 now.HomeTime(); |
1967 r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal); |
1968 r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal); |
1968 test_KErrNone(r); |
1969 test(r==KErrNone); |
1969 User::WaitForRequest(reqStat); |
1970 User::WaitForRequest(reqStat); |
1970 test_KErrNone(reqStat.Int()); |
1971 test(reqStat==KErrNone); |
1971 |
1972 |
1972 // RFile::Set() to change file's modification time and attributes |
1973 // RFile::Set() to change file's modification time and attributes |
1973 test.Next(_L("RFile::Set()")); |
1974 test.Next(_L("RFile::Set()")); |
1974 fs.NotifyChange(ENotifyAll,reqStat,path); |
1975 fs.NotifyChange(ENotifyAll,reqStat,path); |
1975 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
1976 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
1976 test_KErrNone(r); |
1977 test(r==KErrNone); |
1977 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1978 test(reqStat==KRequestPending); |
1978 now.HomeTime(); |
1979 now.HomeTime(); |
1979 r=file.Set(now,KEntryAttNormal,KEntryAttHidden); |
1980 r=file.Set(now,KEntryAttNormal,KEntryAttHidden); |
1980 file.Close(); |
1981 file.Close(); |
1981 User::WaitForRequest(reqStat); |
1982 User::WaitForRequest(reqStat); |
1982 test_KErrNone(reqStat.Int()); |
1983 test(reqStat==KErrNone); |
1983 |
1984 |
1984 // RFs::SetDriveName() |
1985 // RFs::SetDriveName() |
1985 test.Next(_L("RFs::SetDriveName()")); |
1986 test.Next(_L("RFs::SetDriveName()")); |
1986 fs.NotifyChange(ENotifyAll,reqStat,path); |
1987 fs.NotifyChange(ENotifyAll,reqStat,path); |
1987 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1988 test(reqStat==KRequestPending); |
1988 User::After(KNotifyChangeAfter); |
1989 User::After(KNotifyChangeAfter); |
1989 r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST")); |
1990 r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST")); |
1990 test_KErrNone(r); |
1991 test(r==KErrNone); |
1991 User::WaitForRequest(reqStat); |
1992 User::WaitForRequest(reqStat); |
1992 test_KErrNone(reqStat.Int()); |
1993 test(reqStat==KErrNone); |
1993 fs.NotifyChange(ENotifyEntry,reqStat,path); |
1994 fs.NotifyChange(ENotifyEntry,reqStat,path); |
1994 User::After(KNotifyChangeAfter); |
1995 User::After(KNotifyChangeAfter); |
1995 r=TheFs.SetDriveName(KDefaultDrive,_L("TEST")); |
1996 r=TheFs.SetDriveName(KDefaultDrive,_L("TEST")); |
1996 test_KErrNone(r); |
1997 test(r==KErrNone); |
1997 test_Value(reqStat.Int(), reqStat==KRequestPending); |
1998 test(reqStat==KRequestPending); |
1998 fs.NotifyChangeCancel(reqStat); |
1999 fs.NotifyChangeCancel(reqStat); |
1999 User::WaitForRequest(reqStat); |
2000 User::WaitForRequest(reqStat); |
2000 test_Value(reqStat.Int(), reqStat==KErrCancel); |
2001 test(reqStat==KErrCancel); |
2001 fs.NotifyChange(ENotifyDisk,reqStat,path); |
2002 fs.NotifyChange(ENotifyDisk,reqStat,path); |
2002 User::After(KNotifyChangeAfter); |
2003 User::After(KNotifyChangeAfter); |
2003 r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE")); |
2004 r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE")); |
2004 test_KErrNone(r); |
2005 test(r==KErrNone); |
2005 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2006 test(reqStat==KRequestPending); |
2006 fs.NotifyChangeCancel(reqStat); |
2007 fs.NotifyChangeCancel(reqStat); |
2007 User::WaitForRequest(reqStat); |
2008 User::WaitForRequest(reqStat); |
2008 test_Value(reqStat.Int(), reqStat==KErrCancel); |
2009 test(reqStat==KErrCancel); |
2009 |
2010 |
2010 |
2011 |
2011 // RFs::MkDir() |
2012 // RFs::MkDir() |
2012 fs.NotifyChange(ENotifyAll,reqStat,path); |
2013 fs.NotifyChange(ENotifyAll,reqStat,path); |
2013 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2014 test(reqStat==KRequestPending); |
2014 test.Next(_L("RFs::MkDir()")); |
2015 test.Next(_L("RFs::MkDir()")); |
2015 r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\")); |
2016 r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\")); |
2016 test_KErrNone(r); |
2017 test(r==KErrNone); |
2017 User::WaitForRequest(reqStat); |
2018 User::WaitForRequest(reqStat); |
2018 test_KErrNone(reqStat.Int()); |
2019 test(reqStat==KErrNone); |
2019 |
2020 |
2020 // RFs::RmDir() |
2021 // RFs::RmDir() |
2021 test.Next(_L("RFs::RmDir()")); |
2022 test.Next(_L("RFs::RmDir()")); |
2022 fs.NotifyChange(ENotifyAll,reqStat,path); |
2023 fs.NotifyChange(ENotifyAll,reqStat,path); |
2023 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2024 test(reqStat==KRequestPending); |
2024 r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\")); |
2025 r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\")); |
2025 test_KErrNone(r); |
2026 test(r==KErrNone); |
2026 User::WaitForRequest(reqStat); |
2027 User::WaitForRequest(reqStat); |
2027 test_KErrNone(reqStat.Int()); |
2028 test(reqStat==KErrNone); |
2028 |
2029 |
2029 // RFile::Create() |
2030 // RFile::Create() |
2030 test.Next(_L("RFile::Create()")); |
2031 test.Next(_L("RFile::Create()")); |
2031 fs.NotifyChange(ENotifyAll,reqStat,path); |
2032 fs.NotifyChange(ENotifyAll,reqStat,path); |
2032 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2033 test(reqStat==KRequestPending); |
2033 r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite); |
2034 r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite); |
2034 test_KErrNone(r); |
2035 test(r==KErrNone); |
2035 User::WaitForRequest(reqStat); |
2036 User::WaitForRequest(reqStat); |
2036 test_KErrNone(reqStat.Int()); |
2037 test(reqStat==KErrNone); |
2037 file.Close(); |
2038 file.Close(); |
2038 |
2039 |
2039 // RFs::Delete() |
2040 // RFs::Delete() |
2040 test.Next(_L("RFs::Delete()")); |
2041 test.Next(_L("RFs::Delete()")); |
2041 fs.NotifyChange(ENotifyAll,reqStat,path); |
2042 fs.NotifyChange(ENotifyAll,reqStat,path); |
2042 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2043 test(reqStat==KRequestPending); |
2043 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat")); |
2044 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat")); |
2044 test_KErrNone(r); |
2045 test(r==KErrNone); |
2045 User::WaitForRequest(reqStat); |
2046 User::WaitForRequest(reqStat); |
2046 test_KErrNone(reqStat.Int()); |
2047 test(reqStat==KErrNone); |
2047 |
2048 |
2048 // RFile::Replace() |
2049 // RFile::Replace() |
2049 test.Next(_L("RFile::Replace()")); |
2050 test.Next(_L("RFile::Replace()")); |
2050 fs.NotifyChange(ENotifyAll,reqStat,path); |
2051 fs.NotifyChange(ENotifyAll,reqStat,path); |
2051 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2052 test(reqStat==KRequestPending); |
2052 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite); |
2053 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite); |
2053 test_KErrNone(r); |
2054 test(r==KErrNone); |
2054 User::WaitForRequest(reqStat); |
2055 User::WaitForRequest(reqStat); |
2055 test_KErrNone(reqStat.Int()); |
2056 test(reqStat==KErrNone); |
2056 file.Close(); |
2057 file.Close(); |
2057 |
2058 |
2058 // RFs::Delete() |
2059 // RFs::Delete() |
2059 test.Next(_L("RFs::Delete()")); |
2060 test.Next(_L("RFs::Delete()")); |
2060 fs.NotifyChange(ENotifyAll,reqStat,path); |
2061 fs.NotifyChange(ENotifyAll,reqStat,path); |
2061 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2062 test(reqStat==KRequestPending); |
2062 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat")); |
2063 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat")); |
2063 test_KErrNone(r); |
2064 test(r==KErrNone); |
2064 User::WaitForRequest(reqStat); |
2065 User::WaitForRequest(reqStat); |
2065 test_KErrNone(reqStat.Int()); |
2066 test(reqStat==KErrNone); |
2066 |
2067 |
2067 // RFs::SetVolumeLabel() - should only be notification when monitoring relevant TNotifyTypes |
2068 // RFs::SetVolumeLabel() - should only be notification when monitoring relevant TNotifyTypes |
2068 test.Next(_L("RFs::SetVolumeLabel")); |
2069 test.Next(_L("RFs::SetVolumeLabel")); |
2069 fs.NotifyChange(ENotifyAll,reqStat,path); |
2070 fs.NotifyChange(ENotifyAll,reqStat,path); |
2070 |
2071 |
2071 TInt driveNum=CurrentDrive(); |
2072 TInt driveNum=CurrentDrive(); |
2072 TVolumeInfo volInfo; |
2073 TVolumeInfo volInfo; |
2073 TFileName currentVolName; |
2074 TFileName currentVolName; |
2074 |
2075 |
2075 r=TheFs.Volume(volInfo,driveNum); |
2076 r=TheFs.Volume(volInfo,driveNum); |
2076 test_KErrNone(r); |
2077 test(r==KErrNone); |
2077 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2078 test(reqStat==KRequestPending); |
2078 currentVolName=volInfo.iName; |
2079 currentVolName=volInfo.iName; |
2079 |
2080 |
2080 r=TheFs.SetVolumeLabel(_L("VOL"),driveNum); |
2081 r=TheFs.SetVolumeLabel(_L("VOL"),driveNum); |
2081 if (r==KErrNone) |
2082 if (r==KErrNone) |
2082 { |
2083 { |
2083 User::WaitForRequest(reqStat); |
2084 User::WaitForRequest(reqStat); |
2084 test_KErrNone(reqStat.Int()); |
2085 test(reqStat==KErrNone); |
2085 r=TheFs.Volume(volInfo,driveNum); |
2086 r=TheFs.Volume(volInfo,driveNum); |
2086 test_KErrNone(r); |
2087 test(r==KErrNone); |
2087 test(volInfo.iName==_L("VOL")); |
2088 test(volInfo.iName==_L("VOL")); |
2088 // Test notification occurs under ENotifyDisk |
2089 // Test notification occurs under ENotifyDisk |
2089 fs.NotifyChange(ENotifyDisk,reqStat,path); |
2090 fs.NotifyChange(ENotifyDisk,reqStat,path); |
2090 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2091 test(reqStat==KRequestPending); |
2091 r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum); |
2092 r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum); |
2092 test_KErrNone(r); |
2093 test(r==KErrNone); |
2093 User::WaitForRequest(reqStat); |
2094 User::WaitForRequest(reqStat); |
2094 test_KErrNone(reqStat.Int()); |
2095 test(reqStat==KErrNone); |
2095 r=TheFs.Volume(volInfo,driveNum); |
2096 r=TheFs.Volume(volInfo,driveNum); |
2096 test_KErrNone(r); |
2097 test(r==KErrNone); |
2097 |
2098 |
2098 test(volInfo.iName==_L("ABCDEFGHIJK")); |
2099 test(volInfo.iName==_L("ABCDEFGHIJK")); |
2099 |
2100 |
2100 // Test notification does not occur under ENotifyAttributes |
2101 // Test notification does not occur under ENotifyAttributes |
2101 fs.NotifyChange(ENotifyAttributes,reqStat,path); |
2102 fs.NotifyChange(ENotifyAttributes,reqStat,path); |
2102 r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum); |
2103 r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum); |
2103 test_KErrNone(r); |
2104 test(r==KErrNone); |
2104 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2105 test(reqStat==KRequestPending); |
2105 r=TheFs.Volume(volInfo,driveNum); |
2106 r=TheFs.Volume(volInfo,driveNum); |
2106 test_KErrNone(r); |
2107 test(r==KErrNone); |
2107 |
2108 |
2108 test(volInfo.iName==_L("TROPICANA")); |
2109 test(volInfo.iName==_L("TROPICANA")); |
2109 |
2110 |
2110 fs.NotifyChangeCancel(reqStat); |
2111 fs.NotifyChangeCancel(reqStat); |
2111 User::WaitForRequest(reqStat); |
2112 User::WaitForRequest(reqStat); |
2112 test_Value(reqStat.Int(), reqStat==KErrCancel); |
2113 test(reqStat==KErrCancel); |
2113 // Test notification occurs under ENotifyEntry |
2114 // Test notification occurs under ENotifyEntry |
2114 fs.NotifyChange(ENotifyEntry,reqStat,path); |
2115 fs.NotifyChange(ENotifyEntry,reqStat,path); |
2115 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2116 test(reqStat==KRequestPending); |
2116 r=TheFs.SetVolumeLabel(currentVolName,driveNum); |
2117 r=TheFs.SetVolumeLabel(currentVolName,driveNum); |
2117 test_KErrNone(r); |
2118 test(r==KErrNone); |
2118 User::WaitForRequest(reqStat); |
2119 User::WaitForRequest(reqStat); |
2119 test_KErrNone(reqStat.Int()); |
2120 test(reqStat==KErrNone); |
2120 r=TheFs.Volume(volInfo,driveNum); |
2121 r=TheFs.Volume(volInfo,driveNum); |
2121 test_KErrNone(r); |
2122 test(r==KErrNone); |
2122 test(volInfo.iName==currentVolName); |
2123 test(volInfo.iName==currentVolName); |
2123 } |
2124 } |
2124 |
2125 |
2125 else // RFs::SetVolumeLabel() doesn't work on subst drives |
2126 else // RFs::SetVolumeLabel() doesn't work on subst drives |
2126 { |
2127 { |
2170 // Repeat Test15 operations in a subtree of that monitored, and ensure notification |
2173 // Repeat Test15 operations in a subtree of that monitored, and ensure notification |
2171 // occurs for a variety of RFile and RFs operations |
2174 // occurs for a variety of RFile and RFs operations |
2172 // |
2175 // |
2173 RFs fs; // Session to be notified when a change occurs |
2176 RFs fs; // Session to be notified when a change occurs |
2174 TInt r=fs.Connect(); |
2177 TInt r=fs.Connect(); |
2175 test_KErrNone(r); |
2178 test(r==KErrNone); |
2176 r=fs.SetSessionPath(gSessionPath); |
2179 r=fs.SetSessionPath(gSessionPath); |
2177 test_KErrNone(r); |
2180 test(r==KErrNone); |
2178 |
2181 |
2179 // RFile::Write() to a file in the subtree |
2182 // RFile::Write() to a file in the subtree |
2180 test.Next(_L("RFile::Write()")); |
2183 test.Next(_L("RFile::Write()")); |
2181 TFileName path=_L("\\F32-TST\\NOTIFY\\"); |
2184 TFileName path=_L("\\F32-TST\\NOTIFY\\"); |
2182 TRequestStatus reqStat(KRequestPending); |
2185 TRequestStatus reqStat(KRequestPending); |
2183 fs.NotifyChange(ENotifyAll,reqStat,path); |
2186 fs.NotifyChange(ENotifyAll,reqStat,path); |
2184 |
2187 |
2185 RFile file; |
2188 RFile file; |
2186 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
2189 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
2187 test_KErrNone(r); |
2190 test(r==KErrNone); |
2188 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2191 test(reqStat==KRequestPending); |
2189 r=file.Write(0,_L8("Pay no attention to the man behind the curtain")); |
2192 r=file.Write(0,_L8("Pay no attention to the man behind the curtain")); |
2190 file.Close(); |
2193 file.Close(); |
2191 User::WaitForRequest(reqStat); |
2194 User::WaitForRequest(reqStat); |
2192 test_KErrNone(reqStat.Int()); |
2195 test(reqStat==KErrNone); |
2193 |
2196 |
2194 // RFile::Read() a file within the monitored directory - no notification for reads |
2197 // RFile::Read() a file within the monitored directory - no notification for reads |
2195 fs.NotifyChange(ENotifyAll,reqStat,path); |
2198 fs.NotifyChange(ENotifyAll,reqStat,path); |
2196 TBuf8<100> temp; |
2199 TBuf8<100> temp; |
2197 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
2200 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
2198 test_KErrNone(r); |
2201 test(r==KErrNone); |
2199 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2202 test(reqStat==KRequestPending); |
2200 r=file.Read(0,temp,100); |
2203 r=file.Read(0,temp,100); |
2201 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2204 test(reqStat==KRequestPending); |
2202 |
2205 |
2203 // RFile::SetAtt() of a file within the monitored directory |
2206 // RFile::SetAtt() of a file within the monitored directory |
2204 test.Next(_L("RFile::SetAtt()")); |
2207 test.Next(_L("RFile::SetAtt()")); |
2205 r=file.SetAtt(KEntryAttNormal,KEntryAttHidden); |
2208 r=file.SetAtt(KEntryAttNormal,KEntryAttHidden); |
2206 test_KErrNone(r); |
2209 test(r==KErrNone); |
2207 User::WaitForRequest(reqStat); |
2210 User::WaitForRequest(reqStat); |
2208 test_KErrNone(reqStat.Int()); |
2211 test(reqStat==KErrNone); |
2209 |
2212 |
2210 // RFile::SetSize() of a file within the monitored directory |
2213 // RFile::SetSize() of a file within the monitored directory |
2211 test.Next(_L("RFile::SetSize()")); |
2214 test.Next(_L("RFile::SetSize()")); |
2212 fs.NotifyChange(ENotifyAll,reqStat,path); |
2215 fs.NotifyChange(ENotifyAll,reqStat,path); |
2213 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2216 test(reqStat==KRequestPending); |
2214 r=file.SetSize(256); |
2217 r=file.SetSize(256); |
2215 test_KErrNone(r); |
2218 test(r==KErrNone); |
2216 User::WaitForRequest(reqStat); |
2219 User::WaitForRequest(reqStat); |
2217 test_KErrNone(reqStat.Int()); |
2220 test(reqStat==KErrNone); |
2218 file.Close(); |
2221 file.Close(); |
2219 |
2222 |
2220 // RFile::Temp() to create a temp file in the subtree |
2223 // RFile::Temp() to create a temp file in the subtree |
2221 test.Next(_L("RFile::Temp()")); |
2224 test.Next(_L("RFile::Temp()")); |
2222 fs.NotifyChange(ENotifyAll,reqStat,path); |
2225 fs.NotifyChange(ENotifyAll,reqStat,path); |
2223 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2226 test(reqStat==KRequestPending); |
2224 TFileName fileName; |
2227 TFileName fileName; |
2225 r=file.Temp(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"),fileName,EFileWrite); |
2228 r=file.Temp(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\"),fileName,EFileWrite); |
2226 test_KErrNone(r); |
2229 test(r==KErrNone); |
2227 User::WaitForRequest(reqStat); |
2230 User::WaitForRequest(reqStat); |
2228 test_KErrNone(reqStat.Int()); |
2231 test(reqStat==KErrNone); |
2229 file.Close(); |
2232 file.Close(); |
2230 |
2233 |
2231 // RFile::SetModified() to change modification time of a file within monitored dir |
2234 // RFile::SetModified() to change modification time of a file within monitored dir |
2232 test.Next(_L("RFile::SetModified()")); |
2235 test.Next(_L("RFile::SetModified()")); |
2233 fs.NotifyChange(ENotifyAll,reqStat,path); |
2236 fs.NotifyChange(ENotifyAll,reqStat,path); |
2234 TTime now; |
2237 TTime now; |
2235 now.HomeTime(); |
2238 now.HomeTime(); |
2236 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
2239 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
2237 test_KErrNone(r); |
2240 test(r==KErrNone); |
2238 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2241 test(reqStat==KRequestPending); |
2239 file.SetModified(now); |
2242 file.SetModified(now); |
2240 file.Close(); |
2243 file.Close(); |
2241 User::WaitForRequest(reqStat); |
2244 User::WaitForRequest(reqStat); |
2242 test_KErrNone(reqStat.Int()); |
2245 test(reqStat==KErrNone); |
2243 |
2246 |
2244 // RFs::Entry() to change a directory entry within the monitored directory |
2247 // RFs::Entry() to change a directory entry within the monitored directory |
2245 test.Next(_L("RFs::Entry()")); |
2248 test.Next(_L("RFs::Entry()")); |
2246 fs.NotifyChange(ENotifyAll,reqStat,path); |
2249 fs.NotifyChange(ENotifyAll,reqStat,path); |
2247 TEntry entry; |
2250 TEntry entry; |
2248 r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry); |
2251 r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry); |
2249 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2252 test(reqStat==KRequestPending); |
2250 now.HomeTime(); |
2253 now.HomeTime(); |
2251 r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal); |
2254 r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal); |
2252 test_KErrNone(r); |
2255 test(r==KErrNone); |
2253 User::WaitForRequest(reqStat); |
2256 User::WaitForRequest(reqStat); |
2254 test_KErrNone(reqStat.Int()); |
2257 test(reqStat==KErrNone); |
2255 |
2258 |
2256 // RFile::Set() to change file's modification time and attributes |
2259 // RFile::Set() to change file's modification time and attributes |
2257 test.Next(_L("RFile::Set()")); |
2260 test.Next(_L("RFile::Set()")); |
2258 fs.NotifyChange(ENotifyAll,reqStat,path); |
2261 fs.NotifyChange(ENotifyAll,reqStat,path); |
2259 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
2262 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
2260 test_KErrNone(r); |
2263 test(r==KErrNone); |
2261 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2264 test(reqStat==KRequestPending); |
2262 now.HomeTime(); |
2265 now.HomeTime(); |
2263 r=file.Set(now,KEntryAttNormal,KEntryAttHidden); |
2266 r=file.Set(now,KEntryAttNormal,KEntryAttHidden); |
2264 file.Close(); |
2267 file.Close(); |
2265 User::WaitForRequest(reqStat); |
2268 User::WaitForRequest(reqStat); |
2266 test_KErrNone(reqStat.Int()); |
2269 test(reqStat==KErrNone); |
2267 |
2270 |
2268 // RFs::SetDriveName() |
2271 // RFs::SetDriveName() |
2269 test.Next(_L("RFs::SetDriveName()")); |
2272 test.Next(_L("RFs::SetDriveName()")); |
2270 fs.NotifyChange(ENotifyAll,reqStat,path); |
2273 fs.NotifyChange(ENotifyAll,reqStat,path); |
2271 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2274 test(reqStat==KRequestPending); |
2272 User::After(KNotifyChangeAfter); |
2275 User::After(KNotifyChangeAfter); |
2273 r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST")); |
2276 r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST")); |
2274 test_KErrNone(r); |
2277 test(r==KErrNone); |
2275 User::WaitForRequest(reqStat); |
2278 User::WaitForRequest(reqStat); |
2276 test_KErrNone(reqStat.Int()); |
2279 test(reqStat==KErrNone); |
2277 fs.NotifyChange(ENotifyEntry,reqStat,path); |
2280 fs.NotifyChange(ENotifyEntry,reqStat,path); |
2278 r=TheFs.SetDriveName(KDefaultDrive,_L("TEST")); |
2281 r=TheFs.SetDriveName(KDefaultDrive,_L("TEST")); |
2279 test_KErrNone(r); |
2282 test(r==KErrNone); |
2280 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2283 test(reqStat==KRequestPending); |
2281 User::After(KNotifyChangeAfter); |
2284 User::After(KNotifyChangeAfter); |
2282 fs.NotifyChangeCancel(reqStat); |
2285 fs.NotifyChangeCancel(reqStat); |
2283 User::WaitForRequest(reqStat); |
2286 User::WaitForRequest(reqStat); |
2284 test_Value(reqStat.Int(), reqStat==KErrCancel); |
2287 test(reqStat==KErrCancel); |
2285 fs.NotifyChange(ENotifyDisk,reqStat,path); |
2288 fs.NotifyChange(ENotifyDisk,reqStat,path); |
2286 User::After(KNotifyChangeAfter); |
2289 User::After(KNotifyChangeAfter); |
2287 r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE")); |
2290 r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE")); |
2288 test_KErrNone(r); |
2291 test(r==KErrNone); |
2289 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2292 test(reqStat==KRequestPending); |
2290 fs.NotifyChangeCancel(reqStat); |
2293 fs.NotifyChangeCancel(reqStat); |
2291 User::WaitForRequest(reqStat); |
2294 User::WaitForRequest(reqStat); |
2292 test_Value(reqStat.Int(), reqStat==KErrCancel); |
2295 test(reqStat==KErrCancel); |
2293 |
2296 |
2294 // RFs::MkDir() |
2297 // RFs::MkDir() |
2295 test.Next(_L("RFs::MkDir()")); |
2298 test.Next(_L("RFs::MkDir()")); |
2296 fs.NotifyChange(ENotifyAll,reqStat,path); |
2299 fs.NotifyChange(ENotifyAll,reqStat,path); |
2297 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2300 test(reqStat==KRequestPending); |
2298 r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\")); |
2301 r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\")); |
2299 test_KErrNone(r); |
2302 test(r==KErrNone); |
2300 User::WaitForRequest(reqStat); |
2303 User::WaitForRequest(reqStat); |
2301 test_KErrNone(reqStat.Int()); |
2304 test(reqStat==KErrNone); |
2302 |
2305 |
2303 // RFs::RmDir() |
2306 // RFs::RmDir() |
2304 test.Next(_L("RFs::RmDir()")); |
2307 test.Next(_L("RFs::RmDir()")); |
2305 fs.NotifyChange(ENotifyAll,reqStat,path); |
2308 fs.NotifyChange(ENotifyAll,reqStat,path); |
2306 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2309 test(reqStat==KRequestPending); |
2307 r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\")); |
2310 r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\")); |
2308 test_KErrNone(r); |
2311 test(r==KErrNone); |
2309 User::WaitForRequest(reqStat); |
2312 User::WaitForRequest(reqStat); |
2310 test_KErrNone(reqStat.Int()); |
2313 test(reqStat==KErrNone); |
2311 |
2314 |
2312 // RFile::Create() |
2315 // RFile::Create() |
2313 test.Next(_L("RFile::Create()")); |
2316 test.Next(_L("RFile::Create()")); |
2314 fs.NotifyChange(ENotifyAll,reqStat,path); |
2317 fs.NotifyChange(ENotifyAll,reqStat,path); |
2315 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2318 test(reqStat==KRequestPending); |
2316 r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite); |
2319 r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite); |
2317 test_KErrNone(r); |
2320 test(r==KErrNone); |
2318 User::WaitForRequest(reqStat); |
2321 User::WaitForRequest(reqStat); |
2319 test_KErrNone(reqStat.Int()); |
2322 test(reqStat==KErrNone); |
2320 file.Close(); |
2323 file.Close(); |
2321 |
2324 |
2322 // RFs::Delete() |
2325 // RFs::Delete() |
2323 test.Next(_L("RFs::Delete()")); |
2326 test.Next(_L("RFs::Delete()")); |
2324 fs.NotifyChange(ENotifyAll,reqStat,path); |
2327 fs.NotifyChange(ENotifyAll,reqStat,path); |
2325 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2328 test(reqStat==KRequestPending); |
2326 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat")); |
2329 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat")); |
2327 test_KErrNone(r); |
2330 test(r==KErrNone); |
2328 User::WaitForRequest(reqStat); |
2331 User::WaitForRequest(reqStat); |
2329 test_KErrNone(reqStat.Int()); |
2332 test(reqStat==KErrNone); |
2330 |
2333 |
2331 // RFile::Replace() |
2334 // RFile::Replace() |
2332 test.Next(_L("RFile::Replace()")); |
2335 test.Next(_L("RFile::Replace()")); |
2333 fs.NotifyChange(ENotifyAll,reqStat,path); |
2336 fs.NotifyChange(ENotifyAll,reqStat,path); |
2334 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2337 test(reqStat==KRequestPending); |
2335 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite); |
2338 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite); |
2336 test_KErrNone(r); |
2339 test(r==KErrNone); |
2337 User::WaitForRequest(reqStat); |
2340 User::WaitForRequest(reqStat); |
2338 test_KErrNone(reqStat.Int()); |
2341 test(reqStat==KErrNone); |
2339 file.Close(); |
2342 file.Close(); |
2340 |
2343 |
2341 // RFs::Delete() |
2344 // RFs::Delete() |
2342 test.Next(_L("RFs::Delete()")); |
2345 test.Next(_L("RFs::Delete()")); |
2343 fs.NotifyChange(ENotifyAll,reqStat,path); |
2346 fs.NotifyChange(ENotifyAll,reqStat,path); |
2344 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2347 test(reqStat==KRequestPending); |
2345 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat")); |
2348 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat")); |
2346 test_KErrNone(r); |
2349 test(r==KErrNone); |
2347 User::WaitForRequest(reqStat); |
2350 User::WaitForRequest(reqStat); |
2348 test_KErrNone(reqStat.Int()); |
2351 test(reqStat==KErrNone); |
2349 |
2352 |
2350 // RFs::SetVolumeLabel() - should be notification under relevant TNotifyType monitoring |
2353 // RFs::SetVolumeLabel() - should be notification under relevant TNotifyType monitoring |
2351 // The operation is non-path specific so all outstanding interested requests are notified |
2354 // The operation is non-path specific so all outstanding interested requests are notified |
2352 test.Next(_L("RFs::SetVolumeLabel()")); |
2355 test.Next(_L("RFs::SetVolumeLabel()")); |
2353 |
2356 |
2440 // Repeat Test15 operations in a subtree of that monitored, and ensure notification |
2443 // Repeat Test15 operations in a subtree of that monitored, and ensure notification |
2441 // does occur for a variety of file operations when subtree watching is on |
2444 // does occur for a variety of file operations when subtree watching is on |
2442 // |
2445 // |
2443 RFs fs; |
2446 RFs fs; |
2444 TInt r=fs.Connect(); // Session to be notified when a change occurs |
2447 TInt r=fs.Connect(); // Session to be notified when a change occurs |
2445 test_KErrNone(r); |
2448 test(r==KErrNone); |
2446 r=fs.SetSessionPath(gSessionPath); |
2449 r=fs.SetSessionPath(gSessionPath); |
2447 test_KErrNone(r); |
2450 test(r==KErrNone); |
2448 |
2451 |
2449 // RFile::Write() to a file in the subtree |
2452 // RFile::Write() to a file in the subtree |
2450 TFileName path=_L("\\F32-TST\\NOTIFY\\"); |
2453 TFileName path=_L("\\F32-TST\\NOTIFY\\"); |
2451 TRequestStatus reqStat(KRequestPending); |
2454 TRequestStatus reqStat(KRequestPending); |
2452 fs.NotifyChange(ENotifyAll,reqStat,path); |
2455 fs.NotifyChange(ENotifyAll,reqStat,path); |
2453 |
2456 |
2454 RFile file; |
2457 RFile file; |
2455 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
2458 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
2456 test_KErrNone(r); |
2459 test(r==KErrNone); |
2457 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2460 test(reqStat==KRequestPending); |
2458 r=file.Write(0,_L8("Pay no attention to the man behind the curtain")); |
2461 r=file.Write(0,_L8("Pay no attention to the man behind the curtain")); |
2459 file.Close(); |
2462 file.Close(); |
2460 User::WaitForRequest(reqStat); |
2463 User::WaitForRequest(reqStat); |
2461 test_KErrNone(reqStat.Int()); |
2464 test(reqStat==KErrNone); |
2462 |
2465 |
2463 // RFile::Read() a file within the monitored directory - no notification for reads |
2466 // RFile::Read() a file within the monitored directory - no notification for reads |
2464 fs.NotifyChange(ENotifyAll,reqStat,path); |
2467 fs.NotifyChange(ENotifyAll,reqStat,path); |
2465 TBuf8<100> temp; |
2468 TBuf8<100> temp; |
2466 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
2469 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
2467 test_KErrNone(r); |
2470 test(r==KErrNone); |
2468 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2471 test(reqStat==KRequestPending); |
2469 r=file.Read(0,temp,100); |
2472 r=file.Read(0,temp,100); |
2470 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2473 test(reqStat==KRequestPending); |
2471 |
2474 |
2472 // RFile::SetAtt() of a file within the monitored directory |
2475 // RFile::SetAtt() of a file within the monitored directory |
2473 r=file.SetAtt(KEntryAttNormal,KEntryAttHidden); |
2476 r=file.SetAtt(KEntryAttNormal,KEntryAttHidden); |
2474 test_KErrNone(r); |
2477 test(r==KErrNone); |
2475 User::WaitForRequest(reqStat); |
2478 User::WaitForRequest(reqStat); |
2476 test_KErrNone(reqStat.Int()); |
2479 test(reqStat==KErrNone); |
2477 |
2480 |
2478 // RFile::SetSize() of a file within the monitored directory |
2481 // RFile::SetSize() of a file within the monitored directory |
2479 fs.NotifyChange(ENotifyAll,reqStat,path); |
2482 fs.NotifyChange(ENotifyAll,reqStat,path); |
2480 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2483 test(reqStat==KRequestPending); |
2481 r=file.SetSize(256); |
2484 r=file.SetSize(256); |
2482 test_KErrNone(r); |
2485 test(r==KErrNone); |
2483 User::WaitForRequest(reqStat); |
2486 User::WaitForRequest(reqStat); |
2484 test_KErrNone(reqStat.Int()); |
2487 test(reqStat==KErrNone); |
2485 file.Close(); |
2488 file.Close(); |
2486 |
2489 |
2487 |
2490 |
2488 // RFile::SetModified() to change modification time of a file within monitored dir |
2491 // RFile::SetModified() to change modification time of a file within monitored dir |
2489 fs.NotifyChange(ENotifyAll,reqStat,path); |
2492 fs.NotifyChange(ENotifyAll,reqStat,path); |
2490 TTime now; |
2493 TTime now; |
2491 now.HomeTime(); |
2494 now.HomeTime(); |
2492 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
2495 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
2493 test_KErrNone(r); |
2496 test(r==KErrNone); |
2494 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2497 test(reqStat==KRequestPending); |
2495 file.SetModified(now); |
2498 file.SetModified(now); |
2496 file.Close(); |
2499 file.Close(); |
2497 User::WaitForRequest(reqStat); |
2500 User::WaitForRequest(reqStat); |
2498 test_KErrNone(reqStat.Int()); |
2501 test(reqStat==KErrNone); |
2499 |
2502 |
2500 // RFs::Entry() to change a directory entry within the monitored directory |
2503 // RFs::Entry() to change a directory entry within the monitored directory |
2501 fs.NotifyChange(ENotifyAll,reqStat,path); |
2504 fs.NotifyChange(ENotifyAll,reqStat,path); |
2502 TEntry entry; |
2505 TEntry entry; |
2503 r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry); |
2506 r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),entry); |
2504 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2507 test(reqStat==KRequestPending); |
2505 now.HomeTime(); |
2508 now.HomeTime(); |
2506 r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal); |
2509 r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),now,KEntryAttHidden,KEntryAttNormal); |
2507 test_KErrNone(r); |
2510 test(r==KErrNone); |
2508 User::WaitForRequest(reqStat); |
2511 User::WaitForRequest(reqStat); |
2509 test_KErrNone(reqStat.Int()); |
2512 test(reqStat==KErrNone); |
2510 |
2513 |
2511 // RFile::Set() to change file's modification time and attributes |
2514 // RFile::Set() to change file's modification time and attributes |
2512 fs.NotifyChange(ENotifyAll,reqStat,path); |
2515 fs.NotifyChange(ENotifyAll,reqStat,path); |
2513 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
2516 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Dorothy.doc"),EFileRead|EFileWrite); |
2514 test_KErrNone(r); |
2517 test(r==KErrNone); |
2515 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2518 test(reqStat==KRequestPending); |
2516 now.HomeTime(); |
2519 now.HomeTime(); |
2517 r=file.Set(now,KEntryAttNormal,KEntryAttHidden); |
2520 r=file.Set(now,KEntryAttNormal,KEntryAttHidden); |
2518 file.Close(); |
2521 file.Close(); |
2519 User::WaitForRequest(reqStat); |
2522 User::WaitForRequest(reqStat); |
2520 test_KErrNone(reqStat.Int()); |
2523 test(reqStat==KErrNone); |
2521 |
2524 |
2522 // RFs::SetDriveName() - should be no notification ever with extended notification |
2525 // RFs::SetDriveName() - should be no notification ever with extended notification |
2523 fs.NotifyChange(ENotifyAll,reqStat,path); |
2526 fs.NotifyChange(ENotifyAll,reqStat,path); |
2524 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2527 test(reqStat==KRequestPending); |
2525 User::After(KNotifyChangeAfter); |
2528 User::After(KNotifyChangeAfter); |
2526 r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST")); |
2529 r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST")); |
2527 test_KErrNone(r); |
2530 test(r==KErrNone); |
2528 User::WaitForRequest(reqStat); |
2531 User::WaitForRequest(reqStat); |
2529 test_KErrNone(reqStat.Int()); |
2532 test(reqStat==KErrNone); |
2530 fs.NotifyChange(ENotifyEntry,reqStat,path); |
2533 fs.NotifyChange(ENotifyEntry,reqStat,path); |
2531 User::After(KNotifyChangeAfter); |
2534 User::After(KNotifyChangeAfter); |
2532 r=TheFs.SetDriveName(KDefaultDrive,_L("TEST")); |
2535 r=TheFs.SetDriveName(KDefaultDrive,_L("TEST")); |
2533 test_KErrNone(r); |
2536 test(r==KErrNone); |
2534 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2537 test(reqStat==KRequestPending); |
2535 fs.NotifyChangeCancel(reqStat); |
2538 fs.NotifyChangeCancel(reqStat); |
2536 User::WaitForRequest(reqStat); |
2539 User::WaitForRequest(reqStat); |
2537 fs.NotifyChange(ENotifyDisk,reqStat,path); |
2540 fs.NotifyChange(ENotifyDisk,reqStat,path); |
2538 User::After(KNotifyChangeAfter); |
2541 User::After(KNotifyChangeAfter); |
2539 r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE")); |
2542 r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVE")); |
2540 test_KErrNone(r); |
2543 test(r==KErrNone); |
2541 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2544 test(reqStat==KRequestPending); |
2542 fs.NotifyChangeCancel(reqStat); |
2545 fs.NotifyChangeCancel(reqStat); |
2543 User::WaitForRequest(reqStat); |
2546 User::WaitForRequest(reqStat); |
2544 test_Value(reqStat.Int(), reqStat==KErrCancel); |
2547 test(reqStat==KErrCancel); |
2545 |
2548 |
2546 |
2549 |
2547 // RFs::MkDir() |
2550 // RFs::MkDir() |
2548 fs.NotifyChange(ENotifyAll,reqStat,path); |
2551 fs.NotifyChange(ENotifyAll,reqStat,path); |
2549 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2552 test(reqStat==KRequestPending); |
2550 r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\")); |
2553 r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\")); |
2551 test_KErrNone(r); |
2554 test(r==KErrNone); |
2552 User::WaitForRequest(reqStat); |
2555 User::WaitForRequest(reqStat); |
2553 test_KErrNone(reqStat.Int()); |
2556 test(reqStat==KErrNone); |
2554 |
2557 |
2555 // RFs::RmDir() |
2558 // RFs::RmDir() |
2556 fs.NotifyChange(ENotifyAll,reqStat,path); |
2559 fs.NotifyChange(ENotifyAll,reqStat,path); |
2557 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2560 test(reqStat==KRequestPending); |
2558 r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\")); |
2561 r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\EMERALD_CITY\\")); |
2559 test_KErrNone(r); |
2562 test(r==KErrNone); |
2560 User::WaitForRequest(reqStat); |
2563 User::WaitForRequest(reqStat); |
2561 test_KErrNone(reqStat.Int()); |
2564 test(reqStat==KErrNone); |
2562 |
2565 |
2563 // RFile::Create() |
2566 // RFile::Create() |
2564 fs.NotifyChange(ENotifyAll,reqStat,path); |
2567 fs.NotifyChange(ENotifyAll,reqStat,path); |
2565 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2568 test(reqStat==KRequestPending); |
2566 r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite); |
2569 r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite); |
2567 test_KErrNone(r); |
2570 test(r==KErrNone); |
2568 User::WaitForRequest(reqStat); |
2571 User::WaitForRequest(reqStat); |
2569 test_KErrNone(reqStat.Int()); |
2572 test(reqStat==KErrNone); |
2570 file.Close(); |
2573 file.Close(); |
2571 |
2574 |
2572 // RFs::Delete() |
2575 // RFs::Delete() |
2573 fs.NotifyChange(ENotifyAll,reqStat,path); |
2576 fs.NotifyChange(ENotifyAll,reqStat,path); |
2574 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2577 test(reqStat==KRequestPending); |
2575 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat")); |
2578 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat")); |
2576 test_KErrNone(r); |
2579 test(r==KErrNone); |
2577 User::WaitForRequest(reqStat); |
2580 User::WaitForRequest(reqStat); |
2578 test_KErrNone(reqStat.Int()); |
2581 test(reqStat==KErrNone); |
2579 |
2582 |
2580 // RFile::Replace() |
2583 // RFile::Replace() |
2581 fs.NotifyChange(ENotifyAll,reqStat,path); |
2584 fs.NotifyChange(ENotifyAll,reqStat,path); |
2582 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2585 test(reqStat==KRequestPending); |
2583 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite); |
2586 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat"),EFileRead|EFileWrite); |
2584 test_KErrNone(r); |
2587 test(r==KErrNone); |
2585 User::WaitForRequest(reqStat); |
2588 User::WaitForRequest(reqStat); |
2586 test_KErrNone(reqStat.Int()); |
2589 test(reqStat==KErrNone); |
2587 file.Close(); |
2590 file.Close(); |
2588 |
2591 |
2589 // RFs::Delete() |
2592 // RFs::Delete() |
2590 fs.NotifyChange(ENotifyAll,reqStat,path); |
2593 fs.NotifyChange(ENotifyAll,reqStat,path); |
2591 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2594 test(reqStat==KRequestPending); |
2592 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat")); |
2595 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\MUNCHKINS\\Good_Witch.bat")); |
2593 test_KErrNone(r); |
2596 test(r==KErrNone); |
2594 User::WaitForRequest(reqStat); |
2597 User::WaitForRequest(reqStat); |
2595 test_KErrNone(reqStat.Int()); |
2598 test(reqStat==KErrNone); |
2596 |
2599 |
2597 // RFs::SetVolumeLabel() |
2600 // RFs::SetVolumeLabel() |
2598 // Not path specific, so all outstanding requests of correct TNotifyType are notified |
2601 // Not path specific, so all outstanding requests of correct TNotifyType are notified |
2599 fs.NotifyChange(ENotifyAll,reqStat,path); |
2602 fs.NotifyChange(ENotifyAll,reqStat,path); |
2600 TInt driveNum=CurrentDrive(); |
2603 TInt driveNum=CurrentDrive(); |
2601 TVolumeInfo volInfo; |
2604 TVolumeInfo volInfo; |
2602 TFileName currentVolName; |
2605 TFileName currentVolName; |
2603 r=TheFs.Volume(volInfo,driveNum); |
2606 r=TheFs.Volume(volInfo,driveNum); |
2604 test_KErrNone(r); |
2607 test(r==KErrNone); |
2605 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2608 test(reqStat==KRequestPending); |
2606 currentVolName=volInfo.iName; |
2609 currentVolName=volInfo.iName; |
2607 |
2610 |
2608 r=TheFs.SetVolumeLabel(_L("VOL"),driveNum); |
2611 r=TheFs.SetVolumeLabel(_L("VOL"),driveNum); |
2609 if (r==KErrNone) |
2612 if (r==KErrNone) |
2610 { |
2613 { |
2611 User::WaitForRequest(reqStat); |
2614 User::WaitForRequest(reqStat); |
2612 test_KErrNone(reqStat.Int()); |
2615 test(reqStat==KErrNone); |
2613 r=TheFs.Volume(volInfo,driveNum); |
2616 r=TheFs.Volume(volInfo,driveNum); |
2614 test_KErrNone(r); |
2617 test(r==KErrNone); |
2615 test(volInfo.iName==_L("VOL")); |
2618 test(volInfo.iName==_L("VOL")); |
2616 // Test notification occurs under ENotifyDisk |
2619 // Test notification occurs under ENotifyDisk |
2617 fs.NotifyChange(ENotifyDisk,reqStat,path); |
2620 fs.NotifyChange(ENotifyDisk,reqStat,path); |
2618 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2621 test(reqStat==KRequestPending); |
2619 r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum); |
2622 r=TheFs.SetVolumeLabel(_L("ABCDEFGHIJK"),driveNum); |
2620 test_KErrNone(r); |
2623 test(r==KErrNone); |
2621 User::WaitForRequest(reqStat); |
2624 User::WaitForRequest(reqStat); |
2622 test_KErrNone(reqStat.Int()); |
2625 test(reqStat==KErrNone); |
2623 r=TheFs.Volume(volInfo,driveNum); |
2626 r=TheFs.Volume(volInfo,driveNum); |
2624 test_KErrNone(r); |
2627 test(r==KErrNone); |
2625 |
2628 |
2626 test(volInfo.iName==_L("ABCDEFGHIJK")); |
2629 test(volInfo.iName==_L("ABCDEFGHIJK")); |
2627 |
2630 |
2628 // Test notification does not occur under ENotifyAttributes |
2631 // Test notification does not occur under ENotifyAttributes |
2629 fs.NotifyChange(ENotifyAttributes,reqStat,path); |
2632 fs.NotifyChange(ENotifyAttributes,reqStat,path); |
2630 r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum); |
2633 r=TheFs.SetVolumeLabel(_L("TROPICANA"),driveNum); |
2631 test_KErrNone(r); |
2634 test(r==KErrNone); |
2632 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2635 test(reqStat==KRequestPending); |
2633 r=TheFs.Volume(volInfo,driveNum); |
2636 r=TheFs.Volume(volInfo,driveNum); |
2634 test_KErrNone(r); |
2637 test(r==KErrNone); |
2635 |
2638 |
2636 test(volInfo.iName==_L("TROPICANA")); |
2639 test(volInfo.iName==_L("TROPICANA")); |
2637 |
2640 |
2638 fs.NotifyChangeCancel(reqStat); |
2641 fs.NotifyChangeCancel(reqStat); |
2639 User::WaitForRequest(reqStat); |
2642 User::WaitForRequest(reqStat); |
2640 test_Value(reqStat.Int(), reqStat==KErrCancel); |
2643 test(reqStat==KErrCancel); |
2641 // Test notification occurs under ENotifyEntry |
2644 // Test notification occurs under ENotifyEntry |
2642 fs.NotifyChange(ENotifyEntry,reqStat,path); |
2645 fs.NotifyChange(ENotifyEntry,reqStat,path); |
2643 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2646 test(reqStat==KRequestPending); |
2644 r=TheFs.SetVolumeLabel(currentVolName,driveNum); |
2647 r=TheFs.SetVolumeLabel(currentVolName,driveNum); |
2645 test_KErrNone(r); |
2648 test(r==KErrNone); |
2646 User::WaitForRequest(reqStat); |
2649 User::WaitForRequest(reqStat); |
2647 test_KErrNone(reqStat.Int()); |
2650 test(reqStat==KErrNone); |
2648 r=TheFs.Volume(volInfo,driveNum); |
2651 r=TheFs.Volume(volInfo,driveNum); |
2649 test_KErrNone(r); |
2652 test(r==KErrNone); |
2650 test(volInfo.iName==currentVolName); |
2653 test(volInfo.iName==currentVolName); |
2651 } |
2654 } |
2652 |
2655 |
2653 else // RFs::SetVolumeLabel() doesn't work on subst drives |
2656 else // RFs::SetVolumeLabel() doesn't work on subst drives |
2654 { |
2657 { |
2754 TFileName path4=_L("\\F32-TST\\NOTIFY\\dingo.txt"); |
2757 TFileName path4=_L("\\F32-TST\\NOTIFY\\dingo.txt"); |
2755 fs.NotifyChange(ENotifyEntry,reqStat4,path4); |
2758 fs.NotifyChange(ENotifyEntry,reqStat4,path4); |
2756 |
2759 |
2757 |
2760 |
2758 r=gSleepThread.CreateLocal(0); |
2761 r=gSleepThread.CreateLocal(0); |
2759 test_KErrNone(r); |
2762 test(r==KErrNone); |
2760 RThread thread1; |
2763 RThread thread1; |
2761 r=thread1.Create(_L("TestThread1"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5); |
2764 r=thread1.Create(_L("TestThread1"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5); |
2762 test_KErrNone(r); |
2765 test(r==KErrNone); |
2763 thread1.Resume(); |
2766 thread1.Resume(); |
2764 gSleepThread.Wait(); |
2767 gSleepThread.Wait(); |
2765 |
2768 |
2766 test_Value(status1.Int(), status1==KRequestPending); |
2769 test(status1==KRequestPending); |
2767 test_Value(status2.Int(), status2==KRequestPending); |
2770 test(status2==KRequestPending); |
2768 test_Value(status3.Int(), status3==KRequestPending); |
2771 test(status3==KRequestPending); |
2769 test_Value(status4.Int(), status4==KRequestPending); |
2772 test(status4==KRequestPending); |
2770 test_Value(status5.Int(), status5==KRequestPending); |
2773 test(status5==KRequestPending); |
2771 test_Value(status6.Int(), status6==KRequestPending); |
2774 test(status6==KRequestPending); |
2772 |
2775 |
2773 test_Value(statusExtended1.Int(), statusExtended1==KRequestPending); |
2776 test(statusExtended1==KRequestPending); |
2774 test_Value(statusExtended2.Int(), statusExtended2==KRequestPending); |
2777 test(statusExtended2==KRequestPending); |
2775 test_Value(statusExtended3.Int(), statusExtended3==KRequestPending); |
2778 test(statusExtended3==KRequestPending); |
2776 test_Value(statusExtended4.Int(), statusExtended4==KRequestPending); |
2779 test(statusExtended4==KRequestPending); |
2777 test_Value(statusExtended5.Int(), statusExtended5==KRequestPending); |
2780 test(statusExtended5==KRequestPending); |
2778 test_Value(statusExtended6.Int(), statusExtended6==KRequestPending); |
2781 test(statusExtended6==KRequestPending); |
2779 |
2782 |
2780 test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
2783 test(reqStat1==KRequestPending); |
2781 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
2784 test(reqStat2==KRequestPending); |
2782 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
2785 test(reqStat3==KRequestPending); |
2783 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
2786 test(reqStat4==KRequestPending); |
2784 |
2787 |
2785 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt")); |
2788 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt")); |
2786 test_KErrNone(r); |
2789 test(r==KErrNone); |
2787 User::WaitForRequest(reqStat1); |
2790 User::WaitForRequest(reqStat1); |
2788 test_KErrNone(reqStat1.Int()); |
2791 test(reqStat1==KErrNone); |
2789 User::WaitForRequest(status1); |
2792 User::WaitForRequest(status1); |
2790 test_KErrNone(status1.Int()); |
2793 test(status1==KErrNone); |
2791 User::WaitForRequest(status2); |
2794 User::WaitForRequest(status2); |
2792 test_KErrNone(status2.Int()); |
2795 test(status2==KErrNone); |
2793 User::WaitForRequest(status3); |
2796 User::WaitForRequest(status3); |
2794 test_KErrNone(status3.Int()); |
2797 test(status3==KErrNone); |
2795 User::WaitForRequest(status4); |
2798 User::WaitForRequest(status4); |
2796 test_KErrNone(status4.Int()); |
2799 test(status4==KErrNone); |
2797 User::WaitForRequest(status5); |
2800 User::WaitForRequest(status5); |
2798 test_KErrNone(status5.Int()); |
2801 test(status5==KErrNone); |
2799 User::WaitForRequest(status6); |
2802 User::WaitForRequest(status6); |
2800 test_KErrNone(status6.Int()); |
2803 test(status6==KErrNone); |
2801 |
2804 |
2802 User::WaitForRequest(statusExtended1); |
2805 User::WaitForRequest(statusExtended1); |
2803 test_KErrNone(statusExtended1.Int()); |
2806 test(statusExtended1==KErrNone); |
2804 User::WaitForRequest(statusExtended2); |
2807 User::WaitForRequest(statusExtended2); |
2805 test_KErrNone(statusExtended2.Int()); |
2808 test(statusExtended2==KErrNone); |
2806 User::WaitForRequest(statusExtended3); |
2809 User::WaitForRequest(statusExtended3); |
2807 test_KErrNone(statusExtended3.Int()); |
2810 test(statusExtended3==KErrNone); |
2808 User::WaitForRequest(statusExtended4); |
2811 User::WaitForRequest(statusExtended4); |
2809 test_KErrNone(statusExtended4.Int()); |
2812 test(statusExtended4==KErrNone); |
2810 User::WaitForRequest(statusExtended5); |
2813 User::WaitForRequest(statusExtended5); |
2811 test_KErrNone(statusExtended5.Int()); |
2814 test(statusExtended5==KErrNone); |
2812 User::WaitForRequest(statusExtended6); |
2815 User::WaitForRequest(statusExtended6); |
2813 test_KErrNone(statusExtended6.Int()); |
2816 test(statusExtended6==KErrNone); |
2814 |
2817 |
2815 User::WaitForRequest(reqStat2); |
2818 User::WaitForRequest(reqStat2); |
2816 test_KErrNone(reqStat2.Int()); |
2819 test(reqStat2==KErrNone); |
2817 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
2820 test(reqStat3==KRequestPending); |
2818 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
2821 test(reqStat4==KRequestPending); |
2819 fs.NotifyChangeCancel(); // Cancels both remaining notification requests |
2822 fs.NotifyChangeCancel(); // Cancels both remaining notification requests |
2820 |
2823 |
2821 User::WaitForRequest(reqStat3); |
2824 User::WaitForRequest(reqStat3); |
2822 User::WaitForRequest(reqStat4); |
2825 User::WaitForRequest(reqStat4); |
2823 |
2826 |
2824 gSleepThread.Close(); |
2827 gSleepThread.Close(); |
2825 thread1.Close(); |
2828 thread1.Close(); |
2826 |
2829 |
2827 test.Next(_L("Test reads and writes do cause notification under ENotifyAll")); |
2830 test.Next(_L("Test reads and writes do cause notification under ENotifyAll")); |
2828 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite); |
2831 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\kangaroo.txt"),EFileRead|EFileWrite); |
2829 test_KErrNone(r); |
2832 test(r==KErrNone); |
2830 file.Close(); |
2833 file.Close(); |
2831 |
2834 |
2832 fs.NotifyChange(ENotifyAll,reqStat1,path1); |
2835 fs.NotifyChange(ENotifyAll,reqStat1,path1); |
2833 fs.NotifyChange(ENotifyEntry,reqStat2,path2); |
2836 fs.NotifyChange(ENotifyEntry,reqStat2,path2); |
2834 fs.NotifyChange(ENotifyAll,reqStat3,path3); |
2837 fs.NotifyChange(ENotifyAll,reqStat3,path3); |
2835 fs.NotifyChange(ENotifyEntry,reqStat4,path4); |
2838 fs.NotifyChange(ENotifyEntry,reqStat4,path4); |
2836 test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
2839 test(reqStat1==KRequestPending); |
2837 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
2840 test(reqStat2==KRequestPending); |
2838 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
2841 test(reqStat3==KRequestPending); |
2839 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
2842 test(reqStat4==KRequestPending); |
2840 |
2843 |
2841 r=gSleepThread.CreateLocal(0); |
2844 r=gSleepThread.CreateLocal(0); |
2842 test_KErrNone(r); |
2845 test(r==KErrNone); |
2843 RThread thread2; |
2846 RThread thread2; |
2844 r=thread2.Create(_L("TestThread2"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5); |
2847 r=thread2.Create(_L("TestThread2"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5); |
2845 test_KErrNone(r); |
2848 test(r==KErrNone); |
2846 thread2.Resume(); |
2849 thread2.Resume(); |
2847 gSleepThread.Wait(); |
2850 gSleepThread.Wait(); |
2848 |
2851 |
2849 User::WaitForRequest(reqStat1); |
2852 User::WaitForRequest(reqStat1); |
2850 test_KErrNone(reqStat1.Int()); |
2853 test(reqStat1==KErrNone); |
2851 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
2854 test(reqStat2==KRequestPending); |
2852 User::WaitForRequest(reqStat3); |
2855 User::WaitForRequest(reqStat3); |
2853 test_KErrNone(reqStat3.Int()); |
2856 test(reqStat3==KErrNone); |
2854 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
2857 test(reqStat4==KRequestPending); |
2855 |
2858 |
2856 gSleepThread.Close(); |
2859 gSleepThread.Close(); |
2857 thread2.Close(); |
2860 thread2.Close(); |
2858 |
2861 |
2859 fs.NotifyChange(ENotifyAll,reqStat1,path1); |
2862 fs.NotifyChange(ENotifyAll,reqStat1,path1); |
2860 fs.NotifyChange(ENotifyAll,reqStat3,path3); |
2863 fs.NotifyChange(ENotifyAll,reqStat3,path3); |
2861 |
2864 |
2862 test_Value(reqStat1.Int(), reqStat1==KRequestPending); |
2865 test(reqStat1==KRequestPending); |
2863 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
2866 test(reqStat2==KRequestPending); |
2864 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
2867 test(reqStat3==KRequestPending); |
2865 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
2868 test(reqStat4==KRequestPending); |
2866 |
2869 |
2867 r=gSleepThread.CreateLocal(0); |
2870 r=gSleepThread.CreateLocal(0); |
2868 test_KErrNone(r); |
2871 test(r==KErrNone); |
2869 RThread thread3; |
2872 RThread thread3; |
2870 r=thread3.Create(_L("TestThread3"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5); |
2873 r=thread3.Create(_L("TestThread3"),ThreadEntryPoint,0x4000,KHeapSize,KHeapSize,(TAny*)ETest5); |
2871 test_KErrNone(r); |
2874 test(r==KErrNone); |
2872 thread3.Resume(); |
2875 thread3.Resume(); |
2873 gSleepThread.Wait(); |
2876 gSleepThread.Wait(); |
2874 |
2877 |
2875 User::WaitForRequest(reqStat1); |
2878 User::WaitForRequest(reqStat1); |
2876 test_KErrNone(reqStat1.Int()); |
2879 test(reqStat1==KErrNone); |
2877 test_Value(reqStat2.Int(), reqStat2==KRequestPending); // Monitoring with ENotifyEntry |
2880 test(reqStat2==KRequestPending); // Monitoring with ENotifyEntry |
2878 User::WaitForRequest(reqStat3); |
2881 User::WaitForRequest(reqStat3); |
2879 test_KErrNone(reqStat3.Int()); |
2882 test(reqStat3==KErrNone); |
2880 test_Value(reqStat4.Int(), reqStat4==KRequestPending); // Monitoring with ENotifyEntry |
2883 test(reqStat4==KRequestPending); // Monitoring with ENotifyEntry |
2881 |
2884 |
2882 RFs fs2; |
2885 RFs fs2; |
2883 r=fs2.Connect(); |
2886 r=fs2.Connect(); |
2884 test_KErrNone(r); |
2887 test(r==KErrNone); |
2885 r=fs2.SetSessionPath(gSessionPath); |
2888 r=fs2.SetSessionPath(gSessionPath); |
2886 test_KErrNone(r); |
2889 test(r==KErrNone); |
2887 |
2890 |
2888 TRequestStatus reqStat(KRequestPending); |
2891 TRequestStatus reqStat(KRequestPending); |
2889 fs2.NotifyChange(ENotifyEntry,reqStat); |
2892 fs2.NotifyChange(ENotifyEntry,reqStat); |
2890 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2893 test(reqStat==KRequestPending); |
2891 |
2894 |
2892 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt")); |
2895 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\kangaroo.txt")); |
2893 test_KErrNone(r); |
2896 test(r==KErrNone); |
2894 User::WaitForRequest(reqStat2); |
2897 User::WaitForRequest(reqStat2); |
2895 test_KErrNone(reqStat2.Int()); |
2898 test(reqStat2==KErrNone); |
2896 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
2899 test(reqStat4==KRequestPending); |
2897 User::WaitForRequest(reqStat); |
2900 User::WaitForRequest(reqStat); |
2898 test_KErrNone(reqStat.Int()); |
2901 test(reqStat==KErrNone); |
2899 |
2902 |
2900 fs2.NotifyChange(ENotifyAll,reqStat); |
2903 fs2.NotifyChange(ENotifyAll,reqStat); |
2901 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2904 test(reqStat==KRequestPending); |
2902 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\koala.txt")); |
2905 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\koala.txt")); |
2903 test_KErrNone(r); |
2906 test(r==KErrNone); |
2904 User::WaitForRequest(reqStat); |
2907 User::WaitForRequest(reqStat); |
2905 test_KErrNone(reqStat.Int()); |
2908 test(reqStat==KErrNone); |
2906 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
2909 test(reqStat4==KRequestPending); |
2907 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\dingo.txt")); |
2910 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\dingo.txt")); |
2908 test_KErrNone(r); |
2911 test(r==KErrNone); |
2909 User::WaitForRequest(reqStat4); |
2912 User::WaitForRequest(reqStat4); |
2910 test_KErrNone(reqStat4.Int()); |
2913 test(reqStat4==KErrNone); |
2911 |
2914 |
2912 gSleepThread.Close(); |
2915 gSleepThread.Close(); |
2913 thread3.Close(); |
2916 thread3.Close(); |
2914 fs.Close(); |
2917 fs.Close(); |
2915 } |
2918 } |
2941 TRequestStatus reqStat7(KRequestPending); |
2944 TRequestStatus reqStat7(KRequestPending); |
2942 |
2945 |
2943 |
2946 |
2944 RFile file; |
2947 RFile file; |
2945 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite); |
2948 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite); |
2946 test_KErrNone(r); |
2949 test(r==KErrNone); |
2947 |
2950 |
2948 fs.NotifyChange(ENotifyAll,reqStat,path); |
2951 fs.NotifyChange(ENotifyAll,reqStat,path); |
2949 fs.NotifyChange(ENotifyFile,reqStat2,path); |
2952 fs.NotifyChange(ENotifyFile,reqStat2,path); |
2950 fs.NotifyChange(ENotifyWrite,reqStat3,path); |
2953 fs.NotifyChange(ENotifyWrite,reqStat3,path); |
2951 fs.NotifyChange(ENotifyDir,reqStat4,path); |
2954 fs.NotifyChange(ENotifyDir,reqStat4,path); |
2952 fs.NotifyChange(ENotifyEntry,reqStat5,path); |
2955 fs.NotifyChange(ENotifyEntry,reqStat5,path); |
2953 fs.NotifyChange(ENotifyAttributes,reqStat6,path); |
2956 fs.NotifyChange(ENotifyAttributes,reqStat6,path); |
2954 fs.NotifyChange(ENotifyDisk,reqStat7,path); |
2957 fs.NotifyChange(ENotifyDisk,reqStat7,path); |
2955 |
2958 |
2956 |
2959 |
2957 test_Value(reqStat.Int(), reqStat==KRequestPending); |
2960 test(reqStat==KRequestPending); |
2958 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
2961 test(reqStat2==KRequestPending); |
2959 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
2962 test(reqStat3==KRequestPending); |
2960 User::WaitForRequest(reqStat4); |
2963 User::WaitForRequest(reqStat4); |
2961 test_Value(reqStat4.Int(), reqStat4==KErrArgument); // Cannot monitor a file with ENotifyDir |
2964 test(reqStat4==KErrArgument); // Cannot monitor a file with ENotifyDir |
2962 test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
2965 test(reqStat5==KRequestPending); |
2963 test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
2966 test(reqStat6==KRequestPending); |
2964 fs.NotifyChange(ENotifyEntry,reqStat4,path); |
2967 fs.NotifyChange(ENotifyEntry,reqStat4,path); |
2965 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
2968 test(reqStat4==KRequestPending); |
2966 |
2969 |
2967 r=file.Write(0,_L8("Pay no attention to the man behind the curtain")); |
2970 r=file.Write(0,_L8("Pay no attention to the man behind the curtain")); |
2968 file.Close(); |
2971 file.Close(); |
2969 |
2972 |
2970 User::WaitForRequest(reqStat); |
2973 User::WaitForRequest(reqStat); |
2971 test_KErrNone(reqStat.Int()); |
2974 test(reqStat==KErrNone); |
2972 test_Value(reqStat2.Int(), reqStat2==KRequestPending); // Monitoring with ENotifyFile |
2975 test(reqStat2==KRequestPending); // Monitoring with ENotifyFile |
2973 User::WaitForRequest(reqStat3); |
2976 User::WaitForRequest(reqStat3); |
2974 test_KErrNone(reqStat3.Int()); |
2977 test(reqStat3==KErrNone); |
2975 test_Value(reqStat4.Int(), reqStat4==KRequestPending); // Monitoring with ENotifyEntry |
2978 test(reqStat4==KRequestPending); // Monitoring with ENotifyEntry |
2976 test_Value(reqStat5.Int(), reqStat5==KRequestPending); |
2979 test(reqStat5==KRequestPending); |
2977 test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
2980 test(reqStat6==KRequestPending); |
2978 test_Value(reqStat7.Int(), reqStat7==KRequestPending); |
2981 test(reqStat7==KRequestPending); |
2979 fs.NotifyChangeCancel(); // Cancels all outstanding notification requests |
2982 fs.NotifyChangeCancel(); // Cancels all outstanding notification requests |
2980 |
2983 |
2981 User::WaitForRequest(reqStat2); |
2984 User::WaitForRequest(reqStat2); |
2982 test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
2985 test(reqStat2==KErrCancel); |
2983 User::WaitForRequest(reqStat4); |
2986 User::WaitForRequest(reqStat4); |
2984 test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
2987 test(reqStat4==KErrCancel); |
2985 User::WaitForRequest(reqStat5); |
2988 User::WaitForRequest(reqStat5); |
2986 test_Value(reqStat5.Int(), reqStat5==KErrCancel); |
2989 test(reqStat5==KErrCancel); |
2987 User::WaitForRequest(reqStat6); |
2990 User::WaitForRequest(reqStat6); |
2988 test_Value(reqStat6.Int(), reqStat6==KErrCancel); |
2991 test(reqStat6==KErrCancel); |
2989 User::WaitForRequest(reqStat7); |
2992 User::WaitForRequest(reqStat7); |
2990 test_Value(reqStat7.Int(), reqStat7==KErrCancel); |
2993 test(reqStat7==KErrCancel); |
2991 |
2994 |
2992 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite); |
2995 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite); |
2993 test_KErrNone(r); |
2996 test(r==KErrNone); |
2994 |
2997 |
2995 // RFile::SetAtt() of a file within the monitored directory |
2998 // RFile::SetAtt() of a file within the monitored directory |
2996 fs.NotifyChange(ENotifyAll,reqStat,path); |
2999 fs.NotifyChange(ENotifyAll,reqStat,path); |
2997 fs.NotifyChange(ENotifyFile,reqStat2,path); |
3000 fs.NotifyChange(ENotifyFile,reqStat2,path); |
2998 fs.NotifyChange(ENotifyEntry,reqStat3,path); |
3001 fs.NotifyChange(ENotifyEntry,reqStat3,path); |
2999 fs.NotifyChange(ENotifyAttributes,reqStat4,path); |
3002 fs.NotifyChange(ENotifyAttributes,reqStat4,path); |
3000 fs.NotifyChange(ENotifyDir,reqStat5,path); |
3003 fs.NotifyChange(ENotifyDir,reqStat5,path); |
3001 fs.NotifyChange(ENotifyWrite,reqStat6,path); |
3004 fs.NotifyChange(ENotifyWrite,reqStat6,path); |
3002 fs.NotifyChange(ENotifyDisk,reqStat7,path); |
3005 fs.NotifyChange(ENotifyDisk,reqStat7,path); |
3003 |
3006 |
3004 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3007 test(reqStat==KRequestPending); |
3005 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3008 test(reqStat2==KRequestPending); |
3006 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3009 test(reqStat3==KRequestPending); |
3007 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3010 test(reqStat4==KRequestPending); |
3008 User::WaitForRequest(reqStat5); |
3011 User::WaitForRequest(reqStat5); |
3009 test_Value(reqStat5.Int(), reqStat5==KErrArgument); |
3012 test(reqStat5==KErrArgument); |
3010 test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
3013 test(reqStat6==KRequestPending); |
3011 test_Value(reqStat7.Int(), reqStat7==KRequestPending); |
3014 test(reqStat7==KRequestPending); |
3012 |
3015 |
3013 test.Next(_L("RFile::SetAtt()")); |
3016 test.Next(_L("RFile::SetAtt()")); |
3014 r=file.SetAtt(KEntryAttSystem,KEntryAttNormal); |
3017 r=file.SetAtt(KEntryAttSystem,KEntryAttNormal); |
3015 test_KErrNone(r); |
3018 test(r==KErrNone); |
3016 User::WaitForRequest(reqStat); |
3019 User::WaitForRequest(reqStat); |
3017 User::WaitForRequest(reqStat4); |
3020 User::WaitForRequest(reqStat4); |
3018 test_KErrNone(reqStat.Int()); |
3021 test(reqStat==KErrNone); |
3019 test_Value(reqStat2.Int(), reqStat2==KRequestPending); // Monitoring with ENotifyFile |
3022 test(reqStat2==KRequestPending); // Monitoring with ENotifyFile |
3020 test_Value(reqStat3.Int(), reqStat3==KRequestPending); // Monitoring with ENotifyEntry |
3023 test(reqStat3==KRequestPending); // Monitoring with ENotifyEntry |
3021 test_KErrNone(reqStat4.Int()); // Monitoring a file - can't use ENotifyDir |
3024 test(reqStat4==KErrNone); // Monitoring a file - can't use ENotifyDir |
3022 test_Value(reqStat6.Int(), reqStat6==KRequestPending); |
3025 test(reqStat6==KRequestPending); |
3023 test_Value(reqStat7.Int(), reqStat7==KRequestPending); |
3026 test(reqStat7==KRequestPending); |
3024 |
3027 |
3025 fs.NotifyChange(ENotifyWrite,reqStat,path); |
3028 fs.NotifyChange(ENotifyWrite,reqStat,path); |
3026 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3029 test(reqStat==KRequestPending); |
3027 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3030 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3028 User::WaitForRequest(reqStat4); |
3031 User::WaitForRequest(reqStat4); |
3029 test_Value(reqStat4.Int(), reqStat4==KErrArgument); |
3032 test(reqStat4==KErrArgument); |
3030 r=file.SetAtt(KEntryAttNormal,KEntryAttSystem); |
3033 r=file.SetAtt(KEntryAttNormal,KEntryAttSystem); |
3031 test_KErrNone(r); |
3034 test(r==KErrNone); |
3032 test_Value(reqStat.Int(), reqStat==KRequestPending); // Monitoring with ENotifyWrite |
3035 test(reqStat==KRequestPending); // Monitoring with ENotifyWrite |
3033 fs.NotifyChangeCancel(); // Cancel outstanding notification request |
3036 fs.NotifyChangeCancel(); // Cancel outstanding notification request |
3034 |
3037 |
3035 User::WaitForRequest(reqStat); |
3038 User::WaitForRequest(reqStat); |
3036 test_Value(reqStat.Int(), reqStat==KErrCancel); |
3039 test(reqStat==KErrCancel); |
3037 User::WaitForRequest(reqStat2); |
3040 User::WaitForRequest(reqStat2); |
3038 test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
3041 test(reqStat2==KErrCancel); |
3039 User::WaitForRequest(reqStat3); |
3042 User::WaitForRequest(reqStat3); |
3040 test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
3043 test(reqStat3==KErrCancel); |
3041 User::WaitForRequest(reqStat6); |
3044 User::WaitForRequest(reqStat6); |
3042 test_Value(reqStat6.Int(), reqStat6==KErrCancel); |
3045 test(reqStat6==KErrCancel); |
3043 User::WaitForRequest(reqStat7); |
3046 User::WaitForRequest(reqStat7); |
3044 test_Value(reqStat7.Int(), reqStat7==KErrCancel); |
3047 test(reqStat7==KErrCancel); |
3045 |
3048 |
3046 fs.NotifyChange(ENotifyAll,reqStat,path); |
3049 fs.NotifyChange(ENotifyAll,reqStat,path); |
3047 fs.NotifyChange(ENotifyFile,reqStat2,path); |
3050 fs.NotifyChange(ENotifyFile,reqStat2,path); |
3048 fs.NotifyChange(ENotifyEntry,reqStat3,path); |
3051 fs.NotifyChange(ENotifyEntry,reqStat3,path); |
3049 fs.NotifyChange(ENotifyAttributes,reqStat4,path); |
3052 fs.NotifyChange(ENotifyAttributes,reqStat4,path); |
3050 |
3053 |
3051 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3054 test(reqStat==KRequestPending); |
3052 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3055 test(reqStat2==KRequestPending); |
3053 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3056 test(reqStat3==KRequestPending); |
3054 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3057 test(reqStat4==KRequestPending); |
3055 |
3058 |
3056 // RFile::SetSize() of a file within the monitored directory |
3059 // RFile::SetSize() of a file within the monitored directory |
3057 test.Next(_L("RFile::SetSize()")); |
3060 test.Next(_L("RFile::SetSize()")); |
3058 r=file.SetSize(256); |
3061 r=file.SetSize(256); |
3059 test_KErrNone(r); |
3062 test(r==KErrNone); |
3060 User::WaitForRequest(reqStat); |
3063 User::WaitForRequest(reqStat); |
3061 User::WaitForRequest(reqStat4); |
3064 User::WaitForRequest(reqStat4); |
3062 test_KErrNone(reqStat.Int()); |
3065 test(reqStat==KErrNone); |
3063 test_Value(reqStat2.Int(), reqStat2==KRequestPending); // Monitoring with ENotifyFile |
3066 test(reqStat2==KRequestPending); // Monitoring with ENotifyFile |
3064 test_Value(reqStat3.Int(), reqStat3==KRequestPending); // Monitoring with ENotifyEntry |
3067 test(reqStat3==KRequestPending); // Monitoring with ENotifyEntry |
3065 test_KErrNone(reqStat4.Int()); |
3068 test(reqStat4==KErrNone); |
3066 |
3069 |
3067 fs.NotifyChange(ENotifyWrite,reqStat,path); |
3070 fs.NotifyChange(ENotifyWrite,reqStat,path); |
3068 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3071 test(reqStat==KRequestPending); |
3069 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3072 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3070 User::WaitForRequest(reqStat4); |
3073 User::WaitForRequest(reqStat4); |
3071 test_Value(reqStat4.Int(), reqStat4==KErrArgument); |
3074 test(reqStat4==KErrArgument); |
3072 r=file.SetSize(200); |
3075 r=file.SetSize(200); |
3073 test_KErrNone(r); |
3076 test(r==KErrNone); |
3074 User::After(1000000); |
3077 User::After(1000000); |
3075 test_Value(reqStat.Int(), reqStat==KRequestPending); // Monitoring with ENotifyWrite |
3078 test(reqStat==KRequestPending); // Monitoring with ENotifyWrite |
3076 |
3079 |
3077 file.Close(); |
3080 file.Close(); |
3078 fs.NotifyChangeCancel(); // Cancels all outstanding notification requests |
3081 fs.NotifyChangeCancel(); // Cancels all outstanding notification requests |
3079 |
3082 |
3080 User::WaitForRequest(reqStat); |
3083 User::WaitForRequest(reqStat); |
3081 test_Value(reqStat.Int(), reqStat==KErrCancel); |
3084 test(reqStat==KErrCancel); |
3082 User::WaitForRequest(reqStat2); |
3085 User::WaitForRequest(reqStat2); |
3083 test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
3086 test(reqStat2==KErrCancel); |
3084 User::WaitForRequest(reqStat3); |
3087 User::WaitForRequest(reqStat3); |
3085 test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
3088 test(reqStat3==KErrCancel); |
3086 |
3089 |
3087 // RFile::Temp() to create a temp file within the monitored directory |
3090 // RFile::Temp() to create a temp file within the monitored directory |
3088 test.Next(_L("RFile::Temp()")); |
3091 test.Next(_L("RFile::Temp()")); |
3089 path=_L("\\F32-TST\\NOTIFY\\"); |
3092 path=_L("\\F32-TST\\NOTIFY\\"); |
3090 |
3093 |
3091 fs.NotifyChange(ENotifyAll,reqStat,path); |
3094 fs.NotifyChange(ENotifyAll,reqStat,path); |
3092 fs.NotifyChange(ENotifyDir,reqStat2,path); |
3095 fs.NotifyChange(ENotifyDir,reqStat2,path); |
3093 fs.NotifyChange(ENotifyEntry,reqStat3,path); |
3096 fs.NotifyChange(ENotifyEntry,reqStat3,path); |
3094 fs.NotifyChange(ENotifyAttributes,reqStat4,path); |
3097 fs.NotifyChange(ENotifyAttributes,reqStat4,path); |
3095 |
3098 |
3096 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3099 test(reqStat==KRequestPending); |
3097 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3100 test(reqStat2==KRequestPending); |
3098 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3101 test(reqStat3==KRequestPending); |
3099 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3102 test(reqStat4==KRequestPending); |
3100 |
3103 |
3101 TFileName fileName; |
3104 TFileName fileName; |
3102 r=file.Temp(TheFs,path,fileName,EFileWrite); |
3105 r=file.Temp(TheFs,path,fileName,EFileWrite); |
3103 test_KErrNone(r); |
3106 test(r==KErrNone); |
3104 User::WaitForRequest(reqStat); |
3107 User::WaitForRequest(reqStat); |
3105 test_KErrNone(reqStat.Int()); |
3108 test(reqStat==KErrNone); |
3106 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3109 test(reqStat2==KRequestPending); |
3107 test_Value(reqStat3.Int(), reqStat3==KRequestPending); // Monitoring ENotifyEntry |
3110 test(reqStat3==KRequestPending); // Monitoring ENotifyEntry |
3108 test_Value(reqStat4.Int(), reqStat4==KRequestPending); // Monitoring ENotifyAttributes |
3111 test(reqStat4==KRequestPending); // Monitoring ENotifyAttributes |
3109 file.Close(); |
3112 file.Close(); |
3110 fs.NotifyChangeCancel(); |
3113 fs.NotifyChangeCancel(); |
3111 |
3114 |
3112 User::WaitForRequest(reqStat2); |
3115 User::WaitForRequest(reqStat2); |
3113 test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
3116 test(reqStat2==KErrCancel); |
3114 User::WaitForRequest(reqStat3); |
3117 User::WaitForRequest(reqStat3); |
3115 test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
3118 test(reqStat3==KErrCancel); |
3116 User::WaitForRequest(reqStat4); |
3119 User::WaitForRequest(reqStat4); |
3117 test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
3120 test(reqStat4==KErrCancel); |
3118 |
3121 |
3119 fs.NotifyChange(ENotifyFile,reqStat,path); |
3122 fs.NotifyChange(ENotifyFile,reqStat,path); |
3120 fs.NotifyChange(ENotifyDisk,reqStat2,path); |
3123 fs.NotifyChange(ENotifyDisk,reqStat2,path); |
3121 fs.NotifyChange(ENotifyWrite,reqStat3,path); |
3124 fs.NotifyChange(ENotifyWrite,reqStat3,path); |
3122 r=file.Temp(TheFs,path,fileName,EFileWrite); |
3125 r=file.Temp(TheFs,path,fileName,EFileWrite); |
3123 test_KErrNone(r); |
3126 test(r==KErrNone); |
3124 test_Value(reqStat.Int(), reqStat==KRequestPending); // Monitoring ENotifyFile |
3127 test(reqStat==KRequestPending); // Monitoring ENotifyFile |
3125 test_Value(reqStat2.Int(), reqStat2==KRequestPending); // Monitoring ENotifyDisk |
3128 test(reqStat2==KRequestPending); // Monitoring ENotifyDisk |
3126 test_Value(reqStat3.Int(), reqStat3==KRequestPending); // Monitoring ENotifyWrite |
3129 test(reqStat3==KRequestPending); // Monitoring ENotifyWrite |
3127 file.Close(); |
3130 file.Close(); |
3128 |
3131 |
3129 fs.NotifyChangeCancel(); // Cancels all outstanding notification requests |
3132 fs.NotifyChangeCancel(); // Cancels all outstanding notification requests |
3130 |
3133 |
3131 User::WaitForRequest(reqStat); |
3134 User::WaitForRequest(reqStat); |
3132 test_Value(reqStat.Int(), reqStat==KErrCancel); |
3135 test(reqStat==KErrCancel); |
3133 User::WaitForRequest(reqStat2); |
3136 User::WaitForRequest(reqStat2); |
3134 test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
3137 test(reqStat2==KErrCancel); |
3135 User::WaitForRequest(reqStat3); |
3138 User::WaitForRequest(reqStat3); |
3136 test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
3139 test(reqStat3==KErrCancel); |
3137 |
3140 |
3138 // RFile::SetModified() to change modification time of a file within monitored dir |
3141 // RFile::SetModified() to change modification time of a file within monitored dir |
3139 test.Next(_L("RFile::SetModified()")); |
3142 test.Next(_L("RFile::SetModified()")); |
3140 path=_L("\\F32-TST\\NOTIFY\\NewFile.txt"); |
3143 path=_L("\\F32-TST\\NOTIFY\\NewFile.txt"); |
3141 fs.NotifyChange(ENotifyAll,reqStat,path); |
3144 fs.NotifyChange(ENotifyAll,reqStat,path); |
3142 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3145 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3143 fs.NotifyChange(ENotifyAttributes,reqStat3,path); |
3146 fs.NotifyChange(ENotifyAttributes,reqStat3,path); |
3144 fs.NotifyChange(ENotifyFile,reqStat4,path); |
3147 fs.NotifyChange(ENotifyFile,reqStat4,path); |
3145 |
3148 |
3146 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3149 test(reqStat==KRequestPending); |
3147 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3150 test(reqStat2==KRequestPending); |
3148 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3151 test(reqStat3==KRequestPending); |
3149 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3152 test(reqStat4==KRequestPending); |
3150 |
3153 |
3151 TTime now; |
3154 TTime now; |
3152 now.HomeTime(); |
3155 now.HomeTime(); |
3153 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite); |
3156 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite); |
3154 test_KErrNone(r); |
3157 test(r==KErrNone); |
3155 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3158 test(reqStat==KRequestPending); |
3156 file.SetModified(now); |
3159 file.SetModified(now); |
3157 file.Close(); |
3160 file.Close(); |
3158 User::WaitForRequest(reqStat); |
3161 User::WaitForRequest(reqStat); |
3159 test_KErrNone(reqStat.Int()); |
3162 test(reqStat==KErrNone); |
3160 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3163 test(reqStat2==KRequestPending); |
3161 User::WaitForRequest(reqStat3); |
3164 User::WaitForRequest(reqStat3); |
3162 test_KErrNone(reqStat3.Int()); |
3165 test(reqStat3==KErrNone); |
3163 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3166 test(reqStat4==KRequestPending); |
3164 fs.NotifyChangeCancel(); |
3167 fs.NotifyChangeCancel(); |
3165 |
3168 |
3166 User::WaitForRequest(reqStat2); |
3169 User::WaitForRequest(reqStat2); |
3167 test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
3170 test(reqStat2==KErrCancel); |
3168 User::WaitForRequest(reqStat4); |
3171 User::WaitForRequest(reqStat4); |
3169 test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
3172 test(reqStat4==KErrCancel); |
3170 |
3173 |
3171 // RFs::SetEntry() to change a directory entry within the monitored directory |
3174 // RFs::SetEntry() to change a directory entry within the monitored directory |
3172 test.Next(_L("RFs::SetEntry()")); |
3175 test.Next(_L("RFs::SetEntry()")); |
3173 TEntry entry; |
3176 TEntry entry; |
3174 fs.NotifyChange(ENotifyAll,reqStat,path); |
3177 fs.NotifyChange(ENotifyAll,reqStat,path); |
3175 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3178 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3176 fs.NotifyChange(ENotifyAttributes,reqStat3,path); |
3179 fs.NotifyChange(ENotifyAttributes,reqStat3,path); |
3177 fs.NotifyChange(ENotifyDisk,reqStat4,path); |
3180 fs.NotifyChange(ENotifyDisk,reqStat4,path); |
3178 |
3181 |
3179 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3182 test(reqStat==KRequestPending); |
3180 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3183 test(reqStat2==KRequestPending); |
3181 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3184 test(reqStat3==KRequestPending); |
3182 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3185 test(reqStat4==KRequestPending); |
3183 |
3186 |
3184 r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\NewFile.txt"),entry); |
3187 r=TheFs.Entry(_L("\\F32-TST\\NOTIFY\\NewFile.txt"),entry); |
3185 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3188 test(reqStat==KRequestPending); |
3186 now.HomeTime(); |
3189 now.HomeTime(); |
3187 r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\NewFile.txt"),now,KEntryAttHidden,KEntryAttNormal); |
3190 r=TheFs.SetEntry(_L("\\F32-TST\\NOTIFY\\NewFile.txt"),now,KEntryAttHidden,KEntryAttNormal); |
3188 test_KErrNone(r); |
3191 test(r==KErrNone); |
3189 User::WaitForRequest(reqStat); |
3192 User::WaitForRequest(reqStat); |
3190 User::WaitForRequest(reqStat3); |
3193 User::WaitForRequest(reqStat3); |
3191 test_KErrNone(reqStat.Int()); |
3194 test(reqStat==KErrNone); |
3192 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3195 test(reqStat2==KRequestPending); |
3193 test_KErrNone(reqStat3.Int()); |
3196 test(reqStat3==KErrNone); |
3194 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3197 test(reqStat4==KRequestPending); |
3195 fs.NotifyChangeCancel(); |
3198 fs.NotifyChangeCancel(); |
3196 |
3199 |
3197 User::WaitForRequest(reqStat2); |
3200 User::WaitForRequest(reqStat2); |
3198 test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
3201 test(reqStat2==KErrCancel); |
3199 User::WaitForRequest(reqStat4); |
3202 User::WaitForRequest(reqStat4); |
3200 test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
3203 test(reqStat4==KErrCancel); |
3201 |
3204 |
3202 // RFile::Set() to change file's modification time and attributes |
3205 // RFile::Set() to change file's modification time and attributes |
3203 test.Next(_L("RFile::Set()")); |
3206 test.Next(_L("RFile::Set()")); |
3204 fs.NotifyChange(ENotifyAll,reqStat,path); |
3207 fs.NotifyChange(ENotifyAll,reqStat,path); |
3205 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3208 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3206 fs.NotifyChange(ENotifyAttributes,reqStat3,path); |
3209 fs.NotifyChange(ENotifyAttributes,reqStat3,path); |
3207 fs.NotifyChange(ENotifyWrite,reqStat4,path); |
3210 fs.NotifyChange(ENotifyWrite,reqStat4,path); |
3208 |
3211 |
3209 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3212 test(reqStat==KRequestPending); |
3210 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3213 test(reqStat2==KRequestPending); |
3211 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3214 test(reqStat3==KRequestPending); |
3212 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3215 test(reqStat4==KRequestPending); |
3213 |
3216 |
3214 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite); |
3217 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileWrite); |
3215 test_KErrNone(r); |
3218 test(r==KErrNone); |
3216 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3219 test(reqStat==KRequestPending); |
3217 now.HomeTime(); |
3220 now.HomeTime(); |
3218 r=file.Set(now,KEntryAttNormal,KEntryAttHidden); |
3221 r=file.Set(now,KEntryAttNormal,KEntryAttHidden); |
3219 file.Close(); |
3222 file.Close(); |
3220 User::WaitForRequest(reqStat); |
3223 User::WaitForRequest(reqStat); |
3221 User::WaitForRequest(reqStat3); |
3224 User::WaitForRequest(reqStat3); |
3222 test_KErrNone(reqStat.Int()); |
3225 test(reqStat==KErrNone); |
3223 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3226 test(reqStat2==KRequestPending); |
3224 test_KErrNone(reqStat3.Int()); |
3227 test(reqStat3==KErrNone); |
3225 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3228 test(reqStat4==KRequestPending); |
3226 fs.NotifyChangeCancel(); |
3229 fs.NotifyChangeCancel(); |
3227 |
3230 |
3228 User::WaitForRequest(reqStat2); |
3231 User::WaitForRequest(reqStat2); |
3229 test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
3232 test(reqStat2==KErrCancel); |
3230 User::WaitForRequest(reqStat4); |
3233 User::WaitForRequest(reqStat4); |
3231 test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
3234 test(reqStat4==KErrCancel); |
3232 |
3235 |
3233 // RFs::SetDriveName() |
3236 // RFs::SetDriveName() |
3234 |
3237 |
3235 test.Next(_L("RFs::SetDriveName()")); |
3238 test.Next(_L("RFs::SetDriveName()")); |
3236 fs.NotifyChange(ENotifyAll,reqStat,path); |
3239 fs.NotifyChange(ENotifyAll,reqStat,path); |
3237 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3240 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3238 fs.NotifyChange(ENotifyDisk,reqStat3,path); |
3241 fs.NotifyChange(ENotifyDisk,reqStat3,path); |
3239 fs.NotifyChange(ENotifyAttributes,reqStat4,path); |
3242 fs.NotifyChange(ENotifyAttributes,reqStat4,path); |
3240 |
3243 |
3241 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3244 test(reqStat==KRequestPending); |
3242 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3245 test(reqStat2==KRequestPending); |
3243 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3246 test(reqStat3==KRequestPending); |
3244 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3247 test(reqStat4==KRequestPending); |
3245 User::After(KNotifyChangeAfter); |
3248 User::After(KNotifyChangeAfter); |
3246 |
3249 |
3247 r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST")); |
3250 r=TheFs.SetDriveName(KDefaultDrive,_L("DRIVETEST")); |
3248 test_KErrNone(r); |
3251 test(r==KErrNone); |
3249 User::WaitForRequest(reqStat); |
3252 User::WaitForRequest(reqStat); |
3250 test_KErrNone(reqStat.Int()); |
3253 test(reqStat==KErrNone); |
3251 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3254 test(reqStat2==KRequestPending); |
3252 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3255 test(reqStat3==KRequestPending); |
3253 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3256 test(reqStat4==KRequestPending); |
3254 fs.NotifyChangeCancel(); |
3257 fs.NotifyChangeCancel(); |
3255 |
3258 |
3256 User::WaitForRequest(reqStat2); |
3259 User::WaitForRequest(reqStat2); |
3257 test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
3260 test(reqStat2==KErrCancel); |
3258 User::WaitForRequest(reqStat3); |
3261 User::WaitForRequest(reqStat3); |
3259 test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
3262 test(reqStat3==KErrCancel); |
3260 User::WaitForRequest(reqStat4); |
3263 User::WaitForRequest(reqStat4); |
3261 test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
3264 test(reqStat4==KErrCancel); |
3262 |
3265 |
3263 // RFs::MkDir() |
3266 // RFs::MkDir() |
3264 test.Next(_L("RFs::MkDir()")); |
3267 test.Next(_L("RFs::MkDir()")); |
3265 path=_L("\\F32-TST\\NOTIFY\\"); |
3268 path=_L("\\F32-TST\\NOTIFY\\"); |
3266 |
3269 |
3267 fs.NotifyChange(ENotifyAll,reqStat,path); |
3270 fs.NotifyChange(ENotifyAll,reqStat,path); |
3268 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3271 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3269 fs.NotifyChange(ENotifyDir,reqStat3,path); |
3272 fs.NotifyChange(ENotifyDir,reqStat3,path); |
3270 fs.NotifyChange(ENotifyFile,reqStat4,path); |
3273 fs.NotifyChange(ENotifyFile,reqStat4,path); |
3271 |
3274 |
3272 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3275 test(reqStat==KRequestPending); |
3273 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3276 test(reqStat2==KRequestPending); |
3274 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3277 test(reqStat3==KRequestPending); |
3275 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3278 test(reqStat4==KRequestPending); |
3276 |
3279 |
3277 r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\")); |
3280 r=TheFs.MkDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\")); |
3278 test_KErrNone(r); |
3281 test(r==KErrNone); |
3279 User::WaitForRequest(reqStat); |
3282 User::WaitForRequest(reqStat); |
3280 User::WaitForRequest(reqStat2); |
3283 User::WaitForRequest(reqStat2); |
3281 User::WaitForRequest(reqStat3); |
3284 User::WaitForRequest(reqStat3); |
3282 test_KErrNone(reqStat.Int()); |
3285 test(reqStat==KErrNone); |
3283 test_KErrNone(reqStat2.Int()); |
3286 test(reqStat2==KErrNone); |
3284 test_KErrNone(reqStat3.Int()); |
3287 test(reqStat3==KErrNone); |
3285 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3288 test(reqStat4==KRequestPending); |
3286 |
3289 |
3287 // RFs::RmDir() |
3290 // RFs::RmDir() |
3288 test.Next(_L("RFs::RmDir()")); |
3291 test.Next(_L("RFs::RmDir()")); |
3289 fs.NotifyChange(ENotifyAll,reqStat,path); |
3292 fs.NotifyChange(ENotifyAll,reqStat,path); |
3290 fs.NotifyChange(ENotifyDir,reqStat2,path); |
3293 fs.NotifyChange(ENotifyDir,reqStat2,path); |
3291 fs.NotifyChange(ENotifyWrite,reqStat3,path); |
3294 fs.NotifyChange(ENotifyWrite,reqStat3,path); |
3292 |
3295 |
3293 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3296 test(reqStat==KRequestPending); |
3294 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3297 test(reqStat2==KRequestPending); |
3295 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3298 test(reqStat3==KRequestPending); |
3296 |
3299 |
3297 r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\")); |
3300 r=TheFs.RmDir(_L("\\F32-TST\\NOTIFY\\EMERALD_CITY\\")); |
3298 test_KErrNone(r); |
3301 test(r==KErrNone); |
3299 User::WaitForRequest(reqStat); |
3302 User::WaitForRequest(reqStat); |
3300 User::WaitForRequest(reqStat2); |
3303 User::WaitForRequest(reqStat2); |
3301 test_KErrNone(reqStat.Int()); |
3304 test(reqStat==KErrNone); |
3302 test_KErrNone(reqStat2.Int()); |
3305 test(reqStat2==KErrNone); |
3303 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3306 test(reqStat3==KRequestPending); |
3304 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3307 test(reqStat4==KRequestPending); |
3305 fs.NotifyChangeCancel(); |
3308 fs.NotifyChangeCancel(); |
3306 |
3309 |
3307 User::WaitForRequest(reqStat3); |
3310 User::WaitForRequest(reqStat3); |
3308 test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
3311 test(reqStat3==KErrCancel); |
3309 User::WaitForRequest(reqStat4); |
3312 User::WaitForRequest(reqStat4); |
3310 test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
3313 test(reqStat4==KErrCancel); |
3311 |
3314 |
3312 // RFile::Create() |
3315 // RFile::Create() |
3313 test.Next(_L("RFile::Create()")); |
3316 test.Next(_L("RFile::Create()")); |
3314 fs.NotifyChange(ENotifyAll,reqStat,path); |
3317 fs.NotifyChange(ENotifyAll,reqStat,path); |
3315 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3318 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3316 fs.NotifyChange(ENotifyDir,reqStat3,path); |
3319 fs.NotifyChange(ENotifyDir,reqStat3,path); |
3317 fs.NotifyChange(ENotifyFile,reqStat4,path); |
3320 fs.NotifyChange(ENotifyFile,reqStat4,path); |
3318 |
3321 |
3319 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3322 test(reqStat==KRequestPending); |
3320 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3323 test(reqStat2==KRequestPending); |
3321 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3324 test(reqStat3==KRequestPending); |
3322 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3325 test(reqStat4==KRequestPending); |
3323 |
3326 |
3324 r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"),EFileRead|EFileWrite); |
3327 r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"),EFileRead|EFileWrite); |
3325 test_KErrNone(r); |
3328 test(r==KErrNone); |
3326 User::WaitForRequest(reqStat); |
3329 User::WaitForRequest(reqStat); |
3327 User::WaitForRequest(reqStat2); |
3330 User::WaitForRequest(reqStat2); |
3328 User::WaitForRequest(reqStat4); |
3331 User::WaitForRequest(reqStat4); |
3329 test_KErrNone(reqStat.Int()); |
3332 test(reqStat==KErrNone); |
3330 test_KErrNone(reqStat2.Int()); |
3333 test(reqStat2==KErrNone); |
3331 test_Value(reqStat3.Int(), reqStat3==KRequestPending); // Monitoring ENotifyDir |
3334 test(reqStat3==KRequestPending); // Monitoring ENotifyDir |
3332 test_KErrNone(reqStat4.Int()); |
3335 test(reqStat4==KErrNone); |
3333 file.Close(); |
3336 file.Close(); |
3334 fs.NotifyChangeCancel(reqStat3); |
3337 fs.NotifyChangeCancel(reqStat3); |
3335 User::WaitForRequest(reqStat3); |
3338 User::WaitForRequest(reqStat3); |
3336 |
3339 |
3337 fs.NotifyChange(ENotifyAll,reqStat,path); |
3340 fs.NotifyChange(ENotifyAll,reqStat,path); |
3338 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3341 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3339 fs.NotifyChange(ENotifyDisk,reqStat3,path); |
3342 fs.NotifyChange(ENotifyDisk,reqStat3,path); |
3340 fs.NotifyChange(ENotifyWrite,reqStat4,path); |
3343 fs.NotifyChange(ENotifyWrite,reqStat4,path); |
3341 |
3344 |
3342 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3345 test(reqStat==KRequestPending); |
3343 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3346 test(reqStat2==KRequestPending); |
3344 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3347 test(reqStat3==KRequestPending); |
3345 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3348 test(reqStat4==KRequestPending); |
3346 |
3349 |
3347 r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Bad_Witch.bat"),EFileRead|EFileWrite); |
3350 r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Bad_Witch.bat"),EFileRead|EFileWrite); |
3348 test_KErrNone(r); |
3351 test(r==KErrNone); |
3349 User::WaitForRequest(reqStat); |
3352 User::WaitForRequest(reqStat); |
3350 User::WaitForRequest(reqStat2); |
3353 User::WaitForRequest(reqStat2); |
3351 test_KErrNone(reqStat.Int()); |
3354 test(reqStat==KErrNone); |
3352 test_KErrNone(reqStat2.Int()); |
3355 test(reqStat2==KErrNone); |
3353 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3356 test(reqStat3==KRequestPending); |
3354 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3357 test(reqStat4==KRequestPending); |
3355 file.Close(); |
3358 file.Close(); |
3356 fs.NotifyChangeCancel(); |
3359 fs.NotifyChangeCancel(); |
3357 |
3360 |
3358 User::WaitForRequest(reqStat3); |
3361 User::WaitForRequest(reqStat3); |
3359 test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
3362 test(reqStat3==KErrCancel); |
3360 User::WaitForRequest(reqStat4); |
3363 User::WaitForRequest(reqStat4); |
3361 test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
3364 test(reqStat4==KErrCancel); |
3362 |
3365 |
3363 // RFs::Delete() |
3366 // RFs::Delete() |
3364 test.Next(_L("RFs::Delete()")); |
3367 test.Next(_L("RFs::Delete()")); |
3365 fs.NotifyChange(ENotifyAll,reqStat,path); |
3368 fs.NotifyChange(ENotifyAll,reqStat,path); |
3366 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3369 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3367 fs.NotifyChange(ENotifyDir,reqStat3,path); |
3370 fs.NotifyChange(ENotifyDir,reqStat3,path); |
3368 fs.NotifyChange(ENotifyFile,reqStat4,path); |
3371 fs.NotifyChange(ENotifyFile,reqStat4,path); |
3369 |
3372 |
3370 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3373 test(reqStat==KRequestPending); |
3371 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3374 test(reqStat2==KRequestPending); |
3372 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3375 test(reqStat3==KRequestPending); |
3373 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3376 test(reqStat4==KRequestPending); |
3374 |
3377 |
3375 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Good_Witch.bat")); |
3378 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Good_Witch.bat")); |
3376 test_KErrNone(r); |
3379 test(r==KErrNone); |
3377 User::WaitForRequest(reqStat); |
3380 User::WaitForRequest(reqStat); |
3378 User::WaitForRequest(reqStat2); |
3381 User::WaitForRequest(reqStat2); |
3379 User::WaitForRequest(reqStat4); |
3382 User::WaitForRequest(reqStat4); |
3380 test_KErrNone(reqStat.Int()); |
3383 test(reqStat==KErrNone); |
3381 test_KErrNone(reqStat2.Int()); |
3384 test(reqStat2==KErrNone); |
3382 test_Value(reqStat3.Int(), reqStat3==KRequestPending); // Monitoring ENotifyDir |
3385 test(reqStat3==KRequestPending); // Monitoring ENotifyDir |
3383 test_KErrNone(reqStat4.Int()); |
3386 test(reqStat4==KErrNone); |
3384 fs.NotifyChangeCancel(reqStat3); |
3387 fs.NotifyChangeCancel(reqStat3); |
3385 User::WaitForRequest(reqStat3); |
3388 User::WaitForRequest(reqStat3); |
3386 test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
3389 test(reqStat3==KErrCancel); |
3387 |
3390 |
3388 fs.NotifyChange(ENotifyAll,reqStat,path); |
3391 fs.NotifyChange(ENotifyAll,reqStat,path); |
3389 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3392 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3390 fs.NotifyChange(ENotifyAttributes,reqStat3,path); |
3393 fs.NotifyChange(ENotifyAttributes,reqStat3,path); |
3391 fs.NotifyChange(ENotifyAll,reqStat4,path); |
3394 fs.NotifyChange(ENotifyAll,reqStat4,path); |
3392 |
3395 |
3393 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3396 test(reqStat==KRequestPending); |
3394 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3397 test(reqStat2==KRequestPending); |
3395 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3398 test(reqStat3==KRequestPending); |
3396 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3399 test(reqStat4==KRequestPending); |
3397 |
3400 |
3398 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Bad_Witch.bat")); |
3401 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Bad_Witch.bat")); |
3399 test_KErrNone(r); |
3402 test(r==KErrNone); |
3400 User::WaitForRequest(reqStat); |
3403 User::WaitForRequest(reqStat); |
3401 User::WaitForRequest(reqStat2); |
3404 User::WaitForRequest(reqStat2); |
3402 User::WaitForRequest(reqStat4); |
3405 User::WaitForRequest(reqStat4); |
3403 test_KErrNone(reqStat.Int()); |
3406 test(reqStat==KErrNone); |
3404 test_KErrNone(reqStat2.Int()); |
3407 test(reqStat2==KErrNone); |
3405 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3408 test(reqStat3==KRequestPending); |
3406 test_KErrNone(reqStat4.Int()); |
3409 test(reqStat4==KErrNone); |
3407 fs.NotifyChangeCancel(reqStat3); |
3410 fs.NotifyChangeCancel(reqStat3); |
3408 User::WaitForRequest(reqStat3); |
3411 User::WaitForRequest(reqStat3); |
3409 test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
3412 test(reqStat3==KErrCancel); |
3410 |
3413 |
3411 // RFile::Replace() |
3414 // RFile::Replace() |
3412 test.Next(_L("RFile::Replace()")); |
3415 test.Next(_L("RFile::Replace()")); |
3413 fs.NotifyChange(ENotifyAll,reqStat,path); |
3416 fs.NotifyChange(ENotifyAll,reqStat,path); |
3414 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3417 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3415 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3418 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3416 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3419 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3417 |
3420 |
3418 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3421 test(reqStat==KRequestPending); |
3419 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3422 test(reqStat2==KRequestPending); |
3420 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3423 test(reqStat3==KRequestPending); |
3421 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3424 test(reqStat4==KRequestPending); |
3422 |
3425 |
3423 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"),EFileRead|EFileWrite); |
3426 r=file.Replace(TheFs,_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"),EFileRead|EFileWrite); |
3424 test_KErrNone(r); |
3427 test(r==KErrNone); |
3425 User::WaitForRequest(reqStat); |
3428 User::WaitForRequest(reqStat); |
3426 User::WaitForRequest(reqStat2); |
3429 User::WaitForRequest(reqStat2); |
3427 User::WaitForRequest(reqStat3); |
3430 User::WaitForRequest(reqStat3); |
3428 test_KErrNone(reqStat.Int()); |
3431 test(reqStat==KErrNone); |
3429 test_KErrNone(reqStat2.Int()); |
3432 test(reqStat2==KErrNone); |
3430 test_KErrNone(reqStat3.Int()); |
3433 test(reqStat3==KErrNone); |
3431 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3434 test(reqStat4==KRequestPending); |
3432 file.Close(); |
3435 file.Close(); |
3433 fs.NotifyChangeCancel(); |
3436 fs.NotifyChangeCancel(); |
3434 |
3437 |
3435 test_KErrNone(reqStat.Int()); |
3438 test(reqStat==KErrNone); |
3436 test_KErrNone(reqStat2.Int()); |
3439 test(reqStat2==KErrNone); |
3437 test_KErrNone(reqStat3.Int()); |
3440 test(reqStat3==KErrNone); |
3438 User::WaitForRequest(reqStat4); |
3441 User::WaitForRequest(reqStat4); |
3439 test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
3442 test(reqStat4==KErrCancel); |
3440 |
3443 |
3441 // RFs::Delete() |
3444 // RFs::Delete() |
3442 test.Next(_L("RFs::Delete()")); |
3445 test.Next(_L("RFs::Delete()")); |
3443 path=_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"); |
3446 path=_L("\\F32-TST\\NOTIFY\\Good_Witch.bat"); |
3444 fs.NotifyChange(ENotifyAll,reqStat,path); |
3447 fs.NotifyChange(ENotifyAll,reqStat,path); |
3445 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3448 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3446 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3449 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3447 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3450 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3448 |
3451 |
3449 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3452 test(reqStat==KRequestPending); |
3450 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3453 test(reqStat2==KRequestPending); |
3451 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3454 test(reqStat3==KRequestPending); |
3452 User::WaitForRequest(reqStat4); |
3455 User::WaitForRequest(reqStat4); |
3453 test_Value(reqStat4.Int(), reqStat4==KErrArgument); |
3456 test(reqStat4==KErrArgument); |
3454 |
3457 |
3455 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Good_Witch.bat")); |
3458 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Good_Witch.bat")); |
3456 test_KErrNone(r); |
3459 test(r==KErrNone); |
3457 User::WaitForRequest(reqStat); |
3460 User::WaitForRequest(reqStat); |
3458 User::WaitForRequest(reqStat2); |
3461 User::WaitForRequest(reqStat2); |
3459 User::WaitForRequest(reqStat3); |
3462 User::WaitForRequest(reqStat3); |
3460 test_KErrNone(reqStat.Int()); |
3463 test(reqStat==KErrNone); |
3461 test_KErrNone(reqStat2.Int()); |
3464 test(reqStat2==KErrNone); |
3462 test_KErrNone(reqStat3.Int()); |
3465 test(reqStat3==KErrNone); |
3463 test_Value(reqStat4.Int(), reqStat4==KErrArgument); |
3466 test(reqStat4==KErrArgument); |
3464 |
3467 |
3465 // RFs::SetVolumeLabel() |
3468 // RFs::SetVolumeLabel() |
3466 test.Next(_L("RFs::SetVolumeLabel()")); |
3469 test.Next(_L("RFs::SetVolumeLabel()")); |
3467 path=_L("\\F32-TST\\NOTIFY\\"); |
3470 path=_L("\\F32-TST\\NOTIFY\\"); |
3468 fs.NotifyChange(ENotifyAll,reqStat,path); |
3471 fs.NotifyChange(ENotifyAll,reqStat,path); |
3565 fs.NotifyChange(ENotifyAll,reqStat,path); |
3568 fs.NotifyChange(ENotifyAll,reqStat,path); |
3566 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3569 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3567 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3570 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3568 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3571 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3569 |
3572 |
3570 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3573 test(reqStat==KRequestPending); |
3571 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3574 test(reqStat2==KRequestPending); |
3572 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3575 test(reqStat3==KRequestPending); |
3573 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3576 test(reqStat4==KRequestPending); |
3574 |
3577 |
3575 r=file.Rename(_L("\\F32-TST\\NOTIFY\\OldFile.abc")); |
3578 r=file.Rename(_L("\\F32-TST\\NOTIFY\\OldFile.abc")); |
3576 test_Value(r, r == KErrNone||r==KErrAlreadyExists); |
3579 test(r==KErrNone||r==KErrAlreadyExists); |
3577 User::WaitForRequest(reqStat); |
3580 User::WaitForRequest(reqStat); |
3578 User::WaitForRequest(reqStat2); |
3581 User::WaitForRequest(reqStat2); |
3579 User::WaitForRequest(reqStat3); |
3582 User::WaitForRequest(reqStat3); |
3580 test_KErrNone(reqStat.Int()); |
3583 test(reqStat==KErrNone); |
3581 test_KErrNone(reqStat2.Int()); |
3584 test(reqStat2==KErrNone); |
3582 test_KErrNone(reqStat3.Int()); |
3585 test(reqStat3==KErrNone); |
3583 test_Value(reqStat4.Int(), reqStat4==KRequestPending); // Monitoring ENotifyDir |
3586 test(reqStat4==KRequestPending); // Monitoring ENotifyDir |
3584 file.Close(); |
3587 file.Close(); |
3585 fs.NotifyChangeCancel(); |
3588 fs.NotifyChangeCancel(); |
3586 User::WaitForRequest(reqStat4); |
3589 User::WaitForRequest(reqStat4); |
3587 test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
3590 test(reqStat4==KErrCancel); |
3588 |
3591 |
3589 path=_L("\\F32-TST\\NOTIFY\\OldFile.abc"); |
3592 path=_L("\\F32-TST\\NOTIFY\\OldFile.abc"); |
3590 |
3593 |
3591 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\OldFile.abc"),EFileShareExclusive|EFileWrite); |
3594 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\OldFile.abc"),EFileShareExclusive|EFileWrite); |
3592 test_KErrNone(r); |
3595 test(r==KErrNone); |
3593 fs.NotifyChange(ENotifyAll,reqStat,path); |
3596 fs.NotifyChange(ENotifyAll,reqStat,path); |
3594 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3597 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3595 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3598 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3596 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3599 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3597 |
3600 |
3598 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3601 test(reqStat==KRequestPending); |
3599 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3602 test(reqStat2==KRequestPending); |
3600 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3603 test(reqStat3==KRequestPending); |
3601 User::WaitForRequest(reqStat4); |
3604 User::WaitForRequest(reqStat4); |
3602 test_Value(reqStat4.Int(), reqStat4==KErrArgument); |
3605 test(reqStat4==KErrArgument); |
3603 |
3606 |
3604 r=file.Rename(_L("\\F32-TST\\NOTIFY\\NewFile.xyz")); |
3607 r=file.Rename(_L("\\F32-TST\\NOTIFY\\NewFile.xyz")); |
3605 test_KErrNone(r); |
3608 test(r==KErrNone); |
3606 User::WaitForRequest(reqStat); |
3609 User::WaitForRequest(reqStat); |
3607 User::WaitForRequest(reqStat2); |
3610 User::WaitForRequest(reqStat2); |
3608 User::WaitForRequest(reqStat3); |
3611 User::WaitForRequest(reqStat3); |
3609 test_KErrNone(reqStat.Int()); |
3612 test(reqStat==KErrNone); |
3610 test_KErrNone(reqStat2.Int()); |
3613 test(reqStat2==KErrNone); |
3611 test_KErrNone(reqStat3.Int()); |
3614 test(reqStat3==KErrNone); |
3612 test_Value(reqStat4.Int(), reqStat4==KErrArgument); |
3615 test(reqStat4==KErrArgument); |
3613 file.Close(); |
3616 file.Close(); |
3614 |
3617 |
3615 // RFs::Rename() |
3618 // RFs::Rename() |
3616 test.Next(_L("RFs::Rename()")); |
3619 test.Next(_L("RFs::Rename()")); |
3617 path=_L("\\F32-TST\\NOTIFY\\"); |
3620 path=_L("\\F32-TST\\NOTIFY\\"); |
3618 fs.NotifyChange(ENotifyAll,reqStat,path); |
3621 fs.NotifyChange(ENotifyAll,reqStat,path); |
3619 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3622 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3620 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3623 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3621 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3624 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3622 |
3625 |
3623 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3626 test(reqStat==KRequestPending); |
3624 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3627 test(reqStat2==KRequestPending); |
3625 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3628 test(reqStat3==KRequestPending); |
3626 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3629 test(reqStat4==KRequestPending); |
3627 |
3630 |
3628 r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\NewFile.xyz"),_L("\\F32-TST\\NOTIFY\\NewerFile.cat")); |
3631 r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\NewFile.xyz"),_L("\\F32-TST\\NOTIFY\\NewerFile.cat")); |
3629 test_KErrNone(r); |
3632 test(r==KErrNone); |
3630 User::WaitForRequest(reqStat); |
3633 User::WaitForRequest(reqStat); |
3631 User::WaitForRequest(reqStat2); |
3634 User::WaitForRequest(reqStat2); |
3632 User::WaitForRequest(reqStat3); |
3635 User::WaitForRequest(reqStat3); |
3633 test_KErrNone(reqStat.Int()); |
3636 test(reqStat==KErrNone); |
3634 test_KErrNone(reqStat2.Int()); |
3637 test(reqStat2==KErrNone); |
3635 test_KErrNone(reqStat3.Int()); |
3638 test(reqStat3==KErrNone); |
3636 test_Value(reqStat4.Int(), reqStat4==KRequestPending); // Changed a file not a directory entry |
3639 test(reqStat4==KRequestPending); // Changed a file not a directory entry |
3637 fs.NotifyChangeCancel(); |
3640 fs.NotifyChangeCancel(); |
3638 |
3641 |
3639 test_KErrNone(reqStat.Int()); |
3642 test(reqStat==KErrNone); |
3640 test_KErrNone(reqStat2.Int()); |
3643 test(reqStat2==KErrNone); |
3641 test_KErrNone(reqStat3.Int()); |
3644 test(reqStat3==KErrNone); |
3642 User::WaitForRequest(reqStat4); |
3645 User::WaitForRequest(reqStat4); |
3643 test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
3646 test(reqStat4==KErrCancel); |
3644 |
3647 |
3645 path=_L("\\F32-TST\\NOTIFY\\NewerFile.cat"); |
3648 path=_L("\\F32-TST\\NOTIFY\\NewerFile.cat"); |
3646 fs.NotifyChange(ENotifyAll,reqStat,path); |
3649 fs.NotifyChange(ENotifyAll,reqStat,path); |
3647 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3650 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3648 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3651 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3649 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3652 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3650 |
3653 |
3651 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3654 test(reqStat==KRequestPending); |
3652 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3655 test(reqStat2==KRequestPending); |
3653 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3656 test(reqStat3==KRequestPending); |
3654 User::WaitForRequest(reqStat4); |
3657 User::WaitForRequest(reqStat4); |
3655 test_Value(reqStat4.Int(), reqStat4==KErrArgument); |
3658 test(reqStat4==KErrArgument); |
3656 |
3659 |
3657 r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\NewerFile.cat"),_L("\\F32-TST\\NOTIFY\\Original.dog")); |
3660 r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\NewerFile.cat"),_L("\\F32-TST\\NOTIFY\\Original.dog")); |
3658 test_KErrNone(r); |
3661 test(r==KErrNone); |
3659 User::WaitForRequest(reqStat); |
3662 User::WaitForRequest(reqStat); |
3660 User::WaitForRequest(reqStat2); |
3663 User::WaitForRequest(reqStat2); |
3661 User::WaitForRequest(reqStat3); |
3664 User::WaitForRequest(reqStat3); |
3662 test_KErrNone(reqStat.Int()); |
3665 test(reqStat==KErrNone); |
3663 test_KErrNone(reqStat2.Int()); |
3666 test(reqStat2==KErrNone); |
3664 test_KErrNone(reqStat3.Int()); |
3667 test(reqStat3==KErrNone); |
3665 |
3668 |
3666 path=_L("\\F32-TST\\NOTIFY\\"); |
3669 path=_L("\\F32-TST\\NOTIFY\\"); |
3667 fs.NotifyChange(ENotifyAll,reqStat,path); |
3670 fs.NotifyChange(ENotifyAll,reqStat,path); |
3668 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3671 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3669 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3672 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3670 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3673 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3671 |
3674 |
3672 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3675 test(reqStat==KRequestPending); |
3673 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3676 test(reqStat2==KRequestPending); |
3674 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3677 test(reqStat3==KRequestPending); |
3675 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3678 test(reqStat4==KRequestPending); |
3676 |
3679 |
3677 r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\"),_L("\\F32-TST\\NOTIFY_TEMP\\")); |
3680 r=TheFs.Rename(_L("\\F32-TST\\NOTIFY\\"),_L("\\F32-TST\\NOTIFY_TEMP\\")); |
3678 test_KErrNone(r); |
3681 test(r==KErrNone); |
3679 User::WaitForRequest(reqStat); |
3682 User::WaitForRequest(reqStat); |
3680 User::WaitForRequest(reqStat2); |
3683 User::WaitForRequest(reqStat2); |
3681 User::WaitForRequest(reqStat3); |
3684 User::WaitForRequest(reqStat3); |
3682 User::WaitForRequest(reqStat4); |
3685 User::WaitForRequest(reqStat4); |
3683 test_KErrNone(reqStat.Int()); |
3686 test(reqStat==KErrNone); |
3684 test_KErrNone(reqStat2.Int()); |
3687 test(reqStat2==KErrNone); |
3685 test_KErrNone(reqStat3.Int()); // Changed a directory entry but notified anyway despite |
3688 test(reqStat3==KErrNone); // Changed a directory entry but notified anyway despite |
3686 test_KErrNone(reqStat4.Int()); // requesting file notification only because the path we |
3689 test(reqStat4==KErrNone); // requesting file notification only because the path we |
3687 // were monitoring has changed |
3690 // were monitoring has changed |
3688 |
3691 |
3689 path=_L("\\F32-TST\\NOTIFY_TEMP\\Original.dog"); |
3692 path=_L("\\F32-TST\\NOTIFY_TEMP\\Original.dog"); |
3690 fs.NotifyChange(ENotifyAll,reqStat,path); |
3693 fs.NotifyChange(ENotifyAll,reqStat,path); |
3691 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3694 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3692 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3695 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3693 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3696 fs.NotifyChange(ENotifyDir,reqStat4,path); |
3694 |
3697 |
3695 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3698 test(reqStat==KRequestPending); |
3696 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3699 test(reqStat2==KRequestPending); |
3697 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3700 test(reqStat3==KRequestPending); |
3698 User::WaitForRequest(reqStat4); |
3701 User::WaitForRequest(reqStat4); |
3699 test_Value(reqStat4.Int(), reqStat4==KErrArgument); |
3702 test(reqStat4==KErrArgument); |
3700 |
3703 |
3701 r=TheFs.Rename(_L("\\F32-TST\\NOTIFY_TEMP\\"),_L("\\F32-TST\\NOTIFY\\")); |
3704 r=TheFs.Rename(_L("\\F32-TST\\NOTIFY_TEMP\\"),_L("\\F32-TST\\NOTIFY\\")); |
3702 test_KErrNone(r); |
3705 test(r==KErrNone); |
3703 User::WaitForRequest(reqStat); |
3706 User::WaitForRequest(reqStat); |
3704 User::WaitForRequest(reqStat2); |
3707 User::WaitForRequest(reqStat2); |
3705 User::WaitForRequest(reqStat3); |
3708 User::WaitForRequest(reqStat3); |
3706 test_KErrNone(reqStat.Int()); // Modified a directory above the level at which we |
3709 test(reqStat==KErrNone); // Modified a directory above the level at which we |
3707 test_KErrNone(reqStat2.Int()); // are monitoring for changes - we must be notified |
3710 test(reqStat2==KErrNone); // are monitoring for changes - we must be notified |
3708 test_KErrNone(reqStat3.Int()); // anyway because the path has changed |
3711 test(reqStat3==KErrNone); // anyway because the path has changed |
3709 |
3712 |
3710 fs.NotifyChange(ENotifyAll,reqStat,path); |
3713 fs.NotifyChange(ENotifyAll,reqStat,path); |
3711 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3714 test(reqStat==KRequestPending); |
3712 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3715 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3713 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3716 test(reqStat2==KRequestPending); |
3714 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3717 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3715 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3718 test(reqStat3==KRequestPending); |
3716 |
3719 |
3717 fs.NotifyChangeCancel(reqStat); |
3720 fs.NotifyChangeCancel(reqStat); |
3718 User::WaitForRequest(reqStat); |
3721 User::WaitForRequest(reqStat); |
3719 test_Value(reqStat.Int(), reqStat==KErrCancel); |
3722 test(reqStat==KErrCancel); |
3720 fs.NotifyChangeCancel(reqStat2); |
3723 fs.NotifyChangeCancel(reqStat2); |
3721 User::WaitForRequest(reqStat2); |
3724 User::WaitForRequest(reqStat2); |
3722 test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
3725 test(reqStat2==KErrCancel); |
3723 fs.NotifyChangeCancel(reqStat3); |
3726 fs.NotifyChangeCancel(reqStat3); |
3724 User::WaitForRequest(reqStat3); |
3727 User::WaitForRequest(reqStat3); |
3725 test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
3728 test(reqStat3==KErrCancel); |
3726 |
3729 |
3727 path=_L("\\F32-TST\\NOTIFY\\Original.dog"); |
3730 path=_L("\\F32-TST\\NOTIFY\\Original.dog"); |
3728 fs.NotifyChange(ENotifyAll,reqStat,path); |
3731 fs.NotifyChange(ENotifyAll,reqStat,path); |
3729 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3732 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3730 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3733 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3731 |
3734 |
3732 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3735 test(reqStat==KRequestPending); |
3733 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3736 test(reqStat2==KRequestPending); |
3734 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3737 test(reqStat3==KRequestPending); |
3735 |
3738 |
3736 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Original.dog")); |
3739 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Original.dog")); |
3737 test_KErrNone(r); |
3740 test(r==KErrNone); |
3738 User::WaitForRequest(reqStat); |
3741 User::WaitForRequest(reqStat); |
3739 User::WaitForRequest(reqStat2); |
3742 User::WaitForRequest(reqStat2); |
3740 User::WaitForRequest(reqStat3); |
3743 User::WaitForRequest(reqStat3); |
3741 test_KErrNone(reqStat.Int()); |
3744 test(reqStat==KErrNone); |
3742 test_KErrNone(reqStat2.Int()); |
3745 test(reqStat2==KErrNone); |
3743 test_KErrNone(reqStat3.Int()); |
3746 test(reqStat3==KErrNone); |
3744 |
3747 |
3745 path=_L("\\F32-TST\\NOTIFY\\"); |
3748 path=_L("\\F32-TST\\NOTIFY\\"); |
3746 fs.NotifyChange(ENotifyAll,reqStat,path); |
3749 fs.NotifyChange(ENotifyAll,reqStat,path); |
3747 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3750 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3748 fs.NotifyChange(ENotifyDir,reqStat3,path); |
3751 fs.NotifyChange(ENotifyDir,reqStat3,path); |
3749 |
3752 |
3750 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3753 test(reqStat==KRequestPending); |
3751 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3754 test(reqStat2==KRequestPending); |
3752 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3755 test(reqStat3==KRequestPending); |
3753 |
3756 |
3754 r=TheFs.Rename(_L("\\F32-TST\\"),_L("\\F32-TEST\\")); |
3757 r=TheFs.Rename(_L("\\F32-TST\\"),_L("\\F32-TEST\\")); |
3755 test_KErrNone(r); |
3758 test(r==KErrNone); |
3756 User::WaitForRequest(reqStat); |
3759 User::WaitForRequest(reqStat); |
3757 User::WaitForRequest(reqStat2); |
3760 User::WaitForRequest(reqStat2); |
3758 User::WaitForRequest(reqStat3); |
3761 User::WaitForRequest(reqStat3); |
3759 test_KErrNone(reqStat.Int()); // Modified a directory above the level at which we |
3762 test(reqStat==KErrNone); // Modified a directory above the level at which we |
3760 test_KErrNone(reqStat2.Int()); // are monitoring for changes but we receive notification |
3763 test(reqStat2==KErrNone); // are monitoring for changes but we receive notification |
3761 test_KErrNone(reqStat3.Int()); // because the notification path has been changed |
3764 test(reqStat3==KErrNone); // because the notification path has been changed |
3762 |
3765 |
3763 fs.NotifyChange(ENotifyAll,reqStat,path); |
3766 fs.NotifyChange(ENotifyAll,reqStat,path); |
3764 // Notification request is submitted, despite the subject's disappearance |
3767 // Notification request is submitted, despite the subject's disappearance |
3765 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3768 test(reqStat==KRequestPending); |
3766 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3769 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3767 // Notification request is submitted, despite the subject's disappearance |
3770 // Notification request is submitted, despite the subject's disappearance |
3768 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3771 test(reqStat2==KRequestPending); |
3769 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3772 fs.NotifyChange(ENotifyFile,reqStat3,path); |
3770 // Notification request is submitted, despite the subject's disappearance |
3773 // Notification request is submitted, despite the subject's disappearance |
3771 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3774 test(reqStat3==KRequestPending); |
3772 |
3775 |
3773 fs.NotifyChangeCancel(reqStat); |
3776 fs.NotifyChangeCancel(reqStat); |
3774 User::WaitForRequest(reqStat); |
3777 User::WaitForRequest(reqStat); |
3775 test_Value(reqStat.Int(), reqStat==KErrCancel); |
3778 test(reqStat==KErrCancel); |
3776 fs.NotifyChangeCancel(reqStat2); |
3779 fs.NotifyChangeCancel(reqStat2); |
3777 User::WaitForRequest(reqStat2); |
3780 User::WaitForRequest(reqStat2); |
3778 test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
3781 test(reqStat2==KErrCancel); |
3779 fs.NotifyChangeCancel(reqStat3); |
3782 fs.NotifyChangeCancel(reqStat3); |
3780 User::WaitForRequest(reqStat3); |
3783 User::WaitForRequest(reqStat3); |
3781 test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
3784 test(reqStat3==KErrCancel); |
3782 |
3785 |
3783 path=_L("\\F32-TEST\\NOTIFY\\"); |
3786 path=_L("\\F32-TEST\\NOTIFY\\"); |
3784 fs.NotifyChange(ENotifyAll,reqStat,path); |
3787 fs.NotifyChange(ENotifyAll,reqStat,path); |
3785 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3788 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3786 fs.NotifyChange(ENotifyDir,reqStat3,path); |
3789 fs.NotifyChange(ENotifyDir,reqStat3,path); |
3787 |
3790 |
3788 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3791 test(reqStat==KRequestPending); |
3789 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3792 test(reqStat2==KRequestPending); |
3790 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3793 test(reqStat3==KRequestPending); |
3791 |
3794 |
3792 r=TheFs.Rename(_L("\\F32-TEST\\NOTIFY\\"),_L("\\F32-TEST\\NOTIFY_CHANGED\\")); |
3795 r=TheFs.Rename(_L("\\F32-TEST\\NOTIFY\\"),_L("\\F32-TEST\\NOTIFY_CHANGED\\")); |
3793 test_KErrNone(r); |
3796 test(r==KErrNone); |
3794 |
3797 |
3795 User::WaitForRequest(reqStat); |
3798 User::WaitForRequest(reqStat); |
3796 User::WaitForRequest(reqStat2); |
3799 User::WaitForRequest(reqStat2); |
3797 User::WaitForRequest(reqStat3); |
3800 User::WaitForRequest(reqStat3); |
3798 |
3801 |
3799 test_KErrNone(reqStat.Int()); // Rename the directory we were monitoring |
3802 test(reqStat==KErrNone); // Rename the directory we were monitoring |
3800 test_KErrNone(reqStat2.Int()); |
3803 test(reqStat2==KErrNone); |
3801 test_KErrNone(reqStat3.Int()); |
3804 test(reqStat3==KErrNone); |
3802 |
3805 |
3803 // Tidy up the test directory before continuing (while testing notifications of renaming to the monitored directory) |
3806 // Tidy up the test directory before continuing (while testing notifications of renaming to the monitored directory) |
3804 |
3807 |
3805 path=_L("\\F32-TST\\NOTIFY_CHANGED\\"); |
3808 path=_L("\\F32-TST\\NOTIFY_CHANGED\\"); |
3806 fs.NotifyChange(ENotifyAll,reqStat,path); |
3809 fs.NotifyChange(ENotifyAll,reqStat,path); |
3807 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3810 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3808 fs.NotifyChange(ENotifyDir,reqStat3,path); |
3811 fs.NotifyChange(ENotifyDir,reqStat3,path); |
3809 fs.NotifyChange(ENotifyFile,reqStat4,path); |
3812 fs.NotifyChange(ENotifyFile,reqStat4,path); |
3810 |
3813 |
3811 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3814 test(reqStat==KRequestPending); |
3812 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3815 test(reqStat2==KRequestPending); |
3813 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3816 test(reqStat3==KRequestPending); |
3814 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3817 test(reqStat4==KRequestPending); |
3815 |
3818 |
3816 r=TheFs.Rename(_L("\\F32-TEST\\"),_L("\\F32-TST\\")); |
3819 r=TheFs.Rename(_L("\\F32-TEST\\"),_L("\\F32-TST\\")); |
3817 test_KErrNone(r); |
3820 test(r==KErrNone); |
3818 |
3821 |
3819 User::WaitForRequest(reqStat); |
3822 User::WaitForRequest(reqStat); |
3820 User::WaitForRequest(reqStat2); |
3823 User::WaitForRequest(reqStat2); |
3821 User::WaitForRequest(reqStat3); |
3824 User::WaitForRequest(reqStat3); |
3822 |
3825 |
3823 test_KErrNone(reqStat.Int()); // Renaming to (under) the directory we were monitoring |
3826 test(reqStat==KErrNone); // Renaming to (under) the directory we were monitoring |
3824 test_KErrNone(reqStat2.Int()); |
3827 test(reqStat2==KErrNone); |
3825 test_KErrNone(reqStat3.Int()); |
3828 test(reqStat3==KErrNone); |
3826 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3829 test(reqStat4==KRequestPending); |
3827 |
3830 |
3828 fs.NotifyChangeCancel(reqStat4); |
3831 fs.NotifyChangeCancel(reqStat4); |
3829 User::WaitForRequest(reqStat4); |
3832 User::WaitForRequest(reqStat4); |
3830 test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
3833 test(reqStat4==KErrCancel); |
3831 |
3834 |
3832 path=_L("\\F32-TST\\NOTIFY\\"); |
3835 path=_L("\\F32-TST\\NOTIFY\\"); |
3833 fs.NotifyChange(ENotifyAll,reqStat,path); |
3836 fs.NotifyChange(ENotifyAll,reqStat,path); |
3834 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3837 fs.NotifyChange(ENotifyEntry,reqStat2,path); |
3835 fs.NotifyChange(ENotifyDir,reqStat3,path); |
3838 fs.NotifyChange(ENotifyDir,reqStat3,path); |
3836 fs.NotifyChange(ENotifyFile,reqStat4,path); |
3839 fs.NotifyChange(ENotifyFile,reqStat4,path); |
3837 |
3840 |
3838 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3841 test(reqStat==KRequestPending); |
3839 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3842 test(reqStat2==KRequestPending); |
3840 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3843 test(reqStat3==KRequestPending); |
3841 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3844 test(reqStat4==KRequestPending); |
3842 |
3845 |
3843 r=TheFs.Rename(_L("\\F32-TST\\NOTIFY_CHANGED\\"),_L("\\F32-TST\\NOTIFY\\")); |
3846 r=TheFs.Rename(_L("\\F32-TST\\NOTIFY_CHANGED\\"),_L("\\F32-TST\\NOTIFY\\")); |
3844 test_KErrNone(r); |
3847 test(r==KErrNone); |
3845 |
3848 |
3846 User::WaitForRequest(reqStat); |
3849 User::WaitForRequest(reqStat); |
3847 User::WaitForRequest(reqStat2); |
3850 User::WaitForRequest(reqStat2); |
3848 User::WaitForRequest(reqStat3); |
3851 User::WaitForRequest(reqStat3); |
3849 |
3852 |
3850 test_KErrNone(reqStat.Int()); // Renaming to the directory we were monitoring |
3853 test(reqStat==KErrNone); // Renaming to the directory we were monitoring |
3851 test_KErrNone(reqStat2.Int()); |
3854 test(reqStat2==KErrNone); |
3852 test_KErrNone(reqStat3.Int()); |
3855 test(reqStat3==KErrNone); |
3853 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3856 test(reqStat4==KRequestPending); |
3854 |
3857 |
3855 fs.NotifyChangeCancel(reqStat4); |
3858 fs.NotifyChangeCancel(reqStat4); |
3856 User::WaitForRequest(reqStat4); |
3859 User::WaitForRequest(reqStat4); |
3857 test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
3860 test(reqStat4==KErrCancel); |
3858 |
3861 |
3859 // Test combinations of notify types |
3862 // Test combinations of notify types |
3860 test.Next(_L("Test combinations of notify types")); |
3863 test.Next(_L("Test combinations of notify types")); |
3861 |
3864 |
3862 path=_L("\\F32-TST\\NOTIFY\\"); |
3865 path=_L("\\F32-TST\\NOTIFY\\"); |
3863 fs.NotifyChange(ENotifyAll,reqStat,path); |
3866 fs.NotifyChange(ENotifyAll,reqStat,path); |
3864 fs.NotifyChange((TNotifyType)(KGenericEntryChange|ENotifyAttributes),reqStat2,path); |
3867 fs.NotifyChange((TNotifyType)(KGenericEntryChange|ENotifyAttributes),reqStat2,path); |
3865 fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyFile),reqStat3,path); |
3868 fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyFile),reqStat3,path); |
3866 fs.NotifyChange((TNotifyType)(ENotifyDisk|ENotifyAttributes),reqStat4,path); |
3869 fs.NotifyChange((TNotifyType)(ENotifyDisk|ENotifyAttributes),reqStat4,path); |
3867 |
3870 |
3868 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3871 test(reqStat==KRequestPending); |
3869 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3872 test(reqStat2==KRequestPending); |
3870 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3873 test(reqStat3==KRequestPending); |
3871 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3874 test(reqStat4==KRequestPending); |
3872 |
3875 |
3873 r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite); |
3876 r=file.Create(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite); |
3874 test_KErrNone(r); |
3877 test(r==KErrNone); |
3875 User::WaitForRequest(reqStat); |
3878 User::WaitForRequest(reqStat); |
3876 User::WaitForRequest(reqStat2); |
3879 User::WaitForRequest(reqStat2); |
3877 User::WaitForRequest(reqStat3); |
3880 User::WaitForRequest(reqStat3); |
3878 test_KErrNone(reqStat.Int()); |
3881 test(reqStat==KErrNone); |
3879 test_KErrNone(reqStat2.Int()); |
3882 test(reqStat2==KErrNone); |
3880 test_KErrNone(reqStat3.Int()); |
3883 test(reqStat3==KErrNone); |
3881 test_Value(reqStat4.Int(), reqStat4==KRequestPending); // Monitoring ENotifyAttributes|ENotifyDisk |
3884 test(reqStat4==KRequestPending); // Monitoring ENotifyAttributes|ENotifyDisk |
3882 file.Close(); |
3885 file.Close(); |
3883 fs.NotifyChangeCancel(reqStat4); |
3886 fs.NotifyChangeCancel(reqStat4); |
3884 User::WaitForRequest(reqStat4); |
3887 User::WaitForRequest(reqStat4); |
3885 test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
3888 test(reqStat4==KErrCancel); |
3886 |
3889 |
3887 // RFile::SetModified() |
3890 // RFile::SetModified() |
3888 fs.NotifyChange(ENotifyAll,reqStat,path); |
3891 fs.NotifyChange(ENotifyAll,reqStat,path); |
3889 fs.NotifyChange((TNotifyType)(KGenericEntryChange|ENotifyAttributes),reqStat2,path); |
3892 fs.NotifyChange((TNotifyType)(KGenericEntryChange|ENotifyAttributes),reqStat2,path); |
3890 fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyFile),reqStat3,path); |
3893 fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyFile),reqStat3,path); |
3891 fs.NotifyChange((TNotifyType)(ENotifyDisk|ENotifyAttributes),reqStat4,path); |
3894 fs.NotifyChange((TNotifyType)(ENotifyDisk|ENotifyAttributes),reqStat4,path); |
3892 |
3895 |
3893 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3896 test(reqStat==KRequestPending); |
3894 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3897 test(reqStat2==KRequestPending); |
3895 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3898 test(reqStat3==KRequestPending); |
3896 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3899 test(reqStat4==KRequestPending); |
3897 |
3900 |
3898 TTime nowTime; |
3901 TTime nowTime; |
3899 nowTime.HomeTime(); |
3902 nowTime.HomeTime(); |
3900 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite); |
3903 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite); |
3901 test_KErrNone(r); |
3904 test(r==KErrNone); |
3902 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3905 test(reqStat==KRequestPending); |
3903 file.SetModified(now); |
3906 file.SetModified(now); |
3904 file.Close(); |
3907 file.Close(); |
3905 User::WaitForRequest(reqStat); |
3908 User::WaitForRequest(reqStat); |
3906 User::WaitForRequest(reqStat2); |
3909 User::WaitForRequest(reqStat2); |
3907 User::WaitForRequest(reqStat4); |
3910 User::WaitForRequest(reqStat4); |
3908 test_KErrNone(reqStat.Int()); |
3911 test(reqStat==KErrNone); |
3909 test_KErrNone(reqStat2.Int()); |
3912 test(reqStat2==KErrNone); |
3910 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3913 test(reqStat3==KRequestPending); |
3911 test_KErrNone(reqStat4.Int()); |
3914 test(reqStat4==KErrNone); |
3912 fs.NotifyChangeCancel(); |
3915 fs.NotifyChangeCancel(); |
3913 User::WaitForRequest(reqStat3); |
3916 User::WaitForRequest(reqStat3); |
3914 test_Value(reqStat3.Int(), reqStat3==KErrCancel); |
3917 test(reqStat3==KErrCancel); |
3915 |
3918 |
3916 // RFile::Write() |
3919 // RFile::Write() |
3917 fs.NotifyChange(ENotifyAll,reqStat,path); |
3920 fs.NotifyChange(ENotifyAll,reqStat,path); |
3918 fs.NotifyChange((TNotifyType)(KGenericEntryChange|ENotifyAttributes),reqStat2,path); |
3921 fs.NotifyChange((TNotifyType)(KGenericEntryChange|ENotifyAttributes),reqStat2,path); |
3919 fs.NotifyChange((TNotifyType)(ENotifyFile|ENotifyWrite),reqStat3,path); |
3922 fs.NotifyChange((TNotifyType)(ENotifyFile|ENotifyWrite),reqStat3,path); |
3920 fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyWrite),reqStat4,path); |
3923 fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyWrite),reqStat4,path); |
3921 |
3924 |
3922 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3925 test(reqStat==KRequestPending); |
3923 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3926 test(reqStat2==KRequestPending); |
3924 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3927 test(reqStat3==KRequestPending); |
3925 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3928 test(reqStat4==KRequestPending); |
3926 |
3929 |
3927 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite); |
3930 r=file.Open(TheFs,_L("\\F32-TST\\NOTIFY\\Munchkin.msg"),EFileRead|EFileWrite); |
3928 test_KErrNone(r); |
3931 test(r==KErrNone); |
3929 r=file.Write(0,_L8("Pay no attention to the man behind the curtain")); |
3932 r=file.Write(0,_L8("Pay no attention to the man behind the curtain")); |
3930 file.Close(); |
3933 file.Close(); |
3931 User::WaitForRequest(reqStat); |
3934 User::WaitForRequest(reqStat); |
3932 User::WaitForRequest(reqStat3); |
3935 User::WaitForRequest(reqStat3); |
3933 User::WaitForRequest(reqStat4); |
3936 User::WaitForRequest(reqStat4); |
3934 test_KErrNone(reqStat.Int()); |
3937 test(reqStat==KErrNone); |
3935 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3938 test(reqStat2==KRequestPending); |
3936 test_KErrNone(reqStat3.Int()); |
3939 test(reqStat3==KErrNone); |
3937 test_KErrNone(reqStat4.Int()); |
3940 test(reqStat4==KErrNone); |
3938 fs.NotifyChangeCancel(reqStat2); // Cancels all outstanding notification requests |
3941 fs.NotifyChangeCancel(reqStat2); // Cancels all outstanding notification requests |
3939 User::WaitForRequest(reqStat2); |
3942 User::WaitForRequest(reqStat2); |
3940 test_Value(reqStat2.Int(), reqStat2==KErrCancel); |
3943 test(reqStat2==KErrCancel); |
3941 |
3944 |
3942 // RFs::Delete() |
3945 // RFs::Delete() |
3943 test.Next(_L("RFs::Delete()")); |
3946 test.Next(_L("RFs::Delete()")); |
3944 fs.NotifyChange(ENotifyAll,reqStat,path); |
3947 fs.NotifyChange(ENotifyAll,reqStat,path); |
3945 fs.NotifyChange((TNotifyType)(KGenericEntryChange|ENotifyAttributes),reqStat2,path); |
3948 fs.NotifyChange((TNotifyType)(KGenericEntryChange|ENotifyAttributes),reqStat2,path); |
3946 fs.NotifyChange((TNotifyType)(ENotifyFile|ENotifyWrite),reqStat3,path); |
3949 fs.NotifyChange((TNotifyType)(ENotifyFile|ENotifyWrite),reqStat3,path); |
3947 fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyWrite),reqStat4,path); |
3950 fs.NotifyChange((TNotifyType)(ENotifyDir|ENotifyWrite),reqStat4,path); |
3948 |
3951 |
3949 test_Value(reqStat.Int(), reqStat==KRequestPending); |
3952 test(reqStat==KRequestPending); |
3950 test_Value(reqStat2.Int(), reqStat2==KRequestPending); |
3953 test(reqStat2==KRequestPending); |
3951 test_Value(reqStat3.Int(), reqStat3==KRequestPending); |
3954 test(reqStat3==KRequestPending); |
3952 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3955 test(reqStat4==KRequestPending); |
3953 |
3956 |
3954 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Munchkin.msg")); |
3957 r=TheFs.Delete(_L("\\F32-TST\\NOTIFY\\Munchkin.msg")); |
3955 test_KErrNone(r); |
3958 test(r==KErrNone); |
3956 User::WaitForRequest(reqStat); |
3959 User::WaitForRequest(reqStat); |
3957 User::WaitForRequest(reqStat2); |
3960 User::WaitForRequest(reqStat2); |
3958 User::WaitForRequest(reqStat3); |
3961 User::WaitForRequest(reqStat3); |
3959 test_KErrNone(reqStat.Int()); |
3962 test(reqStat==KErrNone); |
3960 test_KErrNone(reqStat2.Int()); |
3963 test(reqStat2==KErrNone); |
3961 test_KErrNone(reqStat3.Int()); |
3964 test(reqStat3==KErrNone); |
3962 test_Value(reqStat4.Int(), reqStat4==KRequestPending); |
3965 test(reqStat4==KRequestPending); |
3963 fs.NotifyChangeCancel(reqStat4); |
3966 fs.NotifyChangeCancel(reqStat4); |
3964 User::WaitForRequest(reqStat4); |
3967 User::WaitForRequest(reqStat4); |
3965 test_Value(reqStat4.Int(), reqStat4==KErrCancel); |
3968 test(reqStat4==KErrCancel); |
3966 |
3969 |
3967 fs.Close(); |
3970 fs.Close(); |
3968 } |
3971 } |
3969 |
3972 |
3970 #if defined __EPOC32__ && defined __INCLUDE_MANUAL_TESTS__ |
3973 #if defined __EPOC32__ && defined __INCLUDE_MANUAL_TESTS__ |
4053 MakeFile(_L("\\F32-TST\\NOTIFY\\NewFile.Txt")); |
4056 MakeFile(_L("\\F32-TST\\NOTIFY\\NewFile.Txt")); |
4054 |
4057 |
4055 test.Next(_L("Test original behaviour of asynchronous read API")); |
4058 test.Next(_L("Test original behaviour of asynchronous read API")); |
4056 RFile reader; |
4059 RFile reader; |
4057 TInt r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileShareAny); |
4060 TInt r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileShareAny); |
4058 test_KErrNone(r); |
4061 test(r==KErrNone); |
4059 TBuf8<596> readBuf; |
4062 TBuf8<596> readBuf; |
4060 reader.Read(0, readBuf, 100, readStat1); |
4063 reader.Read(0, readBuf, 100, readStat1); |
4061 User::WaitForRequest(readStat1); |
4064 User::WaitForRequest(readStat1); |
4062 test_KErrNone(readStat1.Int()); |
4065 test(readStat1==KErrNone); |
4063 test_Equal(0, readBuf.Length()); |
4066 test(readBuf.Length()==0); |
4064 reader.Close(); |
4067 reader.Close(); |
4065 |
4068 |
4066 test.Next(_L("Test asynchronous read fails in EFileShareExclusive mode")); |
4069 test.Next(_L("Test asynchronous read fails in EFileShareExclusive mode")); |
4067 r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareExclusive); |
4070 r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareExclusive); |
4068 test_Value(r, r == KErrArgument); |
4071 test(r==KErrArgument); |
4069 |
4072 |
4070 test.Next(_L("Test asynchronous read fails in EFileShareReadersOnly mode")); |
4073 test.Next(_L("Test asynchronous read fails in EFileShareReadersOnly mode")); |
4071 r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareReadersOnly); |
4074 r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareReadersOnly); |
4072 test_Value(r, r == KErrArgument); |
4075 test(r==KErrArgument); |
4073 |
4076 |
4074 test.Next(_L("Test asynchronous read is cancelled when file is closed")); |
4077 test.Next(_L("Test asynchronous read is cancelled when file is closed")); |
4075 r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny); |
4078 r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny); |
4076 test_KErrNone(r); |
4079 test(r==KErrNone); |
4077 reader.Read(0, readBuf, 100, readStat1); |
4080 reader.Read(0, readBuf, 100, readStat1); |
4078 test_Value(readStat1.Int(), readStat1==KRequestPending); |
4081 test(readStat1==KRequestPending); |
4079 reader.Close(); |
4082 reader.Close(); |
4080 User::WaitForRequest(readStat1); |
4083 User::WaitForRequest(readStat1); |
4081 test_Value(readStat1.Int(), readStat1==KErrCancel); |
4084 test(readStat1==KErrCancel); |
4082 |
4085 |
4083 test.Next(_L("Test asynchronous read can be cancelled")); |
4086 test.Next(_L("Test asynchronous read can be cancelled")); |
4084 r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny); |
4087 r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny); |
4085 test_KErrNone(r); |
4088 test(r==KErrNone); |
4086 reader.Read(0, readBuf, 100, readStat1); |
4089 reader.Read(0, readBuf, 100, readStat1); |
4087 test_Value(readStat1.Int(), readStat1==KRequestPending); |
4090 test(readStat1==KRequestPending); |
4088 reader.ReadCancel(readStat1); |
4091 reader.ReadCancel(readStat1); |
4089 User::WaitForRequest(readStat1); |
4092 User::WaitForRequest(readStat1); |
4090 test_Value(readStat1.Int(), readStat1==KErrCancel); |
4093 test(readStat1==KErrCancel); |
4091 reader.Close(); |
4094 reader.Close(); |
4092 |
4095 |
4093 // DEF105438: File server thread safety issues |
4096 // DEF105438: File server thread safety issues |
4094 // Up the priority of this thread so that we can cancel the request before the drive thread |
4097 // Up the priority of this thread so that we can cancel the request before the drive thread |
4095 // runs (to test whether cancelling still works...) |
4098 // runs (to test whether cancelling still works...) |
4096 test.Next(_L("Test asynchronous read is cancelled when running at high priority")); |
4099 test.Next(_L("Test asynchronous read is cancelled when running at high priority")); |
4097 r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny); |
4100 r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileShareAny); |
4098 test_KErrNone(r); |
4101 test(r==KErrNone); |
4099 RThread thisThread; |
4102 RThread thisThread; |
4100 thisThread.SetPriority(EPriorityRealTime); |
4103 thisThread.SetPriority(EPriorityRealTime); |
4101 reader.Read(0, readBuf, 100, readStat1); |
4104 reader.Read(0, readBuf, 100, readStat1); |
4102 test_Value(readStat1.Int(), readStat1==KRequestPending); |
4105 test(readStat1==KRequestPending); |
4103 reader.ReadCancel(readStat1); |
4106 reader.ReadCancel(readStat1); |
4104 test.Printf(_L("readStat1 %d"), readStat1.Int()); |
4107 test.Printf(_L("readStat1 %d"), readStat1.Int()); |
4105 User::WaitForRequest(readStat1); |
4108 User::WaitForRequest(readStat1); |
4106 test_Value(readStat1.Int(), readStat1==KErrCancel); |
4109 test(readStat1==KErrCancel); |
4107 reader.Close(); |
4110 reader.Close(); |
4108 thisThread.SetPriority(EPriorityNormal); |
4111 thisThread.SetPriority(EPriorityNormal); |
4109 |
4112 |
4110 test.Next(_L("Test asynchronous read is notified due to RFile::SetSize()")); |
4113 test.Next(_L("Test asynchronous read is notified due to RFile::SetSize()")); |
4111 r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny); |
4114 r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny); |
4112 test_KErrNone(r); |
4115 test(r==KErrNone); |
4113 reader.Read(0, readBuf, 100, readStat1); |
4116 reader.Read(0, readBuf, 100, readStat1); |
4114 test_Value(readStat1.Int(), readStat1==KRequestPending); |
4117 test(readStat1==KRequestPending); |
4115 r = reader.SetSize(100); |
4118 r = reader.SetSize(100); |
4116 test_KErrNone(r); |
4119 test(r==KErrNone); |
4117 User::WaitForRequest(readStat1); |
4120 User::WaitForRequest(readStat1); |
4118 test_KErrNone(readStat1.Int()); |
4121 test(readStat1==KErrNone); |
4119 test_Equal(100, readBuf.Length()); |
4122 test(readBuf.Length() == 100); |
4120 r=reader.SetSize(0); |
4123 r=reader.SetSize(0); |
4121 test_KErrNone(r); |
4124 test(r==KErrNone); |
4122 reader.Close(); |
4125 reader.Close(); |
4123 |
4126 |
4124 test.Next(_L("Test asynchronous read is notified due to RFile::Write()")); |
4127 test.Next(_L("Test asynchronous read is notified due to RFile::Write()")); |
4125 r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny); |
4128 r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny); |
4126 test_KErrNone(r); |
4129 test(r==KErrNone); |
4127 reader.Read(0, readBuf, 26, readStat1); |
4130 reader.Read(0, readBuf, 26, readStat1); |
4128 test_Value(readStat1.Int(), readStat1==KRequestPending); |
4131 test(readStat1==KRequestPending); |
4129 RFile writer; |
4132 RFile writer; |
4130 r=writer.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileWrite|EFileShareAny); |
4133 r=writer.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileWrite|EFileShareAny); |
4131 writer.Write(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); |
4134 writer.Write(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); |
4132 User::WaitForRequest(readStat1); |
4135 User::WaitForRequest(readStat1); |
4133 test_KErrNone(readStat1.Int()); |
4136 test(readStat1==KErrNone); |
4134 test_Equal(26, readBuf.Length()); |
4137 test(readBuf.Length() == 26); |
4135 reader.Close(); |
4138 reader.Close(); |
4136 writer.Close(); |
4139 writer.Close(); |
4137 |
4140 |
4138 test.Next(_L("Test multiple asynchronous readers notified from separate thread")); |
4141 test.Next(_L("Test multiple asynchronous readers notified from separate thread")); |
4139 r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny); |
4142 r=reader.Open(TheFs,_L("\\F32-TST\\NOTIFY\\NewFile.txt"),EFileRead|EFileReadAsyncAll|EFileWrite|EFileShareAny); |
4140 test_KErrNone(r); |
4143 test(r==KErrNone); |
4141 r=reader.SetSize(0); |
4144 r=reader.SetSize(0); |
4142 test_KErrNone(r); |
4145 test(r==KErrNone); |
4143 const TInt KReadLen = 26; |
4146 const TInt KReadLen = 26; |
4144 test.Printf(_L(">Read%d[%d]\n"), 0, KReadLen); |
4147 test.Printf(_L(">Read%d[%d]\n"), 0, KReadLen); |
4145 reader.Read(0, readBuf, KReadLen, readStat1); |
4148 reader.Read(0, readBuf, KReadLen, readStat1); |
4146 TBuf8<596> readBuf2; |
4149 TBuf8<596> readBuf2; |
4147 test.Printf(_L(">Read%d[%d]\n"), 1, KReadLen); |
4150 test.Printf(_L(">Read%d[%d]\n"), 1, KReadLen); |
4148 reader.Read(KReadLen, readBuf2, KReadLen, readStat2); |
4151 reader.Read(KReadLen, readBuf2, KReadLen, readStat2); |
4149 test_Value(readStat1.Int(), readStat1==KRequestPending); |
4152 test(readStat1==KRequestPending); |
4150 test_Value(readStat2.Int(), readStat2==KRequestPending); |
4153 test(readStat2==KRequestPending); |
4151 |
4154 |
4152 RThread thread; |
4155 RThread thread; |
4153 r=thread.Create(_L("MyThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest12); |
4156 r=thread.Create(_L("MyThread"),ThreadEntryPoint,KDefaultStackSize,KHeapSize,KHeapSize,(TAny*)ETest12); |
4154 test_KErrNone(r); |
4157 test(r==KErrNone); |
4155 thread.Logon(thrdStat); |
4158 thread.Logon(thrdStat); |
4156 thread.Resume(); |
4159 thread.Resume(); |
4157 thread.Close(); |
4160 thread.Close(); |
4158 |
4161 |
4159 RTimer timer; |
4162 RTimer timer; |
4160 TRequestStatus timerStat(KRequestPending); |
4163 TRequestStatus timerStat(KRequestPending); |
4161 timer.CreateLocal(); |
4164 timer.CreateLocal(); |
4162 timer.After(timerStat, 30000000); // 30 seconds timeout (the following async test should take 10 seconds) |
4165 timer.After(timerStat, 30000000); // 30 seconds timeout (the following async test should take 10 seconds) |
4163 test_Value(timerStat.Int(), timerStat==KRequestPending); |
4166 test(timerStat==KRequestPending); |
4164 |
4167 |
4165 #define ODDPASS (pass&0x01) |
4168 #define ODDPASS (pass&0x01) |
4166 #define REQSTAT (ODDPASS ? readStat2 : readStat1) |
4169 #define REQSTAT (ODDPASS ? readStat2 : readStat1) |
4167 #define PENDSTAT (ODDPASS ? readStat1 : readStat2) |
4170 #define PENDSTAT (ODDPASS ? readStat1 : readStat2) |
4168 #define COMPLEN (ODDPASS ? KReadLen : (pass+1)*KReadLen) |
4171 #define COMPLEN (ODDPASS ? KReadLen : (pass+1)*KReadLen) |