| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/frame_host/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 6776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6787 EXPECT_EQ(1, controller.GetEntryCount()); | 6787 EXPECT_EQ(1, controller.GetEntryCount()); |
| 6788 | 6788 |
| 6789 // Do a 204 navigation. | 6789 // Do a 204 navigation. |
| 6790 EXPECT_FALSE(NavigateToURL(shell(), kURL204)); | 6790 EXPECT_FALSE(NavigateToURL(shell(), kURL204)); |
| 6791 | 6791 |
| 6792 entry = controller.GetLastCommittedEntry(); | 6792 entry = controller.GetLastCommittedEntry(); |
| 6793 EXPECT_EQ(kURL, entry->GetURL()); | 6793 EXPECT_EQ(kURL, entry->GetURL()); |
| 6794 EXPECT_EQ(1, controller.GetEntryCount()); | 6794 EXPECT_EQ(1, controller.GetEntryCount()); |
| 6795 } | 6795 } |
| 6796 | 6796 |
| 6797 // Tests that stopping a load clears the pending navigation entry. |
| 6798 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, StopDuringLoad) { |
| 6799 // Load an initial page since the behavior differs for the first entry. |
| 6800 GURL start_url(embedded_test_server()->GetURL( |
| 6801 "/navigation_controller/simple_page_1.html")); |
| 6802 EXPECT_TRUE(NavigateToURL(shell(), start_url)); |
| 6803 |
| 6804 TestNavigationObserver same_tab_observer(shell()->web_contents(), 1); |
| 6805 GURL slow_url = embedded_test_server()->GetURL("/slow?60"); |
| 6806 shell()->LoadURL(slow_url); |
| 6807 shell()->web_contents()->Stop(); |
| 6808 |
| 6809 // For non-PlzNavigate case, this happens asynchronously. |
| 6810 if (!IsBrowserSideNavigationEnabled()) |
| 6811 same_tab_observer.Wait(); |
| 6812 |
| 6813 const NavigationController& controller = |
| 6814 shell()->web_contents()->GetController(); |
| 6815 ASSERT_EQ(controller.GetPendingEntry(), nullptr); |
| 6816 } |
| 6817 |
| 6797 } // namespace content | 6818 } // namespace content |
| OLD | NEW |