| OLD | NEW |
| 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/memory/weak_ptr.h" | 5 #include "base/memory/weak_ptr.h" |
| 6 #include "content/browser/frame_host/navigation_handle_impl.h" | 6 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 7 #include "content/browser/web_contents/web_contents_impl.h" | 7 #include "content/browser/web_contents/web_contents_impl.h" |
| 8 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
| 9 #include "content/public/browser/web_contents_observer.h" | 9 #include "content/public/browser/web_contents_observer.h" |
| 10 #include "content/public/common/browser_side_navigation_policy.h" | 10 #include "content/public/common/browser_side_navigation_policy.h" |
| (...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 ExecuteScript(shell(), base::StringPrintf("location.href = '%s'", | 1187 ExecuteScript(shell(), base::StringPrintf("location.href = '%s'", |
| 1188 blocked_url.spec().c_str()))); | 1188 blocked_url.spec().c_str()))); |
| 1189 navigation_observer.Wait(); | 1189 navigation_observer.Wait(); |
| 1190 EXPECT_TRUE(observer.has_committed()); | 1190 EXPECT_TRUE(observer.has_committed()); |
| 1191 EXPECT_TRUE(observer.is_error()); | 1191 EXPECT_TRUE(observer.is_error()); |
| 1192 EXPECT_EQ(site_instance, | 1192 EXPECT_EQ(site_instance, |
| 1193 shell()->web_contents()->GetMainFrame()->GetSiteInstance()); | 1193 shell()->web_contents()->GetMainFrame()->GetSiteInstance()); |
| 1194 } | 1194 } |
| 1195 | 1195 |
| 1196 { | 1196 { |
| 1197 // Reloading the page should not transfer processes. | 1197 // Reloading the blocked document should load about:blank and not transfer |
| 1198 NavigationHandleObserver observer(shell()->web_contents(), blocked_url); | 1198 // processes. |
| 1199 GURL about_blank_url(url::kAboutBlankURL); |
| 1200 NavigationHandleObserver observer(shell()->web_contents(), about_blank_url); |
| 1199 TestNavigationObserver navigation_observer(shell()->web_contents(), 1); | 1201 TestNavigationObserver navigation_observer(shell()->web_contents(), 1); |
| 1200 | 1202 |
| 1201 shell()->Reload(); | 1203 shell()->Reload(); |
| 1202 navigation_observer.Wait(); | 1204 navigation_observer.Wait(); |
| 1203 EXPECT_TRUE(observer.has_committed()); | 1205 EXPECT_TRUE(observer.has_committed()); |
| 1204 EXPECT_TRUE(observer.is_error()); | 1206 EXPECT_FALSE(observer.is_error()); |
| 1205 EXPECT_EQ(site_instance, | 1207 EXPECT_EQ(site_instance, |
| 1206 shell()->web_contents()->GetMainFrame()->GetSiteInstance()); | 1208 shell()->web_contents()->GetMainFrame()->GetSiteInstance()); |
| 1207 } | 1209 } |
| 1208 | 1210 |
| 1209 installer.reset(); | 1211 installer.reset(); |
| 1210 | 1212 |
| 1211 { | 1213 { |
| 1212 // With the throttle uninstalled, going back should return to |start_url| in | 1214 // With the throttle uninstalled, going back should return to |start_url| in |
| 1213 // the same process, and clear the error page. | 1215 // the same process, and clear the error page. |
| 1214 NavigationHandleObserver observer(shell()->web_contents(), start_url); | 1216 NavigationHandleObserver observer(shell()->web_contents(), start_url); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 NavigationHandleObserver observer(shell()->web_contents(), error_url); | 1272 NavigationHandleObserver observer(shell()->web_contents(), error_url); |
| 1271 EXPECT_FALSE(NavigateToURL(shell(), error_url)); | 1273 EXPECT_FALSE(NavigateToURL(shell(), error_url)); |
| 1272 EXPECT_TRUE(observer.has_committed()); | 1274 EXPECT_TRUE(observer.has_committed()); |
| 1273 EXPECT_TRUE(observer.is_error()); | 1275 EXPECT_TRUE(observer.is_error()); |
| 1274 EXPECT_NE(site_instance, | 1276 EXPECT_NE(site_instance, |
| 1275 shell()->web_contents()->GetMainFrame()->GetSiteInstance()); | 1277 shell()->web_contents()->GetMainFrame()->GetSiteInstance()); |
| 1276 } | 1278 } |
| 1277 } | 1279 } |
| 1278 | 1280 |
| 1279 } // namespace content | 1281 } // namespace content |
| OLD | NEW |