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/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 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 EXPECT_TRUE(NavigateToURL(shell(), url)); | 1300 EXPECT_TRUE(NavigateToURL(shell(), url)); |
1301 | 1301 |
1302 GURL redirect_url = embedded_test_server()->GetURL( | 1302 GURL redirect_url = embedded_test_server()->GetURL( |
1303 std::string("/server-redirect?") + kChromeUINetworkErrorsListingURL); | 1303 std::string("/server-redirect?") + kChromeUINetworkErrorsListingURL); |
1304 NavigationHandleObserver observer(shell()->web_contents(), redirect_url); | 1304 NavigationHandleObserver observer(shell()->web_contents(), redirect_url); |
1305 TestNavigationObserver same_tab_observer(shell()->web_contents(), 1); | 1305 TestNavigationObserver same_tab_observer(shell()->web_contents(), 1); |
1306 EXPECT_TRUE( | 1306 EXPECT_TRUE( |
1307 ExecuteScript(shell(), base::StringPrintf("location.href = '%s';", | 1307 ExecuteScript(shell(), base::StringPrintf("location.href = '%s';", |
1308 redirect_url.spec().c_str()))); | 1308 redirect_url.spec().c_str()))); |
1309 same_tab_observer.Wait(); | 1309 same_tab_observer.Wait(); |
1310 EXPECT_EQ(net::ERR_ABORTED, observer.net_error_code()); | 1310 EXPECT_EQ(net::ERR_UNSAFE_REDIRECT, observer.net_error_code()); |
1311 } | 1311 } |
1312 | 1312 |
1313 // This class allows running tests with PlzNavigate enabled, regardless of | 1313 // This class allows running tests with PlzNavigate enabled, regardless of |
1314 // default test configuration. | 1314 // default test configuration. |
1315 class PlzNavigateNavigationHandleImplBrowserTest : public ContentBrowserTest { | 1315 class PlzNavigateNavigationHandleImplBrowserTest : public ContentBrowserTest { |
1316 public: | 1316 public: |
1317 PlzNavigateNavigationHandleImplBrowserTest() {} | 1317 PlzNavigateNavigationHandleImplBrowserTest() {} |
1318 | 1318 |
1319 void SetUpCommandLine(base::CommandLine* command_line) override { | 1319 void SetUpCommandLine(base::CommandLine* command_line) override { |
1320 command_line->AppendSwitch(switches::kEnableBrowserSideNavigation); | 1320 command_line->AppendSwitch(switches::kEnableBrowserSideNavigation); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1480 EXPECT_TRUE(last_committed); | 1480 EXPECT_TRUE(last_committed); |
1481 EXPECT_EQ(blocked_url, last_committed->GetVirtualURL()); | 1481 EXPECT_EQ(blocked_url, last_committed->GetVirtualURL()); |
1482 EXPECT_EQ(PAGE_TYPE_ERROR, last_committed->GetPageType()); | 1482 EXPECT_EQ(PAGE_TYPE_ERROR, last_committed->GetPageType()); |
1483 EXPECT_NE(web_ui_process.get(), web_contents->GetSiteInstance()); | 1483 EXPECT_NE(web_ui_process.get(), web_contents->GetSiteInstance()); |
1484 EXPECT_TRUE(commit_observer.has_committed()); | 1484 EXPECT_TRUE(commit_observer.has_committed()); |
1485 EXPECT_TRUE(commit_observer.is_error()); | 1485 EXPECT_TRUE(commit_observer.is_error()); |
1486 EXPECT_FALSE(commit_observer.is_renderer_initiated()); | 1486 EXPECT_FALSE(commit_observer.is_renderer_initiated()); |
1487 } | 1487 } |
1488 | 1488 |
1489 } // namespace content | 1489 } // namespace content |
OLD | NEW |