1694 r=TheFs.Delete(KFileFiller); |
1694 r=TheFs.Delete(KFileFiller); |
1695 test(r==KErrNone); |
1695 test(r==KErrNone); |
1696 |
1696 |
1697 } |
1697 } |
1698 |
1698 |
|
1699 //------------------------------------------------------------------------------------------------- |
|
1700 // Test the fix for: |
|
1701 // ou1cimx#410349 Not getting any Notification from RFs::NotifyDiskSpace() for E and F drive when when tested multiple |
|
1702 // |
|
1703 // Action: Enable a plugin to intercept RFs::Delete, and test RFs::Delet can still trigger disk space |
|
1704 // notification |
|
1705 //------------------------------------------------------------------------------------------------- |
|
1706 |
|
1707 _LIT(KPreModifierPluginFileName,"premodifier_plugin"); |
|
1708 _LIT(KPreModifierPluginName,"PreModifierPlugin"); |
|
1709 const TUint KTestFileSize = KKilo * 100; |
|
1710 |
|
1711 #define SAFETEST(a) if(a != KErrNone)\ |
|
1712 {\ |
|
1713 TheFs.DismountPlugin(KPreModifierPluginName);\ |
|
1714 TheFs.RemovePlugin(KPreModifierPluginName);\ |
|
1715 test(a == KErrNone);\ |
|
1716 } |
|
1717 |
|
1718 TInt PluginTestThreadFunction(TAny*) |
|
1719 { |
|
1720 RTest test(_L("PluginTestThreadFunction")); |
|
1721 RFs fs; |
|
1722 fs.Connect(); |
|
1723 |
|
1724 TInt r = fs.SetSessionPath(gSessionPath); |
|
1725 test(r == KErrNone); |
|
1726 |
|
1727 RFile file; |
|
1728 r = file.Create(fs, KTestFile1, EFileShareAny|EFileWrite); |
|
1729 test(r == KErrNone); |
|
1730 r = file.SetSize(KTestFileSize); |
|
1731 test(r == KErrNone); |
|
1732 file.Close(); |
|
1733 |
|
1734 User::After(5000000); // wait for 5 seconds, to ensure first notification received. |
|
1735 |
|
1736 r = fs.Delete(KTestFile1); |
|
1737 test(r == KErrNone); |
|
1738 |
|
1739 fs.Close(); |
|
1740 return KErrNone; |
|
1741 } |
|
1742 |
|
1743 void TestDiskSpaceNotifyWithPlugin() |
|
1744 { |
|
1745 test.Next(_L("Test Disk Space Notify With Plugin")); |
|
1746 |
|
1747 TInt drive; |
|
1748 TInt r = RFs::CharToDrive(gSessionPath[0],drive); |
|
1749 SAFETEST(r); |
|
1750 Format(drive); |
|
1751 |
|
1752 r = TheFs.MkDirAll(gSessionPath); |
|
1753 SAFETEST(r); |
|
1754 |
|
1755 r = TheFs.AddPlugin(KPreModifierPluginFileName); |
|
1756 SAFETEST(r); |
|
1757 |
|
1758 r = TheFs.MountPlugin(KPreModifierPluginName); |
|
1759 SAFETEST(r); |
|
1760 |
|
1761 TInt64 free = FreeDiskSpace(drive); |
|
1762 TInt64 threshold = free - KTestFileSize + 1; |
|
1763 |
|
1764 TRequestStatus status; |
|
1765 TRequestStatus statusDeath; |
|
1766 |
|
1767 TheFs.NotifyDiskSpace(threshold, drive, status); |
|
1768 |
|
1769 RThread thread; |
|
1770 r = thread.Create(_L("PluginTestThread"), PluginTestThreadFunction, KStackSize, KHeapSize, KHeapSize, NULL); |
|
1771 SAFETEST(r); |
|
1772 thread.Logon(statusDeath); |
|
1773 thread.Resume(); |
|
1774 |
|
1775 User::WaitForRequest(status); |
|
1776 SAFETEST(status.Int()); |
|
1777 |
|
1778 TheFs.NotifyDiskSpace(threshold, drive, status); |
|
1779 User::WaitForRequest(status); |
|
1780 SAFETEST(status.Int()); |
|
1781 |
|
1782 User::WaitForRequest(statusDeath); |
|
1783 SAFETEST(statusDeath.Int()); |
|
1784 thread.Close(); |
|
1785 |
|
1786 r = TheFs.DismountPlugin(KPreModifierPluginName); |
|
1787 SAFETEST(r); |
|
1788 |
|
1789 r = TheFs.RemovePlugin(KPreModifierPluginName); |
|
1790 SAFETEST(r); |
|
1791 |
|
1792 Format(drive); |
|
1793 } |
|
1794 |
1699 GLDEF_C void CallTestsL() |
1795 GLDEF_C void CallTestsL() |
1700 // |
1796 // |
1701 // Do all tests |
1797 // Do all tests |
1702 // |
1798 // |
1703 { |
1799 { |