| <!DOCTYPE html> |
| <title>Tests that a media document will always autoplay.</title> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script src="../media-file.js"></script> |
| <body> |
| <script> |
| async_test(function(t) { |
| t.add_cleanup(() => { |
| internals.settings.setAutoplayPolicy('no-user-gesture-required'); |
| }); |
| internals.settings.setAutoplayPolicy('document-user-activation-required'); |
| |
| const iframe = document.createElement('iframe'); |
| |
| iframe.onload = t.step_func(() => { |
| const video = iframe.contentDocument.querySelector('video'); |
| assert_not_equals(undefined, video); |
| |
| video.play().then( |
| () => { assert_unreached("playback should fail"); }, |
| error => { assert_equals(error.name, "NotAllowedError"); t.done(); } |
| ); |
| }); |
| |
| iframe.src = '../content/test.ogv'; |
| document.body.appendChild(iframe); |
| }); |
| </script> |