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

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

Issue 789703004: Reflect the status of a request for accessing a blacklisted url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tested on Android/Desktop Created 6 years 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
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/logging.h" 5 #include "base/logging.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "content/browser/frame_host/cross_site_transferring_request.h" 7 #include "content/browser/frame_host/cross_site_transferring_request.h"
8 #include "content/browser/frame_host/interstitial_page_impl.h" 8 #include "content/browser/frame_host/interstitial_page_impl.h"
9 #include "content/browser/frame_host/navigation_entry_impl.h" 9 #include "content/browser/frame_host/navigation_entry_impl.h"
10 #include "content/browser/media/audio_stream_monitor.h" 10 #include "content/browser/media/audio_stream_monitor.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 153
154 void TestDomOperationResponse(const std::string& json_string) { 154 void TestDomOperationResponse(const std::string& json_string) {
155 if (enabled()) 155 if (enabled())
156 CommandReceived(); 156 CommandReceived();
157 } 157 }
158 158
159 void TestDidNavigate(int page_id, const GURL& url) { 159 void TestDidNavigate(int page_id, const GURL& url) {
160 FrameHostMsg_DidCommitProvisionalLoad_Params params; 160 FrameHostMsg_DidCommitProvisionalLoad_Params params;
161 InitNavigateParams(&params, page_id, url, ui::PAGE_TRANSITION_TYPED); 161 InitNavigateParams(&params, page_id, url, ui::PAGE_TRANSITION_TYPED);
162 DidNavigate(GetRenderViewHostForTesting(), params); 162 DidNavigate(GetRenderViewHost(), params);
163 } 163 }
164 164
165 void TestRenderViewTerminated(base::TerminationStatus status, 165 void TestRenderViewTerminated(base::TerminationStatus status,
166 int error_code) { 166 int error_code) {
167 RenderViewTerminated(GetRenderViewHostForTesting(), status, error_code); 167 RenderViewTerminated(GetRenderViewHost(), status, error_code);
168 } 168 }
169 169
170 bool is_showing() const { 170 bool is_showing() const {
171 return static_cast<TestRenderWidgetHostView*>( 171 return static_cast<TestRenderWidgetHostView*>(
172 GetRenderViewHostForTesting()->GetView())->is_showing(); 172 GetRenderViewHost()->GetView())->is_showing();
173 } 173 }
174 174
175 void ClearStates() { 175 void ClearStates() {
176 state_ = NULL; 176 state_ = NULL;
177 deleted_ = NULL; 177 deleted_ = NULL;
178 delegate_ = NULL; 178 delegate_ = NULL;
179 } 179 }
180 180
181 void CommandReceived() { 181 void CommandReceived() {
182 command_received_count_++; 182 command_received_count_++;
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after
1896 // Show interstitial. 1896 // Show interstitial.
1897 TestInterstitialPage::InterstitialState state = 1897 TestInterstitialPage::InterstitialState state =
1898 TestInterstitialPage::INVALID; 1898 TestInterstitialPage::INVALID;
1899 bool deleted = false; 1899 bool deleted = false;
1900 GURL url("http://interstitial"); 1900 GURL url("http://interstitial");
1901 TestInterstitialPage* interstitial = 1901 TestInterstitialPage* interstitial =
1902 new TestInterstitialPage(contents(), true, url, &state, &deleted); 1902 new TestInterstitialPage(contents(), true, url, &state, &deleted);
1903 TestInterstitialPageStateGuard state_guard(interstitial); 1903 TestInterstitialPageStateGuard state_guard(interstitial);
1904 interstitial->Show(); 1904 interstitial->Show();
1905 interstitial->TestDidNavigate(1, url); 1905 interstitial->TestDidNavigate(1, url);
1906 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( 1906 RenderViewHostImpl* rvh =
1907 interstitial->GetRenderViewHostForTesting()); 1907 static_cast<RenderViewHostImpl*>(interstitial->GetRenderViewHost());
1908 1908
1909 // Now close the contents. 1909 // Now close the contents.
1910 DeleteContents(); 1910 DeleteContents();
1911 EXPECT_EQ(TestInterstitialPage::CANCELED, state); 1911 EXPECT_EQ(TestInterstitialPage::CANCELED, state);
1912 1912
1913 // Before the interstitial has a chance to process its shutdown task, 1913 // Before the interstitial has a chance to process its shutdown task,
1914 // simulate quitting the browser. This goes through all processes and 1914 // simulate quitting the browser. This goes through all processes and
1915 // tells them to destruct. 1915 // tells them to destruct.
1916 rvh->OnMessageReceived( 1916 rvh->OnMessageReceived(
1917 ViewHostMsg_RenderProcessGone(0, 0, 0)); 1917 ViewHostMsg_RenderProcessGone(0, 0, 0));
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
2785 2785
2786 // Destroy the remote player. No power save blockers should remain. 2786 // Destroy the remote player. No power save blockers should remain.
2787 rfh->OnMessageReceived( 2787 rfh->OnMessageReceived(
2788 FrameHostMsg_MediaPausedNotification(0, kPlayerRemoteId)); 2788 FrameHostMsg_MediaPausedNotification(0, kPlayerRemoteId));
2789 EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing()); 2789 EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing());
2790 EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing()); 2790 EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing());
2791 } 2791 }
2792 #endif 2792 #endif
2793 2793
2794 } // namespace content 2794 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698