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

Unified Diff: content/browser/frame_host/navigation_controller_impl_unittest.cc

Issue 1082083002: Fix ClassifyNavigation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/navigation_controller_impl_unittest.cc
diff --git a/content/browser/frame_host/navigation_controller_impl_unittest.cc b/content/browser/frame_host/navigation_controller_impl_unittest.cc
index c1fce3c30fec4e115e8f926bf45b66b0ef7033ca..03d9d065af5be512cef1d6473a5d8c03d9274009 100644
--- a/content/browser/frame_host/navigation_controller_impl_unittest.cc
+++ b/content/browser/frame_host/navigation_controller_impl_unittest.cc
@@ -1758,7 +1758,7 @@ TEST_F(NavigationControllerTest, Forward_GeneratesNewPage) {
EXPECT_FALSE(controller.CanGoForward());
}
-// Two consequent navigation for the same URL entered in should be considered
+// Two consecutive navigations for the same URL entered in should be considered
// as SAME_PAGE navigation even when we are redirected to some other page.
TEST_F(NavigationControllerTest, Redirect) {
NavigationControllerImpl& controller = controller_impl();
@@ -1768,22 +1768,11 @@ TEST_F(NavigationControllerTest, Redirect) {
const GURL url1("http://foo1");
const GURL url2("http://foo2"); // Redirection target
- // First request
+ // First request.
controller.LoadURL(
url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
EXPECT_EQ(0U, notifications.size());
- main_test_rfh()->SendNavigate(0, url2);
- EXPECT_EQ(1U, navigation_entry_committed_counter_);
- navigation_entry_committed_counter_ = 0;
-
- // Second request
- controller.LoadURL(
- url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
-
- EXPECT_TRUE(controller.GetPendingEntry());
- EXPECT_EQ(controller.GetPendingEntryIndex(), -1);
- EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL());
FrameHostMsg_DidCommitProvisionalLoad_Params params;
params.page_id = 0;
@@ -1798,6 +1787,18 @@ TEST_F(NavigationControllerTest, Redirect) {
LoadCommittedDetails details;
+ EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params,
+ &details));
+ EXPECT_EQ(1U, navigation_entry_committed_counter_);
+ navigation_entry_committed_counter_ = 0;
+
+ // Second request.
+ controller.LoadURL(
+ url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+
+ EXPECT_TRUE(controller.GetPendingEntry());
+ EXPECT_EQ(controller.GetPendingEntryIndex(), -1);
+ EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL());
EXPECT_EQ(0U, notifications.size());
EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params,
&details));
@@ -1827,23 +1828,12 @@ TEST_F(NavigationControllerTest, PostThenRedirect) {
const GURL url1("http://foo1");
const GURL url2("http://foo2"); // Redirection target
- // First request as POST
+ // First request as POST.
controller.LoadURL(
url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
controller.GetVisibleEntry()->SetHasPostData(true);
EXPECT_EQ(0U, notifications.size());
- main_test_rfh()->SendNavigate(0, url2);
- EXPECT_EQ(1U, navigation_entry_committed_counter_);
- navigation_entry_committed_counter_ = 0;
-
- // Second request
- controller.LoadURL(
- url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
-
- EXPECT_TRUE(controller.GetPendingEntry());
- EXPECT_EQ(controller.GetPendingEntryIndex(), -1);
- EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL());
FrameHostMsg_DidCommitProvisionalLoad_Params params;
params.page_id = 0;
@@ -1853,11 +1843,26 @@ TEST_F(NavigationControllerTest, PostThenRedirect) {
params.redirects.push_back(GURL("http://foo2"));
params.should_update_history = false;
params.gesture = NavigationGestureAuto;
- params.is_post = false;
+ params.is_post = true;
params.page_state = PageState::CreateFromURL(url2);
LoadCommittedDetails details;
+ EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params,
+ &details));
+ EXPECT_EQ(1U, navigation_entry_committed_counter_);
+ navigation_entry_committed_counter_ = 0;
+
+ // Second request.
+ controller.LoadURL(
+ url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
+
+ EXPECT_TRUE(controller.GetPendingEntry());
+ EXPECT_EQ(controller.GetPendingEntryIndex(), -1);
+ EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL());
+
+ params.is_post = false;
+
EXPECT_EQ(0U, notifications.size());
EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params,
&details));
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698