diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index b0b282e714ea..a7eaaf98d530 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -591322,7 +591322,7 @@ "support" ], "interfaces/picture-in-picture.idl": [ - "3e97112286c64d274a4ecbdb0f41d4700e5448fb", + "4051a7f0ba28e984294ca32a5a2aef73b7f9a6bb", "support" ], "interfaces/pointerevents-extension.idl": [ @@ -602154,7 +602154,7 @@ "testharness" ], "picture-in-picture/idlharness.window.js": [ - "4b24a93a59e290c762969a4f8c33e24ebe37bf9b", + "0fecf6b24a57f6ae7ca605782fdd9bc66e3fa562", "testharness" ], "picture-in-picture/leave-picture-in-picture.html": [ diff --git a/testing/web-platform/tests/interfaces/picture-in-picture.idl b/testing/web-platform/tests/interfaces/picture-in-picture.idl index e15515d0e7f9..cafcae11df77 100644 --- a/testing/web-platform/tests/interfaces/picture-in-picture.idl +++ b/testing/web-platform/tests/interfaces/picture-in-picture.idl @@ -4,19 +4,18 @@ // See: https://wicg.github.io/picture-in-picture/ partial interface HTMLVideoElement { - Promise requestPictureInPicture(); + [NewObject] Promise requestPictureInPicture(); attribute EventHandler onenterpictureinpicture; attribute EventHandler onleavepictureinpicture; - [CEReactions] - attribute boolean disablePictureInPicture; + [CEReactions] attribute boolean disablePictureInPicture; }; partial interface Document { readonly attribute boolean pictureInPictureEnabled; - Promise exitPictureInPicture(); + [NewObject] Promise exitPictureInPicture(); }; partial interface DocumentOrShadowRoot { diff --git a/testing/web-platform/tests/picture-in-picture/idlharness.window.js b/testing/web-platform/tests/picture-in-picture/idlharness.window.js index d86c676c9d98..e10bc0598b71 100644 --- a/testing/web-platform/tests/picture-in-picture/idlharness.window.js +++ b/testing/web-platform/tests/picture-in-picture/idlharness.window.js @@ -1,22 +1,31 @@ // META: script=/resources/WebIDLParser.js // META: script=/resources/idlharness.js +// META: script=resources/picture-in-picture-helpers.js 'use strict'; // https://wicg.github.io/picture-in-picture/ promise_test(async () => { - const srcs = ['html', 'dom', 'picture-in-picture']; - const [html, dom, pip] = await Promise.all( - srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text()))); + try { + const video = await loadVideo(); + document.body.appendChild(video); + self.video = video; + self.pipw = await video.requestPictureInPicture(); + } catch (e) { + // Will be surfaced when video/pipw are undefined below. + } - const idl_array = new IdlArray(); - idl_array.add_idls(pip); - idl_array.add_dependency_idls(dom); - idl_array.add_dependency_idls(html); - - idl_array.add_objects({ - Document: ['document'], - }); - idl_array.test(); -}, 'picture-in-picture interfaces.'); + idl_test( + ['picture-in-picture'], + ['html', 'dom'], + idl_array => { + idl_array.add_objects({ + Document: ['document'], + DocumentOrShadowRoot: ['document'], + HTMLVideoElement: ['video'], + PictureInPictureWindow: ['pipw'], + }); + }, + 'picture-in-picture interfaces.'); +})