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

Unified Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/storage_setitem.html

Issue 1854003004: Import web-platform-tests@5a8700479d98852455bee6117558897867eb278a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/imported/web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/storage_setitem.html
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/storage_setitem.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/storage_setitem.html
index 3737a707f8a2cafc2f572b6f22ec6b04b7eb1caa..c5a72175a97d5a61a1a2053b27f0111947c660c9 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/storage_setitem.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/webstorage/storage_setitem.html
@@ -7,6 +7,14 @@
<script>
["localStorage", "sessionStorage"].forEach(function(name) {
var test_error = { name: "test" };
+ var interesting_strs = ["\uD7FF", "\uD800", "\uDBFF", "\uDC00",
+ "\uDFFF", "\uE000", "\uFFFD", "\uFFFE", "\uFFFF",
+ "\uD83C\uDF4D", "\uD83Ca", "a\uDF4D",
+ "\uDBFF\uDFFF"];
+
+ for (var i = 0; i <= 0xFF; i++) {
+ interesting_strs.push(String.fromCharCode(i));
+ }
test(function() {
var storage = window[name];
@@ -156,5 +164,60 @@
assert_equals(storage.getItem("null"), "test2");
assert_equals(storage["null"], "test2");
}, name + "[null]");
+
+ test(function() {
+ var storage = window[name];
+ storage.clear();
+
+ storage["foo\0bar"] = "user1";
+ assert_true("foo\0bar" in storage);
+ assert_false("foo\0" in storage);
+ assert_false("foo\0baz" in storage);
+ assert_false("foo" in storage);
+ assert_equals(storage.length, 1, "storage.length")
+ assert_equals(storage.getItem("foo\0bar"), "user1");
+ assert_equals(storage.getItem("foo\0"), null);
+ assert_equals(storage.getItem("foo\0baz"), null);
+ assert_equals(storage.getItem("foo"), null);
+ assert_equals(storage["foo\0bar"], "user1");
+ assert_equals(storage["foo\0"], undefined);
+ assert_equals(storage["foo\0baz"], undefined);
+ assert_equals(storage["foo"], undefined);
+ }, name + " key containing null");
+
+ test(function() {
+ var storage = window[name];
+ storage.clear();
+
+ storage["name"] = "foo\0bar";
+ assert_true("name" in storage);
+ assert_equals(storage.length, 1, "storage.length")
+ assert_equals(storage.getItem("name"), "foo\0bar");
+ assert_equals(storage["name"], "foo\0bar");
+ }, name + " value containing null");
+
+ for (i = 0; i < interesting_strs.length; i++) {
+ var str = interesting_strs[i];
+ test(function() {
+ var storage = window[name];
+ storage.clear();
+
+ storage[str] = "user1";
+ assert_true(str in storage);
+ assert_equals(storage.length, 1, "storage.length")
+ assert_equals(storage.getItem(str), "user1");
+ assert_equals(storage[str], "user1");
+ }, name + "[" + format_value(str) + "]");
+
+ test(function() {
+ var storage = window[name];
+ storage.clear();
+
+ storage["name"] = str;
+ assert_equals(storage.length, 1, "storage.length")
+ assert_equals(storage.getItem("name"), str);
+ assert_equals(storage["name"], str);
+ }, name + "[] = " + format_value(str));
+ }
});
</script>
« no previous file with comments | « third_party/WebKit/LayoutTests/imported/web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698