OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 controller.LoadURL( | 976 controller.LoadURL( |
977 kNewURL, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); | 977 kNewURL, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
978 EXPECT_EQ(0U, notifications.size()); | 978 EXPECT_EQ(0U, notifications.size()); |
979 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); | 979 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); |
980 EXPECT_TRUE(controller.GetPendingEntry()); | 980 EXPECT_TRUE(controller.GetPendingEntry()); |
981 EXPECT_EQ(-1, controller.GetLastCommittedEntryIndex()); | 981 EXPECT_EQ(-1, controller.GetLastCommittedEntryIndex()); |
982 EXPECT_EQ(1, delegate->navigation_state_change_count()); | 982 EXPECT_EQ(1, delegate->navigation_state_change_count()); |
983 | 983 |
984 // Before that commits, a document.write and location.reload can cause the | 984 // Before that commits, a document.write and location.reload can cause the |
985 // renderer to send a FrameNavigate with page_id -1. | 985 // renderer to send a FrameNavigate with page_id -1. |
| 986 // PlzNavigate: this will stop the old navigation and start a new one. |
986 main_test_rfh()->SendRendererInitiatedNavigationRequest(kExistingURL, true); | 987 main_test_rfh()->SendRendererInitiatedNavigationRequest(kExistingURL, true); |
987 main_test_rfh()->PrepareForCommit(); | 988 main_test_rfh()->PrepareForCommit(); |
988 main_test_rfh()->SendNavigate(-1, kExistingURL); | 989 main_test_rfh()->SendNavigate(-1, kExistingURL); |
989 | 990 |
990 // This should clear the pending entry and notify of a navigation state | 991 // This should clear the pending entry and notify of a navigation state |
991 // change, so that we do not keep displaying kNewURL. | 992 // change, so that we do not keep displaying kNewURL. |
992 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); | 993 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); |
993 EXPECT_FALSE(controller.GetPendingEntry()); | 994 EXPECT_FALSE(controller.GetPendingEntry()); |
994 EXPECT_EQ(-1, controller.GetLastCommittedEntryIndex()); | 995 EXPECT_EQ(-1, controller.GetLastCommittedEntryIndex()); |
995 EXPECT_EQ(2, delegate->navigation_state_change_count()); | 996 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 997 switches::kEnableBrowserSideNavigation)) |
| 998 EXPECT_EQ(4, delegate->navigation_state_change_count()); |
| 999 else |
| 1000 EXPECT_EQ(2, delegate->navigation_state_change_count()); |
996 | 1001 |
997 contents()->SetDelegate(NULL); | 1002 contents()->SetDelegate(NULL); |
998 } | 1003 } |
999 | 1004 |
1000 // Tests that the pending entry state is correct after an abort. | 1005 // Tests that the pending entry state is correct after an abort. |
1001 // We do not want to clear the pending entry, so that the user doesn't | 1006 // We do not want to clear the pending entry, so that the user doesn't |
1002 // lose a typed URL. (See http://crbug.com/9682.) | 1007 // lose a typed URL. (See http://crbug.com/9682.) |
1003 TEST_F(NavigationControllerTest, LoadURL_AbortDoesntCancelPending) { | 1008 TEST_F(NavigationControllerTest, LoadURL_AbortDoesntCancelPending) { |
1004 NavigationControllerImpl& controller = controller_impl(); | 1009 NavigationControllerImpl& controller = controller_impl(); |
1005 TestNotificationTracker notifications; | 1010 TestNotificationTracker notifications; |
(...skipping 3613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4619 { | 4624 { |
4620 LoadCommittedDetails details; | 4625 LoadCommittedDetails details; |
4621 controller_impl().RendererDidNavigate(main_test_rfh(), params, &details); | 4626 controller_impl().RendererDidNavigate(main_test_rfh(), params, &details); |
4622 EXPECT_EQ(PAGE_TYPE_ERROR, | 4627 EXPECT_EQ(PAGE_TYPE_ERROR, |
4623 controller_impl().GetLastCommittedEntry()->GetPageType()); | 4628 controller_impl().GetLastCommittedEntry()->GetPageType()); |
4624 EXPECT_EQ(NAVIGATION_TYPE_IN_PAGE, details.type); | 4629 EXPECT_EQ(NAVIGATION_TYPE_IN_PAGE, details.type); |
4625 } | 4630 } |
4626 } | 4631 } |
4627 | 4632 |
4628 } // namespace content | 4633 } // namespace content |
OLD | NEW |