dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

michael@0 1 <html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
michael@0 2 <head>
michael@0 3 <title>Low device storage during update</title>
michael@0 4
michael@0 5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 6 <script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
michael@0 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 8
michael@0 9 <script type="text/javascript">
michael@0 10
michael@0 11 /**
michael@0 12 * This test checks that an offline cache update is canceled when a low device
michael@0 13 * storage condition is detected during the update.
michael@0 14 */
michael@0 15
michael@0 16 var updateService = Cc['@mozilla.org/offlinecacheupdate-service;1']
michael@0 17 .getService(Ci.nsIOfflineCacheUpdateService);
michael@0 18
michael@0 19 var obs = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
michael@0 20 .getService(SpecialPowers.Ci.nsIObserverService);
michael@0 21
michael@0 22 function finish() {
michael@0 23 obs.notifyObservers(updateService, "disk-space-watcher", "free");
michael@0 24
michael@0 25 OfflineTest.teardownAndFinish();
michael@0 26 }
michael@0 27
michael@0 28 function onError() {
michael@0 29 OfflineTest.ok(true, "Expected error: Update canceled");
michael@0 30 finish();
michael@0 31 }
michael@0 32
michael@0 33 function onUnexpectedEvent() {
michael@0 34 OfflineTest.ok(false, "The update was supposed to be canceled");
michael@0 35 finish();
michael@0 36 }
michael@0 37
michael@0 38 function onChecking() {
michael@0 39 obs.notifyObservers(updateService, "disk-space-watcher", "full");
michael@0 40 }
michael@0 41
michael@0 42 if (OfflineTest.setup()) {
michael@0 43 applicationCache.onerror = OfflineTest.priv(onError);
michael@0 44 applicationCache.onprogress = OfflineTest.priv(onUnexpectedEvent);
michael@0 45 applicationCache.oncached = OfflineTest.priv(onUnexpectedEvent);
michael@0 46 applicationCache.onchecking = OfflineTest.priv(onChecking);
michael@0 47 }
michael@0 48
michael@0 49 SimpleTest.waitForExplicitFinish();
michael@0 50
michael@0 51 </script>
michael@0 52
michael@0 53 </head>
michael@0 54
michael@0 55 <body>
michael@0 56
michael@0 57 </body>
michael@0 58 </html>

mercurial