Chromium Code Reviews| 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 <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 4993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5004 NavigationEntry* entry = controller.GetEntryAtIndex(1); | 5004 NavigationEntry* entry = controller.GetEntryAtIndex(1); |
| 5005 EXPECT_EQ(url_a, entry->GetURL()); | 5005 EXPECT_EQ(url_a, entry->GetURL()); |
| 5006 ExplodedPageState exploded_state; | 5006 ExplodedPageState exploded_state; |
| 5007 EXPECT_TRUE( | 5007 EXPECT_TRUE( |
| 5008 DecodePageState(entry->GetPageState().ToEncodedData(), &exploded_state)); | 5008 DecodePageState(entry->GetPageState().ToEncodedData(), &exploded_state)); |
| 5009 EXPECT_EQ(url_a, GURL(exploded_state.top.url_string.string())); | 5009 EXPECT_EQ(url_a, GURL(exploded_state.top.url_string.string())); |
| 5010 EXPECT_EQ(frame_url_a2, | 5010 EXPECT_EQ(frame_url_a2, |
| 5011 GURL(exploded_state.top.children.at(0).url_string.string())); | 5011 GURL(exploded_state.top.children.at(0).url_string.string())); |
| 5012 } | 5012 } |
| 5013 | 5013 |
| 5014 // Start a provisional navigation, but abort it by going back before it commits | |
|
Charlie Reis
2016/07/28 18:22:29
nit: Missing period.
Charlie Harrison
2016/07/28 18:30:52
Done.
| |
| 5015 // In crbug.com/631617 there was an issue which cleared the | |
| 5016 // pending_navigation_params_ in RenderFrameImpl. This caused the abort-er | |
|
Charlie Reis
2016/07/28 18:22:29
nit: s/abort-er/interrupting/
Charlie Harrison
2016/07/28 18:30:52
Done.
| |
| 5017 // navigation to lose important navigation data like its nav_entry_id, which | |
| 5018 // could cause it to commit in-place instead of in the correct location in the | |
| 5019 // browsing history. | |
| 5020 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, | |
| 5021 AbortProvisionalLoadRetainsNavigationParams) { | |
| 5022 EXPECT_TRUE( | |
| 5023 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html"))); | |
| 5024 EXPECT_TRUE( | |
| 5025 NavigateToURL(shell(), embedded_test_server()->GetURL("/title2.html"))); | |
| 5026 | |
| 5027 shell()->LoadURL(embedded_test_server()->GetURL("/slow?30")); | |
|
Charlie Reis
2016/07/28 18:22:29
Can we use a TestNavigationManager here to pause a
Charlie Harrison
2016/07/28 18:30:52
Yupp. Done.
| |
| 5028 | |
| 5029 NavigationController& controller = shell()->web_contents()->GetController(); | |
| 5030 | |
| 5031 TestNavigationManager back_manager( | |
| 5032 shell()->web_contents(), embedded_test_server()->GetURL("/title1.html")); | |
| 5033 controller.GoBack(); | |
| 5034 back_manager.WaitForNavigationFinished(); | |
| 5035 | |
| 5036 EXPECT_TRUE(controller.CanGoForward()); | |
| 5037 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); | |
| 5038 } | |
| 5039 | |
| 5014 // Ensure that we do not corrupt a NavigationEntry's PageState if two forward | 5040 // Ensure that we do not corrupt a NavigationEntry's PageState if two forward |
| 5015 // navigations compete in different frames. See https://crbug.com/623319. | 5041 // navigations compete in different frames. See https://crbug.com/623319. |
| 5016 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, | 5042 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
| 5017 PageStateAfterForwardInCompetingFrames) { | 5043 PageStateAfterForwardInCompetingFrames) { |
| 5018 // Navigate to a page with an iframe. | 5044 // Navigate to a page with an iframe. |
| 5019 GURL url_a(embedded_test_server()->GetURL( | 5045 GURL url_a(embedded_test_server()->GetURL( |
| 5020 "/navigation_controller/page_with_data_iframe.html")); | 5046 "/navigation_controller/page_with_data_iframe.html")); |
| 5021 GURL frame_url_a1("data:text/html,Subframe"); | 5047 GURL frame_url_a1("data:text/html,Subframe"); |
| 5022 EXPECT_TRUE(NavigateToURL(shell(), url_a)); | 5048 EXPECT_TRUE(NavigateToURL(shell(), url_a)); |
| 5023 | 5049 |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5391 std::string body; | 5417 std::string body; |
| 5392 EXPECT_TRUE(ExecuteScriptAndExtractString( | 5418 EXPECT_TRUE(ExecuteScriptAndExtractString( |
| 5393 shell()->web_contents(), | 5419 shell()->web_contents(), |
| 5394 "window.domAutomationController.send(" | 5420 "window.domAutomationController.send(" |
| 5395 "document.getElementsByTagName('pre')[0].innerText);", | 5421 "document.getElementsByTagName('pre')[0].innerText);", |
| 5396 &body)); | 5422 &body)); |
| 5397 EXPECT_EQ("text=value\n", body); | 5423 EXPECT_EQ("text=value\n", body); |
| 5398 } | 5424 } |
| 5399 | 5425 |
| 5400 } // namespace content | 5426 } // namespace content |
| OLD | NEW |