diff options
72 files changed, 1294 insertions, 349 deletions
diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index 5dc9a3c1fff..ca40eed366e 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -11470,6 +11470,10 @@ "url": "/IndexedDB/value_recursive.htm" }, { + "path": "WebCryptoAPI/getRandomValues.worker.js", + "url": "/WebCryptoAPI/getRandomValues.worker" + }, + { "path": "WebCryptoAPI/test_getRandomValues.html", "url": "/WebCryptoAPI/test_getRandomValues.html" }, @@ -13386,6 +13390,10 @@ "url": "/domparsing/DOMParser-parseFromString-xml.html" }, { + "path": "domparsing/XMLSerializer-serializeToString.html", + "url": "/domparsing/XMLSerializer-serializeToString.html" + }, + { "path": "domparsing/insert-adjacent.html", "url": "/domparsing/insert-adjacent.html" }, @@ -16238,6 +16246,10 @@ "url": "/html/semantics/embedded-content/the-iframe-element/move_iframe_in_dom_04.html" }, { + "path": "html/semantics/embedded-content/the-img-element/Image-constructor.html", + "url": "/html/semantics/embedded-content/the-img-element/Image-constructor.html" + }, + { "path": "html/semantics/embedded-content/the-img-element/current-pixel-density/basic.html", "url": "/html/semantics/embedded-content/the-img-element/current-pixel-density/basic.html" }, @@ -16254,10 +16266,6 @@ "url": "/html/semantics/embedded-content/the-img-element/img.complete.html" }, { - "path": "html/semantics/embedded-content/the-img-element/Image-constructor.html", - "url": "/html/semantics/embedded-content/the-img-element/Image-constructor.html" - }, - { "path": "html/semantics/embedded-content/the-img-element/relevant-mutations.html", "url": "/html/semantics/embedded-content/the-img-element/relevant-mutations.html" }, @@ -23018,8 +23026,8 @@ "url": "/webaudio/the-audio-api/the-gainnode-interface/idl-test.html" }, { - "path": "webaudio/the-audio-api/the-gainnode-interface/test.html", - "url": "/webaudio/the-audio-api/the-gainnode-interface/test.html" + "path": "webaudio/the-audio-api/the-gainnode-interface/test-gainnode.html", + "url": "/webaudio/the-audio-api/the-gainnode-interface/test-gainnode.html" }, { "path": "webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface/mediaElementAudioSourceToScriptProcessorTest.html", @@ -24246,6 +24254,14 @@ "url": "/webstorage/storage_clear.html" }, { + "path": "webstorage/storage_enumerate.html", + "url": "/webstorage/storage_enumerate.html" + }, + { + "path": "webstorage/storage_functions_not_overwritten.html", + "url": "/webstorage/storage_functions_not_overwritten.html" + }, + { "path": "webstorage/storage_getitem.html", "url": "/webstorage/storage_getitem.html" }, @@ -24270,10 +24286,26 @@ "url": "/webstorage/storage_length.html" }, { + "path": "webstorage/storage_local_window_open.html", + "url": "/webstorage/storage_local_window_open.html" + }, + { + "path": "webstorage/storage_local_window_open_second.html", + "url": "/webstorage/storage_local_window_open_second.html" + }, + { "path": "webstorage/storage_removeitem.html", "url": "/webstorage/storage_removeitem.html" }, { + "path": "webstorage/storage_session_window_open.html", + "url": "/webstorage/storage_session_window_open.html" + }, + { + "path": "webstorage/storage_session_window_open_second.html", + "url": "/webstorage/storage_session_window_open_second.html" + }, + { "path": "webstorage/storage_set_value_enumerate.html", "url": "/webstorage/storage_set_value_enumerate.html" }, @@ -24282,6 +24314,10 @@ "url": "/webstorage/storage_setitem.html" }, { + "path": "webstorage/storage_string_conversion.html", + "url": "/webstorage/storage_string_conversion.html" + }, + { "path": "webvtt/interfaces.html", "url": "/webvtt/interfaces.html" }, @@ -26341,6 +26377,26 @@ "url": "/websockets/unload-a-document/005.html" }, { + "path": "webstorage/event_basic.html", + "timeout": "long", + "url": "/webstorage/event_basic.html" + }, + { + "path": "webstorage/event_body_attribute.html", + "timeout": "long", + "url": "/webstorage/event_body_attribute.html" + }, + { + "path": "webstorage/event_case_sensitive.html", + "timeout": "long", + "url": "/webstorage/event_case_sensitive.html" + }, + { + "path": "webstorage/event_setattribute.html", + "timeout": "long", + "url": "/webstorage/event_setattribute.html" + }, + { "path": "webstorage/storage_local_setitem_quotaexceedederr.html", "timeout": "long", "url": "/webstorage/storage_local_setitem_quotaexceedederr.html" @@ -31872,7 +31928,7 @@ } ] }, - "rev": "4d96cccabc2feacd48e1dab9afc22b8af2225572", + "rev": "87398b8448f699e3e324148795891658f2fa16dd", "url_base": "/", "version": 2 }
\ No newline at end of file diff --git a/tests/wpt/metadata/domparsing/XMLSerializer-serializeToString.html.ini b/tests/wpt/metadata/domparsing/XMLSerializer-serializeToString.html.ini new file mode 100644 index 00000000000..8adcd02d010 --- /dev/null +++ b/tests/wpt/metadata/domparsing/XMLSerializer-serializeToString.html.ini @@ -0,0 +1,5 @@ +[XMLSerializer-serializeToString.html] + type: testharness + [check XMLSerializer.serializeToString method could parsing xmldoc to string] + expected: FAIL + diff --git a/tests/wpt/metadata/html/dom/interfaces.html.ini b/tests/wpt/metadata/html/dom/interfaces.html.ini index 3d059e0dd58..d000553cacc 100644 --- a/tests/wpt/metadata/html/dom/interfaces.html.ini +++ b/tests/wpt/metadata/html/dom/interfaces.html.ini @@ -9015,3 +9015,33 @@ [WebSocket interface: operation send(ArrayBufferView)] expected: FAIL + [HTMLOptionElement must be primary interface of new Option()] + expected: FAIL + + [Stringification of new Option()] + expected: FAIL + + [HTMLOptionElement interface: new Option() must inherit property "disabled" with the proper type (0)] + expected: FAIL + + [HTMLOptionElement interface: new Option() must inherit property "form" with the proper type (1)] + expected: FAIL + + [HTMLOptionElement interface: new Option() must inherit property "label" with the proper type (2)] + expected: FAIL + + [HTMLOptionElement interface: new Option() must inherit property "defaultSelected" with the proper type (3)] + expected: FAIL + + [HTMLOptionElement interface: new Option() must inherit property "selected" with the proper type (4)] + expected: FAIL + + [HTMLOptionElement interface: new Option() must inherit property "value" with the proper type (5)] + expected: FAIL + + [HTMLOptionElement interface: new Option() must inherit property "text" with the proper type (6)] + expected: FAIL + + [HTMLOptionElement interface: new Option() must inherit property "index" with the proper type (7)] + expected: FAIL + diff --git a/tests/wpt/metadata/mozilla-sync b/tests/wpt/metadata/mozilla-sync index dc9acd461d3..42a6f02a9af 100644 --- a/tests/wpt/metadata/mozilla-sync +++ b/tests/wpt/metadata/mozilla-sync @@ -1 +1 @@ -d86c5879255ec9ced621412d4565a9a66ee4dc72
\ No newline at end of file +836463b9e03f441aaf213ff48c99d50d8c1be5a5
\ No newline at end of file diff --git a/tests/wpt/metadata/webstorage/storage_enumerate.html.ini b/tests/wpt/metadata/webstorage/storage_enumerate.html.ini new file mode 100644 index 00000000000..e9c308dcb55 --- /dev/null +++ b/tests/wpt/metadata/webstorage/storage_enumerate.html.ini @@ -0,0 +1,8 @@ +[storage_enumerate.html] + type: testharness + [localStorage: enumerate a Storage object and get only the keys as a result and the built-in properties of the Storage object should be ignored] + expected: FAIL + + [sessionStorage: enumerate a Storage object and get only the keys as a result and the built-in properties of the Storage object should be ignored] + expected: FAIL + diff --git a/tests/wpt/metadata/webstorage/storage_local_window_open.html.ini b/tests/wpt/metadata/webstorage/storage_local_window_open.html.ini new file mode 100644 index 00000000000..4cf4a59cd27 --- /dev/null +++ b/tests/wpt/metadata/webstorage/storage_local_window_open.html.ini @@ -0,0 +1,5 @@ +[storage_local_window_open.html] + type: testharness + [A new window to make sure there is a copy of the previous window's localStorage, and that they diverge after a change] + expected: FAIL + diff --git a/tests/wpt/metadata/webstorage/storage_local_window_open_second.html.ini b/tests/wpt/metadata/webstorage/storage_local_window_open_second.html.ini new file mode 100644 index 00000000000..d174c62a22b --- /dev/null +++ b/tests/wpt/metadata/webstorage/storage_local_window_open_second.html.ini @@ -0,0 +1,5 @@ +[storage_local_window_open_second.html] + type: testharness + [A new window to make sure there is a copy of the previous window's localStorage, and that they diverge after a change] + expected: FAIL + diff --git a/tests/wpt/metadata/webstorage/storage_session_window_open.html.ini b/tests/wpt/metadata/webstorage/storage_session_window_open.html.ini new file mode 100644 index 00000000000..555a8e32fdd --- /dev/null +++ b/tests/wpt/metadata/webstorage/storage_session_window_open.html.ini @@ -0,0 +1,5 @@ +[storage_session_window_open.html] + type: testharness + [A new window to make sure there is a copy of the previous window's sessionStorage, and that they diverge after a change] + expected: FAIL + diff --git a/tests/wpt/metadata/webstorage/storage_session_window_open_second.html.ini b/tests/wpt/metadata/webstorage/storage_session_window_open_second.html.ini new file mode 100644 index 00000000000..46bffcd7fb0 --- /dev/null +++ b/tests/wpt/metadata/webstorage/storage_session_window_open_second.html.ini @@ -0,0 +1,5 @@ +[storage_session_window_open_second.html] + type: testharness + [A new window to make sure there is a copy of the previous window's sessionStorage, and that they diverge after a change] + expected: FAIL + diff --git a/tests/wpt/web-platform-tests/IndexedDB/idbindex_get7.htm b/tests/wpt/web-platform-tests/IndexedDB/idbindex_get7.htm index a49b0efc6ff..daf0f574968 100644 --- a/tests/wpt/web-platform-tests/IndexedDB/idbindex_get7.htm +++ b/tests/wpt/web-platform-tests/IndexedDB/idbindex_get7.htm @@ -20,7 +20,7 @@ e.target.transaction.abort(); - assert_throws("TransactionInactiveError", function(){ + assert_throws("InvalidStateError", function(){ index.get("data"); }); t.done(); diff --git a/tests/wpt/web-platform-tests/IndexedDB/idbindex_getKey7.htm b/tests/wpt/web-platform-tests/IndexedDB/idbindex_getKey7.htm index 5a35ebb5c91..f41f7635211 100644 --- a/tests/wpt/web-platform-tests/IndexedDB/idbindex_getKey7.htm +++ b/tests/wpt/web-platform-tests/IndexedDB/idbindex_getKey7.htm @@ -20,7 +20,7 @@ e.target.transaction.abort(); - assert_throws("TransactionInactiveError", function(){ + assert_throws("InvalidStateError", function(){ index.getKey("data"); }); t.done(); diff --git a/tests/wpt/web-platform-tests/IndexedDB/idbindex_openCursor2.htm b/tests/wpt/web-platform-tests/IndexedDB/idbindex_openCursor2.htm index d39254055f1..c056abded3e 100644 --- a/tests/wpt/web-platform-tests/IndexedDB/idbindex_openCursor2.htm +++ b/tests/wpt/web-platform-tests/IndexedDB/idbindex_openCursor2.htm @@ -20,7 +20,7 @@ e.target.transaction.abort(); - assert_throws("TransactionInactiveError", function(){ + assert_throws("InvalidStateError", function(){ index.openCursor(); }); t.done(); diff --git a/tests/wpt/web-platform-tests/IndexedDB/idbindex_openKeyCursor3.htm b/tests/wpt/web-platform-tests/IndexedDB/idbindex_openKeyCursor3.htm index b4af3172417..1f5fd015590 100644 --- a/tests/wpt/web-platform-tests/IndexedDB/idbindex_openKeyCursor3.htm +++ b/tests/wpt/web-platform-tests/IndexedDB/idbindex_openKeyCursor3.htm @@ -20,7 +20,7 @@ e.target.transaction.abort(); - assert_throws("TransactionInactiveError", function(){ + assert_throws("InvalidStateError", function(){ index.openKeyCursor(); }); t.done(); diff --git a/tests/wpt/web-platform-tests/WebCryptoAPI/getRandomValues.js b/tests/wpt/web-platform-tests/WebCryptoAPI/getRandomValues.js new file mode 100644 index 00000000000..77855b2822d --- /dev/null +++ b/tests/wpt/web-platform-tests/WebCryptoAPI/getRandomValues.js @@ -0,0 +1,41 @@ +function run_test() { + // Step 1. + test(function() { + assert_throws("TypeMismatchError", function() { + self.crypto.getRandomValues(new Float32Array(6)) + }, "Float32Array") + assert_throws("TypeMismatchError", function() { + self.crypto.getRandomValues(new Float64Array(6)) + }, "Float64Array") + + assert_throws("TypeMismatchError", function() { + self.crypto.getRandomValues(new Float32Array(65537)) + }, "Float32Array (too long)") + assert_throws("TypeMismatchError", function() { + self.crypto.getRandomValues(new Float64Array(65537)) + }, "Float64Array (too long)") + }, "Float arrays") + + test(function() { + assert_equals(self.crypto.getRandomValues(new Int8Array(8)).constructor, + Int8Array, "crypto.getRandomValues(new Int8Array(8))") + assert_equals(self.crypto.getRandomValues(new Uint8Array(8)).constructor, + Uint8Array, "crypto.getRandomValues(new Uint8Array(8))") + + assert_equals(self.crypto.getRandomValues(new Int16Array(8)).constructor, + Int16Array, "crypto.getRandomValues(new Int16Array(8))") + assert_equals(self.crypto.getRandomValues(new Uint16Array(8)).constructor, + Uint16Array, "crypto.getRandomValues(new Uint16Array(8))") + + assert_equals(self.crypto.getRandomValues(new Int32Array(8)).constructor, + Int32Array, "crypto.getRandomValues(new Int32Array(8))") + assert_equals(self.crypto.getRandomValues(new Uint32Array(8)).constructor, + Uint32Array, "crypto.getRandomValues(new Uint32Array(8))") + }, "Integer arrays") + + test(function() { + assert_throws("QuotaExceededError", function() { + self.crypto.getRandomValues(new Int8Array(65537)) + }, "crypto.getRandomValues length over 65536") + }, "Large length") +} diff --git a/tests/wpt/web-platform-tests/WebCryptoAPI/getRandomValues.worker.js b/tests/wpt/web-platform-tests/WebCryptoAPI/getRandomValues.worker.js new file mode 100644 index 00000000000..cc2635630d1 --- /dev/null +++ b/tests/wpt/web-platform-tests/WebCryptoAPI/getRandomValues.worker.js @@ -0,0 +1,4 @@ +importScripts("/resources/testharness.js"); +importScripts("getRandomValues.js"); +run_test(); +done(); diff --git a/tests/wpt/web-platform-tests/WebCryptoAPI/test_getRandomValues.html b/tests/wpt/web-platform-tests/WebCryptoAPI/test_getRandomValues.html index 62b00e9f12c..a5cd5370950 100644 --- a/tests/wpt/web-platform-tests/WebCryptoAPI/test_getRandomValues.html +++ b/tests/wpt/web-platform-tests/WebCryptoAPI/test_getRandomValues.html @@ -5,43 +5,8 @@ <link rel="help" href="https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#dfn-Crypto-method-getRandomValues"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> +<script src="getRandomValues.js"></script> <div id="log"></div> <script> -// Step 1. -test(function() { - assert_throws("TypeMismatchError", function() { - window.crypto.getRandomValues(new Float32Array(6)) - }, "Float32Array") - assert_throws("TypeMismatchError", function() { - window.crypto.getRandomValues(new Float64Array(6)) - }, "Float64Array") - - assert_throws("TypeMismatchError", function() { - window.crypto.getRandomValues(new Float32Array(65537)) - }, "Float32Array (too long)") - assert_throws("TypeMismatchError", function() { - window.crypto.getRandomValues(new Float64Array(65537)) - }, "Float64Array (too long)") -}, "Float arrays") - -test(function() { - assert_equals(window.crypto.getRandomValues(new Int8Array(8)).constructor, - Int8Array, "crypto.getRandomValues(new Int8Array(8))") - assert_equals(window.crypto.getRandomValues(new Uint8Array(8)).constructor, - Uint8Array, "crypto.getRandomValues(new Uint8Array(8))") - - assert_equals(window.crypto.getRandomValues(new Int16Array(8)).constructor, - Int16Array, "crypto.getRandomValues(new Int16Array(8))") - assert_equals(window.crypto.getRandomValues(new Uint16Array(8)).constructor, - Uint16Array, "crypto.getRandomValues(new Uint16Array(8))") - - assert_equals(window.crypto.getRandomValues(new Int32Array(8)).constructor, - Int32Array, "crypto.getRandomValues(new Int32Array(8))") - assert_equals(window.crypto.getRandomValues(new Uint32Array(8)).constructor, - Uint32Array, "crypto.getRandomValues(new Uint32Array(8))") - - assert_throws("QuotaExceededError", function() { - window.crypto.getRandomValues(new Int8Array(65537)) - }, "crypto.getRandomValues length over 65536") -}) +run_test(); </script> diff --git a/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/015-novalid.html b/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/015-novalid.html deleted file mode 100644 index 3f896f06171..00000000000 --- a/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/015-novalid.html +++ /dev/null @@ -1,11 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset=utf-8> -<title>tv and (scan: 1)</title> -<link href='foo' media='tv and (scan: 1)' rel='stylesheet'> -</head> -<body> -<p>tv and (scan: 1)</p> -</body> -</html>
\ No newline at end of file diff --git a/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/016-novalid.html b/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/016-novalid.html deleted file mode 100644 index 8f7a3f003f2..00000000000 --- a/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/016-novalid.html +++ /dev/null @@ -1,11 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset=utf-8> -<title>tv and (scan: İNTERLACE)</title> -<link href='foo' media='tv and (scan: İNTERLACE)' rel='stylesheet'> -</head> -<body> -<p>tv and (scan: İNTERLACE)</p> -</body> -</html>
\ No newline at end of file diff --git a/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/017-novalid.html b/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/017-novalid.html deleted file mode 100644 index b8340dd9829..00000000000 --- a/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/017-novalid.html +++ /dev/null @@ -1,11 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset=utf-8> -<title>screen and (device-aspect-ratio: 16px/9pt)</title> -<link href='foo' media='screen and (device-aspect-ratio: 16px/9pt)' rel='stylesheet'> -</head> -<body> -<p>screen and (device-aspect-ratio: 16px/9pt)</p> -</body> -</html>
\ No newline at end of file diff --git a/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/018-haswarn.html b/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/018-haswarn.html deleted file mode 100644 index 2b9b1cde9ec..00000000000 --- a/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/018-haswarn.html +++ /dev/null @@ -1,11 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset="utf-8"> -<title>Check that device-aspect-ratio warns about U+000C before/after slash in value</title> -<link href='foo' media='screen and (device-aspect-ratio: 16/9)' rel='stylesheet'><!-- U+000C before & after slash --> -</head> -<body> -<p>screen and (device-aspect-ratio: 16 / 9)</p> -</body> -</html> diff --git a/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/022-isvalid.html b/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/022-isvalid.html deleted file mode 100644 index 0481671ada4..00000000000 --- a/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/022-isvalid.html +++ /dev/null @@ -1,11 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset=utf-8> -<title>tv and (scan: interlace)</title> -<link href='foo' media='tv and (scan: interlace)' rel='stylesheet'> -</head> -<body> -<p>tv and (scan: interlace)</p> -</body> -</html>
\ No newline at end of file diff --git a/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/118-isvalid.html b/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/118-isvalid.html deleted file mode 100644 index 00999cfa8ca..00000000000 --- a/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/118-isvalid.html +++ /dev/null @@ -1,13 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset="utf-8"> -<title>Check that device-aspect-ratio allows space, tab, or LF before & after slash</title> -<link href='foo' media='screen and (device-aspect-ratio: 16 -/ -9)' rel='stylesheet'> <!-- space, tab, or LF before & after slash --> -</head> -<body> -<p>Check that device-aspect-ratio allows space, tab, or LF before & after slash</p> -</body> -</html> diff --git a/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/023-isvalid.html b/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/device-aspect-ratio-novalid.html index 2b851935908..2b851935908 100644 --- a/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/023-isvalid.html +++ b/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/device-aspect-ratio-novalid.html diff --git a/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/004-isvalid.html b/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/projection-novalid.html index 6e362710d9b..6e362710d9b 100644 --- a/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/004-isvalid.html +++ b/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/projection-novalid.html diff --git a/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/021-isvalid.html b/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/tv-novalid.html index 6fc7cfcf02a..6fc7cfcf02a 100644 --- a/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/021-isvalid.html +++ b/tests/wpt/web-platform-tests/conformance-checkers/html/media-queries/tv-novalid.html diff --git a/tests/wpt/web-platform-tests/conformance-checkers/messages.json b/tests/wpt/web-platform-tests/conformance-checkers/messages.json index 71c5f3ca5c5..34e3a756738 100644 --- a/tests/wpt/web-platform-tests/conformance-checkers/messages.json +++ b/tests/wpt/web-platform-tests/conformance-checkers/messages.json @@ -1799,8 +1799,8 @@ "html/elements/q/cite/userinfo-username-contains-at-sign-novalid.html": "Bad value \u201chttp://::@c@d:2\u201d for attribute \u201ccite\u201d on element \u201cq\u201d: Bad URL: User or password contains an at symbol (\"@\") not percent-encoded.", "html/elements/q/cite/userinfo-username-contains-pile-of-poo-novalid.html": "Bad value \u201chttp://\ud83d\udca9:foo@example.com\u201d for attribute \u201ccite\u201d on element \u201cq\u201d: Bad URL: Illegal character in user or password: not a URL code point.", "html/elements/q/model-novalid.html": "End tag \u201cp\u201d implied, but there were open elements.", - "html/elements/ruby/empty-novalid.html": "Element \u201cruby\u201d is missing one or more of the following child elements: [rp, rt].", - "html/elements/ruby/missing-rt-novalid.html": "Element \u201cruby\u201d is missing required child element \u201crt\u201d.", + "html/elements/ruby/empty-novalid.html": "Element \u201cruby\u201d is missing one or more of the following child elements: [rp, rt, rtc].", + "html/elements/ruby/missing-rt-novalid.html": "Element \u201cruby\u201d is missing one or more of the following child elements: [rt, rtc].", "html/elements/samp/model-novalid.html": "End tag \u201cp\u201d implied, but there were open elements.", "html/elements/script/language-novalid.html": "The \u201clanguage\u201d attribute on the \u201cscript\u201d element is obsolete. Use the \u201ctype\u201d attribute instead.", "html/elements/script/src-empty-novalid.html": "Bad value \u201c\u201d for attribute \u201csrc\u201d on element \u201cscript\u201d: Bad URL: Must be non-empty.", @@ -2161,16 +2161,15 @@ "html/media-queries/012-novalid.html": "Bad value \u201cscreen and (min-width: 400px)and (max-width: 600px)\u201d for attribute \u201cmedia\u201d on element \u201clink\u201d: Bad media query: Expected whitespace but saw \u201ca\u201d instead.", "html/media-queries/013-novalid.html": "Bad value \u201cscreen and (min-width:\u201d for attribute \u201cmedia\u201d on element \u201clink\u201d: Bad media query: Media query ended prematurely.", "html/media-queries/014-novalid.html": "Bad value \u201cscreen and (min-width: 400px) and\u201d for attribute \u201cmedia\u201d on element \u201clink\u201d: Bad media query: Media query ended prematurely.", - "html/media-queries/015-novalid.html": "Bad value \u201ctv and (scan: 1)\u201d for attribute \u201cmedia\u201d on element \u201clink\u201d: Bad media query: Expected a letter but saw \u201c1\u201d instead.", - "html/media-queries/016-novalid.html": "Bad value \u201ctv and (scan: \u0130NTERLACE)\u201d for attribute \u201cmedia\u201d on element \u201clink\u201d: Bad media query: Expected a letter but saw \u201c\u0130\u201d instead.", - "html/media-queries/017-novalid.html": "Bad value \u201cscreen and (device-aspect-ratio: 16px/9pt)\u201d for attribute \u201cmedia\u201d on element \u201clink\u201d: Bad media query: Expected a digit, whitespace or \u201c/\u201d for device-aspect-ratio value but saw \u201cp\u201d instead.", - "html/media-queries/018-haswarn.html": "This document is not mappable to XML 1.0 without data loss due to U+000c which is not a legal XML 1.0 character.", "html/media-queries/019-novalid.html": "Bad value \u201cscreen and (color: 1em)\u201d for attribute \u201cmedia\u201d on element \u201clink\u201d: Bad media query: Expected a digit, whitespace or \u201c)\u201d but saw \u201ce\u201d instead.", "html/media-queries/020-novalid.html": "Bad value \u201c,\u201d for attribute \u201cmedia\u201d on element \u201clink\u201d: Bad media query: Media query ended prematurely.", "html/media-queries/021-novalid.html": "Bad value \u201cscreen,,print\u201d for attribute \u201cmedia\u201d on element \u201clink\u201d: Bad media query: Media query ended prematurely.", "html/media-queries/022-novalid.html": "Bad value \u201cscreen,\u201d for attribute \u201cmedia\u201d on element \u201clink\u201d: Bad media query: Media query ended prematurely.", "html/media-queries/023-novalid.html": "Bad value \u201c,screen\u201d for attribute \u201cmedia\u201d on element \u201clink\u201d: Bad media query: Media query ended prematurely.", "html/media-queries/024-novalid.html": "Bad value \u201cscreen and (min-width: 400)\u201d for attribute \u201cmedia\u201d on element \u201clink\u201d: Bad media query: Non-zero lengths require a unit.", + "html/media-queries/device-aspect-ratio-novalid.html": "Bad value \u201cscreen and (device-aspect-ratio: 16/9)\u201d for attribute \u201cmedia\u201d on element \u201clink\u201d: Bad media query: Expected a CSS media feature but saw \u201cdevice-aspect-ratio\u201d instead.", + "html/media-queries/projection-novalid.html": "Bad value \u201cprojection\u201d for attribute \u201cmedia\u201d on element \u201clink\u201d: Bad media query: Expected a CSS media type but the query ended.", + "html/media-queries/tv-novalid.html": "Bad value \u201ctv and (scan: progressive)\u201d for attribute \u201cmedia\u201d on element \u201clink\u201d: Bad media query: Expected a CSS media type but saw \u201ctv\u201d instead.", "html/microdata/itemid-scheme-data-contains-fragment-haswarn.html": "Bad value \u201cdata:text/html,test#test\u201d for attribute \u201citemid\u201d on element \u201cdiv\u201d: Bad URL: Fragment is not allowed for data: URIs according to RFC 2397.", "html/microdata/itemid/fragment-backslash-novalid.html": "Bad value \u201c#\\\u201d for attribute \u201citemid\u201d on element \u201cdiv\u201d: Bad URL: Illegal character in fragment: not a URL code point.", "html/microdata/itemid/fragment-contains-hash-novalid.html": "Bad value \u201chttp://foo/path#f#g\u201d for attribute \u201citemid\u201d on element \u201cdiv\u201d: Bad URL: Illegal character in fragment: not a URL code point.", @@ -2391,8 +2390,8 @@ "xhtml/elements/progress/009-novalid.xhtml": "The value of the \u201cvalue\u201d attribute must be less than or equal to the value of the \u201cmax\u201d attribute.", "xhtml/elements/progress/108-novalid.xhtml": "The value of the \u201cvalue\u201d attribute must be less than or equal to one when the \u201cmax\u201d attribute is absent.", "xhtml/elements/progress/309-novalid.xhtml": "The value of the \u201cvalue\u201d attribute must be less than or equal to the value of the \u201cmax\u201d attribute.", - "xhtml/elements/ruby/001-novalid.xhtml": "Element \u201cruby\u201d is missing one or more of the following child elements: [rp, rt].", - "xhtml/elements/ruby/002-novalid.xhtml": "Element \u201cruby\u201d is missing required child element \u201crt\u201d.", + "xhtml/elements/ruby/001-novalid.xhtml": "Element \u201cruby\u201d is missing one or more of the following child elements: [rp, rt, rtc].", + "xhtml/elements/ruby/002-novalid.xhtml": "Element \u201cruby\u201d is missing one or more of the following child elements: [rt, rtc].", "xhtml/elements/script/001-novalid.xhtml": "The \u201clanguage\u201d attribute on the \u201cscript\u201d element is obsolete. Use the \u201ctype\u201d attribute instead.", "xhtml/elements/table/201-novalid.xhtml": "Table cell spans past the end of its row group established by a \u201ctbody\u201d element; clipped to the end of the row group.", "xhtml/elements/table/202-novalid.xhtml": "Table cell is overlapped by later table cell.", diff --git a/tests/wpt/web-platform-tests/conformance-checkers/xhtml/media-queries/119-isvalid.xhtml b/tests/wpt/web-platform-tests/conformance-checkers/xhtml/media-queries/119-isvalid.xhtml deleted file mode 100644 index 857c16dea38..00000000000 --- a/tests/wpt/web-platform-tests/conformance-checkers/xhtml/media-queries/119-isvalid.xhtml +++ /dev/null @@ -1,11 +0,0 @@ -<!DOCTYPE html> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta charset="utf-8"/> -<title>Check that device-aspect-ratio allows CR before and after slash</title> -<link href='foo' media='screen and (device-aspect-ratio: 16
/
9)' rel='stylesheet'/> <!-- CR before & after slash --> -</head> -<body> -<p>Check that device-aspect-ratio allows CR before andafter slash</p> -</body> -</html> diff --git a/tests/wpt/web-platform-tests/content-security-policy/README.html b/tests/wpt/web-platform-tests/content-security-policy/README.html index 6d71659cbb7..88cd0367c5e 100644 --- a/tests/wpt/web-platform-tests/content-security-policy/README.html +++ b/tests/wpt/web-platform-tests/content-security-policy/README.html @@ -3,7 +3,7 @@ <head> <title>Introduction to Writing Content Security Policy Tests</title> - <link rel="stylesheet" type="text/css" href="README.css"></link> + <link rel="stylesheet" type="text/css" href="README.css"> <link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/styles/default.min.css"> <script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/highlight.min.js"></script> <script> diff --git a/tests/wpt/web-platform-tests/domparsing/XMLSerializer-serializeToString.html b/tests/wpt/web-platform-tests/domparsing/XMLSerializer-serializeToString.html new file mode 100644 index 00000000000..60932ee37f9 --- /dev/null +++ b/tests/wpt/web-platform-tests/domparsing/XMLSerializer-serializeToString.html @@ -0,0 +1,26 @@ +<!DOCTYPE HTML> +<meta charset=utf-8> +<html> + <head> + <title>domparsing Test: XMLSerializer.serializeToString</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + <h1>domparsing_XMLSerializer_serializeToString</h1> + <script> + function createXmlDoc(){ + var input = '<?xml version="1.0" encoding="UTF-8"?><root><child1>value1</child1></root>'; + var parser = new DOMParser(); + var doc = parser.parseFromString(input, 'text/xml'); + return doc; + } + test(function() { + var serializer = new XMLSerializer (); + var root = createXmlDoc().documentElement; + var xmlString=serializer.serializeToString(root); + assert_equals(xmlString, "<root><child1>value1</child1></root>"); + }, 'check XMLSerializer.serializeToString method could parsing xmldoc to string'); + </script> + </body> +</html> diff --git a/tests/wpt/web-platform-tests/html/dom/interfaces.html b/tests/wpt/web-platform-tests/html/dom/interfaces.html index 58e4d241d9c..29d059bdc1e 100644 --- a/tests/wpt/web-platform-tests/html/dom/interfaces.html +++ b/tests/wpt/web-platform-tests/html/dom/interfaces.html @@ -3332,7 +3332,7 @@ window.onload = function() { HTMLSelectElement: ['document.createElement("select")'], HTMLDataListElement: ['document.createElement("datalist")'], HTMLOptGroupElement: ['document.createElement("optgroup")'], - HTMLOptionElement: ['document.createElement("option")'], + HTMLOptionElement: ['document.createElement("option")', 'new Option()'], HTMLTextAreaElement: ['document.createElement("textarea")'], HTMLKeygenElement: ['document.createElement("keygen")'], HTMLOutputElement: ['document.createElement("output")'], diff --git a/tests/wpt/web-platform-tests/lint.whitelist b/tests/wpt/web-platform-tests/lint.whitelist index a0d7f1cfd25..30732fbfb14 100644 --- a/tests/wpt/web-platform-tests/lint.whitelist +++ b/tests/wpt/web-platform-tests/lint.whitelist @@ -16,7 +16,6 @@ INDENT TABS: content-security-policy/* INDENT TABS: custom-elements/* INDENT TABS: DOMEvents/* INDENT TABS: html/editing/dnd/* -INDENT TABS: media-source/* INDENT TABS: old-tests/* INDENT TABS: pointerlock/* INDENT TABS: shadow-dom/* @@ -36,7 +35,6 @@ TRAILING WHITESPACE: content-security-policy/* TRAILING WHITESPACE: custom-elements/* TRAILING WHITESPACE: DOMEvents/* TRAILING WHITESPACE: html-longdesc/* -TRAILING WHITESPACE: media-source/* TRAILING WHITESPACE: microdata/* TRAILING WHITESPACE: old-tests/* TRAILING WHITESPACE: pointerevents/* diff --git a/tests/wpt/web-platform-tests/media-source/URL-createObjectURL-revoke.html b/tests/wpt/web-platform-tests/media-source/URL-createObjectURL-revoke.html index a194d24636e..c5e18d4fd58 100644 --- a/tests/wpt/web-platform-tests/media-source/URL-createObjectURL-revoke.html +++ b/tests/wpt/web-platform-tests/media-source/URL-createObjectURL-revoke.html @@ -9,14 +9,51 @@ <body> <div id="log"></div> <script> -var video = document.createElement('video'); -test(function() { +async_test(function(t) { var mediaSource = new MediaSource(); var url = window.URL.createObjectURL(mediaSource); window.URL.revokeObjectURL(url); + mediaSource.addEventListener('sourceopen', + t.unreached_func("url should not reference MediaSource.")); + var video = document.createElement('video'); video.src = url; - assert_equals(mediaSource.readyState, 'closed'); + video.addEventListener('error', t.step_func_done(function(e) { + assert_equals(e.target.error.code, + MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED, + 'Expected error code'); + assert_equals(mediaSource.readyState, 'closed'); + })); }, "Check revoking behavior of URL.revokeObjectURL(url)."); +async_test(function(t) { + var mediaSource = new MediaSource(); + var url = window.URL.createObjectURL(mediaSource); + var video = document.createElement('video'); + var unexpectedErrorHandler = t.unreached_func("Unexpected error.") + video.addEventListener('error', unexpectedErrorHandler); + video.src = url; + window.URL.revokeObjectURL(url); + mediaSource.addEventListener('sourceopen', t.step_func_done(function(e) { + assert_equals(mediaSource.readyState, 'open'); + mediaSource.endOfStream(); + video.removeEventListener('error', unexpectedErrorHandler); + })); +}, "Check referenced MediaSource can open after URL.revokeObjectURL(url)."); +async_test(function(t) { + var mediaSource = new MediaSource(); + var url = window.URL.createObjectURL(mediaSource); + setTimeout(function() { + mediaSource.addEventListener('sourceopen', + t.unreached_func("url should not reference MediaSource.")); + var video = document.createElement('video'); + video.src = url; + video.addEventListener('error', t.step_func_done(function(e) { + assert_equals(e.target.error.code, + MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED, + 'Expected error code'); + assert_equals(mediaSource.readyState, 'closed'); + })); + }, 0); +}, "Check auto-revoking behavior with URL.createObjectURL(MediaSource)."); </script> </body> </html> diff --git a/tests/wpt/web-platform-tests/media-source/index.html b/tests/wpt/web-platform-tests/media-source/index.html deleted file mode 100644 index 903afffdd56..00000000000 --- a/tests/wpt/web-platform-tests/media-source/index.html +++ /dev/null @@ -1,93 +0,0 @@ -<!doctype html> -<html> - <head> - <link rel='stylesheet' href='/resources/testharness.css'> - <script> - (function() { - var testURLs = []; - var testIndex = 0; - var testCount = 0; - var STATUS_STRINGS = ["PASS", "FAIL", "TIMEOUT", "NOTRUN"]; - - function onMessage(e) - { - var testData = e.data; - - //console.log(testData.type, testData); - - if (testData.type == "complete") { - var tableBody = document.querySelector("#results tbody"); - var fragment = document.createDocumentFragment(); - - testCount += testData.tests.length; - - for (var i = 0; i < testData.tests.length; ++i) { - var testResults = testData.tests[i]; - var tr = document.createElement("tr"); - var status = document.createElement("td"); - var testName = document.createElement("td"); - var message = document.createElement("td"); - - status.textContent = STATUS_STRINGS[testResults.status]; - tr.className = STATUS_STRINGS[testResults.status].toLowerCase(); - - testName.textContent = testResults.name; - message.textContent = testResults.message; - - tr.appendChild(status); - tr.appendChild(testName); - tr.appendChild(message); - fragment.appendChild(tr); - } - - testIndex++; - if (testIndex >= testURLs.length) { - return; - } - - tableBody.appendChild(fragment); - startNextTest(); - return; - } - } - - function startNextTest() - { - var iframe = document.querySelector("iframe"); - var testURL = testURLs[testIndex]; - - var tr = document.createElement("tr"); - var td = document.createElement("td"); - td.appendChild(document.createTextNode("Running tests in '" + testURL + "' :")); - td.colSpan = 3; - tr.appendChild(td); - document.querySelector("#results tbody").appendChild(tr); - - iframe.src = testURL; - } - - window["onBodyLoad"] = function() - { - window.addEventListener("message", onMessage); - var xhr = new XMLHttpRequest(); - xhr.open("GET", "manifest.txt", false); - xhr.send(); - - var str = xhr.response.replace("\r", ""); - testURLs = xhr.response.replace("\r", "").split("\n"); - startNextTest(); - } - - - })(window); - </script> - </head> - <body onload="onBodyLoad()"> - <iframe></iframe> - <table id="results" style="float:left;"> - <tbody> - </tbody> - </table> - <div id="log"></div> - </body> -</html> diff --git a/tests/wpt/web-platform-tests/media-source/mediasource-append-buffer.html b/tests/wpt/web-platform-tests/media-source/mediasource-append-buffer.html index 3bff4d9fa53..ac2c487491d 100644 --- a/tests/wpt/web-platform-tests/media-source/mediasource-append-buffer.html +++ b/tests/wpt/web-platform-tests/media-source/mediasource-append-buffer.html @@ -11,7 +11,7 @@ <script> mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) { - test.failOnEvent(mediaElement, 'error'); + mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'")); test.expectEvent(sourceBuffer, "updatestart", "Append started."); test.expectEvent(sourceBuffer, "update", "Append success."); @@ -29,7 +29,7 @@ mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) { - test.failOnEvent(mediaElement, 'error'); + mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'")); test.expectEvent(sourceBuffer, "updatestart", "Append started."); test.expectEvent(sourceBuffer, "update", "Append success."); @@ -53,7 +53,7 @@ mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) { - test.failOnEvent(mediaElement, 'error'); + mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'")); test.expectEvent(sourceBuffer, "updatestart", "Append started."); test.expectEvent(sourceBuffer, "abort", "Append aborted."); @@ -75,7 +75,7 @@ mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) { - test.failOnEvent(mediaElement, 'error'); + mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'")); test.expectEvent(sourceBuffer, "updatestart", "Append started."); test.expectEvent(sourceBuffer, "update", "Append success."); @@ -155,7 +155,7 @@ mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) { - test.failOnEvent(mediaElement, 'error'); + mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'")); test.expectEvent(sourceBuffer, "updatestart", "Append started."); test.expectEvent(sourceBuffer, "abort", "Append aborted."); @@ -183,7 +183,7 @@ mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) { - test.failOnEvent(mediaElement, 'error'); + mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'")); test.expectEvent(sourceBuffer, "updatestart", "Append started."); test.expectEvent(sourceBuffer, "updateend", "Append ended."); @@ -204,8 +204,8 @@ mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) { - test.failOnEvent(mediaElement, "error"); - test.failOnEvent(mediaSource, "sourceended"); + mediaElement.addEventListener("error", test.unreached_func("Unexpected event 'error'")); + mediaSource.addEventListener("sourceended", test.unreached_func("Unexpected event 'sourceended'")); test.expectEvent(sourceBuffer, "updatestart", "Append started."); test.expectEvent(sourceBuffer, "updateend", "Append ended."); @@ -229,7 +229,7 @@ mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) { - test.failOnEvent(mediaElement, 'error'); + mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'")); test.expectEvent(sourceBuffer, "updatestart", "Append started."); test.expectEvent(sourceBuffer, "updateend", "Append ended."); @@ -503,7 +503,7 @@ assert_false(sourceBuffer.updating, "updating attribute is false"); sourceBuffer.abort(); assert_equals(sourceBuffer.appendWindowStart, 0, "appendWindowStart is reset to 0"); - assert_equals(sourceBuffer.appendWindowEnd, Number.POSITIVE_INFINITY, + assert_equals(sourceBuffer.appendWindowEnd, Number.POSITIVE_INFINITY, "appendWindowEnd is reset to +INFINITY"); test.done(); }); diff --git a/tests/wpt/web-platform-tests/media-source/mediasource-appendwindow.html b/tests/wpt/web-platform-tests/media-source/mediasource-appendwindow.html index e1b7c112063..2a6fb426c8d 100644 --- a/tests/wpt/web-platform-tests/media-source/mediasource-appendwindow.html +++ b/tests/wpt/web-platform-tests/media-source/mediasource-appendwindow.html @@ -153,7 +153,7 @@ sourceBuffer.abort(); assert_equals(sourceBuffer.appendWindowStart, 0, "appendWindowStart is 0 after an abort'"); - assert_equals(sourceBuffer.appendWindowEnd, Number.POSITIVE_INFINITY, + assert_equals(sourceBuffer.appendWindowEnd, Number.POSITIVE_INFINITY, "appendWindowStart is POSITIVE_INFINITY after an abort"); test.waitForExpectedEvents(function() { diff --git a/tests/wpt/web-platform-tests/media-source/mediasource-buffered.html b/tests/wpt/web-platform-tests/media-source/mediasource-buffered.html index e39acd5b28a..84a9d0744f4 100644 --- a/tests/wpt/web-platform-tests/media-source/mediasource-buffered.html +++ b/tests/wpt/web-platform-tests/media-source/mediasource-buffered.html @@ -29,8 +29,8 @@ mediasource_test(function(test, mediaElement, mediaSource) { mediaElement.pause(); - test.failOnEvent(mediaElement, "error"); - test.endOnEvent(mediaElement, "ended"); + mediaElement.addEventListener("error", test.unreached_func("Unexpected event 'error'")); + mediaElement.addEventListener("ended", test.step_func_done()); MediaSourceUtil.fetchManifestAndData(test, manifestFilenameA, function(typeA, dataA) { @@ -86,8 +86,8 @@ mediasource_test(function(test, mediaElement, mediaSource) { mediaElement.pause(); - test.failOnEvent(mediaElement, "error"); - test.endOnEvent(mediaElement, "ended"); + mediaElement.addEventListener("error", test.unreached_func("Unexpected event 'error'")); + mediaElement.addEventListener("ended", test.step_func_done()); MediaSourceUtil.fetchManifestAndData(test, subType + "/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json", function(type, data) { @@ -144,8 +144,8 @@ mediasource_test(function(test, mediaElement, mediaSource) { mediaElement.pause(); - test.failOnEvent(mediaElement, "error"); - test.endOnEvent(mediaElement, "ended"); + mediaElement.addEventListener("error", test.unreached_func("Unexpected event 'error'")); + mediaElement.addEventListener("ended", test.step_func_done()); MediaSourceUtil.fetchManifestAndData(test, subType + "/test-av-384k-44100Hz-1ch-320x240-30fps-10kfr-manifest.json", function(type, data) { @@ -173,8 +173,8 @@ mediasource_test(function(test, mediaElement, mediaSource) { mediaElement.pause(); - test.failOnEvent(mediaElement, "error"); - test.endOnEvent(mediaElement, "ended"); + mediaElement.addEventListener("error", test.unreached_func("Unexpected event 'error'")); + mediaElement.addEventListener("ended", test.step_func_done()); var sourceBuffer = mediaSource.addSourceBuffer(MediaSourceUtil.AUDIO_ONLY_TYPE); diff --git a/tests/wpt/web-platform-tests/media-source/mediasource-config-changes.js b/tests/wpt/web-platform-tests/media-source/mediasource-config-changes.js index 2ccc1e1a05d..857bfb93478 100644 --- a/tests/wpt/web-platform-tests/media-source/mediasource-config-changes.js +++ b/tests/wpt/web-platform-tests/media-source/mediasource-config-changes.js @@ -22,7 +22,7 @@ function mediaSourceConfigChangeTest(directory, idA, idB, description) mediasource_test(function(test, mediaElement, mediaSource) { mediaElement.pause(); - test.failOnEvent(mediaElement, 'error'); + mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'")); var expectResizeEvents = resolutionFromFilename(manifestFilenameA) != resolutionFromFilename(manifestFilenameB); var expectedResizeEventCount = 0; @@ -73,9 +73,9 @@ function mediaSourceConfigChangeTest(directory, idA, idB, description) test.expectEvent(sourceBuffer, 'updatestart', 'sourceBuffer'); test.expectEvent(sourceBuffer, 'update', 'sourceBuffer'); test.expectEvent(sourceBuffer, 'updateend', 'sourceBuffer'); - }); + }); - test.waitForExpectedEvents(function() + test.waitForExpectedEvents(function() { assert_false(sourceBuffer.updating, "updating"); diff --git a/tests/wpt/web-platform-tests/media-source/mediasource-endofstream-invaliderror.html b/tests/wpt/web-platform-tests/media-source/mediasource-endofstream-invaliderror.html index e0096decc06..2221d13296f 100644 --- a/tests/wpt/web-platform-tests/media-source/mediasource-endofstream-invaliderror.html +++ b/tests/wpt/web-platform-tests/media-source/mediasource-endofstream-invaliderror.html @@ -11,7 +11,7 @@ <script> mediasource_test(function(test, mediaElement, mediaSource) { - test.failOnEvent(mediaElement, 'error'); + mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'")); assert_equals(mediaSource.readyState, 'open'); assert_throws(new TypeError(), @@ -24,7 +24,7 @@ mediasource_test(function(test, mediaElement, mediaSource) { - test.failOnEvent(mediaElement, 'error'); + mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'")); assert_equals(mediaSource.readyState, 'open'); assert_throws(new TypeError(), @@ -37,7 +37,7 @@ mediasource_test(function(test, mediaElement, mediaSource) { - test.failOnEvent(mediaElement, 'error'); + mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'")); assert_equals(mediaSource.readyState, 'open'); assert_throws(new TypeError(), diff --git a/tests/wpt/web-platform-tests/media-source/mediasource-getvideoplaybackquality.html b/tests/wpt/web-platform-tests/media-source/mediasource-getvideoplaybackquality.html index 1c71968fc15..5a3f6b1b5d7 100644 --- a/tests/wpt/web-platform-tests/media-source/mediasource-getvideoplaybackquality.html +++ b/tests/wpt/web-platform-tests/media-source/mediasource-getvideoplaybackquality.html @@ -33,7 +33,7 @@ timeUpdateCount++; })); - test.failOnEvent(mediaElement, 'error'); + mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'")); test.expectEvent(sourceBuffer, 'updatestart', 'sourceBuffer'); test.expectEvent(sourceBuffer, 'update', 'sourceBuffer'); diff --git a/tests/wpt/web-platform-tests/media-source/mediasource-play.html b/tests/wpt/web-platform-tests/media-source/mediasource-play.html index 928aa72f331..487c03087bd 100644 --- a/tests/wpt/web-platform-tests/media-source/mediasource-play.html +++ b/tests/wpt/web-platform-tests/media-source/mediasource-play.html @@ -11,8 +11,8 @@ <script> mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) { - test.failOnEvent(mediaElement, 'error'); - test.endOnEvent(mediaElement, 'ended'); + mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'")); + mediaElement.addEventListener('ended', test.step_func_done()); test.expectEvent(sourceBuffer, 'updatestart', 'sourceBuffer'); test.expectEvent(sourceBuffer, 'update', 'sourceBuffer'); diff --git a/tests/wpt/web-platform-tests/media-source/mediasource-redundant-seek.html b/tests/wpt/web-platform-tests/media-source/mediasource-redundant-seek.html index c1cc84c3096..152b156f0fd 100644 --- a/tests/wpt/web-platform-tests/media-source/mediasource-redundant-seek.html +++ b/tests/wpt/web-platform-tests/media-source/mediasource-redundant-seek.html @@ -49,8 +49,8 @@ test.waitForExpectedEvents(function() { // No more seeking or seeked events should occur. - test.failOnEvent(mediaElement, 'seeking'); - test.failOnEvent(mediaElement, 'seeked'); + mediaElement.addEventListener('seeking', test.unreached_func("Unexpected event 'seeking'")); + mediaElement.addEventListener('seeked', test.unreached_func("Unexpected event 'seeked'")); assert_false(mediaElement.seeking, 'Element is not seeking'); assert_greater_than_equal(mediaElement.currentTime, 1.0, 'Element time is at or after last seek time'); diff --git a/tests/wpt/web-platform-tests/media-source/mediasource-sequencemode-append-buffer.html b/tests/wpt/web-platform-tests/media-source/mediasource-sequencemode-append-buffer.html index 15263eebf7f..d2cfe351e67 100644 --- a/tests/wpt/web-platform-tests/media-source/mediasource-sequencemode-append-buffer.html +++ b/tests/wpt/web-platform-tests/media-source/mediasource-sequencemode-append-buffer.html @@ -14,7 +14,7 @@ return mediasource_testafterdataloaded(function(test, mediaElement, mediaSource, segmentInfo, sourceBuffer, mediaData) { assert_greater_than(segmentInfo.media.length, 3, "at least 3 media segments for supported type"); - test.failOnEvent(mediaElement, "error"); + mediaElement.addEventListener("error", test.unreached_func("Unexpected event 'error'")); sourceBuffer.mode = "sequence"; assert_equals(sourceBuffer.mode, "sequence", "mode after setting it to \"sequence\""); diff --git a/tests/wpt/web-platform-tests/media-source/mediasource-util.js b/tests/wpt/web-platform-tests/media-source/mediasource-util.js index 0271fc5caee..036df891997 100644 --- a/tests/wpt/web-platform-tests/media-source/mediasource-util.js +++ b/tests/wpt/web-platform-tests/media-source/mediasource-util.js @@ -1,41 +1,41 @@ (function(window) { var SEGMENT_INFO_LIST = [ - { - url: 'mp4/test.mp4', - type: 'video/mp4; codecs="mp4a.40.2,avc1.4d400d"', - duration: 6.0756, - init: { offset: 0, size: 1197 }, - media: [ - { offset: 1241, size: 17845, timecode: 0.000000 }, - { offset: 19130, size: 5551, timecode: 0.464800 }, - { offset: 24725, size: 10944, timecode: 0.763600 }, - { offset: 35713, size: 7131, timecode: 0.863200 }, - { offset: 42888, size: 2513, timecode: 1.128800 }, - { offset: 45457, size: 3022, timecode: 1.261600 }, - { offset: 48479, size: 815, timecode: 1.427600 }, - { offset: 49338, size: 2818, timecode: 1.460800 }, - { offset: 52200, size: 11581, timecode: 1.593600 }, - { offset: 63825, size: 3003, timecode: 1.726400 }, - { offset: 66872, size: 6390, timecode: 1.892400 }, - { offset: 73306, size: 3740, timecode: 2.124800 }, - { offset: 77102, size: 11779, timecode: 2.324000 }, - { offset: 88881, size: 851, timecode: 2.490000 }, - { offset: 89776, size: 4236, timecode: 2.523200 }, - { offset: 94056, size: 9538, timecode: 2.755600 }, - { offset: 103638, size: 13295, timecode: 3.154000 }, - { offset: 116977, size: 309, timecode: 3.386400 }, - { offset: 117330, size: 5806, timecode: 3.419600 }, - { offset: 123180, size: 4392, timecode: 3.751600 }, - { offset: 127616, size: 15408, timecode: 3.984000 }, - { offset: 143068, size: 9899, timecode: 4.216400 }, - { offset: 153011, size: 11562, timecode: 4.780800 }, - { offset: 164617, size: 7398, timecode: 4.946800 }, - { offset: 172059, size: 5698, timecode: 5.212400 }, - { offset: 177801, size: 11682, timecode: 5.511200 }, - { offset: 189527, size: 3023, timecode: 5.677200 }, - { offset: 192594, size: 5726, timecode: 5.843200 }, - ] - }, + { + url: 'mp4/test.mp4', + type: 'video/mp4; codecs="mp4a.40.2,avc1.4d400d"', + duration: 6.0756, + init: { offset: 0, size: 1197 }, + media: [ + { offset: 1241, size: 17845, timecode: 0.000000 }, + { offset: 19130, size: 5551, timecode: 0.464800 }, + { offset: 24725, size: 10944, timecode: 0.763600 }, + { offset: 35713, size: 7131, timecode: 0.863200 }, + { offset: 42888, size: 2513, timecode: 1.128800 }, + { offset: 45457, size: 3022, timecode: 1.261600 }, + { offset: 48479, size: 815, timecode: 1.427600 }, + { offset: 49338, size: 2818, timecode: 1.460800 }, + { offset: 52200, size: 11581, timecode: 1.593600 }, + { offset: 63825, size: 3003, timecode: 1.726400 }, + { offset: 66872, size: 6390, timecode: 1.892400 }, + { offset: 73306, size: 3740, timecode: 2.124800 }, + { offset: 77102, size: 11779, timecode: 2.324000 }, + { offset: 88881, size: 851, timecode: 2.490000 }, + { offset: 89776, size: 4236, timecode: 2.523200 }, + { offset: 94056, size: 9538, timecode: 2.755600 }, + { offset: 103638, size: 13295, timecode: 3.154000 }, + { offset: 116977, size: 309, timecode: 3.386400 }, + { offset: 117330, size: 5806, timecode: 3.419600 }, + { offset: 123180, size: 4392, timecode: 3.751600 }, + { offset: 127616, size: 15408, timecode: 3.984000 }, + { offset: 143068, size: 9899, timecode: 4.216400 }, + { offset: 153011, size: 11562, timecode: 4.780800 }, + { offset: 164617, size: 7398, timecode: 4.946800 }, + { offset: 172059, size: 5698, timecode: 5.212400 }, + { offset: 177801, size: 11682, timecode: 5.511200 }, + { offset: 189527, size: 3023, timecode: 5.677200 }, + { offset: 192594, size: 5726, timecode: 5.843200 }, + ] + }, { url: 'webm/test.webm', type: 'video/webm; codecs="vp8, vorbis"', @@ -274,27 +274,27 @@ MediaSourceUtil.append = function(test, sourceBuffer, data, callback) { - function onUpdate() { - sourceBuffer.removeEventListener("update", onUpdate); - callback(); - } + function onUpdate() { + sourceBuffer.removeEventListener("update", onUpdate); + callback(); + } sourceBuffer.addEventListener("update", onUpdate); - test.failOnEvent(sourceBuffer, "error"); + sourceBuffer.addEventListener('error', test.unreached_func("Unexpected event 'error'")); - sourceBuffer.appendBuffer(data); + sourceBuffer.appendBuffer(data); }; MediaSourceUtil.appendUntilEventFires = function(test, mediaElement, eventName, sourceBuffer, mediaData, segmentInfo, startingIndex) { - var eventFired = false; - function onEvent() { - mediaElement.removeEventListener(eventName, onEvent); - eventFired = true; - } - mediaElement.addEventListener(eventName, onEvent); - - var i = startingIndex; + var eventFired = false; + function onEvent() { + mediaElement.removeEventListener(eventName, onEvent); + eventFired = true; + } + mediaElement.addEventListener(eventName, onEvent); + + var i = startingIndex; var onAppendDone = function() { if (eventFired) return; @@ -308,19 +308,6 @@ function addExtraTestMethods(test) { - test.failOnEvent = function(object, eventName) - { - object.addEventListener(eventName, test.step_func(function(event) - { - assert_unreached("Unexpected event '" + eventName + "'"); - })); - }; - - test.endOnEvent = function(object, eventName) - { - object.addEventListener(eventName, test.step_func(function(event) { test.done(); })); - }; - test.eventExpectations_ = new EventExpectationsManager(test); test.expectEvent = function(object, eventName, description) { @@ -401,7 +388,7 @@ return; } - test.failOnEvent(mediaElement, 'error'); + mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'")); var sourceBuffer = mediaSource.addSourceBuffer(segmentInfo.type); MediaSourceUtil.loadBinaryData(test, segmentInfo.url, function(mediaData) diff --git a/tests/wpt/web-platform-tests/notifications/notification-constructor-invalid.html b/tests/wpt/web-platform-tests/notifications/notification-constructor-invalid.html index 96d9d2f20b6..d065e975e34 100644 --- a/tests/wpt/web-platform-tests/notifications/notification-constructor-invalid.html +++ b/tests/wpt/web-platform-tests/notifications/notification-constructor-invalid.html @@ -10,7 +10,7 @@ <div id="log"></div> <script> test(function() { - assert_throws("new TypeError()", function() { + assert_throws(new TypeError(), function() { var notification = new Notification(); }); }, "Test checks that notification constructor arguments can't be empty"); diff --git a/tests/wpt/web-platform-tests/resource-timing/test_resource_timing.js b/tests/wpt/web-platform-tests/resource-timing/test_resource_timing.js index 0072d50e58a..2862e16d100 100644 --- a/tests/wpt/web-platform-tests/resource-timing/test_resource_timing.js +++ b/tests/wpt/web-platform-tests/resource-timing/test_resource_timing.js @@ -151,9 +151,6 @@ function resource_load(expected) t["simple_attrs"].step(function() { var actual = window.performance.getEntriesByName(expected.name)[0]; var expected_type = expected.initiatorType; - if (expected.initiatorType == "iframe") { - expected_type = "subdocument"; - } assert_equals(actual.name, expected.name); assert_equals(actual.initiatorType, expected_type); assert_equals(actual.entryType, "resource"); diff --git a/tests/wpt/web-platform-tests/serve.py b/tests/wpt/web-platform-tests/serve.py index 536ed4963e5..a65e61f618a 100644 --- a/tests/wpt/web-platform-tests/serve.py +++ b/tests/wpt/web-platform-tests/serve.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python from tools.serve import serve def main(): diff --git a/tests/wpt/web-platform-tests/subresource-integrity/crossorigin-creds-script.js.sub.headers b/tests/wpt/web-platform-tests/subresource-integrity/crossorigin-creds-script.js.sub.headers index a611700410c..cf16bd88ef5 100644 --- a/tests/wpt/web-platform-tests/subresource-integrity/crossorigin-creds-script.js.sub.headers +++ b/tests/wpt/web-platform-tests/subresource-integrity/crossorigin-creds-script.js.sub.headers @@ -1,2 +1,2 @@ -Access-Control-Allow-Origin: http://{{domains[]}}:{{ports[http][0]}} +Access-Control-Allow-Origin: {{location[scheme]}}://{{domains[]}}:{{location[port]}} Access-Control-Allow-Credentials: true diff --git a/tests/wpt/web-platform-tests/subresource-integrity/crossorigin-creds-style.css.sub.headers b/tests/wpt/web-platform-tests/subresource-integrity/crossorigin-creds-style.css.sub.headers index a611700410c..cf16bd88ef5 100644 --- a/tests/wpt/web-platform-tests/subresource-integrity/crossorigin-creds-style.css.sub.headers +++ b/tests/wpt/web-platform-tests/subresource-integrity/crossorigin-creds-style.css.sub.headers @@ -1,2 +1,2 @@ -Access-Control-Allow-Origin: http://{{domains[]}}:{{ports[http][0]}} +Access-Control-Allow-Origin: {{location[scheme]}}://{{domains[]}}:{{location[port]}} Access-Control-Allow-Credentials: true diff --git a/tests/wpt/web-platform-tests/tools/LICENSE b/tests/wpt/web-platform-tests/tools/LICENSE new file mode 100644 index 00000000000..45896e6be2b --- /dev/null +++ b/tests/wpt/web-platform-tests/tools/LICENSE @@ -0,0 +1,30 @@ +W3C 3-clause BSD License + +http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of works must retain the original copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the original copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* Neither the name of the W3C nor the names of its contributors may be + used to endorse or promote products derived from this work without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tests/wpt/web-platform-tests/tools/lint/lint.py b/tests/wpt/web-platform-tests/tools/lint/lint.py index 76453f0cdfd..8a6aadf6da1 100644 --- a/tests/wpt/web-platform-tests/tools/lint/lint.py +++ b/tests/wpt/web-platform-tests/tools/lint/lint.py @@ -165,16 +165,16 @@ def check_parsed(path, f): if source_file.testharness_nodes: if len(source_file.testharness_nodes) > 1: errors.append(("MULTIPLE-TESTHARNESS", - "%s more than one <script src='/resources/testharness.js>'" % path, None)) + "%s more than one <script src='/resources/testharness.js'>" % path, None)) testharnessreport_nodes = source_file.root.findall(".//{http://www.w3.org/1999/xhtml}script[@src='/resources/testharnessreport.js']") if not testharnessreport_nodes: errors.append(("MISSING-TESTHARNESSREPORT", - "%s missing <script src='/resources/testharnessreport.js>'" % path, None)) + "%s missing <script src='/resources/testharnessreport.js'>" % path, None)) else: if len(testharnessreport_nodes) > 1: errors.append(("MULTIPLE-TESTHARNESSREPORT", - "%s more than one <script src='/resources/testharnessreport.js>'" % path, None)) + "%s more than one <script src='/resources/testharnessreport.js'>" % path, None)) for element in source_file.variant_nodes: if "content" not in element.attrib: @@ -232,27 +232,46 @@ def output_error_count(error_count): def main(): error_count = defaultdict(int) + last = None - def run_lint(path, fn, *args): + def run_lint(path, fn, last, *args): errors = whitelist_errors(path, fn(path, *args)) + if errors: + last = (errors[-1][0], path) + output_errors(errors) for error_type, error, line in errors: error_count[error_type] += 1 + return last for path in iter_files(): abs_path = os.path.join(repo_root, path) if not os.path.exists(path): continue for path_fn in path_lints: - run_lint(path, path_fn) + last = run_lint(path, path_fn, last) if not os.path.isdir(abs_path): with open(abs_path) as f: for file_fn in file_lints: - run_lint(path, file_fn, f) + last = run_lint(path, file_fn, last, f) f.seek(0) output_error_count(error_count) + if error_count: + print + print "You must fix all errors; for details on how to fix them, see" + print "https://github.com/w3c/web-platform-tests/blob/master/docs/lint-tool.md" + print + print "However, instead of fixing a particular error, it's sometimes" + print "OK to add a line to the lint.whitelist file in the root of the" + print "web-platform-tests directory to make the lint tool ignore it." + print + print "For example, to make the lint tool ignore all '%s'" % last[0] + print "errors in the %s file," % last[1] + print "you could add the following line to the lint.whitelist file." + print + print "%s:%s" % (last[0], last[1]) return sum(error_count.itervalues()) path_lints = [check_path_length] diff --git a/tests/wpt/web-platform-tests/url/interfaces.html b/tests/wpt/web-platform-tests/url/interfaces.html index f40a1a04ac4..4cae46732be 100644 --- a/tests/wpt/web-platform-tests/url/interfaces.html +++ b/tests/wpt/web-platform-tests/url/interfaces.html @@ -30,7 +30,7 @@ interface URLUtils { attribute ScalarValueString port; attribute ScalarValueString pathname; attribute ScalarValueString search; - attribute URLSearchParams searchParams; + readonly attribute URLSearchParams searchParams; attribute ScalarValueString hash; }; diff --git a/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-gainnode-interface/test.html b/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-gainnode-interface/test-gainnode.html index 4f92fbbe58b..4f92fbbe58b 100644 --- a/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-gainnode-interface/test.html +++ b/tests/wpt/web-platform-tests/webaudio/the-audio-api/the-gainnode-interface/test-gainnode.html diff --git a/tests/wpt/web-platform-tests/webstorage/eventTestHarness.js b/tests/wpt/web-platform-tests/webstorage/eventTestHarness.js new file mode 100644 index 00000000000..82f8c3df02c --- /dev/null +++ b/tests/wpt/web-platform-tests/webstorage/eventTestHarness.js @@ -0,0 +1,53 @@ +iframe = document.createElement("IFRAME"); +iframe.src = "about:blank"; +document.body.appendChild(iframe); +iframe.contentWindow.document.body.innerText = "Nothing to see here."; + +storageEventList = new Array(); +iframe.contentWindow.onstorage = function (e) { + window.parent.storageEventList.push(e); +} + +function runAfterNStorageEvents(callback, expectedNumEvents) +{ + countStorageEvents(callback, expectedNumEvents, 0) +} + +function countStorageEvents(callback, expectedNumEvents, times) +{ + function onTimeout() + { + var currentCount = storageEventList.length; + if (currentCount == expectedNumEvents) { + callback(); + } else if (currentCount > expectedNumEvents) { + msg = "got at least " + currentCount + ", expected only " + expectedNumEvents + " events"; + callback(msg); + } else if (times > 50) { + msg = "Timeout: only got " + currentCount + ", expected " + expectedNumEvents + " events"; + callback(msg); + } else { + countStorageEvents(callback, expectedNumEvents, times+1); + } + } + setTimeout(onTimeout, 20); +} + +function testStorages(testCallback) +{ + // When we're done testing LocalStorage, this is run. + function allDone() + { + localStorage.clear(); + sessionStorage.clear(); + } + + // When we're done testing with SessionStorage, this is run. + function runLocalStorage() + { + testCallback("localStorage", allDone); + } + + // First run the test with SessionStorage. + testCallback("sessionStorage", runLocalStorage); +} diff --git a/tests/wpt/web-platform-tests/webstorage/event_basic.html b/tests/wpt/web-platform-tests/webstorage/event_basic.html new file mode 100644 index 00000000000..407e41c4b12 --- /dev/null +++ b/tests/wpt/web-platform-tests/webstorage/event_basic.html @@ -0,0 +1,15 @@ +<!DOCTYPE HTML> +<html> +<head> +<meta name="timeout" content="long"> +<title>WebStorage Test: StorageEvent - window.onstorage</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<script src="eventTestHarness.js"></script> +<script src="event_basic.js"></script> +</body> +</html> + diff --git a/tests/wpt/web-platform-tests/webstorage/event_basic.js b/tests/wpt/web-platform-tests/webstorage/event_basic.js new file mode 100644 index 00000000000..dbc113675e8 --- /dev/null +++ b/tests/wpt/web-platform-tests/webstorage/event_basic.js @@ -0,0 +1,148 @@ +test(function() { + var name ; + testStorages(runTest); + + function runTest(storageString, callback) + { + name = storageString; + window.completionCallback = callback; + + assert_true(storageString in window, storageString + " exist"); + window.storage = eval(storageString); + + storageEventList = new Array(); + storage.clear(); + assert_equals(storage.length, 0, "storage.length"); + + runAfterNStorageEvents(step1, 0); + } + + function step1(msg) + { + storageEventList = new Array(); + storage.setItem('FOO', 'BAR'); + + runAfterNStorageEvents(step2, 1); + } + + function shouldBeEqualToString(express, expectValue) { + assert_equals(typeof express, "string"); + assert_equals(express, expectValue); + } + + function step2(msg) + { + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + assert_equals(storageEventList.length, 1); + shouldBeEqualToString(storageEventList[0].key, "FOO"); + assert_equals(storageEventList[0].oldValue, null); + shouldBeEqualToString(storageEventList[0].newValue, "BAR"); + }, name + ": the first storage event properties"); + + storage.setItem('FU', 'BAR'); + storage.setItem('a', '1'); + storage.setItem('b', '2'); + storage.setItem('b', '3'); + + runAfterNStorageEvents(step3, 5); + } + + function step3(msg) + { + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + assert_equals(storageEventList.length, 5); + shouldBeEqualToString(storageEventList[1].key, "FU"); + assert_equals(storageEventList[1].oldValue, null); + shouldBeEqualToString(storageEventList[1].newValue, "BAR"); + }, name + ": the second storage event properties"); + + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + shouldBeEqualToString(storageEventList[2].key, "a"); + assert_equals(storageEventList[2].oldValue, null); + shouldBeEqualToString(storageEventList[2].newValue, "1"); + }, name + ": the third storage event properties"); + + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + shouldBeEqualToString(storageEventList[3].key, "b"); + assert_equals(storageEventList[3].oldValue, null); + shouldBeEqualToString(storageEventList[3].newValue, "2"); + }, name + ": the fourth storage event properties"); + + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + shouldBeEqualToString(storageEventList[4].key, "b"); + shouldBeEqualToString(storageEventList[4].oldValue, "2"); + shouldBeEqualToString(storageEventList[4].newValue, "3"); + }, name + ": the fifth storage event properties"); + + + storage.removeItem('FOO'); + + runAfterNStorageEvents(step4, 6); + } + + function step4(msg) + { + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + assert_equals(storageEventList.length, 6); + shouldBeEqualToString(storageEventList[5].key, "FOO"); + shouldBeEqualToString(storageEventList[5].oldValue, "BAR"); + assert_equals(storageEventList[5].newValue, null); + }, name + ": the sixth storage event properties"); + + storage.removeItem('FU'); + + runAfterNStorageEvents(step5, 7); + } + + function step5(msg) + { + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + assert_equals(storageEventList.length, 7); + shouldBeEqualToString(storageEventList[6].key, "FU"); + shouldBeEqualToString(storageEventList[6].oldValue, "BAR"); + assert_equals(storageEventList[6].newValue, null); + }, name + ": the seventh storage event properties"); + + storage.clear(); + + runAfterNStorageEvents(step6, 8); + } + + function step6(msg) + { + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + assert_equals(storageEventList.length, 8); + assert_equals(storageEventList[7].key, null); + assert_equals(storageEventList[7].oldValue, null); + assert_equals(storageEventList[7].newValue, null); + }, name + ": the eighth storage event properties"); + + completionCallback(); + } + +}, "DOM Storage mutations fire StorageEvents that are caught by the event listener set via window.onstorage."); + diff --git a/tests/wpt/web-platform-tests/webstorage/event_body_attribute.html b/tests/wpt/web-platform-tests/webstorage/event_body_attribute.html new file mode 100644 index 00000000000..80ec6761864 --- /dev/null +++ b/tests/wpt/web-platform-tests/webstorage/event_body_attribute.html @@ -0,0 +1,15 @@ +<!DOCTYPE HTML> +<html> +<head> +<meta name="timeout" content="long"> +<title>WebStorage Test: StorageEvent - set onstorage as body attribute</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<script src="eventTestHarness.js"></script> +<script src="event_body_attribute.js"></script> +</body> +</html> + diff --git a/tests/wpt/web-platform-tests/webstorage/event_body_attribute.js b/tests/wpt/web-platform-tests/webstorage/event_body_attribute.js new file mode 100644 index 00000000000..5c976740c6c --- /dev/null +++ b/tests/wpt/web-platform-tests/webstorage/event_body_attribute.js @@ -0,0 +1,148 @@ +test(function() { + var name ; + testStorages(runTest); + + function runTest(storageString, callback) + { + name = storageString; + window.completionCallback = callback; + + assert_true(storageString in window, storageString + " exist"); + window.storage = eval(storageString); + + storage.clear(); + assert_equals(storage.length, 0, "storage.length"); + + iframe.onload = step1; + iframe.src = "iframe/event_body_handler.html"; + } + + function step1(msg) + { + storageEventList = new Array(); + storage.setItem('FOO', 'BAR'); + + runAfterNStorageEvents(step2, 1); + } + + function shouldBeEqualToString(express, expectValue) { + assert_equals(typeof express, "string"); + assert_equals(express, expectValue); + } + + function step2(msg) + { + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + assert_equals(storageEventList.length, 1); + shouldBeEqualToString(storageEventList[0].key, "FOO"); + assert_equals(storageEventList[0].oldValue, null); + shouldBeEqualToString(storageEventList[0].newValue, "BAR"); + }, name + ": the first storage event properties"); + + storage.setItem('FU', 'BAR'); + storage.setItem('a', '1'); + storage.setItem('b', '2'); + storage.setItem('b', '3'); + + runAfterNStorageEvents(step3, 5); + } + + function step3(msg) + { + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + assert_equals(storageEventList.length, 5); + shouldBeEqualToString(storageEventList[1].key, "FU"); + assert_equals(storageEventList[1].oldValue, null); + shouldBeEqualToString(storageEventList[1].newValue, "BAR"); + }, name + ": the second storage event properties"); + + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + shouldBeEqualToString(storageEventList[2].key, "a"); + assert_equals(storageEventList[2].oldValue, null); + shouldBeEqualToString(storageEventList[2].newValue, "1"); + }, name + ": the third storage event properties"); + + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + shouldBeEqualToString(storageEventList[3].key, "b"); + assert_equals(storageEventList[3].oldValue, null); + shouldBeEqualToString(storageEventList[3].newValue, "2"); + }, name + ": the fourth storage event properties"); + + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + shouldBeEqualToString(storageEventList[4].key, "b"); + shouldBeEqualToString(storageEventList[4].oldValue, "2"); + shouldBeEqualToString(storageEventList[4].newValue, "3"); + }, name + ": the fifth storage event properties"); + + + storage.removeItem('FOO'); + + runAfterNStorageEvents(step4, 6); + } + + function step4(msg) + { + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + assert_equals(storageEventList.length, 6); + shouldBeEqualToString(storageEventList[5].key, "FOO"); + shouldBeEqualToString(storageEventList[5].oldValue, "BAR"); + assert_equals(storageEventList[5].newValue, null); + }, name + ": the sixth storage event properties"); + + storage.removeItem('FU'); + + runAfterNStorageEvents(step5, 7); + } + + function step5(msg) + { + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + assert_equals(storageEventList.length, 7); + shouldBeEqualToString(storageEventList[6].key, "FU"); + shouldBeEqualToString(storageEventList[6].oldValue, "BAR"); + assert_equals(storageEventList[6].newValue, null); + }, name + ": the seventh storage event properties"); + + storage.clear(); + + runAfterNStorageEvents(step6, 8); + } + + function step6(msg) + { + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + assert_equals(storageEventList.length, 8); + assert_equals(storageEventList[7].key, null); + assert_equals(storageEventList[7].oldValue, null); + assert_equals(storageEventList[7].newValue, null); + }, name + ": the eighth storage event properties"); + + completionCallback(); + } + +}, "DOM Storage mutations fire StorageEvents that are caught by the event listener specified as an attribute on the body."); + diff --git a/tests/wpt/web-platform-tests/webstorage/event_case_sensitive.html b/tests/wpt/web-platform-tests/webstorage/event_case_sensitive.html new file mode 100644 index 00000000000..916b2304126 --- /dev/null +++ b/tests/wpt/web-platform-tests/webstorage/event_case_sensitive.html @@ -0,0 +1,15 @@ +<!DOCTYPE HTML> +<html> +<head> +<meta name="timeout" content="long"> +<title>WebStorage Test: StorageEvent - the case of value changed</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<script src="eventTestHarness.js"></script> +<script src="event_case_sensitive.js"></script> +</body> +</html> + diff --git a/tests/wpt/web-platform-tests/webstorage/event_case_sensitive.js b/tests/wpt/web-platform-tests/webstorage/event_case_sensitive.js new file mode 100644 index 00000000000..71be9049042 --- /dev/null +++ b/tests/wpt/web-platform-tests/webstorage/event_case_sensitive.js @@ -0,0 +1,54 @@ +test(function() { + var name ; + testStorages(runTest); + + function runTest(storageString, callback) + { + name = storageString; + window.completionCallback = callback; + + assert_true(storageString in window, storageString + " exist"); + window.storage = eval(storageString); + + storage.clear(); + assert_equals(storage.length, 0, "storage.length"); + storage.foo = "test"; + + runAfterNStorageEvents(step1, 1); + } + + function step1(msg) + { + storageEventList = new Array(); + storage.foo = "test"; + + runAfterNStorageEvents(step2, 0); + } + + function step2(msg) + { + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + assert_equals(storageEventList.length, 0); + }, name + ": The key/value does not change, the event is not fired."); + + storage.foo = "TEST"; + + runAfterNStorageEvents(step3, 1); + } + + function step3(msg) + { + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + assert_equals(storageEventList.length, 1); + }, name + ": The event is fired when the value case is changed."); + + completionCallback(); + } +}, "storage events fire even when only the case of the value changes."); + diff --git a/tests/wpt/web-platform-tests/webstorage/event_setattribute.html b/tests/wpt/web-platform-tests/webstorage/event_setattribute.html new file mode 100644 index 00000000000..c48a2e0fc35 --- /dev/null +++ b/tests/wpt/web-platform-tests/webstorage/event_setattribute.html @@ -0,0 +1,15 @@ +<!DOCTYPE HTML> +<html> +<head> +<meta name="timeout" content="long"> +<title>WebStorage Test: StorageEvent - attached setAttribute</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<script src="eventTestHarness.js"></script> +<script src="event_setattribute.js"></script> +</body> +</html> + diff --git a/tests/wpt/web-platform-tests/webstorage/event_setattribute.js b/tests/wpt/web-platform-tests/webstorage/event_setattribute.js new file mode 100644 index 00000000000..1a56504c1db --- /dev/null +++ b/tests/wpt/web-platform-tests/webstorage/event_setattribute.js @@ -0,0 +1,149 @@ +test(function() { + var name ; + testStorages(runTest); + + function runTest(storageString, callback) + { + name = storageString; + window.completionCallback = callback; + + assert_true(storageString in window, storageString + " exist"); + window.storage = eval(storageString); + + storageEventList = new Array(); + storage.clear(); + assert_equals(storage.length, 0, "storage.length"); + + iframe.onload = step1; + iframe.src = "iframe/event_setattribute_handler.html"; + } + + function step1(msg) + { + storageEventList = new Array(); + storage.setItem('FOO', 'BAR'); + + runAfterNStorageEvents(step2, 1); + } + + function shouldBeEqualToString(express, expectValue) { + assert_equals(typeof express, "string"); + assert_equals(express, expectValue); + } + + function step2(msg) + { + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + assert_equals(storageEventList.length, 1); + shouldBeEqualToString(storageEventList[0].key, "FOO"); + assert_equals(storageEventList[0].oldValue, null); + shouldBeEqualToString(storageEventList[0].newValue, "BAR"); + }, name + ": the first storage event properties"); + + storage.setItem('FU', 'BAR'); + storage.setItem('a', '1'); + storage.setItem('b', '2'); + storage.setItem('b', '3'); + + runAfterNStorageEvents(step3, 5); + } + + function step3(msg) + { + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + assert_equals(storageEventList.length, 5); + shouldBeEqualToString(storageEventList[1].key, "FU"); + assert_equals(storageEventList[1].oldValue, null); + shouldBeEqualToString(storageEventList[1].newValue, "BAR"); + }, name + ": the second storage event properties"); + + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + shouldBeEqualToString(storageEventList[2].key, "a"); + assert_equals(storageEventList[2].oldValue, null); + shouldBeEqualToString(storageEventList[2].newValue, "1"); + }, name + ": the third storage event properties"); + + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + shouldBeEqualToString(storageEventList[3].key, "b"); + assert_equals(storageEventList[3].oldValue, null); + shouldBeEqualToString(storageEventList[3].newValue, "2"); + }, name + ": the forth storage event properties"); + + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + shouldBeEqualToString(storageEventList[4].key, "b"); + shouldBeEqualToString(storageEventList[4].oldValue, "2"); + shouldBeEqualToString(storageEventList[4].newValue, "3"); + }, name + ": the fifth storage event properties"); + + + storage.removeItem('FOO'); + + runAfterNStorageEvents(step4, 6); + } + + function step4(msg) + { + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + assert_equals(storageEventList.length, 6); + shouldBeEqualToString(storageEventList[5].key, "FOO"); + shouldBeEqualToString(storageEventList[5].oldValue, "BAR"); + assert_equals(storageEventList[5].newValue, null); + }, name + ": the sixth storage event properties"); + + storage.removeItem('FU'); + + runAfterNStorageEvents(step5, 7); + } + + function step5(msg) + { + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + assert_equals(storageEventList.length, 7); + shouldBeEqualToString(storageEventList[6].key, "FU"); + shouldBeEqualToString(storageEventList[6].oldValue, "BAR"); + assert_equals(storageEventList[6].newValue, null); + }, name + ": the seventh storage event properties"); + + storage.clear(); + + runAfterNStorageEvents(step6, 8); + } + + function step6(msg) + { + test(function() { + if(msg != undefined) { + assert_unreached(msg); + } + assert_equals(storageEventList.length, 8); + assert_equals(storageEventList[7].key, null); + assert_equals(storageEventList[7].oldValue, null); + assert_equals(storageEventList[7].newValue, null); + }, name + ": the eighth storage event properties"); + + completionCallback(); + } + +}, "DOM Storage mutations fire StorageEvents that are caught by the event listener attached via setattribute."); + diff --git a/tests/wpt/web-platform-tests/webstorage/iframe/event_body_handler.html b/tests/wpt/web-platform-tests/webstorage/iframe/event_body_handler.html new file mode 100644 index 00000000000..1200f405e67 --- /dev/null +++ b/tests/wpt/web-platform-tests/webstorage/iframe/event_body_handler.html @@ -0,0 +1,14 @@ +<!DOCTYPE HTML> +<html> +<head> +<script> + +function handleStorageEvent(e) { + window.parent.storageEventList.push(e); +} + +</script> +</head> +<body onstorage="handleStorageEvent(window.event);"> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/webstorage/iframe/event_setattribute_handler.html b/tests/wpt/web-platform-tests/webstorage/iframe/event_setattribute_handler.html new file mode 100644 index 00000000000..f5d6f8a06ff --- /dev/null +++ b/tests/wpt/web-platform-tests/webstorage/iframe/event_setattribute_handler.html @@ -0,0 +1,15 @@ +<!DOCTYPE HTML> +<html> +<head></head> +<body> +<script> + +function handleStorageEvent(e) { + window.parent.storageEventList.push(e); +} + +document.body.setAttribute("onstorage", "handleStorageEvent(window.event);"); + +</script> +</body> +</html> diff --git a/tests/wpt/web-platform-tests/webstorage/storage_enumerate.html b/tests/wpt/web-platform-tests/webstorage/storage_enumerate.html new file mode 100644 index 00000000000..1586f7a6128 --- /dev/null +++ b/tests/wpt/web-platform-tests/webstorage/storage_enumerate.html @@ -0,0 +1,41 @@ +<!DOCTYPE HTML> +<html> +<head> +<title>WebStorage Test: Storage - enumerate and built-in properties</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<script> +["localStorage", "sessionStorage"].forEach(function(name) { + test(function() { + assert_true(name in window, name + " exist"); + + var storage = window[name]; + storage.clear(); + + Storage.prototype.prototypeTestKey = "prototypeTestValue"; + storage.foo = "bar"; + storage.fu = "baz"; + storage.batman = "bin suparman"; + storage.bar = "foo"; + storage.alpha = "beta"; + storage.zeta = "gamma"; + + var enumeratedArray = new Array(); + for (var n in storage) + enumeratedArray.push(n); + + // Sort the array, since the storage order isn't guaranteed + enumeratedArray.sort(); + + var expectArray = ["alpha", "bar", "batman", "foo", "fu", "prototypeTestKey", "zeta"]; + assert_array_equals(enumeratedArray, expectArray); + + }, name + ": enumerate a Storage object and get only the keys as a result and the built-in properties of the Storage object should be ignored"); +}); +</script> +</body> +</html> + diff --git a/tests/wpt/web-platform-tests/webstorage/storage_functions_not_overwritten.html b/tests/wpt/web-platform-tests/webstorage/storage_functions_not_overwritten.html new file mode 100644 index 00000000000..dd67f17ac07 --- /dev/null +++ b/tests/wpt/web-platform-tests/webstorage/storage_functions_not_overwritten.html @@ -0,0 +1,56 @@ +<!DOCTYPE HTML> +<html> +<head> +<title>WebStorage Test: Storage - set key with the same name as storage function</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<script> +["localStorage", "sessionStorage"].forEach(function(name) { + test(function() { + var storage = window[name]; + storage.clear(); + + runTest(); + function doWedgeThySelf() { + storage.setItem("clear", "almost"); + storage.setItem("key", "too"); + storage.setItem("getItem", "funny"); + storage.setItem("removeItem", "to"); + storage.setItem("length", "be"); + storage.setItem("setItem", "true"); + } + + function shouldBeEqualToString(express, expectValue) { + assert_equals(typeof express, "string"); + assert_equals(express, expectValue); + } + + function runTest() { + doWedgeThySelf(); + + shouldBeEqualToString(storage.getItem('clear'), "almost"); + shouldBeEqualToString(storage.getItem('key'), "too"); + shouldBeEqualToString(storage.getItem('getItem'), "funny"); + shouldBeEqualToString(storage.getItem('removeItem'), "to"); + shouldBeEqualToString(storage.getItem('length'), "be"); + shouldBeEqualToString(storage.getItem('setItem'), "true"); + + // Test to see if an exception is thrown for any of the built in + // functions. + storage.setItem("test", "123"); + storage.key(0); + storage.getItem("test"); + storage.removeItem("test"); + storage.clear(); + assert_equals(storage.length, 0); + } + + }, name + " should be not rendered unusable by setting a key with the same name as a storage function such that the function is hidden"); +}); +</script> +</body> +</html> + diff --git a/tests/wpt/web-platform-tests/webstorage/storage_local_setitem_quotaexceedederr.html b/tests/wpt/web-platform-tests/webstorage/storage_local_setitem_quotaexceedederr.html index 8f3b30d0e33..8258a011542 100644 --- a/tests/wpt/web-platform-tests/webstorage/storage_local_setitem_quotaexceedederr.html +++ b/tests/wpt/web-platform-tests/webstorage/storage_local_setitem_quotaexceedederr.html @@ -20,12 +20,12 @@ assert_throws("QUOTA_EXCEEDED_ERR", function() { while (true) { index++; - localStorage.setItem("" + key + index, "" + name + index); + localStorage.setItem("" + key + index, "" + index); } }); localStorage.clear(); - }, "Throws QuotaExceededError when the quota of " + name + " has been exceeded"); + }, "Throws QuotaExceededError when the quota has been exceeded"); </script> </body> </html> diff --git a/tests/wpt/web-platform-tests/webstorage/storage_local_window_open.html b/tests/wpt/web-platform-tests/webstorage/storage_local_window_open.html new file mode 100644 index 00000000000..e5625927bcd --- /dev/null +++ b/tests/wpt/web-platform-tests/webstorage/storage_local_window_open.html @@ -0,0 +1,27 @@ +<!DOCTYPE HTML> +<html> +<head> +<title>WebStorage Test: localStorage - open a existing browsing context</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<script> + + test(function() { + assert_true("localStorage" in window, "localStorage exist"); + + var storage = window.localStorage; + storage.clear(); + + storage.setItem("FOO", "BAR"); + assert_equals(storage.getItem("FOO"), "BAR", "storage.getItem('FOO')"); + window.open("storage_local_window_open_second.html"); + + }, "A new window to make sure there is a copy of the previous window's localStorage, and that they diverge after a change"); + +</script> +</body> +</html> + diff --git a/tests/wpt/web-platform-tests/webstorage/storage_local_window_open_second.html b/tests/wpt/web-platform-tests/webstorage/storage_local_window_open_second.html new file mode 100644 index 00000000000..15ce2f34e52 --- /dev/null +++ b/tests/wpt/web-platform-tests/webstorage/storage_local_window_open_second.html @@ -0,0 +1,27 @@ +<!DOCTYPE HTML> +<html> +<head> +<title>WebStorage Test: localStorage - second page</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<script> + test(function() { + assert_true("localStorage" in window, "localStorage exist"); + + var storage = window.localStorage; + + assert_equals(storage.getItem("FOO"), "BAR", "storage.getItem('FOO')"); + storage.setItem("FOO", "BAR-NEWWINDOW"); + assert_equals(storage.getItem("FOO"), "BAR-NEWWINDOW", "value for FOO after changing"); + + assert_equals(window.opener.localStorage.getItem("FOO"), "BAR-NEWWINDOW", "value for FOO in my opening window"); + + }, "A new window to make sure there is a copy of the previous window's localStorage, and that they diverge after a change"); + +</script> +</body> +</html> + diff --git a/tests/wpt/web-platform-tests/webstorage/storage_session_setitem_quotaexceedederr.html b/tests/wpt/web-platform-tests/webstorage/storage_session_setitem_quotaexceedederr.html index 1541b4e4141..d78b29ebdc4 100644 --- a/tests/wpt/web-platform-tests/webstorage/storage_session_setitem_quotaexceedederr.html +++ b/tests/wpt/web-platform-tests/webstorage/storage_session_setitem_quotaexceedederr.html @@ -20,12 +20,12 @@ assert_throws("QUOTA_EXCEEDED_ERR", function() { while (true) { index++; - sessionStorage.setItem("" + key + index, "" + name + index); + sessionStorage.setItem("" + key + index, "" + index); } }); sessionStorage.clear(); - }, "Throws QuotaExceededError when the quota of " + name + " has been exceeded"); + }, "Throws QuotaExceededError when the quota has been exceeded"); </script> </body> </html> diff --git a/tests/wpt/web-platform-tests/webstorage/storage_session_window_open.html b/tests/wpt/web-platform-tests/webstorage/storage_session_window_open.html new file mode 100644 index 00000000000..d8016e91372 --- /dev/null +++ b/tests/wpt/web-platform-tests/webstorage/storage_session_window_open.html @@ -0,0 +1,26 @@ +<!DOCTYPE HTML> +<html> +<head> +<title>WebStorage Test: sessionStorage - open a existing browsing context</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<script> + + test(function() { + assert_true("sessionStorage" in window, "sessionStorage exist"); + + var storage = window.sessionStorage; + + storage.setItem("FOO", "BAR"); + assert_equals(storage.getItem("FOO"), "BAR", "storage.getItem('FOO')"); + window.open("storage_session_window_open_second.html"); + + }, "A new window to make sure there is a copy of the previous window's sessionStorage, and that they diverge after a change"); + +</script> +</body> +</html> + diff --git a/tests/wpt/web-platform-tests/webstorage/storage_session_window_open_second.html b/tests/wpt/web-platform-tests/webstorage/storage_session_window_open_second.html new file mode 100644 index 00000000000..3e241f4b3c2 --- /dev/null +++ b/tests/wpt/web-platform-tests/webstorage/storage_session_window_open_second.html @@ -0,0 +1,27 @@ +<!DOCTYPE HTML> +<html> +<head> +<title>WebStorage Test: sessionStorage - second page</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<script> + test(function() { + assert_true("sessionStorage" in window, "sessionStorage exist"); + + var storage = window.sessionStorage; + + assert_equals(storage.getItem("FOO"), "BAR", "storage.getItem('FOO')"); + storage.setItem("FOO", "BAR-NEWWINDOW"); + assert_equals(storage.getItem("FOO"), "BAR-NEWWINDOW", "value for FOO after changing"); + + assert_equals(window.opener.sessionStorage.getItem("FOO"), "BAR", "value for FOO in my opening window"); + + }, "A new window to make sure there is a copy of the previous window's sessionStorage, and that they diverge after a change"); + +</script> +</body> +</html> + diff --git a/tests/wpt/web-platform-tests/webstorage/storage_string_conversion.html b/tests/wpt/web-platform-tests/webstorage/storage_string_conversion.html new file mode 100644 index 00000000000..66b7d90a66c --- /dev/null +++ b/tests/wpt/web-platform-tests/webstorage/storage_string_conversion.html @@ -0,0 +1,51 @@ +<!DOCTYPE HTML> +<html> +<head> +<title>WebStorage Test: Storage only store strings</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<script> +["localStorage", "sessionStorage"].forEach(function(name) { + test(function() { + assert_true(name in window, name + " exist"); + + var storage = window[name]; + storage.clear(); + + assert_equals(storage.length, 0); + + function shouldBeEqualToString(express, expectValue) { + assert_equals(typeof express, "string"); + assert_equals(express, expectValue); + } + + storage.a = null; + shouldBeEqualToString(storage.a, "null"); + storage.b = 0; + shouldBeEqualToString(storage.b, "0"); + storage.c = function(){}; + shouldBeEqualToString(storage.c, "function (){}"); + + storage.setItem('d', null); + shouldBeEqualToString(storage.d, "null"); + storage.setItem('e', 0); + shouldBeEqualToString(storage.e, "0"); + storage.setItem('f', function(){}); + shouldBeEqualToString(storage.f, "function (){}"); + + storage['g'] = null; + shouldBeEqualToString(storage.g, "null"); + storage['h'] = 0; + shouldBeEqualToString(storage.h, "0"); + storage['i'] = function(){}; + shouldBeEqualToString(storage.f, "function (){}"); + + }, name + " only stores strings"); +}); + +</script> +</body> +</html> |