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

Side by Side Diff: content/browser/frame_host/navigation_handle_impl_browsertest.cc

Issue 2889003002: Change NavigationEntry to use virtual URL in error pages for blocked navigations (Closed)
Patch Set: Remove some error codes and add a TODO. Created 3 years, 7 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/memory/weak_ptr.h" 6 #include "base/memory/weak_ptr.h"
7 #include "content/browser/frame_host/navigation_handle_impl.h" 7 #include "content/browser/frame_host/navigation_handle_impl.h"
8 #include "content/browser/web_contents/web_contents_impl.h" 8 #include "content/browser/web_contents/web_contents_impl.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 #include "content/public/browser/web_contents_observer.h" 10 #include "content/public/browser/web_contents_observer.h"
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 ExecuteScript(shell(), base::StringPrintf("location.href = '%s'", 1142 ExecuteScript(shell(), base::StringPrintf("location.href = '%s'",
1143 blocked_url.spec().c_str()))); 1143 blocked_url.spec().c_str())));
1144 navigation_observer.Wait(); 1144 navigation_observer.Wait();
1145 EXPECT_TRUE(observer.has_committed()); 1145 EXPECT_TRUE(observer.has_committed());
1146 EXPECT_TRUE(observer.is_error()); 1146 EXPECT_TRUE(observer.is_error());
1147 EXPECT_EQ(site_instance, 1147 EXPECT_EQ(site_instance,
1148 shell()->web_contents()->GetMainFrame()->GetSiteInstance()); 1148 shell()->web_contents()->GetMainFrame()->GetSiteInstance());
1149 } 1149 }
1150 1150
1151 { 1151 {
1152 // Reloading the page should not transfer processes. 1152 // Reloading the blocked document should load about:blank and not transfer
1153 NavigationHandleObserver observer(shell()->web_contents(), blocked_url); 1153 // processes.
1154 GURL about_blank_url(url::kAboutBlankURL);
1155 NavigationHandleObserver observer(shell()->web_contents(), about_blank_url);
1154 TestNavigationObserver navigation_observer(shell()->web_contents(), 1); 1156 TestNavigationObserver navigation_observer(shell()->web_contents(), 1);
1155 1157
1156 shell()->Reload(); 1158 shell()->Reload();
1157 navigation_observer.Wait(); 1159 navigation_observer.Wait();
1158 EXPECT_TRUE(observer.has_committed()); 1160 EXPECT_TRUE(observer.has_committed());
1159 EXPECT_TRUE(observer.is_error()); 1161 EXPECT_FALSE(observer.is_error());
1160 EXPECT_EQ(site_instance, 1162 EXPECT_EQ(site_instance,
1161 shell()->web_contents()->GetMainFrame()->GetSiteInstance()); 1163 shell()->web_contents()->GetMainFrame()->GetSiteInstance());
1162 } 1164 }
1163 1165
1164 installer.reset(); 1166 installer.reset();
1165 1167
1166 { 1168 {
1167 // With the throttle uninstalled, going back should return to |start_url| in 1169 // With the throttle uninstalled, going back should return to |start_url| in
1168 // the same process, and clear the error page. 1170 // the same process, and clear the error page.
1169 NavigationHandleObserver observer(shell()->web_contents(), start_url); 1171 NavigationHandleObserver observer(shell()->web_contents(), start_url);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 NavigationHandleObserver observer(shell()->web_contents(), error_url); 1227 NavigationHandleObserver observer(shell()->web_contents(), error_url);
1226 EXPECT_FALSE(NavigateToURL(shell(), error_url)); 1228 EXPECT_FALSE(NavigateToURL(shell(), error_url));
1227 EXPECT_TRUE(observer.has_committed()); 1229 EXPECT_TRUE(observer.has_committed());
1228 EXPECT_TRUE(observer.is_error()); 1230 EXPECT_TRUE(observer.is_error());
1229 EXPECT_NE(site_instance, 1231 EXPECT_NE(site_instance,
1230 shell()->web_contents()->GetMainFrame()->GetSiteInstance()); 1232 shell()->web_contents()->GetMainFrame()->GetSiteInstance());
1231 } 1233 }
1232 } 1234 }
1233 1235
1234 } // namespace content 1236 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698