Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: LayoutTests/imported/web-platform-tests/webstorage/storage_getitem.html

Issue 1220543007: Import web-platform-tests/webstorage (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <mete charset=utf-8>
3 <title>WebStorage Test: Storage - getItem(key) and named getter</title>
4 <script src="../../../resources/testharness.js"></script>
5 <script src="../../../resources/testharnessreport.js"></script>
6 <div id="log"></div>
7 <script>
8 ["localStorage", "sessionStorage"].forEach(function(name) {
9 test(function() {
10 var storage = window[name];
11 storage.clear();
12 storage.setItem("name", "x");
13 storage.setItem("undefined", "foo");
14 storage.setItem("null", "bar");
15 storage.setItem("", "baz");
16
17 test(function() {
18 assert_equals(storage.length, 4);
19 }, "All items should be added to " + name + ".");
20
21 test(function() {
22 assert_equals(storage["unknown"], undefined, "storage['unknown']")
23 assert_equals(storage["name"], "x", "storage['name']")
24 assert_equals(storage["undefined"], "foo", "storage['undefined']")
25 assert_equals(storage["null"], "bar", "storage['null']")
26 assert_equals(storage[undefined], "foo", "storage[undefined]")
27 assert_equals(storage[null], "bar", "storage[null]")
28 assert_equals(storage[""], "baz", "storage['']")
29 }, "Named access to " + name + " should be correct");
30
31 test(function() {
32 assert_equals(storage.getItem("unknown"), null, "storage.getItem('un known')")
33 assert_equals(storage.getItem("name"), "x", "storage.getItem('name') ")
34 assert_equals(storage.getItem("undefined"), "foo", "storage.getItem( 'undefined')")
35 assert_equals(storage.getItem("null"), "bar", "storage.getItem('null ')")
36 assert_equals(storage.getItem(undefined), "foo", "storage.getItem(un defined)")
37 assert_equals(storage.getItem(null), "bar", "storage.getItem(null)")
38 assert_equals(storage.getItem(""), "baz", "storage.getItem('')")
39 }, name + ".getItem should be correct")
40 }, "Get value by getIten(key) and named access in " + name + ".");
41 });
42 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698