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

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

Issue 2628683003: Add DidSaveScrollOrScaleState flag to prevent restoreScrollPositionAndViewState restore from default (Closed)
Patch Set: add dump file Created 3 years, 10 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 | « no previous file | content/common/page_state_serialization.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/navigation_controller_impl_browsertest.cc
diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
index 8ea87f7e0a15f2f913e0afa9dc61199e9f9d33e1..19689a701f4946043bfac6ef005e6ce89ddc32b6 100644
--- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc
+++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -1335,9 +1335,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
}
// Verify that reloading a page with url anchor scrolls to correct position.
-// Disabled due to flakiness: https://crbug.com/672545.
-IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
- DISABLED_ReloadWithUrlAnchor) {
+IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, ReloadWithUrlAnchor) {
GURL url1(embedded_test_server()->GetURL(
"/navigation_controller/reload-with-url-anchor.html#d2"));
EXPECT_TRUE(NavigateToURL(shell(), url1));
@@ -1355,6 +1353,41 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
EXPECT_EQ(100, value);
}
+// Verify that reloading a page with url anchor and scroll scrolls to correct
+// position.
+IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
+ ReloadWithUrlAnchorAndScroll) {
+ GURL url1(embedded_test_server()->GetURL(
+ "/navigation_controller/reload-with-url-anchor.html#d2"));
+ EXPECT_TRUE(NavigateToURL(shell(), url1));
+
+ std::string script_scroll_down = "window.scroll(0, 10)";
+ EXPECT_TRUE(ExecuteScript(shell(), script_scroll_down));
+
+ std::string get_div_scroll_top =
+ "domAutomationController.send(document.getElementById('div').scrollTop)";
+ std::string get_window_scroll_y =
+ "domAutomationController.send(window.scrollY)";
+ int div_scroll_top = 0;
+ int window_scroll_y = 0;
+ EXPECT_TRUE(
+ ExecuteScriptAndExtractInt(shell(), get_div_scroll_top, &div_scroll_top));
+ EXPECT_TRUE(ExecuteScriptAndExtractInt(shell(), get_window_scroll_y,
+ &window_scroll_y));
+ EXPECT_EQ(100, div_scroll_top);
+ EXPECT_EQ(10, window_scroll_y);
+
+ // Reload.
+ ReloadBlockUntilNavigationsComplete(shell(), 1);
+
+ EXPECT_TRUE(
+ ExecuteScriptAndExtractInt(shell(), get_div_scroll_top, &div_scroll_top));
+ EXPECT_TRUE(ExecuteScriptAndExtractInt(shell(), get_window_scroll_y,
+ &window_scroll_y));
+ EXPECT_EQ(100, div_scroll_top);
+ EXPECT_EQ(10, window_scroll_y);
+}
+
// Verify that empty GURL navigations are not classified as SAME_PAGE.
// See https://crbug.com/534980.
IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
« no previous file with comments | « no previous file | content/common/page_state_serialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698