| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <title>Capture source interruption.</title> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| </head> |
| <body> |
| <script> |
| promise_test(async (test) => { |
| if (window.internals) |
| internals.beginAudioSessionInterruption(); |
| |
| const video = document.createElement('video'); |
| video.autoplay = true; |
| document.body.appendChild(video); |
| |
| const stream = await navigator.mediaDevices.getUserMedia({audio: true}); |
| video.srcObject = stream; |
| |
| let counter = 0; |
| while(++counter < 100 && video.paused) |
| await new Promise(resolve => setTimeout(resolve, 50)); |
| |
| assert_false(video.paused); |
| }, "Correctly handle autoplay for a media element created while page is interrupted"); |
| </script> |
| </body> |
| </html> |