| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 10134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10145 // Verify that POST body was correctly passed to the server and ended up in | 10145 // Verify that POST body was correctly passed to the server and ended up in |
| 10146 // the body of the page. | 10146 // the body of the page. |
| 10147 std::string body; | 10147 std::string body; |
| 10148 EXPECT_TRUE(ExecuteScriptAndExtractString(root->child_at(0), R"( | 10148 EXPECT_TRUE(ExecuteScriptAndExtractString(root->child_at(0), R"( |
| 10149 var body = document.getElementsByTagName('pre')[0].innerText; | 10149 var body = document.getElementsByTagName('pre')[0].innerText; |
| 10150 window.domAutomationController.send(body);)", | 10150 window.domAutomationController.send(body);)", |
| 10151 &body)); | 10151 &body)); |
| 10152 EXPECT_EQ("my_token=my_value\n", body); | 10152 EXPECT_EQ("my_token=my_value\n", body); |
| 10153 } | 10153 } |
| 10154 | 10154 |
| 10155 // Verify that a remote-to-local main frame navigation doesn't overwrite |
| 10156 // the previous history entry. See https://crbug.com/725716. |
| 10157 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 10158 CrossProcessMainFrameNavigationDoesNotOverwriteHistory) { |
| 10159 GURL foo_url(embedded_test_server()->GetURL("foo.com", "/title1.html")); |
| 10160 GURL bar_url(embedded_test_server()->GetURL("bar.com", "/title2.html")); |
| 10161 |
| 10162 EXPECT_TRUE(NavigateToURL(shell(), foo_url)); |
| 10163 |
| 10164 // Open a same-site popup to keep the www.foo.com process alive. |
| 10165 OpenPopup(shell(), GURL(url::kAboutBlankURL), "foo"); |
| 10166 |
| 10167 // Navigate foo -> bar -> foo. |
| 10168 EXPECT_TRUE(NavigateToURL(shell(), bar_url)); |
| 10169 EXPECT_TRUE(NavigateToURL(shell(), foo_url)); |
| 10170 |
| 10171 // There should be three history entries. |
| 10172 EXPECT_EQ(3, web_contents()->GetController().GetEntryCount()); |
| 10173 |
| 10174 // Go back: this should go to bar.com. |
| 10175 { |
| 10176 TestNavigationObserver back_observer(web_contents()); |
| 10177 web_contents()->GetController().GoBack(); |
| 10178 back_observer.Wait(); |
| 10179 } |
| 10180 EXPECT_EQ(bar_url, web_contents()->GetMainFrame()->GetLastCommittedURL()); |
| 10181 |
| 10182 // Go back again. This should go to foo.com. |
| 10183 { |
| 10184 TestNavigationObserver back_observer(web_contents()); |
| 10185 web_contents()->GetController().GoBack(); |
| 10186 back_observer.Wait(); |
| 10187 } |
| 10188 EXPECT_EQ(foo_url, web_contents()->GetMainFrame()->GetLastCommittedURL()); |
| 10189 } |
| 10190 |
| 10155 } // namespace content | 10191 } // namespace content |
| OLD | NEW |