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

Side by Side Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 886603009: Cleanup power save blockers after a RenderView crashes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit. 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 unified diff | Download patch
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "content/browser/frame_host/cross_site_transferring_request.h" 8 #include "content/browser/frame_host/cross_site_transferring_request.h"
9 #include "content/browser/frame_host/interstitial_page_impl.h" 9 #include "content/browser/frame_host/interstitial_page_impl.h"
10 #include "content/browser/frame_host/navigation_entry_impl.h" 10 #include "content/browser/frame_host/navigation_entry_impl.h"
(...skipping 3008 matching lines...) Expand 10 before | Expand all | Expand 10 after
3019 rfh->OnMessageReceived( 3019 rfh->OnMessageReceived(
3020 FrameHostMsg_MediaPausedNotification(0, kPlayerVideoOnlyId)); 3020 FrameHostMsg_MediaPausedNotification(0, kPlayerVideoOnlyId));
3021 EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing()); 3021 EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing());
3022 EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing()); 3022 EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing());
3023 3023
3024 // Destroy the remote player. No power save blockers should remain. 3024 // Destroy the remote player. No power save blockers should remain.
3025 rfh->OnMessageReceived( 3025 rfh->OnMessageReceived(
3026 FrameHostMsg_MediaPausedNotification(0, kPlayerRemoteId)); 3026 FrameHostMsg_MediaPausedNotification(0, kPlayerRemoteId));
3027 EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing()); 3027 EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing());
3028 EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing()); 3028 EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing());
3029
3030 // Start a player with both audio and video. A video power save blocker
3031 // should be created. If audio stream monitoring is available, an audio power
3032 // save blocker should be created too.
3033 rfh->OnMessageReceived(FrameHostMsg_MediaPlayingNotification(
3034 0, kPlayerAudioVideoId, true, true, false));
3035 EXPECT_TRUE(contents()->has_video_power_save_blocker_for_testing());
3036 EXPECT_EQ(contents()->has_audio_power_save_blocker_for_testing(),
3037 !AudioStreamMonitor::monitoring_available());
3038
3039 // Crash the renderer.
3040 contents()->GetMainFrame()->GetRenderViewHost()->OnMessageReceived(
3041 ViewHostMsg_RenderProcessGone(
3042 0, base::TERMINATION_STATUS_PROCESS_CRASHED, -1));
3043
3044 // Verify that all the power save blockers have been released.
3045 EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing());
3046 EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing());
3029 } 3047 }
3030 #endif 3048 #endif
3031 3049
3032 } // namespace content 3050 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698