| <script src="media-file.js"></script> |
| <script src="video-test.js"></script> |
| function didResolvePromise() |
| logResult(Failed, "Expected promise to be rejected. Was resolved."); |
| // Wait some time before ending the test towards ensuring that we ended the session interruption. |
| function didRejectPromise(e) |
| logResult(true, "Promise rejected."); |
| testExpected("error.name", "NotSupportedError"); |
| // Wait some time before ending the test towards ensuring that we ended the session interruption. |
| failTest("This test must be run in DumpRenderTree or WebKitTestRunner."); |
| run('internals.setMediaSessionRestrictions("videoaudio", "InterruptedPlaybackNotPermitted")'); |
| run('video.src = "non-existent.mp4"'); |
| testExpected("video.paused", true); |
| run('internals.beginMediaSessionInterruption("System")'); |
| run("video.play().then(didResolvePromise).catch(didRejectPromise)"); |
| run('internals.endMediaSessionInterruption("MayResumePlaying")'); |