Return a Promise from HTMLMediaElement.play()
[WebKit-https.git] / LayoutTests / media / media-play-promise-reject-load-abort.html
1 <!DOCTYPE html>
2 <html>
3     <head>
4         <script src=media-file.js></script>
5         <script src=video-test.js></script>
6
7         <script>
8         var promise;
9         var error;
10         function start()
11         {
12             findMediaElement();
13             run('mediaElement.play().then(failTest).catch(promiseRejected)');    
14             run('mediaElement.src = findMediaFile("video", "content/test")');
15         }
16         function promiseRejected(e)
17         {
18             error = e;
19             logResult(true, "Promise rejected.");
20             testExpected('error.name', 'AbortError');
21             endTest();
22         }
23         </script>
24     </head>
25
26     <body onload="start()">
27
28         <video></video>
29     
30     </body>
31 </html>