OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <set> | 5 #include <set> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 Shell* new_shell = new_shell_observer.GetShell(); | 321 Shell* new_shell = new_shell_observer.GetShell(); |
322 | 322 |
323 // Wait for the cross-site transition in the new tab to finish. | 323 // Wait for the cross-site transition in the new tab to finish. |
324 EXPECT_TRUE(WaitForLoadStop(new_shell->web_contents())); | 324 EXPECT_TRUE(WaitForLoadStop(new_shell->web_contents())); |
325 EXPECT_EQ("/files/title2.html", | 325 EXPECT_EQ("/files/title2.html", |
326 new_shell->web_contents()->GetLastCommittedURL().path()); | 326 new_shell->web_contents()->GetLastCommittedURL().path()); |
327 | 327 |
328 // Should have the same SiteInstance unless we're in site-per-process mode. | 328 // Should have the same SiteInstance unless we're in site-per-process mode. |
329 scoped_refptr<SiteInstance> blank_site_instance( | 329 scoped_refptr<SiteInstance> blank_site_instance( |
330 new_shell->web_contents()->GetSiteInstance()); | 330 new_shell->web_contents()->GetSiteInstance()); |
331 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 331 if (AreAllSitesIsolatedForTesting()) |
332 switches::kSitePerProcess)) | 332 EXPECT_NE(orig_site_instance, blank_site_instance); |
| 333 else |
333 EXPECT_EQ(orig_site_instance, blank_site_instance); | 334 EXPECT_EQ(orig_site_instance, blank_site_instance); |
334 else | |
335 EXPECT_NE(orig_site_instance, blank_site_instance); | |
336 } | 335 } |
337 | 336 |
338 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer | 337 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer |
339 // and no target=_blank should not create a new SiteInstance. | 338 // and no target=_blank should not create a new SiteInstance. |
340 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, | 339 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
341 DontSwapProcessWithOnlyRelNoreferrer) { | 340 DontSwapProcessWithOnlyRelNoreferrer) { |
342 StartServer(); | 341 StartServer(); |
343 | 342 |
344 // Load a page with links that open in a new window. | 343 // Load a page with links that open in a new window. |
345 std::string replacement_path; | 344 std::string replacement_path; |
(...skipping 20 matching lines...) Expand all Loading... |
366 WaitForLoadStop(shell()->web_contents()); | 365 WaitForLoadStop(shell()->web_contents()); |
367 | 366 |
368 // Opens in same window. | 367 // Opens in same window. |
369 EXPECT_EQ(1u, Shell::windows().size()); | 368 EXPECT_EQ(1u, Shell::windows().size()); |
370 EXPECT_EQ("/files/title2.html", | 369 EXPECT_EQ("/files/title2.html", |
371 shell()->web_contents()->GetLastCommittedURL().path()); | 370 shell()->web_contents()->GetLastCommittedURL().path()); |
372 | 371 |
373 // Should have the same SiteInstance unless we're in site-per-process mode. | 372 // Should have the same SiteInstance unless we're in site-per-process mode. |
374 scoped_refptr<SiteInstance> noref_site_instance( | 373 scoped_refptr<SiteInstance> noref_site_instance( |
375 shell()->web_contents()->GetSiteInstance()); | 374 shell()->web_contents()->GetSiteInstance()); |
376 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 375 if (AreAllSitesIsolatedForTesting()) |
377 switches::kSitePerProcess)) | 376 EXPECT_NE(orig_site_instance, noref_site_instance); |
| 377 else |
378 EXPECT_EQ(orig_site_instance, noref_site_instance); | 378 EXPECT_EQ(orig_site_instance, noref_site_instance); |
379 else | |
380 EXPECT_NE(orig_site_instance, noref_site_instance); | |
381 } | 379 } |
382 | 380 |
383 // Test for crbug.com/116192. Targeted links should still work after the | 381 // Test for crbug.com/116192. Targeted links should still work after the |
384 // named target window has swapped processes. | 382 // named target window has swapped processes. |
385 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, | 383 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
386 AllowTargetedNavigationsAfterSwap) { | 384 AllowTargetedNavigationsAfterSwap) { |
387 StartServer(); | 385 StartServer(); |
388 | 386 |
389 // Load a page with links that open in a new window. | 387 // Load a page with links that open in a new window. |
390 std::string replacement_path; | 388 std::string replacement_path; |
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1931 EXPECT_FALSE(opener_rfph->is_render_frame_proxy_live()); | 1929 EXPECT_FALSE(opener_rfph->is_render_frame_proxy_live()); |
1932 | 1930 |
1933 // Re-navigate the popup to the same URL and check that this recreates the | 1931 // Re-navigate the popup to the same URL and check that this recreates the |
1934 // opener's swapped out RVH and proxy in the foo.com SiteInstance. | 1932 // opener's swapped out RVH and proxy in the foo.com SiteInstance. |
1935 EXPECT_TRUE(NavigateToURL(new_shell, cross_site_url)); | 1933 EXPECT_TRUE(NavigateToURL(new_shell, cross_site_url)); |
1936 EXPECT_TRUE(opener_rvh->IsRenderViewLive()); | 1934 EXPECT_TRUE(opener_rvh->IsRenderViewLive()); |
1937 EXPECT_TRUE(opener_rfph->is_render_frame_proxy_live()); | 1935 EXPECT_TRUE(opener_rfph->is_render_frame_proxy_live()); |
1938 } | 1936 } |
1939 | 1937 |
1940 } // namespace content | 1938 } // namespace content |
OLD | NEW |