browser/fuel/test/browser_ApplicationStorage.js

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.

     1 function test() {
     2   // test for existence of values
     3   var hasItem = Application.storage.has("fuel-test-missing");
     4   is(hasItem, false, "Check 'Application.storage.has' for nonexistent item");
     5   Application.storage.set("fuel-test", "dummy");
     6   hasItem = Application.storage.has("fuel-test");
     7   is(hasItem, true, "Check 'Application.storage.has' for existing item");
     9   // test getting nonexistent and existing values
    10   var itemValue = Application.storage.get("fuel-test-missing", "default");
    11   is(itemValue, "default", "Check 'Application.storage.get' for nonexistent item");
    12   itemValue = Application.storage.get("fuel-test", "default");
    13   is(itemValue, "dummy", "Check 'Application.storage.get' for existing item");
    15   // test for overwriting an existing value
    16   Application.storage.set("fuel-test", "smarty");
    17   itemValue = Application.storage.get("fuel-test", "default");
    18   is(itemValue, "smarty", "Check 'Application.storage.get' for overwritten item");
    20   // check for change event when setting a value
    21   waitForExplicitFinish();
    22   Application.storage.events.addListener("change", onStorageChange);
    23   Application.storage.set("fuel-test", "change event");
    24 }
    26 function onStorageChange(evt) {
    27   is(evt.data, "fuel-test", "Check 'Application.storage.set' fired a change event");
    28   Application.storage.events.removeListener("change", onStorageChange);
    29   finish();
    30 }

mercurial