OLD | NEW |
---|---|
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 4960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4971 // Verify the process is still alive by running script. We can't just call | 4971 // Verify the process is still alive by running script. We can't just call |
4972 // IsRenderFrameLive after the navigation since it might not have disconnected | 4972 // IsRenderFrameLive after the navigation since it might not have disconnected |
4973 // yet. | 4973 // yet. |
4974 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), "true;")); | 4974 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), "true;")); |
4975 EXPECT_TRUE(root->current_frame_host()->IsRenderFrameLive()); | 4975 EXPECT_TRUE(root->current_frame_host()->IsRenderFrameLive()); |
4976 | 4976 |
4977 // TODO(creis): We should probably go back to frame_url here instead of the | 4977 // TODO(creis): We should probably go back to frame_url here instead of the |
4978 // initial blank page. That might require updating all relevant NavEntries to | 4978 // initial blank page. That might require updating all relevant NavEntries to |
4979 // know what the first committed URL is, so that we really elide the initial | 4979 // know what the first committed URL is, so that we really elide the initial |
4980 // blank page from history. | 4980 // blank page from history. |
4981 // | 4981 EXPECT_EQ(blank_url, frame->current_url()); |
4982 // TODO(creis): This actually goes to frame_url in some cases when subframe | |
4983 // FrameNavigationEntries are enabled, due to a mismatch between PageState and | |
4984 // the entry's URL. That should be fixed in https://crbug.com/617239. | |
4985 if (!SiteIsolationPolicy::UseSubframeNavigationEntries()) | |
4986 EXPECT_EQ(blank_url, frame->current_url()); | |
4987 } | 4982 } |
4988 | 4983 |
4989 // This test is similar to "BackToAboutBlankIframe" above, except that a | 4984 // This test is similar to "BackToAboutBlankIframe" above, except that a |
4990 // fragment navigation is used rather than pushState (both create an in-page | 4985 // fragment navigation is used rather than pushState (both create an in-page |
4991 // navigation, so we need to test both), and an initial 'src' is given to the | 4986 // navigation, so we need to test both), and an initial 'src' is given to the |
4992 // iframe to test proper restoration in that case. | 4987 // iframe to test proper restoration in that case. |
4993 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, | 4988 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
4994 BackToIframeWithContent) { | 4989 BackToIframeWithContent) { |
4995 GURL links_url(embedded_test_server()->GetURL( | 4990 GURL links_url(embedded_test_server()->GetURL( |
4996 "/navigation_controller/page_with_links.html")); | 4991 "/navigation_controller/page_with_links.html")); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5097 | 5092 |
5098 // Verify the process is still alive by running script. We can't just call | 5093 // Verify the process is still alive by running script. We can't just call |
5099 // IsRenderFrameLive after the navigation since it might not have disconnected | 5094 // IsRenderFrameLive after the navigation since it might not have disconnected |
5100 // yet. | 5095 // yet. |
5101 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), "true;")); | 5096 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), "true;")); |
5102 EXPECT_TRUE(root->current_frame_host()->IsRenderFrameLive()); | 5097 EXPECT_TRUE(root->current_frame_host()->IsRenderFrameLive()); |
5103 | 5098 |
5104 // TODO(creis): It's a bit surprising to go to frame_url_1 here instead of | 5099 // TODO(creis): It's a bit surprising to go to frame_url_1 here instead of |
5105 // frame_url_2. Perhaps we should be going back to frame_url_1 when going | 5100 // frame_url_2. Perhaps we should be going back to frame_url_1 when going |
5106 // back two entries above, since it's different than the initial blank case. | 5101 // back two entries above, since it's different than the initial blank case. |
5107 // | 5102 EXPECT_EQ(frame_url_1, frame->current_url()); |
5108 // TODO(creis): This actually goes to frame_url_2 in some cases when subframe | |
5109 // FrameNavigationEntries are enabled, due to a mismatch between PageState and | |
5110 // the entry's URL. That should be fixed in https://crbug.com/617239. | |
5111 if (!SiteIsolationPolicy::UseSubframeNavigationEntries()) | |
5112 EXPECT_EQ(frame_url_1, frame->current_url()); | |
5113 } | 5103 } |
5114 | 5104 |
5115 // Test for in-page navigation kills due to using the wrong history item in | 5105 // Test for in-page navigation kills due to using the wrong history item in |
5116 // HistoryController::RecursiveGoToEntry and NavigationControllerImpl:: | 5106 // HistoryController::RecursiveGoToEntry and NavigationControllerImpl:: |
5117 // FindFramesToNavigate. See https://crbug.com/612713. | 5107 // FindFramesToNavigate. See https://crbug.com/612713. |
5118 // | 5108 // |
5119 // TODO(creis): Enable this test when https://crbug.com/618100 is fixed. | 5109 // TODO(creis): Enable this test when https://crbug.com/618100 is fixed. |
5120 // Disabled for now while we switch to the new navigation path, since this kill | 5110 // Disabled for now while we switch to the new navigation path, since this kill |
5121 // is exceptionally rare in practice. | 5111 // is exceptionally rare in practice. |
5122 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, | 5112 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
5123 DISABLED_BackTwiceToIframeWithContent) { | 5113 DISABLED_BackTwiceToIframeWithContent) { |
Charlie Reis
2017/01/05 18:18:05
I almost re-enabled this test, but there's still o
| |
5124 GURL links_url(embedded_test_server()->GetURL( | 5114 GURL links_url(embedded_test_server()->GetURL( |
5125 "/navigation_controller/page_with_links.html")); | 5115 "/navigation_controller/page_with_links.html")); |
5126 EXPECT_TRUE(NavigateToURL(shell(), links_url)); | 5116 EXPECT_TRUE(NavigateToURL(shell(), links_url)); |
5127 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); | 5117 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); |
5128 | 5118 |
5129 NavigationController& controller = shell()->web_contents()->GetController(); | 5119 NavigationController& controller = shell()->web_contents()->GetController(); |
5130 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 5120 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) |
5131 ->GetFrameTree() | 5121 ->GetFrameTree() |
5132 ->root(); | 5122 ->root(); |
5133 | 5123 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5220 | 5210 |
5221 // Verify the process is still alive by running script. We can't just call | 5211 // Verify the process is still alive by running script. We can't just call |
5222 // IsRenderFrameLive after the navigation since it might not have disconnected | 5212 // IsRenderFrameLive after the navigation since it might not have disconnected |
5223 // yet. | 5213 // yet. |
5224 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), "true;")); | 5214 EXPECT_TRUE(ExecuteScript(root->current_frame_host(), "true;")); |
5225 EXPECT_TRUE(root->current_frame_host()->IsRenderFrameLive()); | 5215 EXPECT_TRUE(root->current_frame_host()->IsRenderFrameLive()); |
5226 | 5216 |
5227 // TODO(creis): It's a bit surprising to go to frame_url_1 here instead of | 5217 // TODO(creis): It's a bit surprising to go to frame_url_1 here instead of |
5228 // frame_url_2. Perhaps we should be going back to frame_url_1 when going | 5218 // frame_url_2. Perhaps we should be going back to frame_url_1 when going |
5229 // back two entries above, since it's different than the initial blank case. | 5219 // back two entries above, since it's different than the initial blank case. |
5230 // | 5220 EXPECT_EQ(frame_url_1, frame->current_url()); |
5231 // TODO(creis): This actually goes to frame_url_2 in some cases when subframe | |
5232 // FrameNavigationEntries are enabled, due to a mismatch between PageState and | |
5233 // the entry's URL. That should be fixed in https://crbug.com/617239. | |
5234 if (!SiteIsolationPolicy::UseSubframeNavigationEntries()) | |
5235 EXPECT_EQ(frame_url_1, frame->current_url()); | |
5236 } | 5221 } |
5237 | 5222 |
5238 // Test for in-page navigation kills when going back to about:blank after a | 5223 // Test for in-page navigation kills when going back to about:blank after a |
5239 // document.write. See https://crbug.com/446959. | 5224 // document.write. See https://crbug.com/446959. |
5240 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, | 5225 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
5241 BackAfterIframeDocumentWrite) { | 5226 BackAfterIframeDocumentWrite) { |
5242 GURL links_url(embedded_test_server()->GetURL( | 5227 GURL links_url(embedded_test_server()->GetURL( |
5243 "/navigation_controller/page_with_links.html")); | 5228 "/navigation_controller/page_with_links.html")); |
5244 EXPECT_TRUE(NavigateToURL(shell(), links_url)); | 5229 EXPECT_TRUE(NavigateToURL(shell(), links_url)); |
5245 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); | 5230 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); |
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6726 NavigationHandleCommitObserver handle_observer(shell()->web_contents(), | 6711 NavigationHandleCommitObserver handle_observer(shell()->web_contents(), |
6727 kFragmentURL); | 6712 kFragmentURL); |
6728 EXPECT_TRUE(NavigateToURL(shell(), kFragmentURL)); | 6713 EXPECT_TRUE(NavigateToURL(shell(), kFragmentURL)); |
6729 | 6714 |
6730 EXPECT_TRUE(handle_observer.has_committed()); | 6715 EXPECT_TRUE(handle_observer.has_committed()); |
6731 EXPECT_TRUE(handle_observer.was_same_page()); | 6716 EXPECT_TRUE(handle_observer.was_same_page()); |
6732 EXPECT_FALSE(handle_observer.was_renderer_initiated()); | 6717 EXPECT_FALSE(handle_observer.was_renderer_initiated()); |
6733 } | 6718 } |
6734 | 6719 |
6735 } // namespace content | 6720 } // namespace content |
OLD | NEW |