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

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 layout 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..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>
« 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