diff --git a/tests/wpt/metadata/FileAPI/url/url-in-tags-revoke.window.js.ini b/tests/wpt/metadata/FileAPI/url/url-in-tags-revoke.window.js.ini index dd4ffcf4345..76b398963ae 100644 --- a/tests/wpt/metadata/FileAPI/url/url-in-tags-revoke.window.js.ini +++ b/tests/wpt/metadata/FileAPI/url/url-in-tags-revoke.window.js.ini @@ -1,4 +1,5 @@ [url-in-tags-revoke.window.html] + expected: TIMEOUT [Fetching a blob URL immediately before revoking it works in an iframe.] expected: FAIL @@ -14,3 +15,6 @@ [Opening a blob URL in a new window by clicking an tag works immediately before revoking the URL.] expected: FAIL + [Fetching a blob URL immediately before revoking it works in + + + + + + + diff --git a/tests/wpt/web-platform-tests/css/css-align/parsing/place-content-valid.html b/tests/wpt/web-platform-tests/css/css-align/parsing/place-content-valid.html new file mode 100644 index 00000000000..a83aa4cec86 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-align/parsing/place-content-valid.html @@ -0,0 +1,46 @@ + + + + +CSS Box Alignment Level 3: parsing place-content with valid values + + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/css/css-align/parsing/place-items-invalid.html b/tests/wpt/web-platform-tests/css/css-align/parsing/place-items-invalid.html new file mode 100644 index 00000000000..9468d30e2e7 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-align/parsing/place-items-invalid.html @@ -0,0 +1,36 @@ + + + + +CSS Box Alignment Level 3: parsing place-items with invalid values + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/css/css-align/parsing/place-items-valid.html b/tests/wpt/web-platform-tests/css/css-align/parsing/place-items-valid.html new file mode 100644 index 00000000000..72179bf2db0 --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-align/parsing/place-items-valid.html @@ -0,0 +1,39 @@ + + + + +CSS Box Alignment Level 3: parsing place-items with valid values + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/css/css-align/parsing/place-self-invalid.html b/tests/wpt/web-platform-tests/css/css-align/parsing/place-self-invalid.html new file mode 100644 index 00000000000..8a7a2ab187f --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-align/parsing/place-self-invalid.html @@ -0,0 +1,28 @@ + + + + +CSS Box Alignment Level 3: parsing place-self with invalid values + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/css/css-align/parsing/place-self-valid.html b/tests/wpt/web-platform-tests/css/css-align/parsing/place-self-valid.html new file mode 100644 index 00000000000..36a8bd5026e --- /dev/null +++ b/tests/wpt/web-platform-tests/css/css-align/parsing/place-self-valid.html @@ -0,0 +1,36 @@ + + + + +CSS Box Alignment Level 3: parsing place-self with valid values + + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/element-timing/cross-origin-element.sub.html b/tests/wpt/web-platform-tests/element-timing/cross-origin-element.sub.html index 40a97056c2b..eef69a1d423 100644 --- a/tests/wpt/web-platform-tests/element-timing/cross-origin-element.sub.html +++ b/tests/wpt/web-platform-tests/element-timing/cross-origin-element.sub.html @@ -1,6 +1,6 @@ -Element Timing: observe cross-origin images but without startTime +Element Timing: observe cross-origin images but without renderTime + + + + + + + diff --git a/tests/wpt/web-platform-tests/element-timing/resources/element-timing-helpers.js b/tests/wpt/web-platform-tests/element-timing/resources/element-timing-helpers.js index 6c0aec80960..f98f9b21134 100644 --- a/tests/wpt/web-platform-tests/element-timing/resources/element-timing-helpers.js +++ b/tests/wpt/web-platform-tests/element-timing/resources/element-timing-helpers.js @@ -4,16 +4,17 @@ function checkElementInternal(entry, expectedUrl, expectedIdentifier, expectedID assert_equals(entry.entryType, 'element'); assert_equals(entry.url, expectedUrl); assert_equals(entry.identifier, expectedIdentifier); + assert_equals(entry.startTime, 0); assert_equals(entry.duration, 0); assert_equals(entry.id, expectedID); - assert_greater_than_equal(entry.startTime, beforeRender); - assert_greater_than_equal(performance.now(), entry.startTime); + assert_greater_than_equal(entry.renderTime, beforeRender); + assert_greater_than_equal(performance.now(), entry.renderTime); if (expectedElement !== null) assert_equals(entry.element, expectedElement); } // Checks that this is an ElementTiming entry with url |expectedUrl|. It also -// does a very basic check on |startTime|: after |beforeRender| and before now(). +// does a very basic check on |renderTime|: after |beforeRender| and before now(). function checkElement(entry, expectedUrl, expectedIdentifier, expectedID, beforeRender, expectedElement) { checkElementInternal(entry, expectedUrl, expectedIdentifier, expectedID, beforeRender, diff --git a/tests/wpt/web-platform-tests/event-timing/buffered-flag.html b/tests/wpt/web-platform-tests/event-timing/buffered-flag.html new file mode 100644 index 00000000000..8b56ad7f44d --- /dev/null +++ b/tests/wpt/web-platform-tests/event-timing/buffered-flag.html @@ -0,0 +1,45 @@ + + + +Event Timing: PerformanceObserver sees entries with buffered flag + + + + + + + + diff --git a/tests/wpt/web-platform-tests/fetch/sec-metadata/fetch.tentative.sub.html b/tests/wpt/web-platform-tests/fetch/sec-metadata/fetch.tentative.sub.html new file mode 100644 index 00000000000..0c5caa76a23 --- /dev/null +++ b/tests/wpt/web-platform-tests/fetch/sec-metadata/fetch.tentative.sub.html @@ -0,0 +1,37 @@ + + + + + diff --git a/tests/wpt/web-platform-tests/fetch/sec-metadata/iframe.tentative.sub.html b/tests/wpt/web-platform-tests/fetch/sec-metadata/iframe.tentative.sub.html index eab2d3f5886..2bc2581fcee 100644 --- a/tests/wpt/web-platform-tests/fetch/sec-metadata/iframe.tentative.sub.html +++ b/tests/wpt/web-platform-tests/fetch/sec-metadata/iframe.tentative.sub.html @@ -60,4 +60,23 @@ document.body.appendChild(i); }, "Non-secure cross-site iframe => No headers."); + + async_test(t => { + let i = document.createElement('iframe'); + i.src = "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/post-to-owner.py"; + window.addEventListener('message', t.step_func(e => { + if (e.source != i.contentWindow) + return; + + assert_header_equals(e.data, { + "dest": "nested-document", + "site": "cross-site", + "user": "", + "mode": "nested-navigate", + }); + t.done(); + })); + + document.body.appendChild(i); + }, "Secure, cross-site (cross-scheme, same-host) iframe"); diff --git a/tests/wpt/web-platform-tests/fetch/sec-metadata/redirect/multiple-redirect-https-downgrade-upgrade.tentative.sub.html b/tests/wpt/web-platform-tests/fetch/sec-metadata/redirect/multiple-redirect-https-downgrade-upgrade.tentative.sub.html index 3f8726dc69e..cede6712264 100644 --- a/tests/wpt/web-platform-tests/fetch/sec-metadata/redirect/multiple-redirect-https-downgrade-upgrade.tentative.sub.html +++ b/tests/wpt/web-platform-tests/fetch/sec-metadata/redirect/multiple-redirect-https-downgrade-upgrade.tentative.sub.html @@ -19,7 +19,7 @@
Downgraded then upgraded font
+ + + + diff --git a/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-a-element/resources/a-download-redirect-to-javascript.html b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-a-element/resources/a-download-redirect-to-javascript.html new file mode 100644 index 00000000000..4ff8b61e3be --- /dev/null +++ b/tests/wpt/web-platform-tests/html/semantics/text-level-semantics/the-a-element/resources/a-download-redirect-to-javascript.html @@ -0,0 +1,5 @@ + + +
Click me diff --git a/tests/wpt/web-platform-tests/interfaces/speech-api.idl b/tests/wpt/web-platform-tests/interfaces/speech-api.idl index ba86d5065b7..8a32b457a99 100644 --- a/tests/wpt/web-platform-tests/interfaces/speech-api.idl +++ b/tests/wpt/web-platform-tests/interfaces/speech-api.idl @@ -11,7 +11,6 @@ interface SpeechRecognition : EventTarget { attribute boolean continuous; attribute boolean interimResults; attribute unsigned long maxAlternatives; - attribute DOMString serviceURI; // methods to drive the speech interaction void start(); diff --git a/tests/wpt/web-platform-tests/kv-storage/non-secure-context-script-element.html b/tests/wpt/web-platform-tests/kv-storage/non-secure-context-script-element.html deleted file mode 100644 index 66802b1254e..00000000000 --- a/tests/wpt/web-platform-tests/kv-storage/non-secure-context-script-element.html +++ /dev/null @@ -1,25 +0,0 @@ - - -KV Storage: should not work in non-secure contexts when included via a script element - - - - - - - diff --git a/tests/wpt/web-platform-tests/kv-storage/secure-context/README.md b/tests/wpt/web-platform-tests/kv-storage/secure-context/README.md new file mode 100644 index 00000000000..9b3539995bf --- /dev/null +++ b/tests/wpt/web-platform-tests/kv-storage/secure-context/README.md @@ -0,0 +1,5 @@ +# KV Storage `[SecureContext]` tests + +These tests ensure that KV Storage follows the rules for `[SecureContext]` modules. (As of the time of this writing, they are only proposed rules, in [heycam/webidl#675](https://github.com/heycam/webidl/pull/675).) + +Eventually these should probably be generalized and tested as part of `idlharness.js`. diff --git a/tests/wpt/web-platform-tests/kv-storage/non-secure-context-dynamic-import.html b/tests/wpt/web-platform-tests/kv-storage/secure-context/dynamic-import.html similarity index 87% rename from tests/wpt/web-platform-tests/kv-storage/non-secure-context-dynamic-import.html rename to tests/wpt/web-platform-tests/kv-storage/secure-context/dynamic-import.html index 6ccbf84ba1d..38e1bb79c47 100644 --- a/tests/wpt/web-platform-tests/kv-storage/non-secure-context-dynamic-import.html +++ b/tests/wpt/web-platform-tests/kv-storage/secure-context/dynamic-import.html @@ -13,6 +13,6 @@ test(() => { }, "Prerequisite check"); promise_test(t => { - return promise_rejects(t, "SecurityError", import("std:kv-storage")); + return promise_rejects(t, new TypeError(), import("std:kv-storage")); }); diff --git a/tests/wpt/web-platform-tests/kv-storage/secure-context/import-maps.html b/tests/wpt/web-platform-tests/kv-storage/secure-context/import-maps.html new file mode 100644 index 00000000000..64301f03032 --- /dev/null +++ b/tests/wpt/web-platform-tests/kv-storage/secure-context/import-maps.html @@ -0,0 +1,31 @@ + + +KV Storage: in non-secure contexts, import map mappings should fall back + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/kv-storage/non-secure-context-import-statement.html b/tests/wpt/web-platform-tests/kv-storage/secure-context/import-statement.html similarity index 75% rename from tests/wpt/web-platform-tests/kv-storage/non-secure-context-import-statement.html rename to tests/wpt/web-platform-tests/kv-storage/secure-context/import-statement.html index fda02aadf14..db01152a4e1 100644 --- a/tests/wpt/web-platform-tests/kv-storage/non-secure-context-import-statement.html +++ b/tests/wpt/web-platform-tests/kv-storage/secure-context/import-statement.html @@ -15,9 +15,7 @@ test(() => { async_test(t => { window.addEventListener("error", t.step_func_done(errorEvent => { - assert_equals(errorEvent.error.constructor, DOMException, "Must trigger a DOMException"); - assert_equals(errorEvent.error.name, "SecurityError", - "The DOMException must be a \"SecurityError\""); + assert_equals(errorEvent.error.constructor, TypeError, "Must trigger a TypeError"); }, { once: true })); }); diff --git a/tests/wpt/web-platform-tests/kv-storage/secure-context/resources/dummy-module.js b/tests/wpt/web-platform-tests/kv-storage/secure-context/resources/dummy-module.js new file mode 100644 index 00000000000..27fb98860ea --- /dev/null +++ b/tests/wpt/web-platform-tests/kv-storage/secure-context/resources/dummy-module.js @@ -0,0 +1 @@ +export const myExport = "not the real KV storage"; diff --git a/tests/wpt/web-platform-tests/kv-storage/secure-context/resources/test-side-effects.js b/tests/wpt/web-platform-tests/kv-storage/secure-context/resources/test-side-effects.js new file mode 100644 index 00000000000..39780a92fff --- /dev/null +++ b/tests/wpt/web-platform-tests/kv-storage/secure-context/resources/test-side-effects.js @@ -0,0 +1 @@ +window.sideEffectsHappened = true; diff --git a/tests/wpt/web-platform-tests/kv-storage/secure-context/script-element.html b/tests/wpt/web-platform-tests/kv-storage/secure-context/script-element.html new file mode 100644 index 00000000000..b8170549ab5 --- /dev/null +++ b/tests/wpt/web-platform-tests/kv-storage/secure-context/script-element.html @@ -0,0 +1,21 @@ + + +KV Storage: should not work in non-secure contexts when included via a script element + + + + + + + diff --git a/tests/wpt/web-platform-tests/kv-storage/secure-context/side-effects.html b/tests/wpt/web-platform-tests/kv-storage/secure-context/side-effects.html new file mode 100644 index 00000000000..f4c4b691d30 --- /dev/null +++ b/tests/wpt/web-platform-tests/kv-storage/secure-context/side-effects.html @@ -0,0 +1,28 @@ + + +KV Storage: should fail in non-secure contexts in the fetching phase, not evaluation phase + + + + + + + + + diff --git a/tests/wpt/web-platform-tests/largest-contentful-paint/cross-origin-image.sub.html b/tests/wpt/web-platform-tests/largest-contentful-paint/cross-origin-image.sub.html index fd4844d16b3..6e86f13b9cc 100644 --- a/tests/wpt/web-platform-tests/largest-contentful-paint/cross-origin-image.sub.html +++ b/tests/wpt/web-platform-tests/largest-contentful-paint/cross-origin-image.sub.html @@ -1,6 +1,6 @@ -Largest Contentful Paint: observe cross-origin images but without startTime. +Largest Contentful Paint: observe cross-origin images but without renderTime. @@ -14,7 +14,8 @@ assert_equals(entryList.getEntries().length, 1); const entry = entryList.getEntries()[0]; assert_equals(entry.entryType, 'largest-contentful-paint'); - assert_equals(entry.startTime, 0, 'The startTime value should be 0 for a cross origin image.'); + assert_equals(entry.renderTime, 0, 'The renderTime value should be 0 for a cross origin image.'); + assert_equals(entry.startTime, 0); assert_equals(entry.duration, 0); // blue.png is 133 x 106. assert_equals(entry.size, 14098); @@ -27,7 +28,7 @@ }) ); observer.observe({type: 'largest-contentful-paint', buffered: true}); - }, 'Cross-origin image is observable, with startTime equal to 0.'); + }, 'Cross-origin image is observable, with renderTime equal to 0.'); diff --git a/tests/wpt/web-platform-tests/largest-contentful-paint/image-src-change.html b/tests/wpt/web-platform-tests/largest-contentful-paint/image-src-change.html new file mode 100644 index 00000000000..3e083625bdc --- /dev/null +++ b/tests/wpt/web-platform-tests/largest-contentful-paint/image-src-change.html @@ -0,0 +1,50 @@ + + +Largest Contentful Paint: src change triggers new entry. + + + + + + diff --git a/tests/wpt/web-platform-tests/largest-contentful-paint/observe-image.html b/tests/wpt/web-platform-tests/largest-contentful-paint/observe-image.html index a1ecbceb503..4d56cc2d838 100644 --- a/tests/wpt/web-platform-tests/largest-contentful-paint/observe-image.html +++ b/tests/wpt/web-platform-tests/largest-contentful-paint/observe-image.html @@ -15,10 +15,11 @@ assert_equals(entryList.getEntries().length, 1); const entry = entryList.getEntries()[0]; assert_equals(entry.entryType, 'largest-contentful-paint'); - assert_greater_than_equal(entry.startTime, beforeRender, + assert_greater_than_equal(entry.renderTime, beforeRender, 'The rendering timestamp should occur after script starts running.'); - assert_greater_than_equal(performance.now(), entry.startTime, + assert_greater_than_equal(performance.now(), entry.renderTime, 'The rendering timestamp should occur before the entry is dispatched to the observer.'); + assert_equals(entry.startTime, 0); assert_equals(entry.duration, 0); // blue.png is 133 x 106. assert_equals(entry.size, 14098); diff --git a/tests/wpt/web-platform-tests/largest-contentful-paint/observe-text.html b/tests/wpt/web-platform-tests/largest-contentful-paint/observe-text.html index 58897907365..7dbfbe52f3d 100644 --- a/tests/wpt/web-platform-tests/largest-contentful-paint/observe-text.html +++ b/tests/wpt/web-platform-tests/largest-contentful-paint/observe-text.html @@ -20,8 +20,9 @@ p { assert_equals(entryList.getEntries().length, 1); const entry = entryList.getEntries()[0]; assert_equals(entry.entryType, 'largest-contentful-paint'); - assert_greater_than_equal(entry.startTime, beforeRender); - assert_greater_than_equal(performance.now(), entry.startTime); + assert_greater_than_equal(entry.renderTime, beforeRender); + assert_greater_than_equal(performance.now(), entry.renderTime); + assert_equals(entry.startTime, 0); assert_equals(entry.duration, 0); // Some lower bound: height of at least 12 px. // Width of at least 100 px. diff --git a/tests/wpt/web-platform-tests/layout-instability/buffered-flag.html b/tests/wpt/web-platform-tests/layout-instability/buffered-flag.html new file mode 100644 index 00000000000..6a8c937e5ff --- /dev/null +++ b/tests/wpt/web-platform-tests/layout-instability/buffered-flag.html @@ -0,0 +1,32 @@ + + +Layout Instability: PerformanceObserver sees entries with buffered flag + + +
+ + + + diff --git a/tests/wpt/web-platform-tests/media-source/mediasource-changetype-play-implicit.html b/tests/wpt/web-platform-tests/media-source/mediasource-changetype-play-implicit.html new file mode 100644 index 00000000000..c186361e791 --- /dev/null +++ b/tests/wpt/web-platform-tests/media-source/mediasource-changetype-play-implicit.html @@ -0,0 +1,89 @@ + + + + + Exercise implicit changeType for supported test types, using mime types WITH and WITHOUT codecs for addSourceBuffer. + + + + + + + +
+ + + diff --git a/tests/wpt/web-platform-tests/media-source/mediasource-changetype-play-negative.html b/tests/wpt/web-platform-tests/media-source/mediasource-changetype-play-negative.html new file mode 100644 index 00000000000..f74e12945ac --- /dev/null +++ b/tests/wpt/web-platform-tests/media-source/mediasource-changetype-play-negative.html @@ -0,0 +1,122 @@ + + + + + Exercise scenarios expected to fail for changeType for supported test types, using mime types WITH and WITHOUT codecs. + + + + + + + +
+ + + diff --git a/tests/wpt/web-platform-tests/media-source/mediasource-changetype-play-without-codecs-parameter.html b/tests/wpt/web-platform-tests/media-source/mediasource-changetype-play-without-codecs-parameter.html new file mode 100644 index 00000000000..f802b155f72 --- /dev/null +++ b/tests/wpt/web-platform-tests/media-source/mediasource-changetype-play-without-codecs-parameter.html @@ -0,0 +1,52 @@ + + + + + Exercise changeType for supported test types, using mime types WITHOUT codecs for addSourceBuffer and changeType. + + + + + + + +
+ + + diff --git a/tests/wpt/web-platform-tests/media-source/mediasource-changetype-play.html b/tests/wpt/web-platform-tests/media-source/mediasource-changetype-play.html index 210f66e1a28..26a67c32704 100644 --- a/tests/wpt/web-platform-tests/media-source/mediasource-changetype-play.html +++ b/tests/wpt/web-platform-tests/media-source/mediasource-changetype-play.html @@ -2,7 +2,7 @@ - Exercise changeType for supported test types. + Exercise changeType for supported test types, using mime types WITH codecs (if applicable) for addSourceBuffer and changeType. @@ -23,14 +23,20 @@ function generateChangeTypeTests(audio_types, video_types) { // Generate audio-only changeType tests for (let audio1 of audio_types) { for (let audio2 of audio_types) { - mediaSourceChangeTypeTest(audio1, audio2, "Test audio-only changeType for " + audio1.type + " <-> " + audio2.type); + mediaSourceChangeTypeTest( + audio1, audio2, + "Test audio-only changeType for " + + audio1.type + " <-> " + audio2.type); } } // Generate video-only changeType tests for (let video1 of video_types) { for (let video2 of video_types) { - mediaSourceChangeTypeTest(video1, video2, "Test video-only changeType for " + video1.type + " <-> " + video2.type); + mediaSourceChangeTypeTest( + video1, video2, + "Test video-only changeType for " + + video1.type + " <-> " + video2.type); } } } diff --git a/tests/wpt/web-platform-tests/media-source/mediasource-changetype-util.js b/tests/wpt/web-platform-tests/media-source/mediasource-changetype-util.js index 3dd1c473876..28e92893657 100644 --- a/tests/wpt/web-platform-tests/media-source/mediasource-changetype-util.js +++ b/tests/wpt/web-platform-tests/media-source/mediasource-changetype-util.js @@ -1,9 +1,38 @@ // Copyright © 2018 Chromium authors and World Wide Web Consortium, (Massachusetts Institute of Technology, ERCIM, Keio University, Beihang). function findSupportedChangeTypeTestTypes(cb) { + // Changetype test media metadata. + // type: fully specified mime type (and codecs substring if the bytestream + // format does not forbid codecs parameter). This is required for use with + // isTypeSupported, and if supported, should work with both addSourceBuffer + // and changeType (unless implementation has restrictions). + // + // relaxed_type: possibly ambiguous mime type/subtype without any codecs + // substring. This is the same as type minus any codecs substring. + // + // mime_subtype: the subtype of the mime type in type and relaxed_type. Across + // types registered in the bytestream format registry + // (https://www.w3.org/TR/mse-byte-stream-format-registry/), this is + // currently sufficient to describe uniquely which test media share the same + // bytestream format for use in implicit changeType testing. + // + // is_video: All test media currently is single track. This describes whether + // or not the track is video. + // + // url: Relative location of the test media file. + // + // The next two items enable more reliable test media splicing test logic that + // prevents buffered range gaps at the splice points. + // start_time: Some test media begins at a time later than 0.0 seconds. This + // is the start time of the media. + // keyframe_interval: Some test media contains out-of-order PTS versus DTS + // coded frames. In those cases, a constant keyframe_interval is needed to + // prevent severely truncating out-of-order GOPs at splice points. let CHANGE_TYPE_MEDIA_LIST = [ { type: 'video/webm; codecs="vp8"', + relaxed_type: 'video/webm', + mime_subtype: 'webm', is_video: true, url: 'webm/test-v-128k-320x240-24fps-8kfr.webm', start_time: 0.0 @@ -12,6 +41,8 @@ function findSupportedChangeTypeTestTypes(cb) { }, { type: 'video/webm; codecs="vp9"', + relaxed_type: 'video/webm', + mime_subtype: 'webm', is_video: true, url: 'webm/test-vp9.webm', start_time: 0.0 @@ -20,6 +51,8 @@ function findSupportedChangeTypeTestTypes(cb) { }, { type: 'video/mp4; codecs="avc1.4D4001"', + relaxed_type: 'video/mp4', + mime_subtype: 'mp4', is_video: true, url: 'mp4/test-v-128k-320x240-24fps-8kfr.mp4', start_time: 0.083333, @@ -27,6 +60,8 @@ function findSupportedChangeTypeTestTypes(cb) { }, { type: 'audio/webm; codecs="vorbis"', + relaxed_type: 'audio/webm', + mime_subtype: 'webm', is_video: false, url: 'webm/test-a-128k-44100Hz-1ch.webm', start_time: 0.0 @@ -36,6 +71,8 @@ function findSupportedChangeTypeTestTypes(cb) { }, { type: 'audio/mp4; codecs="mp4a.40.2"', + relaxed_type: 'audio/mp4', + mime_subtype: 'mp4', is_video: false, url: 'mp4/test-a-128k-44100Hz-1ch.mp4', start_time: 0.0 @@ -45,6 +82,8 @@ function findSupportedChangeTypeTestTypes(cb) { }, { type: 'audio/mpeg', + relaxed_type: 'audio/mpeg', + mime_subtype: 'mpeg', is_video: false, url: 'mp3/sound_5.mp3', start_time: 0.0 @@ -77,21 +116,26 @@ function appendBuffer(test, sourceBuffer, data) { sourceBuffer.appendBuffer(data); } -function trimBuffered(test, mediaElement, sourceBuffer, minimumPreviousDuration, newDuration) { - assert_less_than(newDuration, minimumPreviousDuration); - assert_less_than(minimumPreviousDuration, mediaElement.duration); +function trimBuffered(test, mediaElement, sourceBuffer, minimumPreviousDuration, newDuration, skip_duration_prechecks) { + if (!skip_duration_prechecks) { + assert_less_than(newDuration, minimumPreviousDuration); + assert_less_than(minimumPreviousDuration, mediaElement.duration); + } test.expectEvent(sourceBuffer, "update"); test.expectEvent(sourceBuffer, "updateend"); sourceBuffer.remove(newDuration, Infinity); } -function trimDuration(test, mediaElement, mediaSource, newDuration) { - assert_less_than(newDuration, mediaElement.duration); +function trimDuration(test, mediaElement, mediaSource, newDuration, skip_duration_prechecks) { + if (!skip_duration_prechecks) { + assert_less_than(newDuration, mediaElement.duration); + } test.expectEvent(mediaElement, "durationchange"); mediaSource.duration = newDuration; } -function runChangeTypeTest(test, mediaElement, mediaSource, metadataA, dataA, metadataB, dataB) { +function runChangeTypeTest(test, mediaElement, mediaSource, metadataA, typeA, dataA, metadataB, typeB, dataB, + implicit_changetype, negative_test) { // Some streams, like the MP4 video stream, contain presentation times for // frames out of order versus their decode times. If we overlap-append the // latter part of such a stream's GOP presentation interval, a significant @@ -104,6 +148,14 @@ function runChangeTypeTest(test, mediaElement, mediaSource, metadataA, dataA, me // splice-overlapping such GOP sequences that aren't SAP-Type-1. // TODO(wolenetz): https://github.com/w3c/media-source/issues/160 could // greatly simplify this problem by allowing us play through these small gaps. + // + // typeA and typeB may be underspecified for use with isTypeSupported, but + // this helper does not use isTypeSupported. typeA and typeB must work (even + // if missing codec specific substrings) with addSourceBuffer (just typeA) and + // changeType (both typeA and typeB). + // + // See also mediaSourceChangeTypeTest's options argument for the meanings of + // implicit_changetype and negative_test. function findSafeOffset(targetTime, overlappedMediaMetadata, overlappedStartTime, overlappingMediaMetadata) { assert_greater_than_equal(targetTime, overlappedStartTime); @@ -130,8 +182,18 @@ function runChangeTypeTest(test, mediaElement, mediaSource, metadataA, dataA, me return { "offset": offset, "adjustedTime": adjustedTime }; } - let sourceBuffer = mediaSource.addSourceBuffer(metadataA.type); + // Note, none of the current negative changeType tests should fail the initial addSourceBuffer. + let sourceBuffer = mediaSource.addSourceBuffer(typeA); + // Add error event listeners to sourceBuffer. The caller of this helper may + // also have installed error event listeners on mediaElement. + if (negative_test) { + sourceBuffer.addEventListener("error", test.step_func_done()); + } else { + sourceBuffer.addEventListener("error", test.unreached_func("Unexpected event 'error'")); + } + + // In either negative test or not, the first appendBuffer should succeed. appendBuffer(test, sourceBuffer, dataA); let lastStart = metadataA["start_time"]; if (lastStart == null) { @@ -144,7 +206,14 @@ function runChangeTypeTest(test, mediaElement, mediaSource, metadataA, dataA, me test.waitForExpectedEvents(() => { let safeOffset = findSafeOffset(0.5, metadataA, lastStart, metadataB); lastStart = safeOffset["adjustedTime"]; - sourceBuffer.changeType(metadataB.type); + if (!implicit_changetype) { + try { sourceBuffer.changeType(typeB); } catch(err) { + if (negative_test) + test.done(); + else + throw err; + } + } sourceBuffer.timestampOffset = safeOffset["offset"]; appendBuffer(test, sourceBuffer, dataB); }); @@ -155,7 +224,14 @@ function runChangeTypeTest(test, mediaElement, mediaSource, metadataA, dataA, me assert_less_than(lastStart, 1.0); let safeOffset = findSafeOffset(1.0, metadataB, lastStart, metadataB); lastStart = safeOffset["adjustedTime"]; - sourceBuffer.changeType(metadataB.type); + if (!implicit_changetype) { + try { sourceBuffer.changeType(typeB); } catch(err) { + if (negative_test) + test.done(); + else + throw err; + } + } sourceBuffer.timestampOffset = safeOffset["offset"]; appendBuffer(test, sourceBuffer, dataB); }); @@ -167,7 +243,14 @@ function runChangeTypeTest(test, mediaElement, mediaSource, metadataA, dataA, me let safeOffset = findSafeOffset(1.5, metadataB, lastStart, metadataA); // Retain the previous lastStart because the next block will append data // which begins between that start time and this block's start time. - sourceBuffer.changeType(metadataA.type); + if (!implicit_changetype) { + try { sourceBuffer.changeType(typeA); } catch(err) { + if (negative_test) + test.done(); + else + throw err; + } + } sourceBuffer.timestampOffset = safeOffset["offset"]; appendBuffer(test, sourceBuffer, dataA); }); @@ -179,18 +262,27 @@ function runChangeTypeTest(test, mediaElement, mediaSource, metadataA, dataA, me // Our next append will begin by overlapping some of metadataB, then some of // metadataA. let safeOffset = findSafeOffset(1.3, metadataB, lastStart, metadataA); - sourceBuffer.changeType(metadataA.type); + if (!implicit_changetype) { + try { sourceBuffer.changeType(typeA); } catch(err) { + if (negative_test) + test.done(); + else + throw err; + } + } sourceBuffer.timestampOffset = safeOffset["offset"]; appendBuffer(test, sourceBuffer, dataA); }); // Trim duration to 2 seconds, then play through to end. test.waitForExpectedEvents(() => { - trimBuffered(test, mediaElement, sourceBuffer, 2.1, 2); + // If negative testing, then skip fragile assertions. + trimBuffered(test, mediaElement, sourceBuffer, 2.1, 2, negative_test); }); test.waitForExpectedEvents(() => { - trimDuration(test, mediaElement, mediaSource, 2); + // If negative testing, then skip fragile assertions. + trimDuration(test, mediaElement, mediaSource, 2, negative_test); }); test.waitForExpectedEvents(() => { @@ -203,17 +295,56 @@ function runChangeTypeTest(test, mediaElement, mediaSource, metadataA, dataA, me }); test.waitForExpectedEvents(() => { - test.done(); + if (negative_test) + assert_unreached("Received 'ended' while negative testing."); + else + test.done(); }); } -function mediaSourceChangeTypeTest(metadataA, metadataB, description) { +// options.use_relaxed_mime_types : boolean (defaults to false). +// If true, the initial addSourceBuffer and any changeType calls will use the +// relaxed_type in metadataA and metadataB instead of the full type in the +// metadata. +// options.implicit_changetype : boolean (defaults to false). +// If true, no changeType calls will be used. Instead, the test media files +// are expected to begin with an initialization segment and end at a segment +// boundary (no abort() call is issued by this test to reset the +// SourceBuffer's parser). +// options.negative_test : boolean (defaults to false). +// If true, the test is expected to hit error amongst one of the following +// areas: addSourceBuffer, appendBuffer (synchronous or asynchronous error), +// changeType, playback to end of buffered media. If 'ended' is received +// without error otherwise already occurring, then fail the test. Otherwise, +// pass the test on receipt of error. Continue to consider timeouts as test +// failures. +function mediaSourceChangeTypeTest(metadataA, metadataB, description, options = {}) { mediasource_test((test, mediaElement, mediaSource) => { + let typeA = metadataA.type; + let typeB = metadataB.type; + if (options.hasOwnProperty("use_relaxed_mime_types") && + options.use_relaxed_mime_types === true) { + typeA = metadataA.relaxed_type; + typeB = metadataB.relaxed_type; + } + let implicit_changetype = options.hasOwnProperty("implicit_changetype") && + options.implicit_changetype === true; + let negative_test = options.hasOwnProperty("negative_test") && + options.negative_test === true; + mediaElement.pause(); - mediaElement.addEventListener('error', test.unreached_func("Unexpected event 'error'")); + if (negative_test) { + mediaElement.addEventListener("error", test.step_func_done()); + } else { + mediaElement.addEventListener("error", + test.unreached_func("Unexpected event 'error'")); + } MediaSourceUtil.loadBinaryData(test, metadataA.url, (dataA) => { MediaSourceUtil.loadBinaryData(test, metadataB.url, (dataB) => { - runChangeTypeTest(test, mediaElement, mediaSource, metadataA, dataA, metadataB, dataB); + runChangeTypeTest( + test, mediaElement, mediaSource, + metadataA, typeA, dataA, metadataB, typeB, dataB, + implicit_changetype, negative_test); }); }); }, description); 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 bb701e70524..6b11210052d 100644 --- a/tests/wpt/web-platform-tests/media-source/mediasource-util.js +++ b/tests/wpt/web-platform-tests/media-source/mediasource-util.js @@ -323,7 +323,9 @@ test.done = function() { if (test.status == test.PASS) { - assert_false(test.eventExpectations_.expectingEvents(), "No pending event expectations."); + test.step(function() { + assert_false(test.eventExpectations_.expectingEvents(), "No pending event expectations."); + }); } oldTestDone(); }; diff --git a/tests/wpt/web-platform-tests/native-file-system/FileSystemBaseHandle-remove.tentative.window.js b/tests/wpt/web-platform-tests/native-file-system/FileSystemBaseHandle-remove.tentative.https.window.js similarity index 100% rename from tests/wpt/web-platform-tests/native-file-system/FileSystemBaseHandle-remove.tentative.window.js rename to tests/wpt/web-platform-tests/native-file-system/FileSystemBaseHandle-remove.tentative.https.window.js diff --git a/tests/wpt/web-platform-tests/native-file-system/FileSystemDirectoryHandle-getDirectory.tentative.window.js b/tests/wpt/web-platform-tests/native-file-system/FileSystemDirectoryHandle-getDirectory.tentative.https.window.js similarity index 100% rename from tests/wpt/web-platform-tests/native-file-system/FileSystemDirectoryHandle-getDirectory.tentative.window.js rename to tests/wpt/web-platform-tests/native-file-system/FileSystemDirectoryHandle-getDirectory.tentative.https.window.js diff --git a/tests/wpt/web-platform-tests/native-file-system/FileSystemDirectoryHandle-getFile.tentative.window.js b/tests/wpt/web-platform-tests/native-file-system/FileSystemDirectoryHandle-getFile.tentative.https.window.js similarity index 100% rename from tests/wpt/web-platform-tests/native-file-system/FileSystemDirectoryHandle-getFile.tentative.window.js rename to tests/wpt/web-platform-tests/native-file-system/FileSystemDirectoryHandle-getFile.tentative.https.window.js diff --git a/tests/wpt/web-platform-tests/native-file-system/FileSystemWriter.tentative.window.js b/tests/wpt/web-platform-tests/native-file-system/FileSystemWriter.tentative.https.window.js similarity index 100% rename from tests/wpt/web-platform-tests/native-file-system/FileSystemWriter.tentative.window.js rename to tests/wpt/web-platform-tests/native-file-system/FileSystemWriter.tentative.https.window.js diff --git a/tests/wpt/web-platform-tests/native-file-system/NativeFileSystemWritableFileStream.tentative.window.js b/tests/wpt/web-platform-tests/native-file-system/NativeFileSystemWritableFileStream.tentative.https.window.js similarity index 100% rename from tests/wpt/web-platform-tests/native-file-system/NativeFileSystemWritableFileStream.tentative.window.js rename to tests/wpt/web-platform-tests/native-file-system/NativeFileSystemWritableFileStream.tentative.https.window.js diff --git a/tests/wpt/web-platform-tests/navigation-timing/resources/secure-connection-interim.html b/tests/wpt/web-platform-tests/navigation-timing/resources/secure-connection-interim.html new file mode 100644 index 00000000000..e40b00bedbd --- /dev/null +++ b/tests/wpt/web-platform-tests/navigation-timing/resources/secure-connection-interim.html @@ -0,0 +1,8 @@ + + +