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 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 115 net::TestServer::GetSourceRelativePath( |
| 116 base::FilePath(FILE_PATH_LITERAL("content/test/data")))); |
116 ASSERT_TRUE(https_server.Start()); | 117 ASSERT_TRUE(https_server.Start()); |
117 | 118 |
118 // Load a page with links that open in a new window. | 119 // Load a page with links that open in a new window. |
119 std::string replacement_path; | 120 std::string replacement_path; |
120 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 121 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
121 "files/click-noreferrer-links.html", | 122 "files/click-noreferrer-links.html", |
122 https_server.host_port_pair(), | 123 https_server.host_port_pair(), |
123 &replacement_path)); | 124 &replacement_path)); |
124 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 125 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
125 | 126 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 174 |
174 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer | 175 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer |
175 // and target=_blank should create a new SiteInstance. | 176 // and target=_blank should create a new SiteInstance. |
176 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 177 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
177 SwapProcessWithRelNoreferrerAndTargetBlank) { | 178 SwapProcessWithRelNoreferrerAndTargetBlank) { |
178 // Start two servers with different sites. | 179 // Start two servers with different sites. |
179 ASSERT_TRUE(test_server()->Start()); | 180 ASSERT_TRUE(test_server()->Start()); |
180 net::TestServer https_server( | 181 net::TestServer https_server( |
181 net::TestServer::TYPE_HTTPS, | 182 net::TestServer::TYPE_HTTPS, |
182 net::TestServer::kLocalhost, | 183 net::TestServer::kLocalhost, |
183 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 184 net::TestServer::GetSourceRelativePath( |
| 185 base::FilePath(FILE_PATH_LITERAL("content/test/data")))); |
184 ASSERT_TRUE(https_server.Start()); | 186 ASSERT_TRUE(https_server.Start()); |
185 | 187 |
186 // Load a page with links that open in a new window. | 188 // Load a page with links that open in a new window. |
187 std::string replacement_path; | 189 std::string replacement_path; |
188 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 190 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
189 "files/click-noreferrer-links.html", | 191 "files/click-noreferrer-links.html", |
190 https_server.host_port_pair(), | 192 https_server.host_port_pair(), |
191 &replacement_path)); | 193 &replacement_path)); |
192 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 194 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
193 | 195 |
(...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) | 228 // 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 | 229 // for rel=noreferrer links in new windows, even to same site pages and named |
228 // targets. | 230 // targets. |
229 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 231 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
230 SwapProcessWithSameSiteRelNoreferrer) { | 232 SwapProcessWithSameSiteRelNoreferrer) { |
231 // Start two servers with different sites. | 233 // Start two servers with different sites. |
232 ASSERT_TRUE(test_server()->Start()); | 234 ASSERT_TRUE(test_server()->Start()); |
233 net::TestServer https_server( | 235 net::TestServer https_server( |
234 net::TestServer::TYPE_HTTPS, | 236 net::TestServer::TYPE_HTTPS, |
235 net::TestServer::kLocalhost, | 237 net::TestServer::kLocalhost, |
236 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 238 net::TestServer::GetSourceRelativePath( |
| 239 base::FilePath(FILE_PATH_LITERAL("content/test/data")))); |
237 ASSERT_TRUE(https_server.Start()); | 240 ASSERT_TRUE(https_server.Start()); |
238 | 241 |
239 // Load a page with links that open in a new window. | 242 // Load a page with links that open in a new window. |
240 std::string replacement_path; | 243 std::string replacement_path; |
241 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 244 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
242 "files/click-noreferrer-links.html", | 245 "files/click-noreferrer-links.html", |
243 https_server.host_port_pair(), | 246 https_server.host_port_pair(), |
244 &replacement_path)); | 247 &replacement_path)); |
245 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 248 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
246 | 249 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 282 |
280 // Test for crbug.com/24447. Following a cross-site link with just | 283 // Test for crbug.com/24447. Following a cross-site link with just |
281 // target=_blank should not create a new SiteInstance. | 284 // target=_blank should not create a new SiteInstance. |
282 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 285 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
283 DontSwapProcessWithOnlyTargetBlank) { | 286 DontSwapProcessWithOnlyTargetBlank) { |
284 // Start two servers with different sites. | 287 // Start two servers with different sites. |
285 ASSERT_TRUE(test_server()->Start()); | 288 ASSERT_TRUE(test_server()->Start()); |
286 net::TestServer https_server( | 289 net::TestServer https_server( |
287 net::TestServer::TYPE_HTTPS, | 290 net::TestServer::TYPE_HTTPS, |
288 net::TestServer::kLocalhost, | 291 net::TestServer::kLocalhost, |
289 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 292 net::TestServer::GetSourceRelativePath( |
| 293 base::FilePath(FILE_PATH_LITERAL("content/test/data")))); |
290 ASSERT_TRUE(https_server.Start()); | 294 ASSERT_TRUE(https_server.Start()); |
291 | 295 |
292 // Load a page with links that open in a new window. | 296 // Load a page with links that open in a new window. |
293 std::string replacement_path; | 297 std::string replacement_path; |
294 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 298 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
295 "files/click-noreferrer-links.html", | 299 "files/click-noreferrer-links.html", |
296 https_server.host_port_pair(), | 300 https_server.host_port_pair(), |
297 &replacement_path)); | 301 &replacement_path)); |
298 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 302 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
299 | 303 |
(...skipping 27 matching lines...) Expand all Loading... |
327 | 331 |
328 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer | 332 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer |
329 // and no target=_blank should not create a new SiteInstance. | 333 // and no target=_blank should not create a new SiteInstance. |
330 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 334 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
331 DontSwapProcessWithOnlyRelNoreferrer) { | 335 DontSwapProcessWithOnlyRelNoreferrer) { |
332 // Start two servers with different sites. | 336 // Start two servers with different sites. |
333 ASSERT_TRUE(test_server()->Start()); | 337 ASSERT_TRUE(test_server()->Start()); |
334 net::TestServer https_server( | 338 net::TestServer https_server( |
335 net::TestServer::TYPE_HTTPS, | 339 net::TestServer::TYPE_HTTPS, |
336 net::TestServer::kLocalhost, | 340 net::TestServer::kLocalhost, |
337 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 341 net::TestServer::GetSourceRelativePath( |
| 342 base::FilePath(FILE_PATH_LITERAL("content/test/data")))); |
338 ASSERT_TRUE(https_server.Start()); | 343 ASSERT_TRUE(https_server.Start()); |
339 | 344 |
340 // Load a page with links that open in a new window. | 345 // Load a page with links that open in a new window. |
341 std::string replacement_path; | 346 std::string replacement_path; |
342 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 347 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
343 "files/click-noreferrer-links.html", | 348 "files/click-noreferrer-links.html", |
344 https_server.host_port_pair(), | 349 https_server.host_port_pair(), |
345 &replacement_path)); | 350 &replacement_path)); |
346 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 351 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
347 | 352 |
(...skipping 25 matching lines...) Expand all Loading... |
373 | 378 |
374 // Test for crbug.com/116192. Targeted links should still work after the | 379 // Test for crbug.com/116192. Targeted links should still work after the |
375 // named target window has swapped processes. | 380 // named target window has swapped processes. |
376 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 381 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
377 AllowTargetedNavigationsAfterSwap) { | 382 AllowTargetedNavigationsAfterSwap) { |
378 // Start two servers with different sites. | 383 // Start two servers with different sites. |
379 ASSERT_TRUE(test_server()->Start()); | 384 ASSERT_TRUE(test_server()->Start()); |
380 net::TestServer https_server( | 385 net::TestServer https_server( |
381 net::TestServer::TYPE_HTTPS, | 386 net::TestServer::TYPE_HTTPS, |
382 net::TestServer::kLocalhost, | 387 net::TestServer::kLocalhost, |
383 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 388 net::TestServer::GetSourceRelativePath( |
| 389 base::FilePath(FILE_PATH_LITERAL("content/test/data")))); |
384 ASSERT_TRUE(https_server.Start()); | 390 ASSERT_TRUE(https_server.Start()); |
385 | 391 |
386 // Load a page with links that open in a new window. | 392 // Load a page with links that open in a new window. |
387 std::string replacement_path; | 393 std::string replacement_path; |
388 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 394 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
389 "files/click-noreferrer-links.html", | 395 "files/click-noreferrer-links.html", |
390 https_server.host_port_pair(), | 396 https_server.host_port_pair(), |
391 &replacement_path)); | 397 &replacement_path)); |
392 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 398 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
393 | 399 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 } | 462 } |
457 | 463 |
458 // Test that setting the opener to null in a window affects cross-process | 464 // Test that setting the opener to null in a window affects cross-process |
459 // navigations, including those to existing entries. http://crbug.com/156669. | 465 // navigations, including those to existing entries. http://crbug.com/156669. |
460 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, DisownOpener) { | 466 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, DisownOpener) { |
461 // Start two servers with different sites. | 467 // Start two servers with different sites. |
462 ASSERT_TRUE(test_server()->Start()); | 468 ASSERT_TRUE(test_server()->Start()); |
463 net::TestServer https_server( | 469 net::TestServer https_server( |
464 net::TestServer::TYPE_HTTPS, | 470 net::TestServer::TYPE_HTTPS, |
465 net::TestServer::kLocalhost, | 471 net::TestServer::kLocalhost, |
466 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 472 net::TestServer::GetSourceRelativePath( |
| 473 base::FilePath(FILE_PATH_LITERAL("content/test/data")))); |
467 ASSERT_TRUE(https_server.Start()); | 474 ASSERT_TRUE(https_server.Start()); |
468 | 475 |
469 // Load a page with links that open in a new window. | 476 // Load a page with links that open in a new window. |
470 std::string replacement_path; | 477 std::string replacement_path; |
471 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 478 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
472 "files/click-noreferrer-links.html", | 479 "files/click-noreferrer-links.html", |
473 https_server.host_port_pair(), | 480 https_server.host_port_pair(), |
474 &replacement_path)); | 481 &replacement_path)); |
475 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 482 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
476 | 483 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 // 4) Post a message from _blank to "foo". | 551 // 4) Post a message from _blank to "foo". |
545 // 5) Post a message from "foo" to a subframe of opener, which replies back. | 552 // 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". | 553 // 6) Post a message from _blank to a subframe of "foo". |
547 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 554 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
548 SupportCrossProcessPostMessage) { | 555 SupportCrossProcessPostMessage) { |
549 // Start two servers with different sites. | 556 // Start two servers with different sites. |
550 ASSERT_TRUE(test_server()->Start()); | 557 ASSERT_TRUE(test_server()->Start()); |
551 net::TestServer https_server( | 558 net::TestServer https_server( |
552 net::TestServer::TYPE_HTTPS, | 559 net::TestServer::TYPE_HTTPS, |
553 net::TestServer::kLocalhost, | 560 net::TestServer::kLocalhost, |
554 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 561 net::TestServer::GetSourceRelativePath( |
| 562 base::FilePath(FILE_PATH_LITERAL("content/test/data")))); |
555 ASSERT_TRUE(https_server.Start()); | 563 ASSERT_TRUE(https_server.Start()); |
556 | 564 |
557 // Load a page with links that open in a new window. | 565 // Load a page with links that open in a new window. |
558 std::string replacement_path; | 566 std::string replacement_path; |
559 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 567 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
560 "files/click-noreferrer-links.html", | 568 "files/click-noreferrer-links.html", |
561 https_server.host_port_pair(), | 569 https_server.host_port_pair(), |
562 &replacement_path)); | 570 &replacement_path)); |
563 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 571 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
564 | 572 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 | 690 |
683 // Test for crbug.com/116192. Navigations to a window's opener should | 691 // Test for crbug.com/116192. Navigations to a window's opener should |
684 // still work after a process swap. | 692 // still work after a process swap. |
685 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 693 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
686 AllowTargetedNavigationsInOpenerAfterSwap) { | 694 AllowTargetedNavigationsInOpenerAfterSwap) { |
687 // Start two servers with different sites. | 695 // Start two servers with different sites. |
688 ASSERT_TRUE(test_server()->Start()); | 696 ASSERT_TRUE(test_server()->Start()); |
689 net::TestServer https_server( | 697 net::TestServer https_server( |
690 net::TestServer::TYPE_HTTPS, | 698 net::TestServer::TYPE_HTTPS, |
691 net::TestServer::kLocalhost, | 699 net::TestServer::kLocalhost, |
692 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 700 net::TestServer::GetSourceRelativePath( |
| 701 base::FilePath(FILE_PATH_LITERAL("content/test/data")))); |
693 ASSERT_TRUE(https_server.Start()); | 702 ASSERT_TRUE(https_server.Start()); |
694 | 703 |
695 // Load a page with links that open in a new window. | 704 // Load a page with links that open in a new window. |
696 std::string replacement_path; | 705 std::string replacement_path; |
697 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 706 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
698 "files/click-noreferrer-links.html", | 707 "files/click-noreferrer-links.html", |
699 https_server.host_port_pair(), | 708 https_server.host_port_pair(), |
700 &replacement_path)); | 709 &replacement_path)); |
701 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 710 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
702 | 711 |
(...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 | 762 // 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. | 763 // both windows to a different SiteInstance allows the first process to exit. |
755 // See http://crbug.com/126333. | 764 // See http://crbug.com/126333. |
756 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 765 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
757 ProcessExitWithSwappedOutViews) { | 766 ProcessExitWithSwappedOutViews) { |
758 // Start two servers with different sites. | 767 // Start two servers with different sites. |
759 ASSERT_TRUE(test_server()->Start()); | 768 ASSERT_TRUE(test_server()->Start()); |
760 net::TestServer https_server( | 769 net::TestServer https_server( |
761 net::TestServer::TYPE_HTTPS, | 770 net::TestServer::TYPE_HTTPS, |
762 net::TestServer::kLocalhost, | 771 net::TestServer::kLocalhost, |
763 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 772 net::TestServer::GetSourceRelativePath( |
| 773 base::FilePath(FILE_PATH_LITERAL("content/test/data")))); |
764 ASSERT_TRUE(https_server.Start()); | 774 ASSERT_TRUE(https_server.Start()); |
765 | 775 |
766 // Load a page with links that open in a new window. | 776 // Load a page with links that open in a new window. |
767 std::string replacement_path; | 777 std::string replacement_path; |
768 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 778 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
769 "files/click-noreferrer-links.html", | 779 "files/click-noreferrer-links.html", |
770 https_server.host_port_pair(), | 780 https_server.host_port_pair(), |
771 &replacement_path)); | 781 &replacement_path)); |
772 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 782 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
773 | 783 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 } | 830 } |
821 | 831 |
822 // Test for crbug.com/76666. A cross-site navigation that fails with a 204 | 832 // 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. | 833 // error should not make us ignore future renderer-initiated navigations. |
824 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, ClickLinkAfter204Error) { | 834 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, ClickLinkAfter204Error) { |
825 // Start two servers with different sites. | 835 // Start two servers with different sites. |
826 ASSERT_TRUE(test_server()->Start()); | 836 ASSERT_TRUE(test_server()->Start()); |
827 net::TestServer https_server( | 837 net::TestServer https_server( |
828 net::TestServer::TYPE_HTTPS, | 838 net::TestServer::TYPE_HTTPS, |
829 net::TestServer::kLocalhost, | 839 net::TestServer::kLocalhost, |
830 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 840 net::TestServer::GetSourceRelativePath( |
| 841 base::FilePath(FILE_PATH_LITERAL("content/test/data")))); |
831 ASSERT_TRUE(https_server.Start()); | 842 ASSERT_TRUE(https_server.Start()); |
832 | 843 |
833 // Load a page with links that open in a new window. | 844 // Load a page with links that open in a new window. |
834 // The links will point to the HTTPS server. | 845 // The links will point to the HTTPS server. |
835 std::string replacement_path; | 846 std::string replacement_path; |
836 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 847 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
837 "files/click-noreferrer-links.html", | 848 "files/click-noreferrer-links.html", |
838 https_server.host_port_pair(), | 849 https_server.host_port_pair(), |
839 &replacement_path)); | 850 &replacement_path)); |
840 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 851 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 | 894 // do not cause back/forward navigations to be considered stale by the |
884 // renderer. | 895 // renderer. |
885 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, BackForwardNotStale) { | 896 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, BackForwardNotStale) { |
886 NavigateToURL(shell(), GURL(chrome::kAboutBlankURL)); | 897 NavigateToURL(shell(), GURL(chrome::kAboutBlankURL)); |
887 | 898 |
888 // Start two servers with different sites. | 899 // Start two servers with different sites. |
889 ASSERT_TRUE(test_server()->Start()); | 900 ASSERT_TRUE(test_server()->Start()); |
890 net::TestServer https_server( | 901 net::TestServer https_server( |
891 net::TestServer::TYPE_HTTPS, | 902 net::TestServer::TYPE_HTTPS, |
892 net::TestServer::kLocalhost, | 903 net::TestServer::kLocalhost, |
893 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 904 net::TestServer::GetSourceRelativePath( |
| 905 base::FilePath(FILE_PATH_LITERAL("content/test/data")))); |
894 ASSERT_TRUE(https_server.Start()); | 906 ASSERT_TRUE(https_server.Start()); |
895 | 907 |
896 // Visit a page on first site. | 908 // Visit a page on first site. |
897 std::string replacement_path_a1; | 909 std::string replacement_path_a1; |
898 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 910 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
899 "files/title1.html", | 911 "files/title1.html", |
900 test_server()->host_port_pair(), | 912 test_server()->host_port_pair(), |
901 &replacement_path_a1)); | 913 &replacement_path_a1)); |
902 NavigateToURL(shell(), test_server()->GetURL(replacement_path_a1)); | 914 NavigateToURL(shell(), test_server()->GetURL(replacement_path_a1)); |
903 | 915 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 | 1010 |
999 // Test for http://crbug.com/130016. | 1011 // Test for http://crbug.com/130016. |
1000 // Swapping out a render view should update its visiblity state. | 1012 // Swapping out a render view should update its visiblity state. |
1001 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 1013 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
1002 SwappedOutViewHasCorrectVisibilityState) { | 1014 SwappedOutViewHasCorrectVisibilityState) { |
1003 // Start two servers with different sites. | 1015 // Start two servers with different sites. |
1004 ASSERT_TRUE(test_server()->Start()); | 1016 ASSERT_TRUE(test_server()->Start()); |
1005 net::TestServer https_server( | 1017 net::TestServer https_server( |
1006 net::TestServer::TYPE_HTTPS, | 1018 net::TestServer::TYPE_HTTPS, |
1007 net::TestServer::kLocalhost, | 1019 net::TestServer::kLocalhost, |
1008 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 1020 net::TestServer::GetSourceRelativePath( |
| 1021 base::FilePath(FILE_PATH_LITERAL("content/test/data")))); |
1009 ASSERT_TRUE(https_server.Start()); | 1022 ASSERT_TRUE(https_server.Start()); |
1010 | 1023 |
1011 // Load a page with links that open in a new window. | 1024 // Load a page with links that open in a new window. |
1012 std::string replacement_path; | 1025 std::string replacement_path; |
1013 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 1026 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
1014 "files/click-noreferrer-links.html", | 1027 "files/click-noreferrer-links.html", |
1015 https_server.host_port_pair(), | 1028 https_server.host_port_pair(), |
1016 &replacement_path)); | 1029 &replacement_path)); |
1017 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 1030 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
1018 | 1031 |
(...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 | 1137 // 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 | 1138 // 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 | 1139 // ensure that a separate SiteInstance is created when navigating to view-source |
1127 // URLs, regardless of current URL. | 1140 // URLs, regardless of current URL. |
1128 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, LeakingRenderViewHosts) { | 1141 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, LeakingRenderViewHosts) { |
1129 // Start two servers with different sites. | 1142 // Start two servers with different sites. |
1130 ASSERT_TRUE(test_server()->Start()); | 1143 ASSERT_TRUE(test_server()->Start()); |
1131 net::TestServer https_server( | 1144 net::TestServer https_server( |
1132 net::TestServer::TYPE_HTTPS, | 1145 net::TestServer::TYPE_HTTPS, |
1133 net::TestServer::kLocalhost, | 1146 net::TestServer::kLocalhost, |
1134 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 1147 net::TestServer::GetSourceRelativePath( |
| 1148 base::FilePath(FILE_PATH_LITERAL("content/test/data")))); |
1135 ASSERT_TRUE(https_server.Start()); | 1149 ASSERT_TRUE(https_server.Start()); |
1136 | 1150 |
1137 // Observe the created render_view_host's to make sure they will not leak. | 1151 // Observe the created render_view_host's to make sure they will not leak. |
1138 RenderViewHostObserverArray rvh_observers; | 1152 RenderViewHostObserverArray rvh_observers; |
1139 | 1153 |
1140 GURL navigated_url(test_server()->GetURL("files/title2.html")); | 1154 GURL navigated_url(test_server()->GetURL("files/title2.html")); |
1141 GURL view_source_url(chrome::kViewSourceScheme + std::string(":") + | 1155 GURL view_source_url(chrome::kViewSourceScheme + std::string(":") + |
1142 navigated_url.spec()); | 1156 navigated_url.spec()); |
1143 | 1157 |
1144 // Let's ensure that when we start with a blank window, navigating away to a | 1158 // 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 | 1209 // that frame hierarchies are kept in sync through navigations, reloading, and |
1196 // JavaScript manipulation of the frame tree. | 1210 // JavaScript manipulation of the frame tree. |
1197 // | 1211 // |
1198 // Disable the test until http://crbug.com/153701 is fixed. | 1212 // Disable the test until http://crbug.com/153701 is fixed. |
1199 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, DISABLED_FrameTreeUpdates) { | 1213 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, DISABLED_FrameTreeUpdates) { |
1200 // Start two servers to allow using different sites. | 1214 // Start two servers to allow using different sites. |
1201 EXPECT_TRUE(test_server()->Start()); | 1215 EXPECT_TRUE(test_server()->Start()); |
1202 net::TestServer https_server( | 1216 net::TestServer https_server( |
1203 net::TestServer::TYPE_HTTPS, | 1217 net::TestServer::TYPE_HTTPS, |
1204 net::TestServer::kLocalhost, | 1218 net::TestServer::kLocalhost, |
1205 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 1219 net::TestServer::GetSourceRelativePath( |
| 1220 base::FilePath(FILE_PATH_LITERAL("content/test/data")))); |
1206 EXPECT_TRUE(https_server.Start()); | 1221 EXPECT_TRUE(https_server.Start()); |
1207 | 1222 |
1208 GURL frame_tree_url(test_server()->GetURL("files/frame_tree/top.html")); | 1223 GURL frame_tree_url(test_server()->GetURL("files/frame_tree/top.html")); |
1209 | 1224 |
1210 // Replace the 127.0.0.1 with localhost, which will give us a different | 1225 // Replace the 127.0.0.1 with localhost, which will give us a different |
1211 // site instance. | 1226 // site instance. |
1212 GURL::Replacements replacements; | 1227 GURL::Replacements replacements; |
1213 std::string new_host("localhost"); | 1228 std::string new_host("localhost"); |
1214 replacements.SetHostStr(new_host); | 1229 replacements.SetHostStr(new_host); |
1215 GURL remote_frame = test_server()->GetURL( | 1230 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, | 1379 // 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 | 1380 // just as it was navigating to a real page. That pre-empted the real |
1366 // navigation and visibly sent the tab to swappedout://. | 1381 // navigation and visibly sent the tab to swappedout://. |
1367 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 1382 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, |
1368 DontPreemptNavigationWithFrameTreeUpdate) { | 1383 DontPreemptNavigationWithFrameTreeUpdate) { |
1369 // Start two servers with different sites. | 1384 // Start two servers with different sites. |
1370 ASSERT_TRUE(test_server()->Start()); | 1385 ASSERT_TRUE(test_server()->Start()); |
1371 net::TestServer https_server( | 1386 net::TestServer https_server( |
1372 net::TestServer::TYPE_HTTPS, | 1387 net::TestServer::TYPE_HTTPS, |
1373 net::TestServer::kLocalhost, | 1388 net::TestServer::kLocalhost, |
1374 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 1389 net::TestServer::GetSourceRelativePath( |
| 1390 base::FilePath(FILE_PATH_LITERAL("content/test/data")))); |
1375 ASSERT_TRUE(https_server.Start()); | 1391 ASSERT_TRUE(https_server.Start()); |
1376 | 1392 |
1377 // 1. Load a page that deletes its iframe during unload. | 1393 // 1. Load a page that deletes its iframe during unload. |
1378 NavigateToURL(shell(), | 1394 NavigateToURL(shell(), |
1379 test_server()->GetURL("files/remove_frame_on_unload.html")); | 1395 test_server()->GetURL("files/remove_frame_on_unload.html")); |
1380 | 1396 |
1381 // Get the original SiteInstance for later comparison. | 1397 // Get the original SiteInstance for later comparison. |
1382 scoped_refptr<SiteInstance> orig_site_instance( | 1398 scoped_refptr<SiteInstance> orig_site_instance( |
1383 shell()->web_contents()->GetSiteInstance()); | 1399 shell()->web_contents()->GetSiteInstance()); |
1384 | 1400 |
(...skipping 25 matching lines...) Expand all Loading... |
1410 NavigateToURL(shell(), https_server.GetURL("files/title1.html")); | 1426 NavigateToURL(shell(), https_server.GetURL("files/title1.html")); |
1411 | 1427 |
1412 // Make sure it ends up at the right page. | 1428 // Make sure it ends up at the right page. |
1413 WaitForLoadStop(shell()->web_contents()); | 1429 WaitForLoadStop(shell()->web_contents()); |
1414 EXPECT_EQ(https_server.GetURL("files/title1.html"), | 1430 EXPECT_EQ(https_server.GetURL("files/title1.html"), |
1415 shell()->web_contents()->GetURL()); | 1431 shell()->web_contents()->GetURL()); |
1416 EXPECT_EQ(new_site_instance, shell()->web_contents()->GetSiteInstance()); | 1432 EXPECT_EQ(new_site_instance, shell()->web_contents()->GetSiteInstance()); |
1417 } | 1433 } |
1418 | 1434 |
1419 } // namespace content | 1435 } // namespace content |
OLD | NEW |