| 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 "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/json/json_reader.h" | 6 #include "base/json/json_reader.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 105 } |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 // Web pages should not have script access to the swapped out page. | 108 // Web pages should not have script access to the swapped out page. |
| 109 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, NoScriptAccessAfterSwapOut) { | 109 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, NoScriptAccessAfterSwapOut) { |
| 110 // Start two servers with different sites. | 110 // Start two servers with different sites. |
| 111 ASSERT_TRUE(test_server()->Start()); | 111 ASSERT_TRUE(test_server()->Start()); |
| 112 net::TestServer https_server( | 112 net::TestServer https_server( |
| 113 net::TestServer::TYPE_HTTPS, | 113 net::TestServer::TYPE_HTTPS, |
| 114 net::TestServer::kLocalhost, | 114 net::TestServer::kLocalhost, |
| 115 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 115 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 116 ASSERT_TRUE(https_server.Start()); | 116 ASSERT_TRUE(https_server.Start()); |
| 117 | 117 |
| 118 // Load a page with links that open in a new window. | 118 // Load a page with links that open in a new window. |
| 119 std::string replacement_path; | 119 std::string replacement_path; |
| 120 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 120 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 121 "files/click-noreferrer-links.html", | 121 "files/click-noreferrer-links.html", |
| 122 https_server.host_port_pair(), | 122 https_server.host_port_pair(), |
| 123 &replacement_path)); | 123 &replacement_path)); |
| 124 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 124 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
| 125 | 125 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer | 174 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer |
| 175 // and target=_blank should create a new SiteInstance. | 175 // and target=_blank should create a new SiteInstance. |
| 176 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 176 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
| 177 SwapProcessWithRelNoreferrerAndTargetBlank) { | 177 SwapProcessWithRelNoreferrerAndTargetBlank) { |
| 178 // Start two servers with different sites. | 178 // Start two servers with different sites. |
| 179 ASSERT_TRUE(test_server()->Start()); | 179 ASSERT_TRUE(test_server()->Start()); |
| 180 net::TestServer https_server( | 180 net::TestServer https_server( |
| 181 net::TestServer::TYPE_HTTPS, | 181 net::TestServer::TYPE_HTTPS, |
| 182 net::TestServer::kLocalhost, | 182 net::TestServer::kLocalhost, |
| 183 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 183 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 184 ASSERT_TRUE(https_server.Start()); | 184 ASSERT_TRUE(https_server.Start()); |
| 185 | 185 |
| 186 // Load a page with links that open in a new window. | 186 // Load a page with links that open in a new window. |
| 187 std::string replacement_path; | 187 std::string replacement_path; |
| 188 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 188 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 189 "files/click-noreferrer-links.html", | 189 "files/click-noreferrer-links.html", |
| 190 https_server.host_port_pair(), | 190 https_server.host_port_pair(), |
| 191 &replacement_path)); | 191 &replacement_path)); |
| 192 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 192 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
| 193 | 193 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // As of crbug.com/69267, we create a new BrowsingInstance (and SiteInstance) | 226 // As of crbug.com/69267, we create a new BrowsingInstance (and SiteInstance) |
| 227 // for rel=noreferrer links in new windows, even to same site pages and named | 227 // for rel=noreferrer links in new windows, even to same site pages and named |
| 228 // targets. | 228 // targets. |
| 229 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 229 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
| 230 SwapProcessWithSameSiteRelNoreferrer) { | 230 SwapProcessWithSameSiteRelNoreferrer) { |
| 231 // Start two servers with different sites. | 231 // Start two servers with different sites. |
| 232 ASSERT_TRUE(test_server()->Start()); | 232 ASSERT_TRUE(test_server()->Start()); |
| 233 net::TestServer https_server( | 233 net::TestServer https_server( |
| 234 net::TestServer::TYPE_HTTPS, | 234 net::TestServer::TYPE_HTTPS, |
| 235 net::TestServer::kLocalhost, | 235 net::TestServer::kLocalhost, |
| 236 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 236 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 237 ASSERT_TRUE(https_server.Start()); | 237 ASSERT_TRUE(https_server.Start()); |
| 238 | 238 |
| 239 // Load a page with links that open in a new window. | 239 // Load a page with links that open in a new window. |
| 240 std::string replacement_path; | 240 std::string replacement_path; |
| 241 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 241 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 242 "files/click-noreferrer-links.html", | 242 "files/click-noreferrer-links.html", |
| 243 https_server.host_port_pair(), | 243 https_server.host_port_pair(), |
| 244 &replacement_path)); | 244 &replacement_path)); |
| 245 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 245 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
| 246 | 246 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 279 |
| 280 // Test for crbug.com/24447. Following a cross-site link with just | 280 // Test for crbug.com/24447. Following a cross-site link with just |
| 281 // target=_blank should not create a new SiteInstance. | 281 // target=_blank should not create a new SiteInstance. |
| 282 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 282 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
| 283 DontSwapProcessWithOnlyTargetBlank) { | 283 DontSwapProcessWithOnlyTargetBlank) { |
| 284 // Start two servers with different sites. | 284 // Start two servers with different sites. |
| 285 ASSERT_TRUE(test_server()->Start()); | 285 ASSERT_TRUE(test_server()->Start()); |
| 286 net::TestServer https_server( | 286 net::TestServer https_server( |
| 287 net::TestServer::TYPE_HTTPS, | 287 net::TestServer::TYPE_HTTPS, |
| 288 net::TestServer::kLocalhost, | 288 net::TestServer::kLocalhost, |
| 289 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 289 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 290 ASSERT_TRUE(https_server.Start()); | 290 ASSERT_TRUE(https_server.Start()); |
| 291 | 291 |
| 292 // Load a page with links that open in a new window. | 292 // Load a page with links that open in a new window. |
| 293 std::string replacement_path; | 293 std::string replacement_path; |
| 294 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 294 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 295 "files/click-noreferrer-links.html", | 295 "files/click-noreferrer-links.html", |
| 296 https_server.host_port_pair(), | 296 https_server.host_port_pair(), |
| 297 &replacement_path)); | 297 &replacement_path)); |
| 298 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 298 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
| 299 | 299 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 327 | 327 |
| 328 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer | 328 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer |
| 329 // and no target=_blank should not create a new SiteInstance. | 329 // and no target=_blank should not create a new SiteInstance. |
| 330 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 330 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
| 331 DontSwapProcessWithOnlyRelNoreferrer) { | 331 DontSwapProcessWithOnlyRelNoreferrer) { |
| 332 // Start two servers with different sites. | 332 // Start two servers with different sites. |
| 333 ASSERT_TRUE(test_server()->Start()); | 333 ASSERT_TRUE(test_server()->Start()); |
| 334 net::TestServer https_server( | 334 net::TestServer https_server( |
| 335 net::TestServer::TYPE_HTTPS, | 335 net::TestServer::TYPE_HTTPS, |
| 336 net::TestServer::kLocalhost, | 336 net::TestServer::kLocalhost, |
| 337 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 337 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 338 ASSERT_TRUE(https_server.Start()); | 338 ASSERT_TRUE(https_server.Start()); |
| 339 | 339 |
| 340 // Load a page with links that open in a new window. | 340 // Load a page with links that open in a new window. |
| 341 std::string replacement_path; | 341 std::string replacement_path; |
| 342 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 342 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 343 "files/click-noreferrer-links.html", | 343 "files/click-noreferrer-links.html", |
| 344 https_server.host_port_pair(), | 344 https_server.host_port_pair(), |
| 345 &replacement_path)); | 345 &replacement_path)); |
| 346 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 346 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
| 347 | 347 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 373 | 373 |
| 374 // Test for crbug.com/116192. Targeted links should still work after the | 374 // Test for crbug.com/116192. Targeted links should still work after the |
| 375 // named target window has swapped processes. | 375 // named target window has swapped processes. |
| 376 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 376 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
| 377 AllowTargetedNavigationsAfterSwap) { | 377 AllowTargetedNavigationsAfterSwap) { |
| 378 // Start two servers with different sites. | 378 // Start two servers with different sites. |
| 379 ASSERT_TRUE(test_server()->Start()); | 379 ASSERT_TRUE(test_server()->Start()); |
| 380 net::TestServer https_server( | 380 net::TestServer https_server( |
| 381 net::TestServer::TYPE_HTTPS, | 381 net::TestServer::TYPE_HTTPS, |
| 382 net::TestServer::kLocalhost, | 382 net::TestServer::kLocalhost, |
| 383 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 383 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 384 ASSERT_TRUE(https_server.Start()); | 384 ASSERT_TRUE(https_server.Start()); |
| 385 | 385 |
| 386 // Load a page with links that open in a new window. | 386 // Load a page with links that open in a new window. |
| 387 std::string replacement_path; | 387 std::string replacement_path; |
| 388 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 388 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 389 "files/click-noreferrer-links.html", | 389 "files/click-noreferrer-links.html", |
| 390 https_server.host_port_pair(), | 390 https_server.host_port_pair(), |
| 391 &replacement_path)); | 391 &replacement_path)); |
| 392 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 392 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
| 393 | 393 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 } | 456 } |
| 457 | 457 |
| 458 // Test that setting the opener to null in a window affects cross-process | 458 // Test that setting the opener to null in a window affects cross-process |
| 459 // navigations, including those to existing entries. http://crbug.com/156669. | 459 // navigations, including those to existing entries. http://crbug.com/156669. |
| 460 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, DisownOpener) { | 460 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, DisownOpener) { |
| 461 // Start two servers with different sites. | 461 // Start two servers with different sites. |
| 462 ASSERT_TRUE(test_server()->Start()); | 462 ASSERT_TRUE(test_server()->Start()); |
| 463 net::TestServer https_server( | 463 net::TestServer https_server( |
| 464 net::TestServer::TYPE_HTTPS, | 464 net::TestServer::TYPE_HTTPS, |
| 465 net::TestServer::kLocalhost, | 465 net::TestServer::kLocalhost, |
| 466 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 466 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 467 ASSERT_TRUE(https_server.Start()); | 467 ASSERT_TRUE(https_server.Start()); |
| 468 | 468 |
| 469 // Load a page with links that open in a new window. | 469 // Load a page with links that open in a new window. |
| 470 std::string replacement_path; | 470 std::string replacement_path; |
| 471 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 471 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 472 "files/click-noreferrer-links.html", | 472 "files/click-noreferrer-links.html", |
| 473 https_server.host_port_pair(), | 473 https_server.host_port_pair(), |
| 474 &replacement_path)); | 474 &replacement_path)); |
| 475 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 475 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
| 476 | 476 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 // 4) Post a message from _blank to "foo". | 544 // 4) Post a message from _blank to "foo". |
| 545 // 5) Post a message from "foo" to a subframe of opener, which replies back. | 545 // 5) Post a message from "foo" to a subframe of opener, which replies back. |
| 546 // 6) Post a message from _blank to a subframe of "foo". | 546 // 6) Post a message from _blank to a subframe of "foo". |
| 547 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 547 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
| 548 SupportCrossProcessPostMessage) { | 548 SupportCrossProcessPostMessage) { |
| 549 // Start two servers with different sites. | 549 // Start two servers with different sites. |
| 550 ASSERT_TRUE(test_server()->Start()); | 550 ASSERT_TRUE(test_server()->Start()); |
| 551 net::TestServer https_server( | 551 net::TestServer https_server( |
| 552 net::TestServer::TYPE_HTTPS, | 552 net::TestServer::TYPE_HTTPS, |
| 553 net::TestServer::kLocalhost, | 553 net::TestServer::kLocalhost, |
| 554 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 554 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 555 ASSERT_TRUE(https_server.Start()); | 555 ASSERT_TRUE(https_server.Start()); |
| 556 | 556 |
| 557 // Load a page with links that open in a new window. | 557 // Load a page with links that open in a new window. |
| 558 std::string replacement_path; | 558 std::string replacement_path; |
| 559 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 559 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 560 "files/click-noreferrer-links.html", | 560 "files/click-noreferrer-links.html", |
| 561 https_server.host_port_pair(), | 561 https_server.host_port_pair(), |
| 562 &replacement_path)); | 562 &replacement_path)); |
| 563 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 563 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
| 564 | 564 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 | 682 |
| 683 // Test for crbug.com/116192. Navigations to a window's opener should | 683 // Test for crbug.com/116192. Navigations to a window's opener should |
| 684 // still work after a process swap. | 684 // still work after a process swap. |
| 685 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 685 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
| 686 AllowTargetedNavigationsInOpenerAfterSwap) { | 686 AllowTargetedNavigationsInOpenerAfterSwap) { |
| 687 // Start two servers with different sites. | 687 // Start two servers with different sites. |
| 688 ASSERT_TRUE(test_server()->Start()); | 688 ASSERT_TRUE(test_server()->Start()); |
| 689 net::TestServer https_server( | 689 net::TestServer https_server( |
| 690 net::TestServer::TYPE_HTTPS, | 690 net::TestServer::TYPE_HTTPS, |
| 691 net::TestServer::kLocalhost, | 691 net::TestServer::kLocalhost, |
| 692 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 692 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 693 ASSERT_TRUE(https_server.Start()); | 693 ASSERT_TRUE(https_server.Start()); |
| 694 | 694 |
| 695 // Load a page with links that open in a new window. | 695 // Load a page with links that open in a new window. |
| 696 std::string replacement_path; | 696 std::string replacement_path; |
| 697 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 697 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 698 "files/click-noreferrer-links.html", | 698 "files/click-noreferrer-links.html", |
| 699 https_server.host_port_pair(), | 699 https_server.host_port_pair(), |
| 700 &replacement_path)); | 700 &replacement_path)); |
| 701 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 701 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
| 702 | 702 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 // Test that opening a new window in the same SiteInstance and then navigating | 753 // Test that opening a new window in the same SiteInstance and then navigating |
| 754 // both windows to a different SiteInstance allows the first process to exit. | 754 // both windows to a different SiteInstance allows the first process to exit. |
| 755 // See http://crbug.com/126333. | 755 // See http://crbug.com/126333. |
| 756 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 756 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
| 757 ProcessExitWithSwappedOutViews) { | 757 ProcessExitWithSwappedOutViews) { |
| 758 // Start two servers with different sites. | 758 // Start two servers with different sites. |
| 759 ASSERT_TRUE(test_server()->Start()); | 759 ASSERT_TRUE(test_server()->Start()); |
| 760 net::TestServer https_server( | 760 net::TestServer https_server( |
| 761 net::TestServer::TYPE_HTTPS, | 761 net::TestServer::TYPE_HTTPS, |
| 762 net::TestServer::kLocalhost, | 762 net::TestServer::kLocalhost, |
| 763 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 763 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 764 ASSERT_TRUE(https_server.Start()); | 764 ASSERT_TRUE(https_server.Start()); |
| 765 | 765 |
| 766 // Load a page with links that open in a new window. | 766 // Load a page with links that open in a new window. |
| 767 std::string replacement_path; | 767 std::string replacement_path; |
| 768 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 768 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 769 "files/click-noreferrer-links.html", | 769 "files/click-noreferrer-links.html", |
| 770 https_server.host_port_pair(), | 770 https_server.host_port_pair(), |
| 771 &replacement_path)); | 771 &replacement_path)); |
| 772 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 772 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
| 773 | 773 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 } | 820 } |
| 821 | 821 |
| 822 // Test for crbug.com/76666. A cross-site navigation that fails with a 204 | 822 // Test for crbug.com/76666. A cross-site navigation that fails with a 204 |
| 823 // error should not make us ignore future renderer-initiated navigations. | 823 // error should not make us ignore future renderer-initiated navigations. |
| 824 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, ClickLinkAfter204Error) { | 824 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, ClickLinkAfter204Error) { |
| 825 // Start two servers with different sites. | 825 // Start two servers with different sites. |
| 826 ASSERT_TRUE(test_server()->Start()); | 826 ASSERT_TRUE(test_server()->Start()); |
| 827 net::TestServer https_server( | 827 net::TestServer https_server( |
| 828 net::TestServer::TYPE_HTTPS, | 828 net::TestServer::TYPE_HTTPS, |
| 829 net::TestServer::kLocalhost, | 829 net::TestServer::kLocalhost, |
| 830 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 830 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 831 ASSERT_TRUE(https_server.Start()); | 831 ASSERT_TRUE(https_server.Start()); |
| 832 | 832 |
| 833 // Load a page with links that open in a new window. | 833 // Load a page with links that open in a new window. |
| 834 // The links will point to the HTTPS server. | 834 // The links will point to the HTTPS server. |
| 835 std::string replacement_path; | 835 std::string replacement_path; |
| 836 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 836 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 837 "files/click-noreferrer-links.html", | 837 "files/click-noreferrer-links.html", |
| 838 https_server.host_port_pair(), | 838 https_server.host_port_pair(), |
| 839 &replacement_path)); | 839 &replacement_path)); |
| 840 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 840 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 // do not cause back/forward navigations to be considered stale by the | 883 // do not cause back/forward navigations to be considered stale by the |
| 884 // renderer. | 884 // renderer. |
| 885 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, BackForwardNotStale) { | 885 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, BackForwardNotStale) { |
| 886 NavigateToURL(shell(), GURL(chrome::kAboutBlankURL)); | 886 NavigateToURL(shell(), GURL(chrome::kAboutBlankURL)); |
| 887 | 887 |
| 888 // Start two servers with different sites. | 888 // Start two servers with different sites. |
| 889 ASSERT_TRUE(test_server()->Start()); | 889 ASSERT_TRUE(test_server()->Start()); |
| 890 net::TestServer https_server( | 890 net::TestServer https_server( |
| 891 net::TestServer::TYPE_HTTPS, | 891 net::TestServer::TYPE_HTTPS, |
| 892 net::TestServer::kLocalhost, | 892 net::TestServer::kLocalhost, |
| 893 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 893 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 894 ASSERT_TRUE(https_server.Start()); | 894 ASSERT_TRUE(https_server.Start()); |
| 895 | 895 |
| 896 // Visit a page on first site. | 896 // Visit a page on first site. |
| 897 std::string replacement_path_a1; | 897 std::string replacement_path_a1; |
| 898 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 898 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 899 "files/title1.html", | 899 "files/title1.html", |
| 900 test_server()->host_port_pair(), | 900 test_server()->host_port_pair(), |
| 901 &replacement_path_a1)); | 901 &replacement_path_a1)); |
| 902 NavigateToURL(shell(), test_server()->GetURL(replacement_path_a1)); | 902 NavigateToURL(shell(), test_server()->GetURL(replacement_path_a1)); |
| 903 | 903 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 | 998 |
| 999 // Test for http://crbug.com/130016. | 999 // Test for http://crbug.com/130016. |
| 1000 // Swapping out a render view should update its visiblity state. | 1000 // Swapping out a render view should update its visiblity state. |
| 1001 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 1001 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
| 1002 SwappedOutViewHasCorrectVisibilityState) { | 1002 SwappedOutViewHasCorrectVisibilityState) { |
| 1003 // Start two servers with different sites. | 1003 // Start two servers with different sites. |
| 1004 ASSERT_TRUE(test_server()->Start()); | 1004 ASSERT_TRUE(test_server()->Start()); |
| 1005 net::TestServer https_server( | 1005 net::TestServer https_server( |
| 1006 net::TestServer::TYPE_HTTPS, | 1006 net::TestServer::TYPE_HTTPS, |
| 1007 net::TestServer::kLocalhost, | 1007 net::TestServer::kLocalhost, |
| 1008 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 1008 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 1009 ASSERT_TRUE(https_server.Start()); | 1009 ASSERT_TRUE(https_server.Start()); |
| 1010 | 1010 |
| 1011 // Load a page with links that open in a new window. | 1011 // Load a page with links that open in a new window. |
| 1012 std::string replacement_path; | 1012 std::string replacement_path; |
| 1013 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 1013 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
| 1014 "files/click-noreferrer-links.html", | 1014 "files/click-noreferrer-links.html", |
| 1015 https_server.host_port_pair(), | 1015 https_server.host_port_pair(), |
| 1016 &replacement_path)); | 1016 &replacement_path)); |
| 1017 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 1017 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
| 1018 | 1018 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 // they may cause crashes or memory corruptions when trying to call dead | 1124 // they may cause crashes or memory corruptions when trying to call dead |
| 1125 // delegate_. This test also verifies crbug.com/117420 and crbug.com/143255 to | 1125 // delegate_. This test also verifies crbug.com/117420 and crbug.com/143255 to |
| 1126 // ensure that a separate SiteInstance is created when navigating to view-source | 1126 // ensure that a separate SiteInstance is created when navigating to view-source |
| 1127 // URLs, regardless of current URL. | 1127 // URLs, regardless of current URL. |
| 1128 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, LeakingRenderViewHosts) { | 1128 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, LeakingRenderViewHosts) { |
| 1129 // Start two servers with different sites. | 1129 // Start two servers with different sites. |
| 1130 ASSERT_TRUE(test_server()->Start()); | 1130 ASSERT_TRUE(test_server()->Start()); |
| 1131 net::TestServer https_server( | 1131 net::TestServer https_server( |
| 1132 net::TestServer::TYPE_HTTPS, | 1132 net::TestServer::TYPE_HTTPS, |
| 1133 net::TestServer::kLocalhost, | 1133 net::TestServer::kLocalhost, |
| 1134 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 1134 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 1135 ASSERT_TRUE(https_server.Start()); | 1135 ASSERT_TRUE(https_server.Start()); |
| 1136 | 1136 |
| 1137 // Observe the created render_view_host's to make sure they will not leak. | 1137 // Observe the created render_view_host's to make sure they will not leak. |
| 1138 RenderViewHostObserverArray rvh_observers; | 1138 RenderViewHostObserverArray rvh_observers; |
| 1139 | 1139 |
| 1140 GURL navigated_url(test_server()->GetURL("files/title2.html")); | 1140 GURL navigated_url(test_server()->GetURL("files/title2.html")); |
| 1141 GURL view_source_url(chrome::kViewSourceScheme + std::string(":") + | 1141 GURL view_source_url(chrome::kViewSourceScheme + std::string(":") + |
| 1142 navigated_url.spec()); | 1142 navigated_url.spec()); |
| 1143 | 1143 |
| 1144 // Let's ensure that when we start with a blank window, navigating away to a | 1144 // Let's ensure that when we start with a blank window, navigating away to a |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 // that frame hierarchies are kept in sync through navigations, reloading, and | 1195 // that frame hierarchies are kept in sync through navigations, reloading, and |
| 1196 // JavaScript manipulation of the frame tree. | 1196 // JavaScript manipulation of the frame tree. |
| 1197 // | 1197 // |
| 1198 // Disable the test until http://crbug.com/153701 is fixed. | 1198 // Disable the test until http://crbug.com/153701 is fixed. |
| 1199 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, DISABLED_FrameTreeUpdates) { | 1199 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, DISABLED_FrameTreeUpdates) { |
| 1200 // Start two servers to allow using different sites. | 1200 // Start two servers to allow using different sites. |
| 1201 EXPECT_TRUE(test_server()->Start()); | 1201 EXPECT_TRUE(test_server()->Start()); |
| 1202 net::TestServer https_server( | 1202 net::TestServer https_server( |
| 1203 net::TestServer::TYPE_HTTPS, | 1203 net::TestServer::TYPE_HTTPS, |
| 1204 net::TestServer::kLocalhost, | 1204 net::TestServer::kLocalhost, |
| 1205 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 1205 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 1206 EXPECT_TRUE(https_server.Start()); | 1206 EXPECT_TRUE(https_server.Start()); |
| 1207 | 1207 |
| 1208 GURL frame_tree_url(test_server()->GetURL("files/frame_tree/top.html")); | 1208 GURL frame_tree_url(test_server()->GetURL("files/frame_tree/top.html")); |
| 1209 | 1209 |
| 1210 // Replace the 127.0.0.1 with localhost, which will give us a different | 1210 // Replace the 127.0.0.1 with localhost, which will give us a different |
| 1211 // site instance. | 1211 // site instance. |
| 1212 GURL::Replacements replacements; | 1212 GURL::Replacements replacements; |
| 1213 std::string new_host("localhost"); | 1213 std::string new_host("localhost"); |
| 1214 replacements.SetHostStr(new_host); | 1214 replacements.SetHostStr(new_host); |
| 1215 GURL remote_frame = test_server()->GetURL( | 1215 GURL remote_frame = test_server()->GetURL( |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 // This used to cause an update to the frame tree of the swapped out RV, | 1364 // This used to cause an update to the frame tree of the swapped out RV, |
| 1365 // just as it was navigating to a real page. That pre-empted the real | 1365 // just as it was navigating to a real page. That pre-empted the real |
| 1366 // navigation and visibly sent the tab to swappedout://. | 1366 // navigation and visibly sent the tab to swappedout://. |
| 1367 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 1367 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
| 1368 DontPreemptNavigationWithFrameTreeUpdate) { | 1368 DontPreemptNavigationWithFrameTreeUpdate) { |
| 1369 // Start two servers with different sites. | 1369 // Start two servers with different sites. |
| 1370 ASSERT_TRUE(test_server()->Start()); | 1370 ASSERT_TRUE(test_server()->Start()); |
| 1371 net::TestServer https_server( | 1371 net::TestServer https_server( |
| 1372 net::TestServer::TYPE_HTTPS, | 1372 net::TestServer::TYPE_HTTPS, |
| 1373 net::TestServer::kLocalhost, | 1373 net::TestServer::kLocalhost, |
| 1374 FilePath(FILE_PATH_LITERAL("content/test/data"))); | 1374 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 1375 ASSERT_TRUE(https_server.Start()); | 1375 ASSERT_TRUE(https_server.Start()); |
| 1376 | 1376 |
| 1377 // 1. Load a page that deletes its iframe during unload. | 1377 // 1. Load a page that deletes its iframe during unload. |
| 1378 NavigateToURL(shell(), | 1378 NavigateToURL(shell(), |
| 1379 test_server()->GetURL("files/remove_frame_on_unload.html")); | 1379 test_server()->GetURL("files/remove_frame_on_unload.html")); |
| 1380 | 1380 |
| 1381 // Get the original SiteInstance for later comparison. | 1381 // Get the original SiteInstance for later comparison. |
| 1382 scoped_refptr<SiteInstance> orig_site_instance( | 1382 scoped_refptr<SiteInstance> orig_site_instance( |
| 1383 shell()->web_contents()->GetSiteInstance()); | 1383 shell()->web_contents()->GetSiteInstance()); |
| 1384 | 1384 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1410 NavigateToURL(shell(), https_server.GetURL("files/title1.html")); | 1410 NavigateToURL(shell(), https_server.GetURL("files/title1.html")); |
| 1411 | 1411 |
| 1412 // Make sure it ends up at the right page. | 1412 // Make sure it ends up at the right page. |
| 1413 WaitForLoadStop(shell()->web_contents()); | 1413 WaitForLoadStop(shell()->web_contents()); |
| 1414 EXPECT_EQ(https_server.GetURL("files/title1.html"), | 1414 EXPECT_EQ(https_server.GetURL("files/title1.html"), |
| 1415 shell()->web_contents()->GetURL()); | 1415 shell()->web_contents()->GetURL()); |
| 1416 EXPECT_EQ(new_site_instance, shell()->web_contents()->GetSiteInstance()); | 1416 EXPECT_EQ(new_site_instance, shell()->web_contents()->GetSiteInstance()); |
| 1417 } | 1417 } |
| 1418 | 1418 |
| 1419 } // namespace content | 1419 } // namespace content |
| OLD | NEW |