Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: third_party/WebKit/LayoutTests/media/autoplay-document-move.html

Issue 2047433003: Update autoplay settings when moving media elements between documents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed nits in tests Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..962a5f4611d0596cdb7a68564f6a89923eec13c5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/media/autoplay-document-move.html
@@ -0,0 +1,43 @@
+<!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(
+ t.step_func_done(),
+ t.step_func_done(function() {
+ assert_unreached('Video should autoplay when gesture not required');
+ }));
+ }, '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(
+ t.step_func_done(function() {
+ assert_unreached('Video should not autoplay when gesture required');
+ }),
+ t.step_func_done());
+ }, 'Test that video should not autoplay when gesture required');
+</script>
+</body>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698