Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: content/browser/frame_host/render_frame_host_manager_browsertest.cc

Issue 635933002: Fix RenderFrameHostManagerTest.DontSwapProcessWithOnlyTargetBlank for OOPIF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 EXPECT_FALSE(web_contents->GetRenderManagerForTesting()-> 246 EXPECT_FALSE(web_contents->GetRenderManagerForTesting()->
247 pending_render_view_host()); 247 pending_render_view_host());
248 248
249 // Should have a new SiteInstance (in a new BrowsingInstance). 249 // Should have a new SiteInstance (in a new BrowsingInstance).
250 scoped_refptr<SiteInstance> noref_blank_site_instance( 250 scoped_refptr<SiteInstance> noref_blank_site_instance(
251 new_shell->web_contents()->GetSiteInstance()); 251 new_shell->web_contents()->GetSiteInstance());
252 EXPECT_NE(orig_site_instance, noref_blank_site_instance); 252 EXPECT_NE(orig_site_instance, noref_blank_site_instance);
253 } 253 }
254 254
255 // Test for crbug.com/24447. Following a cross-site link with just 255 // Test for crbug.com/24447. Following a cross-site link with just
256 // target=_blank should not create a new SiteInstance. 256 // target=_blank should not create a new SiteInstance, unless we
257 // are running in --site-per-process mode.
257 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, 258 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest,
258 DontSwapProcessWithOnlyTargetBlank) { 259 DontSwapProcessWithOnlyTargetBlank) {
259 StartServer(); 260 StartServer();
260 261
261 // Load a page with links that open in a new window. 262 // Load a page with links that open in a new window.
262 std::string replacement_path; 263 std::string replacement_path;
263 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement( 264 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
264 "files/click-noreferrer-links.html", 265 "files/click-noreferrer-links.html",
265 foo_host_port_, 266 foo_host_port_,
266 &replacement_path)); 267 &replacement_path));
(...skipping 14 matching lines...) Expand all
281 EXPECT_TRUE(success); 282 EXPECT_TRUE(success);
282 283
283 // Wait for the window to open. 284 // Wait for the window to open.
284 Shell* new_shell = new_shell_observer.GetShell(); 285 Shell* new_shell = new_shell_observer.GetShell();
285 286
286 // Wait for the cross-site transition in the new tab to finish. 287 // Wait for the cross-site transition in the new tab to finish.
287 WaitForLoadStop(new_shell->web_contents()); 288 WaitForLoadStop(new_shell->web_contents());
288 EXPECT_EQ("/files/title2.html", 289 EXPECT_EQ("/files/title2.html",
289 new_shell->web_contents()->GetLastCommittedURL().path()); 290 new_shell->web_contents()->GetLastCommittedURL().path());
290 291
291 // Should have the same SiteInstance. 292 // Should have the same SiteInstance unless we're in site-per-process mode.
292 scoped_refptr<SiteInstance> blank_site_instance( 293 scoped_refptr<SiteInstance> blank_site_instance(
293 new_shell->web_contents()->GetSiteInstance()); 294 new_shell->web_contents()->GetSiteInstance());
294 EXPECT_EQ(orig_site_instance, blank_site_instance); 295 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
Charlie Reis 2014/10/07 22:40:38 nit: Let's invert this so that _EQ comes before _N
296 switches::kSitePerProcess))
297 EXPECT_NE(orig_site_instance, blank_site_instance);
298 else
299 EXPECT_EQ(orig_site_instance, blank_site_instance);
295 } 300 }
296 301
297 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer 302 // Test for crbug.com/24447. Following a cross-site link with rel=noreferrer
298 // and no target=_blank should not create a new SiteInstance. 303 // and no target=_blank should not create a new SiteInstance.
299 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, 304 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest,
300 DontSwapProcessWithOnlyRelNoreferrer) { 305 DontSwapProcessWithOnlyRelNoreferrer) {
301 StartServer(); 306 StartServer();
302 307
303 // Load a page with links that open in a new window. 308 // Load a page with links that open in a new window.
304 std::string replacement_path; 309 std::string replacement_path;
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 // Navigate to url1 and check bindings. 1467 // Navigate to url1 and check bindings.
1463 NavigateToURL(new_shell, url1); 1468 NavigateToURL(new_shell, url1);
1464 // The navigation should have used the first SiteInstance, otherwise 1469 // The navigation should have used the first SiteInstance, otherwise
1465 // |initial_rvh| did not have a chance to be used. 1470 // |initial_rvh| did not have a chance to be used.
1466 EXPECT_EQ(new_web_contents->GetSiteInstance(), site_instance1); 1471 EXPECT_EQ(new_web_contents->GetSiteInstance(), site_instance1);
1467 EXPECT_EQ(BINDINGS_POLICY_WEB_UI, 1472 EXPECT_EQ(BINDINGS_POLICY_WEB_UI,
1468 new_web_contents->GetRenderViewHost()->GetEnabledBindings()); 1473 new_web_contents->GetRenderViewHost()->GetEnabledBindings());
1469 } 1474 }
1470 1475
1471 } // namespace content 1476 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698