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 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1887 interstitial->Show(); | 1887 interstitial->Show(); |
1888 int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID(); | 1888 int interstitial_entry_id = controller().GetTransientEntry()->GetUniqueID(); |
1889 interstitial->TestDidNavigate(2, interstitial_entry_id, true, | 1889 interstitial->TestDidNavigate(2, interstitial_entry_id, true, |
1890 interstitial_url); | 1890 interstitial_url); |
1891 | 1891 |
1892 // Crash the renderer | 1892 // Crash the renderer |
1893 contents()->GetMainFrame()->GetProcess()->SimulateCrash(); | 1893 contents()->GetMainFrame()->GetProcess()->SimulateCrash(); |
1894 | 1894 |
1895 // While the interstitial is showing, go back. | 1895 // While the interstitial is showing, go back. |
1896 controller().GoBack(); | 1896 controller().GoBack(); |
1897 main_test_rfh()->PrepareForCommit(); | |
1898 contents()->GetMainFrame()->SendNavigate(1, entry->GetUniqueID(), false, | |
1899 url1); | |
1900 | 1897 |
ncarter (slow)
2015/05/26 21:44:14
What's the story with the lines that were removed
nasko
2015/05/26 22:25:49
This might belong to a separate CL. It is incorrec
| |
1901 // Make sure we are back to the original page and that the interstitial is | 1898 // Make sure we are back to the original page and that the interstitial is |
1902 // gone. | 1899 // gone. |
1903 EXPECT_EQ(TestInterstitialPage::CANCELED, state); | 1900 EXPECT_EQ(TestInterstitialPage::CANCELED, state); |
1904 entry = controller().GetVisibleEntry(); | 1901 entry = controller().GetVisibleEntry(); |
1905 ASSERT_TRUE(entry); | 1902 ASSERT_TRUE(entry); |
1906 EXPECT_EQ(url1.spec(), entry->GetURL().spec()); | 1903 EXPECT_EQ(url1.spec(), entry->GetURL().spec()); |
1907 | 1904 |
1908 RunAllPendingInMessageLoop(); | 1905 RunAllPendingInMessageLoop(); |
1909 EXPECT_TRUE(deleted); | 1906 EXPECT_TRUE(deleted); |
1910 } | 1907 } |
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3009 const int kPlayerAudioOnlyId = -15; | 3006 const int kPlayerAudioOnlyId = -15; |
3010 const int kPlayerVideoOnlyId = 30; | 3007 const int kPlayerVideoOnlyId = 30; |
3011 const int kPlayerRemoteId = -30; | 3008 const int kPlayerRemoteId = -30; |
3012 | 3009 |
3013 EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing()); | 3010 EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing()); |
3014 EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing()); | 3011 EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing()); |
3015 | 3012 |
3016 TestRenderFrameHost* rfh = contents()->GetMainFrame(); | 3013 TestRenderFrameHost* rfh = contents()->GetMainFrame(); |
3017 AudioStateProvider* audio_state = contents()->audio_state_provider(); | 3014 AudioStateProvider* audio_state = contents()->audio_state_provider(); |
3018 | 3015 |
3016 // Ensure RenderFrame is initialized before simulating events coming from it. | |
3017 main_test_rfh()->InitializeRenderFrameIfNeeded(); | |
3018 | |
3019 // The audio power save blocker should not be based on having a media player | 3019 // The audio power save blocker should not be based on having a media player |
3020 // when audio stream monitoring is available. | 3020 // when audio stream monitoring is available. |
3021 if (audio_state->IsAudioStateAvailable()) { | 3021 if (audio_state->IsAudioStateAvailable()) { |
3022 // Send a fake audio stream monitor notification. The audio power save | 3022 // Send a fake audio stream monitor notification. The audio power save |
3023 // blocker should be created. | 3023 // blocker should be created. |
3024 audio_state->set_was_recently_audible_for_testing(true); | 3024 audio_state->set_was_recently_audible_for_testing(true); |
3025 contents()->NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB); | 3025 contents()->NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB); |
3026 EXPECT_TRUE(contents()->has_audio_power_save_blocker_for_testing()); | 3026 EXPECT_TRUE(contents()->has_audio_power_save_blocker_for_testing()); |
3027 | 3027 |
3028 // Send another fake notification, this time when WasRecentlyAudible() will | 3028 // Send another fake notification, this time when WasRecentlyAudible() will |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3111 | 3111 |
3112 // Crash the renderer. | 3112 // Crash the renderer. |
3113 contents()->GetMainFrame()->GetProcess()->SimulateCrash(); | 3113 contents()->GetMainFrame()->GetProcess()->SimulateCrash(); |
3114 | 3114 |
3115 // Verify that all the power save blockers have been released. | 3115 // Verify that all the power save blockers have been released. |
3116 EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing()); | 3116 EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing()); |
3117 EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing()); | 3117 EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing()); |
3118 } | 3118 } |
3119 | 3119 |
3120 } // namespace content | 3120 } // namespace content |
OLD | NEW |