Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/autoplay-document-move.html |
| diff --git a/third_party/WebKit/LayoutTests/media/autoplay-document-move.html b/third_party/WebKit/LayoutTests/media/autoplay-document-move.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..95d7ff459d1433100b1befaeef9252338bb53d94 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/media/autoplay-document-move.html |
| @@ -0,0 +1,49 @@ |
| +<!DOCTYPE html> |
| +<title>Moving media element to other document to bypass autoplay</title> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="media-file.js"></script> |
| +<body> |
| +<script> |
| + function createAndMoveVideo() { |
| + var v = document.implementation.createHTMLDocument().createElement('video'); |
| + v.src = findMediaFile('video', 'content/test'); |
| + document.body.appendChild(v); |
| + return v; |
| + } |
| + |
| + test(function() { |
| + assert_true(window.internals != null, 'This test only works with internals exposed present'); |
| + }, 'internals are exposed'); |
| + |
| + async_test(function(t) { |
| + window.internals.settings.setMediaPlaybackRequiresUserGesture(false); |
| + var v = createAndMoveVideo(); |
| + assert_true(v.paused, 'Video should be paused before calling play()'); |
| + |
| + v.play().then( |
| + function(e) { |
|
mlamouri (slow - plz ping)
2016/06/09 10:57:58
v.play().then(
t.step_func_done,
t.step_func_d
Zhiqiang Zhang (Slow)
2016/06/09 11:20:18
Done.
|
| + t.done(); |
| + }, |
| + function(e) { |
| + assert_unreached('Video should autoplay when gesture not required'); |
| + t.done(); |
| + }); |
| + }, 'Test that video should autoplay without gesture requirement'); |
| + |
| + async_test(function(t) { |
| + window.internals.settings.setMediaPlaybackRequiresUserGesture(true); |
| + var v = createAndMoveVideo(); |
| + assert_true(v.paused, 'Video should be paused before calling play()'); |
| + |
| + v.play().then( |
| + function(e) { |
| + assert_unreached('Video should not autoplay when gesture required'); |
| + t.done(); |
| + }, |
| + function(e) { |
| + t.done(); |
| + }); |
|
mlamouri (slow - plz ping)
2016/06/09 10:57:58
ditto
Zhiqiang Zhang (Slow)
2016/06/09 11:20:18
Done.
|
| + }, 'Test that video should not autoplay when gesture required'); |
| +</script> |
| +</body> |