| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 335 |
| 336 EXPECT_EQ("/title2.html", new_shell->web_contents()->GetVisibleURL().path()); | 336 EXPECT_EQ("/title2.html", new_shell->web_contents()->GetVisibleURL().path()); |
| 337 | 337 |
| 338 // Check that `window.opener` is not set. | 338 // Check that `window.opener` is not set. |
| 339 success = false; | 339 success = false; |
| 340 EXPECT_TRUE(ExecuteScriptAndExtractBool( | 340 EXPECT_TRUE(ExecuteScriptAndExtractBool( |
| 341 new_shell, "window.domAutomationController.send(window.opener == null);", | 341 new_shell, "window.domAutomationController.send(window.opener == null);", |
| 342 &success)); | 342 &success)); |
| 343 EXPECT_TRUE(success); | 343 EXPECT_TRUE(success); |
| 344 | 344 |
| 345 // Wait for the cross-site transition in the new tab to finish. |
| 346 WaitForLoadStop(new_shell->web_contents()); |
| 347 WebContentsImpl* web_contents = |
| 348 static_cast<WebContentsImpl*>(new_shell->web_contents()); |
| 349 EXPECT_FALSE( |
| 350 web_contents->GetRenderManagerForTesting()->pending_render_view_host()); |
| 351 |
| 345 // Check that the referrer is set correctly. | 352 // Check that the referrer is set correctly. |
| 346 std::string expected_referrer = | 353 std::string expected_referrer = |
| 347 embedded_test_server()->GetURL("/click-noreferrer-links.html").spec(); | 354 embedded_test_server()->GetURL("/click-noreferrer-links.html").spec(); |
| 348 success = false; | 355 success = false; |
| 349 EXPECT_TRUE(ExecuteScriptAndExtractBool( | 356 EXPECT_TRUE(ExecuteScriptAndExtractBool( |
| 350 new_shell, "window.domAutomationController.send(document.referrer == '" + | 357 new_shell, "window.domAutomationController.send(document.referrer == '" + |
| 351 expected_referrer + "');", | 358 expected_referrer + "');", |
| 352 &success)); | 359 &success)); |
| 353 EXPECT_TRUE(success); | 360 EXPECT_TRUE(success); |
| 354 | 361 |
| 355 // Wait for the cross-site transition in the new tab to finish. | |
| 356 WaitForLoadStop(new_shell->web_contents()); | |
| 357 WebContentsImpl* web_contents = | |
| 358 static_cast<WebContentsImpl*>(new_shell->web_contents()); | |
| 359 EXPECT_FALSE( | |
| 360 web_contents->GetRenderManagerForTesting()->pending_render_view_host()); | |
| 361 | |
| 362 // Should have a new SiteInstance. | 362 // Should have a new SiteInstance. |
| 363 scoped_refptr<SiteInstance> noopener_blank_site_instance( | 363 scoped_refptr<SiteInstance> noopener_blank_site_instance( |
| 364 new_shell->web_contents()->GetSiteInstance()); | 364 new_shell->web_contents()->GetSiteInstance()); |
| 365 EXPECT_NE(orig_site_instance, noopener_blank_site_instance); | 365 EXPECT_NE(orig_site_instance, noopener_blank_site_instance); |
| 366 } | 366 } |
| 367 | 367 |
| 368 // 'noopener' also works from 'window.open' | 368 // 'noopener' also works from 'window.open' |
| 369 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, | 369 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
| 370 SwapProcessWithWindowOpenAndNoopener) { | 370 SwapProcessWithWindowOpenAndNoopener) { |
| 371 StartEmbeddedServer(); | 371 StartEmbeddedServer(); |
| (...skipping 2424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2796 TestNavigationObserver commit_observer(web_contents); | 2796 TestNavigationObserver commit_observer(web_contents); |
| 2797 shell()->LoadURL(embedded_test_server()->GetURL("b.com", "/title1.html")); | 2797 shell()->LoadURL(embedded_test_server()->GetURL("b.com", "/title1.html")); |
| 2798 commit_observer.Wait(); | 2798 commit_observer.Wait(); |
| 2799 exit_observer.Wait(); | 2799 exit_observer.Wait(); |
| 2800 | 2800 |
| 2801 // Ensure the entry's title hasn't changed after the ignored commit. | 2801 // Ensure the entry's title hasn't changed after the ignored commit. |
| 2802 EXPECT_EQ(title, entry->GetTitle()); | 2802 EXPECT_EQ(title, entry->GetTitle()); |
| 2803 } | 2803 } |
| 2804 | 2804 |
| 2805 } // namespace content | 2805 } // namespace content |
| OLD | NEW |