[Web Animations] Update WPT tests related to Web Animations and remove imported Mozil...
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / picture-in-picture / request-picture-in-picture.html
1 <!DOCTYPE html>
2 <title>Test request Picture-in-Picture</title>
3 <script src="/common/media.js"></script>
4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
6 <script src="/resources/testdriver.js"></script>
7 <script src="/resources/testdriver-vendor.js"></script>
8 <script src="resources/picture-in-picture-helpers.js"></script>
9 <body></body>
10 <script>
11 promise_test(async t => {
12   const video = await loadVideo();
13   return promise_rejects(t, 'NotAllowedError', video.requestPictureInPicture());
14 }, 'request Picture-in-Picture requires a user gesture');
15
16 promise_test(t => {
17   const video = document.createElement('video');
18   return promise_rejects(t, 'InvalidStateError',
19       requestPictureInPictureWithTrustedClick(video));
20 }, 'request Picture-in-Picture requires loaded metadata for the video element');
21
22 promise_test(async t => {
23   const video = document.createElement('video');
24   await new Promise(resolve => {
25     video.src = getAudioURI('/media/sound_5');
26     video.onloadeddata = resolve;
27   }).then(() => {
28     return promise_rejects(t, 'InvalidStateError',
29       requestPictureInPictureWithTrustedClick(video));
30   })
31 }, 'request Picture-in-Picture requires video track for the video element');
32
33 promise_test(async t => {
34   const video = await loadVideo();
35   return requestPictureInPictureWithTrustedClick(video);
36 }, 'request Picture-in-Picture resolves on user click');
37 </script>