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

Unified Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 975943003: Revert of Revert of Propagate audible state from player to the containing tab" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
Index: content/browser/web_contents/web_contents_impl_unittest.cc
diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc
index da3c82e7d4826fe968344dadc907178eca8bb1d1..187f3c42b3e7d0eca942e47303532da9095a4b48 100644
--- a/content/browser/web_contents/web_contents_impl_unittest.cc
+++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -9,7 +9,7 @@
#include "content/browser/frame_host/interstitial_page_impl.h"
#include "content/browser/frame_host/navigation_entry_impl.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
-#include "content/browser/media/audio_stream_monitor.h"
+#include "content/browser/media/audio_state_provider.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/site_instance_impl.h"
#include "content/browser/webui/web_ui_controller_factory_registry.h"
@@ -2891,20 +2891,20 @@ TEST_F(WebContentsImplTest, MediaPowerSaveBlocking) {
EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing());
TestRenderFrameHost* rfh = contents()->GetMainFrame();
- AudioStreamMonitor* monitor = contents()->audio_stream_monitor();
+ AudioStateProvider* audio_state = contents()->audio_state_provider();
// The audio power save blocker should not be based on having a media player
// when audio stream monitoring is available.
- if (AudioStreamMonitor::monitoring_available()) {
+ if (audio_state->IsAudioStateAvailable()) {
// Send a fake audio stream monitor notification. The audio power save
// blocker should be created.
- monitor->set_was_recently_audible_for_testing(true);
+ audio_state->set_was_recently_audible_for_testing(true);
contents()->NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
EXPECT_TRUE(contents()->has_audio_power_save_blocker_for_testing());
// Send another fake notification, this time when WasRecentlyAudible() will
// be false. The power save blocker should be released.
- monitor->set_was_recently_audible_for_testing(false);
+ audio_state->set_was_recently_audible_for_testing(false);
contents()->NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing());
}
@@ -2916,7 +2916,7 @@ TEST_F(WebContentsImplTest, MediaPowerSaveBlocking) {
0, kPlayerAudioVideoId, true, true, false));
EXPECT_TRUE(contents()->has_video_power_save_blocker_for_testing());
EXPECT_EQ(contents()->has_audio_power_save_blocker_for_testing(),
- !AudioStreamMonitor::monitoring_available());
+ !audio_state->IsAudioStateAvailable());
// Upon hiding the video power save blocker should be released.
contents()->WasHidden();
@@ -2929,7 +2929,7 @@ TEST_F(WebContentsImplTest, MediaPowerSaveBlocking) {
0, kPlayerVideoOnlyId, true, false, false));
EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing());
EXPECT_EQ(contents()->has_audio_power_save_blocker_for_testing(),
- !AudioStreamMonitor::monitoring_available());
+ !audio_state->IsAudioStateAvailable());
// Showing the WebContents should result in the creation of the blocker.
contents()->WasShown();
@@ -2941,7 +2941,7 @@ TEST_F(WebContentsImplTest, MediaPowerSaveBlocking) {
0, kPlayerAudioOnlyId, false, true, false));
EXPECT_TRUE(contents()->has_video_power_save_blocker_for_testing());
EXPECT_EQ(contents()->has_audio_power_save_blocker_for_testing(),
- !AudioStreamMonitor::monitoring_available());
+ !audio_state->IsAudioStateAvailable());
// Start a remote player. There should be no change in the power save
// blockers.
@@ -2949,7 +2949,7 @@ TEST_F(WebContentsImplTest, MediaPowerSaveBlocking) {
0, kPlayerRemoteId, true, true, true));
EXPECT_TRUE(contents()->has_video_power_save_blocker_for_testing());
EXPECT_EQ(contents()->has_audio_power_save_blocker_for_testing(),
- !AudioStreamMonitor::monitoring_available());
+ !audio_state->IsAudioStateAvailable());
// Destroy the original audio video player. Both power save blockers should
// remain.
@@ -2957,7 +2957,7 @@ TEST_F(WebContentsImplTest, MediaPowerSaveBlocking) {
FrameHostMsg_MediaPausedNotification(0, kPlayerAudioVideoId));
EXPECT_TRUE(contents()->has_video_power_save_blocker_for_testing());
EXPECT_EQ(contents()->has_audio_power_save_blocker_for_testing(),
- !AudioStreamMonitor::monitoring_available());
+ !audio_state->IsAudioStateAvailable());
// Destroy the audio only player. The video power save blocker should remain.
rfh->OnMessageReceived(
@@ -2984,7 +2984,7 @@ TEST_F(WebContentsImplTest, MediaPowerSaveBlocking) {
0, kPlayerAudioVideoId, true, true, false));
EXPECT_TRUE(contents()->has_video_power_save_blocker_for_testing());
EXPECT_EQ(contents()->has_audio_power_save_blocker_for_testing(),
- !AudioStreamMonitor::monitoring_available());
+ !audio_state->IsAudioStateAvailable());
// Crash the renderer.
contents()->GetMainFrame()->OnMessageReceived(

Powered by Google App Engine
This is Rietveld 408576698