Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / domstorage / script-tests / clear.js
blobbf6e5f39ad60f1d67707cec59a6ea195f6fac1e4
1 description("Test basic dom storage .clear() functionality.");
3 function test(storageString)
5     storage = eval(storageString);
6     if (!storage) {
7         testFailed(storageString + " DOES NOT exist");
8         return;
9     }
11     debug("Testing " + storageString);
13     evalAndLog("storage.clear()");
14     shouldBe("storage.length", "0");
16     evalAndLog("storage['FOO'] = 'MyFOO'");
17     evalAndLog("storage['BAR'] = 'MyBar'");
18     shouldBe("storage.length", "2");
19     shouldBeEqualToString("storage['FOO']", "MyFOO");
20     shouldBeEqualToString("storage['BAR']", "MyBar");
22     evalAndLog("storage.clear()");
23     shouldBe("storage.length", "0");
24     shouldBe("storage['FOO']", "undefined");  // FIXME: Wait...shouldn't this be null?
25     shouldBe("storage['BAR']", "undefined");  // ditto
28 test("sessionStorage");
29 debug("");
30 debug("");
31 test("localStorage");
33 window.successfullyParsed = true;
34 isSuccessfullyParsed();