OLD | NEW |
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 Loading... |
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 |
OLD | NEW |