Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: content/browser/frame_host/navigation_controller_impl_unittest.cc

Issue 1108283002: PlzNavigate: Call DidStartLoading and DidStopLoading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Commentses. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/frame_host/frame_tree_node.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/browser/frame_host/frame_tree_node.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698