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

Unified Diff: media/blink/webmediaplayer_impl_unittest.cc

Issue 2618883002: [Media, Video] Enable the video track for a new renderer. (Closed)
Patch Set: Fixed debug tests Created 3 years, 11 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/filters/pipeline_controller.h » ('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 9fc4322c31a7b7d99c79b6a5ba0645eaf09103db..0d7a8280a32849f856b7672a9cd0fff2df239eaf 100644
--- a/media/blink/webmediaplayer_impl_unittest.cc
+++ b/media/blink/webmediaplayer_impl_unittest.cc
@@ -249,6 +249,20 @@ class WebMediaPlayerImplTest : public testing::Test {
scoped_feature_list_.InitAndEnableFeature(kResumeBackgroundVideo);
}
+ void SetBackgroundVideoOptimization(bool enable) {
+ if (enable) {
+ scoped_feature_list_.InitAndEnableFeature(
+ kBackgroundVideoTrackOptimization);
+ } else {
+ scoped_feature_list_.InitAndDisableFeature(
+ kBackgroundVideoTrackOptimization);
+ }
+ }
+
+ bool ShouldDisableVideoWhenHidden() const {
+ return wmpi_->ShouldDisableVideoWhenHidden();
+ }
+
// "Renderer" thread.
base::MessageLoop message_loop_;
@@ -755,4 +769,28 @@ TEST_F(WebMediaPlayerImplTest, AutoplayMuted_SetVolume) {
wmpi_->setVolume(1.0);
}
+TEST_F(WebMediaPlayerImplTest, ShouldDisableVideoWhenHidden) {
+ InitializeWebMediaPlayerImpl();
+ EXPECT_CALL(delegate_, IsHidden()).WillRepeatedly(Return(true));
+ SetBackgroundVideoOptimization(true);
+
+ SetMetadata(true, true);
+ EXPECT_TRUE(ShouldDisableVideoWhenHidden());
+
+ SetMetadata(false, true);
+ EXPECT_FALSE(ShouldDisableVideoWhenHidden());
+
+ SetMetadata(true, false);
+ EXPECT_FALSE(ShouldDisableVideoWhenHidden());
+}
+
+TEST_F(WebMediaPlayerImplTest, ShouldDisableVideoWhenHiddenFeatureDisabled) {
+ InitializeWebMediaPlayerImpl();
+ EXPECT_CALL(delegate_, IsHidden()).WillRepeatedly(Return(true));
+ SetBackgroundVideoOptimization(false);
+
+ SetMetadata(true, true);
+ EXPECT_FALSE(ShouldDisableVideoWhenHidden());
+}
+
} // namespace media
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | media/filters/pipeline_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698