diff options
Diffstat (limited to 'dom/tests/mochitest/localstorage')
3 files changed, 1 insertions, 84 deletions
diff --git a/dom/tests/mochitest/localstorage/mochitest.ini b/dom/tests/mochitest/localstorage/mochitest.ini index 5242bf9b1..30b90664a 100644 --- a/dom/tests/mochitest/localstorage/mochitest.ini +++ b/dom/tests/mochitest/localstorage/mochitest.ini @@ -47,6 +47,5 @@ skip-if = toolkit == 'android' #TIMED_OUT skip-if = toolkit == 'android' #TIMED_OUT [test_localStorageReplace.html] skip-if = toolkit == 'android' -[test_lowDeviceStorage.html] [test_storageConstructor.html] [test_localStorageSessionPrefOverride.html] diff --git a/dom/tests/mochitest/localstorage/test_localStorageQuotaPrivateBrowsing_perwindowpb.html b/dom/tests/mochitest/localstorage/test_localStorageQuotaPrivateBrowsing_perwindowpb.html index 24d3e4ba3..4dcc361c1 100644 --- a/dom/tests/mochitest/localstorage/test_localStorageQuotaPrivateBrowsing_perwindowpb.html +++ b/dom/tests/mochitest/localstorage/test_localStorageQuotaPrivateBrowsing_perwindowpb.html @@ -14,13 +14,7 @@ const Ci = Components.interfaces; const CONTENT_PAGE = "http://mochi.test:8888/chrome/dom/tests/mochitest/localstorage/page_blank.html"; const slavePath = "/chrome/dom/tests/mochitest/localstorage/"; var currentTest = 1; -var quota; - -try { - quota = Services.prefs.getIntPref("dom.storage.default_quota"); -} catch (ex) { - quota = 5 * 1024; -} +var quota = Services.prefs.getIntPref("dom.storage.default_quota", 5 * 1024); Services.prefs.setIntPref("browser.startup.page", 0); Services.prefs.setIntPref("dom.storage.default_quota", 1); diff --git a/dom/tests/mochitest/localstorage/test_lowDeviceStorage.html b/dom/tests/mochitest/localstorage/test_lowDeviceStorage.html deleted file mode 100644 index 046587150..000000000 --- a/dom/tests/mochitest/localstorage/test_lowDeviceStorage.html +++ /dev/null @@ -1,76 +0,0 @@ -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<title>Test localStorage usage while in a low device storage situation</title> - -<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> -<script type="text/javascript" src="localStorageCommon.js"></script> -<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> - -<script type="text/javascript"> - -/* -This test does the following: -- Stores an item in localStorage. -- Checks the stored value. -- Emulates a low device storage situation. -- Gets the stored item again. -- Removes the stored item. -- Fails storing a new value. -- Emulates recovering from a low device storage situation. -- Stores a new value. -- Checks the stored value. -*/ - -function lowDeviceStorage(lowStorage) { - var data = lowStorage ? "full" : "free"; - os().notifyObservers(null, "disk-space-watcher", data); -} - -function startTest() { - // Add a test item. - localStorage.setItem("item", "value"); - is(localStorage.getItem("item"), "value", "getItem()"); - - // Emulates a low device storage situation. - lowDeviceStorage(true); - - // Checks that we can still access to the stored item. - is(localStorage.getItem("item"), "value", - "getItem() during a device storage situation"); - - // Removes the stored item. - localStorage.removeItem("item"); - is(localStorage.getItem("item"), null, - "getItem() after removing the item"); - - // Fails storing a new item. - try { - localStorage.setItem("newItem", "value"); - ok(false, "Storing a new item is expected to fail"); - } catch(e) { - ok(true, "Got an expected exception " + e); - } finally { - is(localStorage.getItem("newItem"), null, - "setItem while device storage is low"); - } - - // Emulates recovering from a low device storage situation. - lowDeviceStorage(false); - - // Add a test item after recovering from the low device storage situation. - localStorage.setItem("newItem", "value"); - is(localStorage.getItem("newItem"), "value", - "getItem() with available storage"); - - SimpleTest.finish(); -} - -SimpleTest.waitForExplicitFinish(); - -</script> - -</head> - -<body onload="startTest();"> -</body> -</html> |