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

Side by Side Diff: third_party/WebKit/LayoutTests/media/autoplay-muted.html

Issue 2471373005: Pretend the video has no audio track if it is playing as part of autoplay muted. (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Test for autoplay of muted video</title> 2 <title>Test for autoplay of muted video</title>
3 <script src="../resources/testharness.js"></script> 3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script> 4 <script src="../resources/testharnessreport.js"></script>
5 <script src="media-file.js"></script> 5 <script src="media-file.js"></script>
6 <script src="media-controls.js"></script> 6 <script src="media-controls.js"></script>
7 <body> 7 <body>
8 <script> 8 <script>
9 test(function() { 9 test(function() {
10 assert_true(!!window.internals 10 assert_true(!!window.internals
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 var e = createMutedAudioElement(); 63 var e = createMutedAudioElement();
64 e.autoplay = true; 64 e.autoplay = true;
65 e.onplay = t.unreached_func(); 65 e.onplay = t.unreached_func();
66 e.oncanplaythrough = t.step_func(function() { 66 e.oncanplaythrough = t.step_func(function() {
67 setTimeout(t.step_func_done(function() { 67 setTimeout(t.step_func_done(function() {
68 assert_true(e.paused); 68 assert_true(e.paused);
69 }), 0); 69 }), 0);
70 }); 70 });
71 }, "Test that autoplay on a muted audio without gesture has no effect."); 71 }, "Test that autoplay on a muted audio without gesture has no effect.");
72 72
73 promise_test(function(t) { 73 async_test(t => {
74 var e = createMutedVideoElement(); 74 var e = createMutedVideoElement();
75 return e.play().then(t.step_func_done(function() { 75 e.play().then(t.step_func(() => {
76 e.muted = false; 76 e.muted = false;
77
78 var expectedEvents = [ 'volumechange', 'pause' ];
79 new EventWatcher(t, e, expectedEvents).wait_for(expectedEvents).then(
80 t.step_func_done(() => {
77 assert_true(e.paused, "The video should be paused."); 81 assert_true(e.paused, "The video should be paused.");
78 })); 82 }));
83 }));
79 }, "Test that unmuting an autoplayed video without gesture pauses."); 84 }, "Test that unmuting an autoplayed video without gesture pauses.");
80 85
81 async_test(function(t) { 86 async_test(function(t) {
82 var e = createMutedVideoElement(); 87 var e = createMutedVideoElement();
83 88
84 e.play().then(t.step_func(function() { 89 e.play().then(t.step_func(function() {
85 eventSender.mouseDown(); 90 eventSender.mouseDown();
86 eventSender.mouseUp(); 91 eventSender.mouseUp();
87 })); 92 }));
88 93
89 document.onclick = t.step_func_done(function() { 94 document.onclick = t.step_func_done(function() {
90 e.muted = false; 95 e.muted = false;
91 assert_false(e.paused, "The video should not be paused."); 96 assert_false(e.paused, "The video should not be paused.");
92 }); 97 });
93 }, "Test that unmuting autoplayed video with gesture doesn't pause it."); 98 }, "Test that unmuting autoplayed video with gesture doesn't pause it.");
94 99
95 promise_test(function(t) { 100 promise_test(function(t) {
96 testRunner.setAutoplayAllowed(false); 101 testRunner.setAutoplayAllowed(false);
97 return promise_rejects( 102 return promise_rejects(
98 t, 103 t,
99 new DOMException( 104 new DOMException(
100 'play() can only be initiated by a user gesture.', 105 'play() can only be initiated by a user gesture.',
101 'NotAllowedError'), 106 'NotAllowedError'),
102 createMutedVideoElement().play()); 107 createMutedVideoElement().play());
103 }, "Test that muted videos don't autoplay when the setting is disabled"); 108 }, "Test that muted videos don't autoplay when the setting is disabled");
104 </script> 109 </script>
105 </body> 110 </body>
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl_unittest.cc ('k') | third_party/WebKit/Source/core/html/HTMLMediaElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698