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

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

Issue 2239413002: Don't mark a history navigation as in page in a new renderer process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 3720 matching lines...) Expand 10 before | Expand all | Expand 10 after
3731 } 3731 }
3732 3732
3733 // Go back. 3733 // Go back.
3734 { 3734 {
3735 TestNavigationObserver back_load_observer(new_tab.get()); 3735 TestNavigationObserver back_load_observer(new_tab.get());
3736 new_controller.GoBack(); 3736 new_controller.GoBack();
3737 back_load_observer.Wait(); 3737 back_load_observer.Wait();
3738 } 3738 }
3739 } 3739 }
3740 3740
3741 // Ensure that going back/forward to an apparently in-page NavigationEntry works
3742 // when the renderer process hasn't committed anything yet. This can happen
3743 // when using Ctrl+Back or after a crash. See https://crbug.com/635403.
3744 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
3745 BackInPageInNewWindow) {
3746 // Start on an initial page.
3747 GURL url_1(embedded_test_server()->GetURL(
3748 "/navigation_controller/simple_page_1.html"));
3749 EXPECT_TRUE(NavigateToURL(shell(), url_1));
3750
3751 // Navigate it in-page.
3752 GURL url_2(embedded_test_server()->GetURL(
3753 "/navigation_controller/simple_page_1.html#foo"));
3754 EXPECT_TRUE(NavigateToURL(shell(), url_2));
3755
3756 // Clone the tab but don't load last committed page.
3757 std::unique_ptr<WebContentsImpl> new_tab(
3758 static_cast<WebContentsImpl*>(shell()->web_contents()->Clone()));
3759 NavigationController& new_controller = new_tab->GetController();
3760 EXPECT_TRUE(new_controller.IsInitialNavigation());
3761 EXPECT_TRUE(new_controller.NeedsReload());
3762
3763 // Go back in the new tab.
3764 {
3765 TestNavigationObserver back_load_observer(new_tab.get());
3766 new_controller.GoBack();
3767 back_load_observer.Wait();
3768 }
3769
3770 // Make sure the new tab isn't still loading.
3771 EXPECT_EQ(url_1, new_controller.GetLastCommittedEntry()->GetURL());
3772 EXPECT_FALSE(new_tab->IsLoading());
3773
3774 // Also check going back in the original tab after a renderer crash.
3775 NavigationController& controller = shell()->web_contents()->GetController();
3776 RenderProcessHost* process = shell()->web_contents()->GetRenderProcessHost();
3777 RenderProcessHostWatcher crash_observer(
3778 process, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
3779 process->Shutdown(0, false);
3780 crash_observer.Wait();
3781 {
3782 TestNavigationObserver back_load_observer(shell()->web_contents());
3783 controller.GoBack();
3784 back_load_observer.Wait();
3785 }
3786
3787 // Make sure the original tab isn't still loading.
3788 EXPECT_EQ(url_1, controller.GetLastCommittedEntry()->GetURL());
3789 EXPECT_FALSE(shell()->web_contents()->IsLoading());
3790 }
3791
3741 // Ensures that FrameNavigationEntries for dynamically added iframes can be 3792 // Ensures that FrameNavigationEntries for dynamically added iframes can be
3742 // found correctly when cloning them during a transfer. If we don't look for 3793 // found correctly when cloning them during a transfer. If we don't look for
3743 // them based on unique name in AddOrUpdateFrameEntry, the FrameTreeNode ID 3794 // them based on unique name in AddOrUpdateFrameEntry, the FrameTreeNode ID
3744 // mismatch will cause us to create a second FrameNavigationEntry during the 3795 // mismatch will cause us to create a second FrameNavigationEntry during the
3745 // transfer. Later, we'll find the wrong FrameNavigationEntry (the earlier one 3796 // transfer. Later, we'll find the wrong FrameNavigationEntry (the earlier one
3746 // from the clone which still has a PageState), and this will cause the renderer 3797 // from the clone which still has a PageState), and this will cause the renderer
3747 // to crash in NavigateInternal because the PageState is present but the page_id 3798 // to crash in NavigateInternal because the PageState is present but the page_id
3748 // is -1 (similar to https://crbug.com/568703). See https://crbug.com/568768. 3799 // is -1 (similar to https://crbug.com/568703). See https://crbug.com/568768.
3749 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, 3800 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
3750 FrameNavigationEntry_RepeatCreatedFrame) { 3801 FrameNavigationEntry_RepeatCreatedFrame) {
(...skipping 1951 matching lines...) Expand 10 before | Expand all | Expand 10 after
5702 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { 5753 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) {
5703 EXPECT_EQ(1U, nav_entry->root_node()->children.size()); 5754 EXPECT_EQ(1U, nav_entry->root_node()->children.size());
5704 EXPECT_EQ(tree_node, nav_entry->root_node()->children[0]); 5755 EXPECT_EQ(tree_node, nav_entry->root_node()->children[0]);
5705 } 5756 }
5706 5757
5707 EXPECT_TRUE(ExecuteScript(root, kRemoveFrameScript)); 5758 EXPECT_TRUE(ExecuteScript(root, kRemoveFrameScript));
5708 EXPECT_EQ(0U, root->child_count()); 5759 EXPECT_EQ(0U, root->child_count());
5709 } 5760 }
5710 5761
5711 } // namespace content 5762 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl.cc ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698