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 <set> | 5 #include <set> |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "content/public/test/test_navigation_observer.h" | 27 #include "content/public/test/test_navigation_observer.h" |
28 #include "content/public/test/test_utils.h" | 28 #include "content/public/test/test_utils.h" |
29 #include "content/shell/browser/shell.h" | 29 #include "content/shell/browser/shell.h" |
30 #include "content/test/content_browser_test.h" | 30 #include "content/test/content_browser_test.h" |
31 #include "content/test/content_browser_test_utils.h" | 31 #include "content/test/content_browser_test_utils.h" |
32 #include "net/base/net_util.h" | 32 #include "net/base/net_util.h" |
33 #include "net/test/spawned_test_server/spawned_test_server.h" | 33 #include "net/test/spawned_test_server/spawned_test_server.h" |
34 | 34 |
35 namespace content { | 35 namespace content { |
36 | 36 |
37 class RenderViewHostManagerTest : public ContentBrowserTest { | 37 class RenderFrameHostManagerTest : public ContentBrowserTest { |
38 public: | 38 public: |
39 RenderViewHostManagerTest() {} | 39 RenderFrameHostManagerTest() {} |
40 | 40 |
41 static bool GetFilePathWithHostAndPortReplacement( | 41 static bool GetFilePathWithHostAndPortReplacement( |
42 const std::string& original_file_path, | 42 const std::string& original_file_path, |
43 const net::HostPortPair& host_port_pair, | 43 const net::HostPortPair& host_port_pair, |
44 std::string* replacement_path) { | 44 std::string* replacement_path) { |
45 std::vector<net::SpawnedTestServer::StringPair> replacement_text; | 45 std::vector<net::SpawnedTestServer::StringPair> replacement_text; |
46 replacement_text.push_back( | 46 replacement_text.push_back( |
47 make_pair("REPLACE_WITH_HOST_AND_PORT", host_port_pair.ToString())); | 47 make_pair("REPLACE_WITH_HOST_AND_PORT", host_port_pair.ToString())); |
48 return net::SpawnedTestServer::GetFilePathWithReplacements( | 48 return net::SpawnedTestServer::GetFilePathWithReplacements( |
49 original_file_path, replacement_text, replacement_path); | 49 original_file_path, replacement_text, replacement_path); |
50 } | 50 } |
51 }; | 51 }; |
52 | 52 |
53 // Web pages should not have script access to the swapped out page. | 53 // Web pages should not have script access to the swapped out page. |
54 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 54 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
55 DISABLED_NoScriptAccessAfterSwapOut) { | 55 DISABLED_NoScriptAccessAfterSwapOut) { |
56 // Start two servers with different sites. | 56 // Start two servers with different sites. |
57 ASSERT_TRUE(test_server()->Start()); | 57 ASSERT_TRUE(test_server()->Start()); |
58 net::SpawnedTestServer https_server( | 58 net::SpawnedTestServer https_server( |
59 net::SpawnedTestServer::TYPE_HTTPS, | 59 net::SpawnedTestServer::TYPE_HTTPS, |
60 net::SpawnedTestServer::kLocalhost, | 60 net::SpawnedTestServer::kLocalhost, |
61 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 61 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
62 ASSERT_TRUE(https_server.Start()); | 62 ASSERT_TRUE(https_server.Start()); |
63 | 63 |
64 // Load a page with links that open in a new window. | 64 // Load a page with links that open in a new window. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 success = false; | 112 success = false; |
113 EXPECT_TRUE(ExecuteScriptAndExtractBool( | 113 EXPECT_TRUE(ExecuteScriptAndExtractBool( |
114 shell()->web_contents(), | 114 shell()->web_contents(), |
115 "window.domAutomationController.send(testScriptAccessToWindow());", | 115 "window.domAutomationController.send(testScriptAccessToWindow());", |
116 &success)); | 116 &success)); |
117 EXPECT_FALSE(success); | 117 EXPECT_FALSE(success); |
118 } | 118 } |
119 | 119 |
120 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer | 120 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer |
121 // and target=_blank should create a new SiteInstance. | 121 // and target=_blank should create a new SiteInstance. |
122 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 122 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
123 SwapProcessWithRelNoreferrerAndTargetBlank) { | 123 SwapProcessWithRelNoreferrerAndTargetBlank) { |
124 // Start two servers with different sites. | 124 // Start two servers with different sites. |
125 ASSERT_TRUE(test_server()->Start()); | 125 ASSERT_TRUE(test_server()->Start()); |
126 net::SpawnedTestServer https_server( | 126 net::SpawnedTestServer https_server( |
127 net::SpawnedTestServer::TYPE_HTTPS, | 127 net::SpawnedTestServer::TYPE_HTTPS, |
128 net::SpawnedTestServer::kLocalhost, | 128 net::SpawnedTestServer::kLocalhost, |
129 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 129 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
130 ASSERT_TRUE(https_server.Start()); | 130 ASSERT_TRUE(https_server.Start()); |
131 | 131 |
132 // Load a page with links that open in a new window. | 132 // Load a page with links that open in a new window. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 // Should have a new SiteInstance. | 167 // Should have a new SiteInstance. |
168 scoped_refptr<SiteInstance> noref_blank_site_instance( | 168 scoped_refptr<SiteInstance> noref_blank_site_instance( |
169 new_shell->web_contents()->GetSiteInstance()); | 169 new_shell->web_contents()->GetSiteInstance()); |
170 EXPECT_NE(orig_site_instance, noref_blank_site_instance); | 170 EXPECT_NE(orig_site_instance, noref_blank_site_instance); |
171 } | 171 } |
172 | 172 |
173 // As of crbug.com/69267, we create a new BrowsingInstance (and SiteInstance) | 173 // As of crbug.com/69267, we create a new BrowsingInstance (and SiteInstance) |
174 // for rel=noreferrer links in new windows, even to same site pages and named | 174 // for rel=noreferrer links in new windows, even to same site pages and named |
175 // targets. | 175 // targets. |
176 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 176 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
177 SwapProcessWithSameSiteRelNoreferrer) { | 177 SwapProcessWithSameSiteRelNoreferrer) { |
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::SpawnedTestServer https_server( | 180 net::SpawnedTestServer https_server( |
181 net::SpawnedTestServer::TYPE_HTTPS, | 181 net::SpawnedTestServer::TYPE_HTTPS, |
182 net::SpawnedTestServer::kLocalhost, | 182 net::SpawnedTestServer::kLocalhost, |
183 base::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. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 pending_render_view_host()); | 220 pending_render_view_host()); |
221 | 221 |
222 // Should have a new SiteInstance (in a new BrowsingInstance). | 222 // Should have a new SiteInstance (in a new BrowsingInstance). |
223 scoped_refptr<SiteInstance> noref_blank_site_instance( | 223 scoped_refptr<SiteInstance> noref_blank_site_instance( |
224 new_shell->web_contents()->GetSiteInstance()); | 224 new_shell->web_contents()->GetSiteInstance()); |
225 EXPECT_NE(orig_site_instance, noref_blank_site_instance); | 225 EXPECT_NE(orig_site_instance, noref_blank_site_instance); |
226 } | 226 } |
227 | 227 |
228 // Test for crbug.com/24447. Following a cross-site link with just | 228 // Test for crbug.com/24447. Following a cross-site link with just |
229 // target=_blank should not create a new SiteInstance. | 229 // target=_blank should not create a new SiteInstance. |
230 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 230 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
231 DontSwapProcessWithOnlyTargetBlank) { | 231 DontSwapProcessWithOnlyTargetBlank) { |
232 // Start two servers with different sites. | 232 // Start two servers with different sites. |
233 ASSERT_TRUE(test_server()->Start()); | 233 ASSERT_TRUE(test_server()->Start()); |
234 net::SpawnedTestServer https_server( | 234 net::SpawnedTestServer https_server( |
235 net::SpawnedTestServer::TYPE_HTTPS, | 235 net::SpawnedTestServer::TYPE_HTTPS, |
236 net::SpawnedTestServer::kLocalhost, | 236 net::SpawnedTestServer::kLocalhost, |
237 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 237 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
238 ASSERT_TRUE(https_server.Start()); | 238 ASSERT_TRUE(https_server.Start()); |
239 | 239 |
240 // Load a page with links that open in a new window. | 240 // Load a page with links that open in a new window. |
(...skipping 27 matching lines...) Expand all Loading... |
268 new_shell->web_contents()->GetLastCommittedURL().path()); | 268 new_shell->web_contents()->GetLastCommittedURL().path()); |
269 | 269 |
270 // Should have the same SiteInstance. | 270 // Should have the same SiteInstance. |
271 scoped_refptr<SiteInstance> blank_site_instance( | 271 scoped_refptr<SiteInstance> blank_site_instance( |
272 new_shell->web_contents()->GetSiteInstance()); | 272 new_shell->web_contents()->GetSiteInstance()); |
273 EXPECT_EQ(orig_site_instance, blank_site_instance); | 273 EXPECT_EQ(orig_site_instance, blank_site_instance); |
274 } | 274 } |
275 | 275 |
276 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer | 276 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer |
277 // and no target=_blank should not create a new SiteInstance. | 277 // and no target=_blank should not create a new SiteInstance. |
278 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 278 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
279 DontSwapProcessWithOnlyRelNoreferrer) { | 279 DontSwapProcessWithOnlyRelNoreferrer) { |
280 // Start two servers with different sites. | 280 // Start two servers with different sites. |
281 ASSERT_TRUE(test_server()->Start()); | 281 ASSERT_TRUE(test_server()->Start()); |
282 net::SpawnedTestServer https_server( | 282 net::SpawnedTestServer https_server( |
283 net::SpawnedTestServer::TYPE_HTTPS, | 283 net::SpawnedTestServer::TYPE_HTTPS, |
284 net::SpawnedTestServer::kLocalhost, | 284 net::SpawnedTestServer::kLocalhost, |
285 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 285 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
286 ASSERT_TRUE(https_server.Start()); | 286 ASSERT_TRUE(https_server.Start()); |
287 | 287 |
288 // Load a page with links that open in a new window. | 288 // Load a page with links that open in a new window. |
(...skipping 26 matching lines...) Expand all Loading... |
315 shell()->web_contents()->GetLastCommittedURL().path()); | 315 shell()->web_contents()->GetLastCommittedURL().path()); |
316 | 316 |
317 // Should have the same SiteInstance. | 317 // Should have the same SiteInstance. |
318 scoped_refptr<SiteInstance> noref_site_instance( | 318 scoped_refptr<SiteInstance> noref_site_instance( |
319 shell()->web_contents()->GetSiteInstance()); | 319 shell()->web_contents()->GetSiteInstance()); |
320 EXPECT_EQ(orig_site_instance, noref_site_instance); | 320 EXPECT_EQ(orig_site_instance, noref_site_instance); |
321 } | 321 } |
322 | 322 |
323 // Test for crbug.com/116192. Targeted links should still work after the | 323 // Test for crbug.com/116192. Targeted links should still work after the |
324 // named target window has swapped processes. | 324 // named target window has swapped processes. |
325 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 325 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
326 AllowTargetedNavigationsAfterSwap) { | 326 AllowTargetedNavigationsAfterSwap) { |
327 // Start two servers with different sites. | 327 // Start two servers with different sites. |
328 ASSERT_TRUE(test_server()->Start()); | 328 ASSERT_TRUE(test_server()->Start()); |
329 net::SpawnedTestServer https_server( | 329 net::SpawnedTestServer https_server( |
330 net::SpawnedTestServer::TYPE_HTTPS, | 330 net::SpawnedTestServer::TYPE_HTTPS, |
331 net::SpawnedTestServer::kLocalhost, | 331 net::SpawnedTestServer::kLocalhost, |
332 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 332 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
333 ASSERT_TRUE(https_server.Start()); | 333 ASSERT_TRUE(https_server.Start()); |
334 | 334 |
335 // Load a page with links that open in a new window. | 335 // Load a page with links that open in a new window. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 } | 400 } |
401 | 401 |
402 // Test that setting the opener to null in a window affects cross-process | 402 // Test that setting the opener to null in a window affects cross-process |
403 // navigations, including those to existing entries. http://crbug.com/156669. | 403 // navigations, including those to existing entries. http://crbug.com/156669. |
404 // Flaky on windows: http://crbug.com/291249 | 404 // Flaky on windows: http://crbug.com/291249 |
405 #if defined(OS_WIN) | 405 #if defined(OS_WIN) |
406 #define MAYBE_DisownOpener DISABLED_DisownOpener | 406 #define MAYBE_DisownOpener DISABLED_DisownOpener |
407 #else | 407 #else |
408 #define MAYBE_DisownOpener DisownOpener | 408 #define MAYBE_DisownOpener DisownOpener |
409 #endif | 409 #endif |
410 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, MAYBE_DisownOpener) { | 410 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, MAYBE_DisownOpener) { |
411 // Start two servers with different sites. | 411 // Start two servers with different sites. |
412 ASSERT_TRUE(test_server()->Start()); | 412 ASSERT_TRUE(test_server()->Start()); |
413 net::SpawnedTestServer https_server( | 413 net::SpawnedTestServer https_server( |
414 net::SpawnedTestServer::TYPE_HTTPS, | 414 net::SpawnedTestServer::TYPE_HTTPS, |
415 net::SpawnedTestServer::kLocalhost, | 415 net::SpawnedTestServer::kLocalhost, |
416 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 416 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
417 ASSERT_TRUE(https_server.Start()); | 417 ASSERT_TRUE(https_server.Start()); |
418 | 418 |
419 // Load a page with links that open in a new window. | 419 // Load a page with links that open in a new window. |
420 std::string replacement_path; | 420 std::string replacement_path; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 NavigateToURL(new_shell, https_server.GetURL("files/title1.html")); | 476 NavigateToURL(new_shell, https_server.GetURL("files/title1.html")); |
477 success = false; | 477 success = false; |
478 EXPECT_TRUE(ExecuteScriptAndExtractBool( | 478 EXPECT_TRUE(ExecuteScriptAndExtractBool( |
479 new_shell->web_contents(), | 479 new_shell->web_contents(), |
480 "window.domAutomationController.send(window.opener == null);", | 480 "window.domAutomationController.send(window.opener == null);", |
481 &success)); | 481 &success)); |
482 EXPECT_TRUE(success); | 482 EXPECT_TRUE(success); |
483 } | 483 } |
484 | 484 |
485 // Test that subframes can disown their openers. http://crbug.com/225528. | 485 // Test that subframes can disown their openers. http://crbug.com/225528. |
486 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, DisownSubframeOpener) { | 486 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, DisownSubframeOpener) { |
487 const GURL frame_url("data:text/html,<iframe name=\"foo\"></iframe>"); | 487 const GURL frame_url("data:text/html,<iframe name=\"foo\"></iframe>"); |
488 NavigateToURL(shell(), frame_url); | 488 NavigateToURL(shell(), frame_url); |
489 | 489 |
490 // Give the frame an opener using window.open. | 490 // Give the frame an opener using window.open. |
491 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), | 491 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), |
492 "window.open('about:blank','foo');")); | 492 "window.open('about:blank','foo');")); |
493 | 493 |
494 // Now disown the frame's opener. Shouldn't crash. | 494 // Now disown the frame's opener. Shouldn't crash. |
495 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), | 495 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), |
496 "window.frames[0].opener = null;")); | 496 "window.frames[0].opener = null;")); |
497 } | 497 } |
498 | 498 |
499 // Test for crbug.com/99202. PostMessage calls should still work after | 499 // Test for crbug.com/99202. PostMessage calls should still work after |
500 // navigating the source and target windows to different sites. | 500 // navigating the source and target windows to different sites. |
501 // Specifically: | 501 // Specifically: |
502 // 1) Create 3 windows (opener, "foo", and _blank) and send "foo" cross-process. | 502 // 1) Create 3 windows (opener, "foo", and _blank) and send "foo" cross-process. |
503 // 2) Fail to post a message from "foo" to opener with the wrong target origin. | 503 // 2) Fail to post a message from "foo" to opener with the wrong target origin. |
504 // 3) Post a message from "foo" to opener, which replies back to "foo". | 504 // 3) Post a message from "foo" to opener, which replies back to "foo". |
505 // 4) Post a message from _blank to "foo". | 505 // 4) Post a message from _blank to "foo". |
506 // 5) Post a message from "foo" to a subframe of opener, which replies back. | 506 // 5) Post a message from "foo" to a subframe of opener, which replies back. |
507 // 6) Post a message from _blank to a subframe of "foo". | 507 // 6) Post a message from _blank to a subframe of "foo". |
508 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 508 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
509 SupportCrossProcessPostMessage) { | 509 SupportCrossProcessPostMessage) { |
510 // Start two servers with different sites. | 510 // Start two servers with different sites. |
511 ASSERT_TRUE(test_server()->Start()); | 511 ASSERT_TRUE(test_server()->Start()); |
512 net::SpawnedTestServer https_server( | 512 net::SpawnedTestServer https_server( |
513 net::SpawnedTestServer::TYPE_HTTPS, | 513 net::SpawnedTestServer::TYPE_HTTPS, |
514 net::SpawnedTestServer::kLocalhost, | 514 net::SpawnedTestServer::kLocalhost, |
515 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 515 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
516 ASSERT_TRUE(https_server.Start()); | 516 ASSERT_TRUE(https_server.Start()); |
517 | 517 |
518 // Load a page with links that open in a new window. | 518 // Load a page with links that open in a new window. |
519 std::string replacement_path; | 519 std::string replacement_path; |
520 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 520 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
521 "files/click-noreferrer-links.html", | 521 "files/click-noreferrer-links.html", |
522 https_server.host_port_pair(), | 522 https_server.host_port_pair(), |
523 &replacement_path)); | 523 &replacement_path)); |
524 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 524 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
525 | 525 |
526 // Get the original SiteInstance and RVHM for later comparison. | 526 // Get the original SiteInstance and RVHM for later comparison. |
527 WebContents* opener_contents = shell()->web_contents(); | 527 WebContents* opener_contents = shell()->web_contents(); |
528 scoped_refptr<SiteInstance> orig_site_instance( | 528 scoped_refptr<SiteInstance> orig_site_instance( |
529 opener_contents->GetSiteInstance()); | 529 opener_contents->GetSiteInstance()); |
530 EXPECT_TRUE(orig_site_instance.get() != NULL); | 530 EXPECT_TRUE(orig_site_instance.get() != NULL); |
531 RenderViewHostManager* opener_manager = static_cast<WebContentsImpl*>( | 531 RenderFrameHostManager* opener_manager = static_cast<WebContentsImpl*>( |
532 opener_contents)->GetRenderManagerForTesting(); | 532 opener_contents)->GetRenderManagerForTesting(); |
533 | 533 |
534 // 1) Open two more windows, one named. These initially have openers but no | 534 // 1) Open two more windows, one named. These initially have openers but no |
535 // reference to each other. We will later post a message between them. | 535 // reference to each other. We will later post a message between them. |
536 | 536 |
537 // First, a named target=foo window. | 537 // First, a named target=foo window. |
538 ShellAddedObserver new_shell_observer; | 538 ShellAddedObserver new_shell_observer; |
539 bool success = false; | 539 bool success = false; |
540 EXPECT_TRUE(ExecuteScriptAndExtractBool( | 540 EXPECT_TRUE(ExecuteScriptAndExtractBool( |
541 opener_contents, | 541 opener_contents, |
(...skipping 22 matching lines...) Expand all Loading... |
564 EXPECT_TRUE(success); | 564 EXPECT_TRUE(success); |
565 | 565 |
566 // Wait for the navigation in the new window to finish, if it hasn't, then | 566 // Wait for the navigation in the new window to finish, if it hasn't, then |
567 // send it to post_message.html on the original site. | 567 // send it to post_message.html on the original site. |
568 Shell* new_shell2 = new_shell_observer2.GetShell(); | 568 Shell* new_shell2 = new_shell_observer2.GetShell(); |
569 WebContents* new_contents = new_shell2->web_contents(); | 569 WebContents* new_contents = new_shell2->web_contents(); |
570 WaitForLoadStop(new_contents); | 570 WaitForLoadStop(new_contents); |
571 EXPECT_EQ("/files/title2.html", new_contents->GetLastCommittedURL().path()); | 571 EXPECT_EQ("/files/title2.html", new_contents->GetLastCommittedURL().path()); |
572 NavigateToURL(new_shell2, test_server()->GetURL("files/post_message.html")); | 572 NavigateToURL(new_shell2, test_server()->GetURL("files/post_message.html")); |
573 EXPECT_EQ(orig_site_instance, new_contents->GetSiteInstance()); | 573 EXPECT_EQ(orig_site_instance, new_contents->GetSiteInstance()); |
574 RenderViewHostManager* new_manager = | 574 RenderFrameHostManager* new_manager = |
575 static_cast<WebContentsImpl*>(new_contents)->GetRenderManagerForTesting(); | 575 static_cast<WebContentsImpl*>(new_contents)->GetRenderManagerForTesting(); |
576 | 576 |
577 // We now have three windows. The opener should have a swapped out RVH | 577 // We now have three windows. The opener should have a swapped out RVH |
578 // for the new SiteInstance, but the _blank window should not. | 578 // for the new SiteInstance, but the _blank window should not. |
579 EXPECT_EQ(3u, Shell::windows().size()); | 579 EXPECT_EQ(3u, Shell::windows().size()); |
580 EXPECT_TRUE( | 580 EXPECT_TRUE( |
581 opener_manager->GetSwappedOutRenderViewHost(foo_site_instance.get())); | 581 opener_manager->GetSwappedOutRenderViewHost(foo_site_instance.get())); |
582 EXPECT_FALSE( | 582 EXPECT_FALSE( |
583 new_manager->GetSwappedOutRenderViewHost(foo_site_instance.get())); | 583 new_manager->GetSwappedOutRenderViewHost(foo_site_instance.get())); |
584 | 584 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 | 645 |
646 // Test for crbug.com/278336. MessagePorts should work cross-process. I.e., | 646 // Test for crbug.com/278336. MessagePorts should work cross-process. I.e., |
647 // messages which contain Transferables and get intercepted by | 647 // messages which contain Transferables and get intercepted by |
648 // RenderViewImpl::willCheckAndDispatchMessageEvent (because the RenderView is | 648 // RenderViewImpl::willCheckAndDispatchMessageEvent (because the RenderView is |
649 // swapped out) should work. | 649 // swapped out) should work. |
650 // Specifically: | 650 // Specifically: |
651 // 1) Create 2 windows (opener and "foo") and send "foo" cross-process. | 651 // 1) Create 2 windows (opener and "foo") and send "foo" cross-process. |
652 // 2) Post a message containing a message port from opener to "foo". | 652 // 2) Post a message containing a message port from opener to "foo". |
653 // 3) Post a message from "foo" back to opener via the passed message port. | 653 // 3) Post a message from "foo" back to opener via the passed message port. |
654 // The test will be enabled when the feature implementation lands. | 654 // The test will be enabled when the feature implementation lands. |
655 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 655 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
656 SupportCrossProcessPostMessageWithMessagePort) { | 656 SupportCrossProcessPostMessageWithMessagePort) { |
657 // Start two servers with different sites. | 657 // Start two servers with different sites. |
658 ASSERT_TRUE(test_server()->Start()); | 658 ASSERT_TRUE(test_server()->Start()); |
659 net::SpawnedTestServer https_server( | 659 net::SpawnedTestServer https_server( |
660 net::SpawnedTestServer::TYPE_HTTPS, | 660 net::SpawnedTestServer::TYPE_HTTPS, |
661 net::SpawnedTestServer::kLocalhost, | 661 net::SpawnedTestServer::kLocalhost, |
662 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 662 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
663 ASSERT_TRUE(https_server.Start()); | 663 ASSERT_TRUE(https_server.Start()); |
664 | 664 |
665 // Load a page with links that open in a new window. | 665 // Load a page with links that open in a new window. |
666 std::string replacement_path; | 666 std::string replacement_path; |
667 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( | 667 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( |
668 "files/click-noreferrer-links.html", | 668 "files/click-noreferrer-links.html", |
669 https_server.host_port_pair(), | 669 https_server.host_port_pair(), |
670 &replacement_path)); | 670 &replacement_path)); |
671 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); | 671 NavigateToURL(shell(), test_server()->GetURL(replacement_path)); |
672 | 672 |
673 // Get the original SiteInstance and RVHM for later comparison. | 673 // Get the original SiteInstance and RVHM for later comparison. |
674 WebContents* opener_contents = shell()->web_contents(); | 674 WebContents* opener_contents = shell()->web_contents(); |
675 scoped_refptr<SiteInstance> orig_site_instance( | 675 scoped_refptr<SiteInstance> orig_site_instance( |
676 opener_contents->GetSiteInstance()); | 676 opener_contents->GetSiteInstance()); |
677 EXPECT_TRUE(orig_site_instance.get() != NULL); | 677 EXPECT_TRUE(orig_site_instance.get() != NULL); |
678 RenderViewHostManager* opener_manager = static_cast<WebContentsImpl*>( | 678 RenderFrameHostManager* opener_manager = static_cast<WebContentsImpl*>( |
679 opener_contents)->GetRenderManagerForTesting(); | 679 opener_contents)->GetRenderManagerForTesting(); |
680 | 680 |
681 // 1) Open a named target=foo window. We will later post a message between the | 681 // 1) Open a named target=foo window. We will later post a message between the |
682 // opener and the new window. | 682 // opener and the new window. |
683 ShellAddedObserver new_shell_observer; | 683 ShellAddedObserver new_shell_observer; |
684 bool success = false; | 684 bool success = false; |
685 EXPECT_TRUE(ExecuteScriptAndExtractBool( | 685 EXPECT_TRUE(ExecuteScriptAndExtractBool( |
686 opener_contents, | 686 opener_contents, |
687 "window.domAutomationController.send(clickSameSiteTargetedLink());", | 687 "window.domAutomationController.send(clickSameSiteTargetedLink());", |
688 &success)); | 688 &success)); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 &foo_received_messages_with_port)); | 741 &foo_received_messages_with_port)); |
742 EXPECT_EQ(1, foo_received_messages); | 742 EXPECT_EQ(1, foo_received_messages); |
743 EXPECT_EQ(1, foo_received_messages_with_port); | 743 EXPECT_EQ(1, foo_received_messages_with_port); |
744 EXPECT_EQ(1, opener_received_messages_via_port); | 744 EXPECT_EQ(1, opener_received_messages_via_port); |
745 EXPECT_EQ(ASCIIToUTF16("msg-with-port"), foo_contents->GetTitle()); | 745 EXPECT_EQ(ASCIIToUTF16("msg-with-port"), foo_contents->GetTitle()); |
746 EXPECT_EQ(ASCIIToUTF16("msg-back-via-port"), opener_contents->GetTitle()); | 746 EXPECT_EQ(ASCIIToUTF16("msg-back-via-port"), opener_contents->GetTitle()); |
747 } | 747 } |
748 | 748 |
749 // Test for crbug.com/116192. Navigations to a window's opener should | 749 // Test for crbug.com/116192. Navigations to a window's opener should |
750 // still work after a process swap. | 750 // still work after a process swap. |
751 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 751 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
752 AllowTargetedNavigationsInOpenerAfterSwap) { | 752 AllowTargetedNavigationsInOpenerAfterSwap) { |
753 // Start two servers with different sites. | 753 // Start two servers with different sites. |
754 ASSERT_TRUE(test_server()->Start()); | 754 ASSERT_TRUE(test_server()->Start()); |
755 net::SpawnedTestServer https_server( | 755 net::SpawnedTestServer https_server( |
756 net::SpawnedTestServer::TYPE_HTTPS, | 756 net::SpawnedTestServer::TYPE_HTTPS, |
757 net::SpawnedTestServer::kLocalhost, | 757 net::SpawnedTestServer::kLocalhost, |
758 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 758 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
759 ASSERT_TRUE(https_server.Start()); | 759 ASSERT_TRUE(https_server.Start()); |
760 | 760 |
761 // Load a page with links that open in a new window. | 761 // Load a page with links that open in a new window. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 | 809 |
810 // Should have swapped back into this process. | 810 // Should have swapped back into this process. |
811 scoped_refptr<SiteInstance> revisit_site_instance( | 811 scoped_refptr<SiteInstance> revisit_site_instance( |
812 shell()->web_contents()->GetSiteInstance()); | 812 shell()->web_contents()->GetSiteInstance()); |
813 EXPECT_EQ(orig_site_instance, revisit_site_instance); | 813 EXPECT_EQ(orig_site_instance, revisit_site_instance); |
814 } | 814 } |
815 | 815 |
816 // Test that opening a new window in the same SiteInstance and then navigating | 816 // Test that opening a new window in the same SiteInstance and then navigating |
817 // both windows to a different SiteInstance allows the first process to exit. | 817 // both windows to a different SiteInstance allows the first process to exit. |
818 // See http://crbug.com/126333. | 818 // See http://crbug.com/126333. |
819 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 819 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
820 ProcessExitWithSwappedOutViews) { | 820 ProcessExitWithSwappedOutViews) { |
821 // Start two servers with different sites. | 821 // Start two servers with different sites. |
822 ASSERT_TRUE(test_server()->Start()); | 822 ASSERT_TRUE(test_server()->Start()); |
823 net::SpawnedTestServer https_server( | 823 net::SpawnedTestServer https_server( |
824 net::SpawnedTestServer::TYPE_HTTPS, | 824 net::SpawnedTestServer::TYPE_HTTPS, |
825 net::SpawnedTestServer::kLocalhost, | 825 net::SpawnedTestServer::kLocalhost, |
826 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 826 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
827 ASSERT_TRUE(https_server.Start()); | 827 ASSERT_TRUE(https_server.Start()); |
828 | 828 |
829 // Load a page with links that open in a new window. | 829 // Load a page with links that open in a new window. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 Source<RenderProcessHost>(orig_process)); | 877 Source<RenderProcessHost>(orig_process)); |
878 NavigateToURL(shell(), https_server.GetURL("files/title1.html")); | 878 NavigateToURL(shell(), https_server.GetURL("files/title1.html")); |
879 exit_observer.Wait(); | 879 exit_observer.Wait(); |
880 scoped_refptr<SiteInstance> new_site_instance2( | 880 scoped_refptr<SiteInstance> new_site_instance2( |
881 shell()->web_contents()->GetSiteInstance()); | 881 shell()->web_contents()->GetSiteInstance()); |
882 EXPECT_EQ(new_site_instance, new_site_instance2); | 882 EXPECT_EQ(new_site_instance, new_site_instance2); |
883 } | 883 } |
884 | 884 |
885 // Test for crbug.com/76666. A cross-site navigation that fails with a 204 | 885 // Test for crbug.com/76666. A cross-site navigation that fails with a 204 |
886 // error should not make us ignore future renderer-initiated navigations. | 886 // error should not make us ignore future renderer-initiated navigations. |
887 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, ClickLinkAfter204Error) { | 887 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, ClickLinkAfter204Error) { |
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::SpawnedTestServer https_server( | 890 net::SpawnedTestServer https_server( |
891 net::SpawnedTestServer::TYPE_HTTPS, | 891 net::SpawnedTestServer::TYPE_HTTPS, |
892 net::SpawnedTestServer::kLocalhost, | 892 net::SpawnedTestServer::kLocalhost, |
893 base::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 // Load a page with links that open in a new window. | 896 // Load a page with links that open in a new window. |
897 // The links will point to the HTTPS server. | 897 // The links will point to the HTTPS server. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 // Should have the same SiteInstance. | 941 // Should have the same SiteInstance. |
942 scoped_refptr<SiteInstance> noref_site_instance( | 942 scoped_refptr<SiteInstance> noref_site_instance( |
943 shell()->web_contents()->GetSiteInstance()); | 943 shell()->web_contents()->GetSiteInstance()); |
944 EXPECT_EQ(orig_site_instance, noref_site_instance); | 944 EXPECT_EQ(orig_site_instance, noref_site_instance); |
945 } | 945 } |
946 | 946 |
947 // Test for crbug.com/9682. We should show the URL for a pending renderer- | 947 // Test for crbug.com/9682. We should show the URL for a pending renderer- |
948 // initiated navigation in a new tab, until the content of the initial | 948 // initiated navigation in a new tab, until the content of the initial |
949 // about:blank page is modified by another window. At that point, we should | 949 // about:blank page is modified by another window. At that point, we should |
950 // revert to showing about:blank to prevent a URL spoof. | 950 // revert to showing about:blank to prevent a URL spoof. |
951 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, ShowLoadingURLUntilSpoof) { | 951 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, ShowLoadingURLUntilSpoof) { |
952 ASSERT_TRUE(test_server()->Start()); | 952 ASSERT_TRUE(test_server()->Start()); |
953 | 953 |
954 // Load a page that can open a URL that won't commit in a new window. | 954 // Load a page that can open a URL that won't commit in a new window. |
955 NavigateToURL( | 955 NavigateToURL( |
956 shell(), test_server()->GetURL("files/click-nocontent-link.html")); | 956 shell(), test_server()->GetURL("files/click-nocontent-link.html")); |
957 WebContents* orig_contents = shell()->web_contents(); | 957 WebContents* orig_contents = shell()->web_contents(); |
958 | 958 |
959 // Click a /nocontent link that opens in a new window but never commits. | 959 // Click a /nocontent link that opens in a new window but never commits. |
960 ShellAddedObserver new_shell_observer; | 960 ShellAddedObserver new_shell_observer; |
961 bool success = false; | 961 bool success = false; |
(...skipping 28 matching lines...) Expand all Loading... |
990 // At this point, we should no longer be showing the destination URL. | 990 // At this point, we should no longer be showing the destination URL. |
991 // The visible entry should be null, resulting in about:blank in the address | 991 // The visible entry should be null, resulting in about:blank in the address |
992 // bar. | 992 // bar. |
993 EXPECT_FALSE(contents->GetController().GetVisibleEntry()); | 993 EXPECT_FALSE(contents->GetController().GetVisibleEntry()); |
994 } | 994 } |
995 | 995 |
996 // Test for crbug.com/9682. We should not show the URL for a pending renderer- | 996 // Test for crbug.com/9682. We should not show the URL for a pending renderer- |
997 // initiated navigation in a new tab if it is not the initial navigation. In | 997 // initiated navigation in a new tab if it is not the initial navigation. In |
998 // this case, the renderer will not notify us of a modification, so we cannot | 998 // this case, the renderer will not notify us of a modification, so we cannot |
999 // show the pending URL without allowing a spoof. | 999 // show the pending URL without allowing a spoof. |
1000 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 1000 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
1001 DontShowLoadingURLIfNotInitialNav) { | 1001 DontShowLoadingURLIfNotInitialNav) { |
1002 ASSERT_TRUE(test_server()->Start()); | 1002 ASSERT_TRUE(test_server()->Start()); |
1003 | 1003 |
1004 // Load a page that can open a URL that won't commit in a new window. | 1004 // Load a page that can open a URL that won't commit in a new window. |
1005 NavigateToURL( | 1005 NavigateToURL( |
1006 shell(), test_server()->GetURL("files/click-nocontent-link.html")); | 1006 shell(), test_server()->GetURL("files/click-nocontent-link.html")); |
1007 WebContents* orig_contents = shell()->web_contents(); | 1007 WebContents* orig_contents = shell()->web_contents(); |
1008 | 1008 |
1009 // Click a /nocontent link that opens in a new window but never commits. | 1009 // Click a /nocontent link that opens in a new window but never commits. |
1010 // By using an onclick handler that first creates the window, the slow | 1010 // By using an onclick handler that first creates the window, the slow |
(...skipping 13 matching lines...) Expand all Loading... |
1024 // Ensure the destination URL is not visible, because it is not the initial | 1024 // Ensure the destination URL is not visible, because it is not the initial |
1025 // navigation. | 1025 // navigation. |
1026 WebContents* contents = new_shell->web_contents(); | 1026 WebContents* contents = new_shell->web_contents(); |
1027 EXPECT_FALSE(contents->GetController().IsInitialNavigation()); | 1027 EXPECT_FALSE(contents->GetController().IsInitialNavigation()); |
1028 EXPECT_FALSE(contents->GetController().GetVisibleEntry()); | 1028 EXPECT_FALSE(contents->GetController().GetVisibleEntry()); |
1029 } | 1029 } |
1030 | 1030 |
1031 // Test for http://crbug.com/93427. Ensure that cross-site navigations | 1031 // Test for http://crbug.com/93427. Ensure that cross-site navigations |
1032 // do not cause back/forward navigations to be considered stale by the | 1032 // do not cause back/forward navigations to be considered stale by the |
1033 // renderer. | 1033 // renderer. |
1034 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, BackForwardNotStale) { | 1034 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, BackForwardNotStale) { |
1035 NavigateToURL(shell(), GURL(kAboutBlankURL)); | 1035 NavigateToURL(shell(), GURL(kAboutBlankURL)); |
1036 | 1036 |
1037 // Start two servers with different sites. | 1037 // Start two servers with different sites. |
1038 ASSERT_TRUE(test_server()->Start()); | 1038 ASSERT_TRUE(test_server()->Start()); |
1039 net::SpawnedTestServer https_server( | 1039 net::SpawnedTestServer https_server( |
1040 net::SpawnedTestServer::TYPE_HTTPS, | 1040 net::SpawnedTestServer::TYPE_HTTPS, |
1041 net::SpawnedTestServer::kLocalhost, | 1041 net::SpawnedTestServer::kLocalhost, |
1042 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 1042 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
1043 ASSERT_TRUE(https_server.Start()); | 1043 ASSERT_TRUE(https_server.Start()); |
1044 | 1044 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 // Now go forward directly to B3. Shouldn't be left spinning. | 1122 // Now go forward directly to B3. Shouldn't be left spinning. |
1123 { | 1123 { |
1124 TestNavigationObserver forward_nav_load_observer(shell()->web_contents()); | 1124 TestNavigationObserver forward_nav_load_observer(shell()->web_contents()); |
1125 shell()->web_contents()->GetController().GoToIndex(4); | 1125 shell()->web_contents()->GetController().GoToIndex(4); |
1126 forward_nav_load_observer.Wait(); | 1126 forward_nav_load_observer.Wait(); |
1127 } | 1127 } |
1128 } | 1128 } |
1129 | 1129 |
1130 // Test for http://crbug.com/130016. | 1130 // Test for http://crbug.com/130016. |
1131 // Swapping out a render view should update its visiblity state. | 1131 // Swapping out a render view should update its visiblity state. |
1132 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 1132 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
1133 SwappedOutViewHasCorrectVisibilityState) { | 1133 SwappedOutViewHasCorrectVisibilityState) { |
1134 // Start two servers with different sites. | 1134 // Start two servers with different sites. |
1135 ASSERT_TRUE(test_server()->Start()); | 1135 ASSERT_TRUE(test_server()->Start()); |
1136 net::SpawnedTestServer https_server( | 1136 net::SpawnedTestServer https_server( |
1137 net::SpawnedTestServer::TYPE_HTTPS, | 1137 net::SpawnedTestServer::TYPE_HTTPS, |
1138 net::SpawnedTestServer::kLocalhost, | 1138 net::SpawnedTestServer::kLocalhost, |
1139 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 1139 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
1140 ASSERT_TRUE(https_server.Start()); | 1140 ASSERT_TRUE(https_server.Start()); |
1141 | 1141 |
1142 // Load a page with links that open in a new window. | 1142 // Load a page with links that open in a new window. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 } | 1224 } |
1225 | 1225 |
1226 std::set<RenderViewHost*> watched_render_view_hosts_; | 1226 std::set<RenderViewHost*> watched_render_view_hosts_; |
1227 }; | 1227 }; |
1228 | 1228 |
1229 // Test for crbug.com/90867. Make sure we don't leak render view hosts since | 1229 // Test for crbug.com/90867. Make sure we don't leak render view hosts since |
1230 // they may cause crashes or memory corruptions when trying to call dead | 1230 // they may cause crashes or memory corruptions when trying to call dead |
1231 // delegate_. This test also verifies crbug.com/117420 and crbug.com/143255 to | 1231 // delegate_. This test also verifies crbug.com/117420 and crbug.com/143255 to |
1232 // ensure that a separate SiteInstance is created when navigating to view-source | 1232 // ensure that a separate SiteInstance is created when navigating to view-source |
1233 // URLs, regardless of current URL. | 1233 // URLs, regardless of current URL. |
1234 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, LeakingRenderViewHosts) { | 1234 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, LeakingRenderViewHosts) { |
1235 // Start two servers with different sites. | 1235 // Start two servers with different sites. |
1236 ASSERT_TRUE(test_server()->Start()); | 1236 ASSERT_TRUE(test_server()->Start()); |
1237 net::SpawnedTestServer https_server( | 1237 net::SpawnedTestServer https_server( |
1238 net::SpawnedTestServer::TYPE_HTTPS, | 1238 net::SpawnedTestServer::TYPE_HTTPS, |
1239 net::SpawnedTestServer::kLocalhost, | 1239 net::SpawnedTestServer::kLocalhost, |
1240 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 1240 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
1241 ASSERT_TRUE(https_server.Start()); | 1241 ASSERT_TRUE(https_server.Start()); |
1242 | 1242 |
1243 // Observe the created render_view_host's to make sure they will not leak. | 1243 // Observe the created render_view_host's to make sure they will not leak. |
1244 RenderViewHostDestructionObserver rvh_observers(shell()->web_contents()); | 1244 RenderViewHostDestructionObserver rvh_observers(shell()->web_contents()); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1299 // interrupt the intended navigation and show swappedout:// instead. | 1299 // interrupt the intended navigation and show swappedout:// instead. |
1300 // Specifically: | 1300 // Specifically: |
1301 // 1) Open 2 tabs in an HTTP SiteInstance, with a subframe in the opener. | 1301 // 1) Open 2 tabs in an HTTP SiteInstance, with a subframe in the opener. |
1302 // 2) Send the second tab to a different HTTPS SiteInstance. | 1302 // 2) Send the second tab to a different HTTPS SiteInstance. |
1303 // This creates a swapped out opener for the first tab in the HTTPS process. | 1303 // This creates a swapped out opener for the first tab in the HTTPS process. |
1304 // 3) Navigate the first tab to the HTTPS SiteInstance, and have the first | 1304 // 3) Navigate the first tab to the HTTPS SiteInstance, and have the first |
1305 // tab's unload handler remove its frame. | 1305 // tab's unload handler remove its frame. |
1306 // This used to cause an update to the frame tree of the swapped out RV, | 1306 // This used to cause an update to the frame tree of the swapped out RV, |
1307 // just as it was navigating to a real page. That pre-empted the real | 1307 // just as it was navigating to a real page. That pre-empted the real |
1308 // navigation and visibly sent the tab to swappedout://. | 1308 // navigation and visibly sent the tab to swappedout://. |
1309 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, | 1309 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
1310 DontPreemptNavigationWithFrameTreeUpdate) { | 1310 DontPreemptNavigationWithFrameTreeUpdate) { |
1311 // Start two servers with different sites. | 1311 // Start two servers with different sites. |
1312 ASSERT_TRUE(test_server()->Start()); | 1312 ASSERT_TRUE(test_server()->Start()); |
1313 net::SpawnedTestServer https_server( | 1313 net::SpawnedTestServer https_server( |
1314 net::SpawnedTestServer::TYPE_HTTPS, | 1314 net::SpawnedTestServer::TYPE_HTTPS, |
1315 net::SpawnedTestServer::kLocalhost, | 1315 net::SpawnedTestServer::kLocalhost, |
1316 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 1316 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
1317 ASSERT_TRUE(https_server.Start()); | 1317 ASSERT_TRUE(https_server.Start()); |
1318 | 1318 |
1319 // 1. Load a page that deletes its iframe during unload. | 1319 // 1. Load a page that deletes its iframe during unload. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 NavigateToURL(shell(), https_server.GetURL("files/title1.html")); | 1352 NavigateToURL(shell(), https_server.GetURL("files/title1.html")); |
1353 | 1353 |
1354 // Make sure it ends up at the right page. | 1354 // Make sure it ends up at the right page. |
1355 WaitForLoadStop(shell()->web_contents()); | 1355 WaitForLoadStop(shell()->web_contents()); |
1356 EXPECT_EQ(https_server.GetURL("files/title1.html"), | 1356 EXPECT_EQ(https_server.GetURL("files/title1.html"), |
1357 shell()->web_contents()->GetLastCommittedURL()); | 1357 shell()->web_contents()->GetLastCommittedURL()); |
1358 EXPECT_EQ(new_site_instance, shell()->web_contents()->GetSiteInstance()); | 1358 EXPECT_EQ(new_site_instance, shell()->web_contents()->GetSiteInstance()); |
1359 } | 1359 } |
1360 | 1360 |
1361 } // namespace content | 1361 } // namespace content |
OLD | NEW |