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

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

Issue 1949213002: Don't update subframes on parent frame commits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 3484 matching lines...) Expand 10 before | Expand all | Expand 10 after
3495 } 3495 }
3496 3496
3497 // Make sure the renderer is still alive. 3497 // Make sure the renderer is still alive.
3498 EXPECT_TRUE( 3498 EXPECT_TRUE(
3499 ExecuteScript(shell()->web_contents(), "console.log('Success');")); 3499 ExecuteScript(shell()->web_contents(), "console.log('Success');"));
3500 } 3500 }
3501 3501
3502 // This tests that 1) the initial "about:blank" URL is elided from the 3502 // This tests that 1) the initial "about:blank" URL is elided from the
3503 // navigation history of a subframe when it is loaded, and 2) that that initial 3503 // navigation history of a subframe when it is loaded, and 2) that that initial
3504 // "about:blank" returns if it is navigated to as part of a history navigation. 3504 // "about:blank" returns if it is navigated to as part of a history navigation.
3505 // See http://crbug.com/542299 and https://github.com/whatwg/html/issues/546 . 3505 // See http://crbug.com/542299 and https://github.com/whatwg/html/issues/546 .
Charlie Reis 2016/05/05 17:45:42 // TODO(avi, creis): Find another fix for the NC_I
Avi (use Gerrit) 2016/05/05 19:06:21 Done.
3506 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, 3506 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
3507 BackToAboutBlankIframe) { 3507 BackToAboutBlankIframe) {
3508 GURL original_url(embedded_test_server()->GetURL( 3508 GURL original_url(embedded_test_server()->GetURL(
3509 "/navigation_controller/simple_page_1.html")); 3509 "/navigation_controller/simple_page_1.html"));
3510 NavigateToURL(shell(), original_url); 3510 NavigateToURL(shell(), original_url);
3511 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); 3511 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
3512 3512
3513 NavigationController& controller = shell()->web_contents()->GetController(); 3513 NavigationController& controller = shell()->web_contents()->GetController();
3514 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) 3514 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
3515 ->GetFrameTree() 3515 ->GetFrameTree()
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3555 "/navigation_controller/simple_page_2.html"); 3555 "/navigation_controller/simple_page_2.html");
3556 NavigateFrameToURL(frame, frame_url); 3556 NavigateFrameToURL(frame, frame_url);
3557 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); 3557 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
3558 3558
3559 EXPECT_EQ(2, controller.GetEntryCount()); 3559 EXPECT_EQ(2, controller.GetEntryCount());
3560 EXPECT_EQ(2, RendererHistoryLength(shell())); 3560 EXPECT_EQ(2, RendererHistoryLength(shell()));
3561 EXPECT_EQ(1, controller.GetLastCommittedEntryIndex()); 3561 EXPECT_EQ(1, controller.GetLastCommittedEntryIndex());
3562 3562
3563 EXPECT_EQ(frame_url, frame->current_url()); 3563 EXPECT_EQ(frame_url, frame->current_url());
3564 3564
3565 // At this point the rest of the test is inapplicable. The bug that it tests
3566 // to be gone had to be reintroduced.
Charlie Reis 2016/05/05 17:45:42 Can you clarify that the code below repros a NC_IN
Avi (use Gerrit) 2016/05/05 19:06:21 It does not. This browsertest tested the basic fu
Charlie Reis 2016/05/05 19:34:22 Oh! I must have misunderstood when reviewing the
Avi (use Gerrit) 2016/05/05 19:52:15 Yep.
3567 //
3568 // See the discussion in NavigationControllerImpl::FindFramesToNavigate for
3569 // more information.
3570 return;
Charlie Reis 2016/05/05 17:45:42 nit: No need for return or the blank line below, g
Avi (use Gerrit) 2016/05/05 19:06:21 Done.
3571
3572 #if 0
3565 // Go back. Because the old state had an empty frame, that should be restored 3573 // Go back. Because the old state had an empty frame, that should be restored
3566 // even though it was replaced in the second navigation entry. 3574 // even though it was replaced in the second navigation entry.
3567 3575
3568 TestFrameNavigationObserver observer(frame); 3576 TestFrameNavigationObserver observer(frame);
3569 ASSERT_TRUE(controller.CanGoBack()); 3577 ASSERT_TRUE(controller.CanGoBack());
3570 controller.GoBack(); 3578 controller.GoBack();
3571 observer.Wait(); 3579 observer.Wait();
3572 3580
3573 EXPECT_EQ(2, controller.GetEntryCount()); 3581 EXPECT_EQ(2, controller.GetEntryCount());
3574 EXPECT_EQ(2, RendererHistoryLength(shell())); 3582 EXPECT_EQ(2, RendererHistoryLength(shell()));
3575 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); 3583 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex());
3576 3584
3577 EXPECT_EQ(GURL(url::kAboutBlankURL), frame->current_url()); 3585 EXPECT_EQ(GURL(url::kAboutBlankURL), frame->current_url());
3586 #endif
3578 } 3587 }
3579 3588
3580 // This test is similar to "BackToAboutBlankIframe" above, except that a 3589 // This test is similar to "BackToAboutBlankIframe" above, except that a
3581 // fragment navigation is used rather than pushState (both create an in-page 3590 // fragment navigation is used rather than pushState (both create an in-page
3582 // navigation, so we need to test both), and an initial 'src' is given to the 3591 // navigation, so we need to test both), and an initial 'src' is given to the
3583 // iframe to test proper restoration in that case. 3592 // iframe to test proper restoration in that case.
3584 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, 3593 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
3585 BackToIframeWithContent) { 3594 BackToIframeWithContent) {
3586 GURL links_url(embedded_test_server()->GetURL( 3595 GURL links_url(embedded_test_server()->GetURL(
3587 "/navigation_controller/page_with_links.html")); 3596 "/navigation_controller/page_with_links.html"));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
3638 "/navigation_controller/simple_page_2.html"); 3647 "/navigation_controller/simple_page_2.html");
3639 NavigateFrameToURL(frame, frame_url_2); 3648 NavigateFrameToURL(frame, frame_url_2);
3640 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); 3649 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
3641 3650
3642 EXPECT_EQ(3, controller.GetEntryCount()); 3651 EXPECT_EQ(3, controller.GetEntryCount());
3643 EXPECT_EQ(3, RendererHistoryLength(shell())); 3652 EXPECT_EQ(3, RendererHistoryLength(shell()));
3644 EXPECT_EQ(2, controller.GetLastCommittedEntryIndex()); 3653 EXPECT_EQ(2, controller.GetLastCommittedEntryIndex());
3645 3654
3646 EXPECT_EQ(frame_url_2, frame->current_url()); 3655 EXPECT_EQ(frame_url_2, frame->current_url());
3647 3656
3657 // At this point the rest of the test is inapplicable. The bug that it tests
3658 // to be gone had to be reintroduced.
3659 //
3660 // See the discussion in NavigationControllerImpl::FindFramesToNavigate for
3661 // more information.
3662 return;
3663
Charlie Reis 2016/05/05 17:45:42 Same nits.
Avi (use Gerrit) 2016/05/05 19:06:21 Done.
3664 #if 0
3648 // Go back two entries. The original frame URL should be back. 3665 // Go back two entries. The original frame URL should be back.
3649 3666
3650 TestFrameNavigationObserver observer(frame); 3667 TestFrameNavigationObserver observer(frame);
3651 ASSERT_TRUE(controller.CanGoToOffset(-2)); 3668 ASSERT_TRUE(controller.CanGoToOffset(-2));
3652 controller.GoToOffset(-2); 3669 controller.GoToOffset(-2);
3653 observer.Wait(); 3670 observer.Wait();
3654 3671
3655 EXPECT_EQ(3, controller.GetEntryCount()); 3672 EXPECT_EQ(3, controller.GetEntryCount());
3656 EXPECT_EQ(3, RendererHistoryLength(shell())); 3673 EXPECT_EQ(3, RendererHistoryLength(shell()));
3657 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); 3674 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex());
3658 3675
3659 EXPECT_EQ(frame_url_1, frame->current_url()); 3676 EXPECT_EQ(frame_url_1, frame->current_url());
3677 #endif
3660 } 3678 }
3661 3679
3662 // Ensure that we do not corrupt a NavigationEntry's PageState if a subframe 3680 // Ensure that we do not corrupt a NavigationEntry's PageState if a subframe
3663 // forward navigation commits after we've already started another forward 3681 // forward navigation commits after we've already started another forward
3664 // navigation in the main frame. See https://crbug.com/597322. 3682 // navigation in the main frame. See https://crbug.com/597322.
3665 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, 3683 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
3666 ForwardInSubframeWithPendingForward) { 3684 ForwardInSubframeWithPendingForward) {
3667 // Navigate to a page with an iframe. 3685 // Navigate to a page with an iframe.
3668 GURL url_a(embedded_test_server()->GetURL( 3686 GURL url_a(embedded_test_server()->GetURL(
3669 "/navigation_controller/page_with_data_iframe.html")); 3687 "/navigation_controller/page_with_data_iframe.html"));
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
3857 // TODO(clamy): Check the post id as well when PlzNavigate handles it 3875 // TODO(clamy): Check the post id as well when PlzNavigate handles it
3858 // properly. 3876 // properly.
3859 if (!IsBrowserSideNavigationEnabled()) 3877 if (!IsBrowserSideNavigationEnabled())
3860 EXPECT_NE(-1, frame_entry->post_id()); 3878 EXPECT_NE(-1, frame_entry->post_id());
3861 EXPECT_FALSE(entry->GetHasPostData()); 3879 EXPECT_FALSE(entry->GetHasPostData());
3862 EXPECT_EQ(-1, entry->GetPostID()); 3880 EXPECT_EQ(-1, entry->GetPostID());
3863 } 3881 }
3864 } 3882 }
3865 3883
3866 } // namespace content 3884 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698