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

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

Issue 2541513004: Ensure scrollToFragmentAnchor called before restoreScrollPositionAndViewState. (Closed)
Patch Set: bokan@ comments addressed Created 4 years 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
OLDNEW
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 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 GURL frame_url(embedded_test_server()->GetURL( 1329 GURL frame_url(embedded_test_server()->GetURL(
1330 "/navigation_controller/simple_page_1.html")); 1330 "/navigation_controller/simple_page_1.html"));
1331 NavigateFrameToURL(root, frame_url); 1331 NavigateFrameToURL(root, frame_url);
1332 capturer.Wait(); 1332 capturer.Wait();
1333 EXPECT_TRUE(ui::PageTransitionTypeIncludingQualifiersIs( 1333 EXPECT_TRUE(ui::PageTransitionTypeIncludingQualifiersIs(
1334 capturer.params().transition, ui::PAGE_TRANSITION_LINK)); 1334 capturer.params().transition, ui::PAGE_TRANSITION_LINK));
1335 EXPECT_EQ(NAVIGATION_TYPE_SAME_PAGE, capturer.details().type); 1335 EXPECT_EQ(NAVIGATION_TYPE_SAME_PAGE, capturer.details().type);
1336 } 1336 }
1337 } 1337 }
1338 1338
1339 // Verify that reload page with url anchor scroll to correct position.
Charlie Reis 2016/12/05 18:54:15 nit: s/reload/reloading a/ nit: s/scroll/scrolls/
1340 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, ReloadWithUrlAnchor) {
1341 GURL url1(embedded_test_server()->GetURL(
1342 "/navigation_controller/reload-with-url-anchor.html#d2"));
1343 EXPECT_TRUE(NavigateToURL(shell(), url1));
1344
1345 std::string script =
1346 "domAutomationController.send(document.getElementById('div').scrollTop)";
1347 int value = 0;
1348 EXPECT_TRUE(ExecuteScriptAndExtractInt(shell(), script, &value));
1349 EXPECT_EQ(100, value);
1350
1351 // reload
Charlie Reis 2016/12/05 18:54:15 Minor nit: Capitalize and end with period.
1352 ReloadBlockUntilNavigationsComplete(shell(), 1);
1353
1354 EXPECT_TRUE(ExecuteScriptAndExtractInt(shell(), script, &value));
1355 EXPECT_EQ(100, value);
1356 }
1357
1339 // Verify that empty GURL navigations are not classified as SAME_PAGE. 1358 // Verify that empty GURL navigations are not classified as SAME_PAGE.
1340 // See https://crbug.com/534980. 1359 // See https://crbug.com/534980.
1341 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, 1360 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
1342 NavigationTypeClassification_EmptyGURL) { 1361 NavigationTypeClassification_EmptyGURL) {
1343 GURL url1(embedded_test_server()->GetURL( 1362 GURL url1(embedded_test_server()->GetURL(
1344 "/navigation_controller/simple_page_1.html")); 1363 "/navigation_controller/simple_page_1.html"));
1345 EXPECT_TRUE(NavigateToURL(shell(), url1)); 1364 EXPECT_TRUE(NavigateToURL(shell(), url1));
1346 1365
1347 FrameTreeNode* root = 1366 FrameTreeNode* root =
1348 static_cast<WebContentsImpl*>(shell()->web_contents())-> 1367 static_cast<WebContentsImpl*>(shell()->web_contents())->
(...skipping 5673 matching lines...) Expand 10 before | Expand all | Expand 10 after
7022 NavigationHandleCommitObserver handle_observer(shell()->web_contents(), 7041 NavigationHandleCommitObserver handle_observer(shell()->web_contents(),
7023 kFragmentURL); 7042 kFragmentURL);
7024 EXPECT_TRUE(NavigateToURL(shell(), kFragmentURL)); 7043 EXPECT_TRUE(NavigateToURL(shell(), kFragmentURL));
7025 7044
7026 EXPECT_TRUE(handle_observer.has_committed()); 7045 EXPECT_TRUE(handle_observer.has_committed());
7027 EXPECT_TRUE(handle_observer.was_same_page()); 7046 EXPECT_TRUE(handle_observer.was_same_page());
7028 EXPECT_FALSE(handle_observer.was_renderer_initiated()); 7047 EXPECT_FALSE(handle_observer.was_renderer_initiated());
7029 } 7048 }
7030 7049
7031 } // namespace content 7050 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698