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

Unified Diff: third_party/WebKit/LayoutTests/media/media-play-promise.html

Issue 1865933002: Fix race when HTMLMediaElement.play() is called just after pause(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix 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/LayoutTests/media/media-play-promise-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/media/media-play-promise.html
diff --git a/third_party/WebKit/LayoutTests/media/media-play-promise.html b/third_party/WebKit/LayoutTests/media/media-play-promise.html
index 77b4ac76d873b04ea315ffba91cc0df810ef6f1d..992b0b0654d02553de8649af8a9331bdb229922a 100644
--- a/third_party/WebKit/LayoutTests/media/media-play-promise.html
+++ b/third_party/WebKit/LayoutTests/media/media-play-promise.html
@@ -65,7 +65,7 @@
var TESTS = [
// Test that play() on an element that doesn't have enough data will
- // return a promise that resolves successfuly.
+ // return a promise that resolves successfully.
function playBeforeCanPlay()
{
consoleWrite("playBeforeCanPlay()");
@@ -85,7 +85,7 @@
},
// Test that play() on an element that has enough data will return a
- // promise that resolves successfuly.
+ // promise that resolves successfully.
function playWhenCanPlay()
{
consoleWrite("playWhenCanPlay()");
@@ -105,6 +105,8 @@
});
},
+ // Test that play() on an element that is already playing returns a
+ // promise that resolves successfully.
function playAfterPlaybackStarted()
{
consoleWrite("playAfterPlaybackStarted()");
@@ -391,7 +393,32 @@
run("mediaElement.volume = 0.2");
});
- }
+ },
+
+ // Test that calling pause() then play() on an element that is already
+ // playing returns a promise that resolves successfully.
+ function pausePlayAfterPlaybackStarted()
+ {
+ consoleWrite("pausePlayAfterPlaybackStarted()");
+ internals.settings.setMediaPlaybackRequiresUserGesture(false);
+
+ run("mediaElement = document.createElement('audio')");
+ mediaElement.preload = "auto";
+ var mediaFile = findMediaFile("audio", "content/test");
+ run("mediaElement.src = '" + mediaFile + "'");
+
+ waitForEvent('playing', function() {
+ testExpected("mediaElement.readyState", HTMLMediaElement.HAVE_ENOUGH_DATA);
+ testExpected("mediaElement.paused", false);
+
+ run("mediaElement.pause()");
+ play();
+ });
+
+ waitForEvent('canplaythrough', function() {
+ run("mediaElement.play()");
+ });
+ },
];
function start()
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/media-play-promise-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698