| 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 6719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6730 // Do a browser-initiated fragment navigation. | 6730 // Do a browser-initiated fragment navigation. |
| 6731 NavigationHandleCommitObserver handle_observer(shell()->web_contents(), | 6731 NavigationHandleCommitObserver handle_observer(shell()->web_contents(), |
| 6732 kFragmentURL); | 6732 kFragmentURL); |
| 6733 EXPECT_TRUE(NavigateToURL(shell(), kFragmentURL)); | 6733 EXPECT_TRUE(NavigateToURL(shell(), kFragmentURL)); |
| 6734 | 6734 |
| 6735 EXPECT_TRUE(handle_observer.has_committed()); | 6735 EXPECT_TRUE(handle_observer.has_committed()); |
| 6736 EXPECT_TRUE(handle_observer.was_same_page()); | 6736 EXPECT_TRUE(handle_observer.was_same_page()); |
| 6737 EXPECT_FALSE(handle_observer.was_renderer_initiated()); | 6737 EXPECT_FALSE(handle_observer.was_renderer_initiated()); |
| 6738 } | 6738 } |
| 6739 | 6739 |
| 6740 // Tests that a 204 response to a browser-initiated navigation does not result |
| 6741 // in a new NavigationEntry being committed. |
| 6742 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
| 6743 204Navigation) { |
| 6744 const GURL kURL = embedded_test_server()->GetURL("/title1.html"); |
| 6745 const GURL kURL204 = embedded_test_server()->GetURL("/page204.html"); |
| 6746 |
| 6747 // Navigate to the initial page. |
| 6748 EXPECT_TRUE(NavigateToURL(shell(), kURL)); |
| 6749 |
| 6750 const NavigationControllerImpl& controller = |
| 6751 static_cast<const NavigationControllerImpl&>( |
| 6752 shell()->web_contents()->GetController()); |
| 6753 |
| 6754 NavigationEntryImpl* entry = controller.GetLastCommittedEntry(); |
| 6755 EXPECT_EQ(kURL, entry->GetURL()); |
| 6756 EXPECT_EQ(1, controller.GetEntryCount()); |
| 6757 |
| 6758 // Do a 204 navigation. |
| 6759 EXPECT_FALSE(NavigateToURL(shell(), kURL204)); |
| 6760 |
| 6761 entry = controller.GetLastCommittedEntry(); |
| 6762 EXPECT_EQ(kURL, entry->GetURL()); |
| 6763 EXPECT_EQ(1, controller.GetEntryCount()); |
| 6764 } |
| 6765 |
| 6740 } // namespace content | 6766 } // namespace content |
| OLD | NEW |