Return a Promise from HTMLMediaElement.play()
[WebKit-https.git] / LayoutTests / media / media-play-promise-reject-play-notsupported.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.src = findMediaFile("video", "content/invalid")');
14             waitForEventOnce('error', error);
15         }
16
17         function error()
18         {
19             run('mediaElement.play().then(failTest).catch(promiseRejected)');    
20         }
21
22         function promiseRejected(e)
23         {
24             error = e;
25             logResult(true, "Promise rejected.");
26             testExpected('error.name', 'NotSupportedError');
27             endTest();
28         }
29         </script>
30     </head>
31
32     <body onload="start()">
33
34         <video></video>
35     
36     </body>
37 </html>