| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../video-test.js"></script> |
| <script src="../media-file.js"></script> |
| <script> |
| window.addEventListener('load', async event => { |
| if (!window.internals) { |
| failTest('This test requires window.internals.'); |
| return; |
| } |
| |
| findMediaElement(); |
| |
| run('internals.settings.setAllowsPictureInPictureMediaPlayback(true)'); |
| run('internals.setMockVideoPresentationModeEnabled(true)'); |
| |
| run('video.src = findMediaFile("audio", "../content/test")'); |
| await waitFor(video, 'canplaythrough'); |
| runWithKeyDown(() => { |
| video.requestPictureInPicture() |
| .then(() => { |
| failTest('request Picture-in-Picture requires video track for the video element.') |
| }) |
| .catch(error => { |
| window.error = error; |
| testExpected('error.name', 'InvalidStateError'); |
| endTest(); |
| }); |
| }); |
| }); |
| </script> |
| </head> |
| <body> |
| <div>This tests that request Picture-in-Picture requires video track for the video element.</div> |
| <video controls></video> |
| </body> |
| </html> |