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

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: rebase Created 3 years, 6 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 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 ExecuteScript(shell(), base::StringPrintf("location.href = '%s'", 1117 ExecuteScript(shell(), base::StringPrintf("location.href = '%s'",
1118 blocked_url.spec().c_str()))); 1118 blocked_url.spec().c_str())));
1119 navigation_observer.Wait(); 1119 navigation_observer.Wait();
1120 EXPECT_TRUE(observer.has_committed()); 1120 EXPECT_TRUE(observer.has_committed());
1121 EXPECT_TRUE(observer.is_error()); 1121 EXPECT_TRUE(observer.is_error());
1122 EXPECT_EQ(site_instance, 1122 EXPECT_EQ(site_instance,
1123 shell()->web_contents()->GetMainFrame()->GetSiteInstance()); 1123 shell()->web_contents()->GetMainFrame()->GetSiteInstance());
1124 } 1124 }
1125 1125
1126 { 1126 {
1127 // Reloading the page should not transfer processes. 1127 // Reloading the blocked document should load about:blank and not transfer
1128 NavigationHandleObserver observer(shell()->web_contents(), blocked_url); 1128 // processes.
1129 GURL about_blank_url(url::kAboutBlankURL);
1130 NavigationHandleObserver observer(shell()->web_contents(), about_blank_url);
1129 TestNavigationObserver navigation_observer(shell()->web_contents(), 1); 1131 TestNavigationObserver navigation_observer(shell()->web_contents(), 1);
1130 1132
1131 shell()->Reload(); 1133 shell()->Reload();
1132 navigation_observer.Wait(); 1134 navigation_observer.Wait();
1133 EXPECT_TRUE(observer.has_committed()); 1135 EXPECT_TRUE(observer.has_committed());
1134 EXPECT_TRUE(observer.is_error()); 1136 EXPECT_FALSE(observer.is_error());
1135 EXPECT_EQ(site_instance, 1137 EXPECT_EQ(site_instance,
1136 shell()->web_contents()->GetMainFrame()->GetSiteInstance()); 1138 shell()->web_contents()->GetMainFrame()->GetSiteInstance());
1137 } 1139 }
1138 1140
1139 installer.reset(); 1141 installer.reset();
1140 1142
1141 { 1143 {
1142 // With the throttle uninstalled, going back should return to |start_url| in 1144 // With the throttle uninstalled, going back should return to |start_url| in
1143 // the same process, and clear the error page. 1145 // the same process, and clear the error page.
1144 NavigationHandleObserver observer(shell()->web_contents(), start_url); 1146 NavigationHandleObserver observer(shell()->web_contents(), start_url);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 EXPECT_TRUE(last_committed); 1238 EXPECT_TRUE(last_committed);
1237 EXPECT_EQ(blocked_url, last_committed->GetVirtualURL()); 1239 EXPECT_EQ(blocked_url, last_committed->GetVirtualURL());
1238 EXPECT_EQ(PAGE_TYPE_ERROR, last_committed->GetPageType()); 1240 EXPECT_EQ(PAGE_TYPE_ERROR, last_committed->GetPageType());
1239 EXPECT_NE(web_ui_process.get(), web_contents->GetSiteInstance()); 1241 EXPECT_NE(web_ui_process.get(), web_contents->GetSiteInstance());
1240 EXPECT_TRUE(commit_observer.has_committed()); 1242 EXPECT_TRUE(commit_observer.has_committed());
1241 EXPECT_TRUE(commit_observer.is_error()); 1243 EXPECT_TRUE(commit_observer.is_error());
1242 EXPECT_FALSE(commit_observer.is_renderer_initiated()); 1244 EXPECT_FALSE(commit_observer.is_renderer_initiated());
1243 } 1245 }
1244 1246
1245 } // namespace content 1247 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl_browsertest.cc ('k') | content/test/data/data_url_navigations.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698