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

Unified Diff: media/blink/webmediaplayer_impl_unittest.cc

Issue 2115143002: Transition media element to HAVE_CURRENT_DATA upon underflow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Feedback Created 4 years, 5 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 | « media/blink/webmediaplayer_impl.cc ('k') | media/renderers/renderer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/webmediaplayer_impl_unittest.cc
diff --git a/media/blink/webmediaplayer_impl_unittest.cc b/media/blink/webmediaplayer_impl_unittest.cc
index 0aee551c1676cd3e339ee3161813202d2fc41d4d..ea8d2720d6e85a985f7ffba34895687677fd24c6 100644
--- a/media/blink/webmediaplayer_impl_unittest.cc
+++ b/media/blink/webmediaplayer_impl_unittest.cc
@@ -311,6 +311,33 @@ TEST_F(WebMediaPlayerImplTest, ComputePlayState_Playing) {
EXPECT_TRUE(state.is_suspended);
}
+TEST_F(WebMediaPlayerImplTest, ComputePlayState_PlayingThenUnderflow) {
+ WebMediaPlayerImpl::PlayState state;
+ SetMetadata(true, true);
+ SetReadyState(blink::WebMediaPlayer::ReadyStateHaveFutureData);
+ SetPaused(false);
+ SetReadyState(blink::WebMediaPlayer::ReadyStateHaveCurrentData);
+
+ // Underflow should not trigger idle suspend. The user is still playing the
+ // the video, just waiting on the network.
+ state = ComputePlayState();
+ EXPECT_EQ(WebMediaPlayerImpl::DelegateState::PLAYING, state.delegate_state);
+ EXPECT_TRUE(state.is_memory_reporting_enabled);
+ EXPECT_FALSE(state.is_suspended);
+
+ // Background suspend should still be possible during underflow.
+ state = ComputeBackgroundedPlayState();
+ EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
+ EXPECT_FALSE(state.is_memory_reporting_enabled);
+ EXPECT_TRUE(state.is_suspended);
+
+ // Forced suspend should still be possible during underflow.
+ state = ComputeMustSuspendPlayState();
+ EXPECT_EQ(WebMediaPlayerImpl::DelegateState::GONE, state.delegate_state);
+ EXPECT_FALSE(state.is_memory_reporting_enabled);
+ EXPECT_TRUE(state.is_suspended);
+}
+
TEST_F(WebMediaPlayerImplTest, ComputePlayState_Playing_AudioOnly) {
WebMediaPlayerImpl::PlayState state;
SetMetadata(true, false);
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | media/renderers/renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698