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

Side by Side Diff: content/browser/cross_site_transfer_browsertest.cc

Issue 2394343002: Removing ShouldSwapProcessesForRedirect (using DoesSiteRequireDedicatedProcess).
Patch Set: Rebasing... Created 3 years, 7 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
OLDNEW
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 <memory> 5 #include <memory>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 const NavigationController& controller = 263 const NavigationController& controller =
264 shell()->web_contents()->GetController(); 264 shell()->web_contents()->GetController();
265 265
266 // Navigate to a starting URL, so there is a history entry to replace. 266 // Navigate to a starting URL, so there is a history entry to replace.
267 GURL url1 = embedded_test_server()->GetURL("/site_isolation/blank.html?1"); 267 GURL url1 = embedded_test_server()->GetURL("/site_isolation/blank.html?1");
268 EXPECT_TRUE(NavigateToURL(shell(), url1)); 268 EXPECT_TRUE(NavigateToURL(shell(), url1));
269 269
270 // Force all future navigations to transfer. Note that this includes same-site 270 // Force all future navigations to transfer. Note that this includes same-site
271 // navigiations which may cause double process swaps (via OpenURL and then via 271 // navigiations which may cause double process swaps (via OpenURL and then via
272 // transfer). This test intentionally exercises that case. 272 // transfer). This test intentionally exercises that case.
273 ShellContentBrowserClient::SetSwapProcessesForRedirect(true); 273 ShellContentBrowserClient::SetTransferAllNavigations(true);
274 274
275 // Navigate to a page on A.com with entry replacement. This navigation is 275 // Navigate to a page on A.com with entry replacement. This navigation is
276 // cross-site, so the renderer will send it to the browser via OpenURL to give 276 // cross-site, so the renderer will send it to the browser via OpenURL to give
277 // to a new process. It will then be transferred into yet another process due 277 // to a new process. It will then be transferred into yet another process due
278 // to the call above. 278 // to the call above.
279 GURL url2 = 279 GURL url2 =
280 embedded_test_server()->GetURL("A.com", "/site_isolation/blank.html?2"); 280 embedded_test_server()->GetURL("A.com", "/site_isolation/blank.html?2");
281 // Used to make sure the request for url2 succeeds, and there was only one of 281 // Used to make sure the request for url2 succeeds, and there was only one of
282 // them. 282 // them.
283 tracking_delegate().SetTrackedURL(url2); 283 tracking_delegate().SetTrackedURL(url2);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 shell()->web_contents()->GetController(); 323 shell()->web_contents()->GetController();
324 324
325 // Navigate to a starting URL, so there is a history entry to replace. 325 // Navigate to a starting URL, so there is a history entry to replace.
326 GURL url = embedded_test_server()->GetURL("/site_isolation/blank.html?1"); 326 GURL url = embedded_test_server()->GetURL("/site_isolation/blank.html?1");
327 EXPECT_TRUE(NavigateToURL(shell(), url)); 327 EXPECT_TRUE(NavigateToURL(shell(), url));
328 328
329 // Force all future navigations to transfer. Note that this includes same-site 329 // Force all future navigations to transfer. Note that this includes same-site
330 // navigiations which may cause double process swaps (via OpenURL and then via 330 // navigiations which may cause double process swaps (via OpenURL and then via
331 // transfer). All navigations in this test are same-site, so it only swaps 331 // transfer). All navigations in this test are same-site, so it only swaps
332 // processes via request transfer. 332 // processes via request transfer.
333 ShellContentBrowserClient::SetSwapProcessesForRedirect(true); 333 ShellContentBrowserClient::SetTransferAllNavigations(true);
334 334
335 // Navigate in-process with entry replacement. It will then be transferred 335 // Navigate in-process with entry replacement. It will then be transferred
336 // into a new one due to the call above. 336 // into a new one due to the call above.
337 GURL url2 = embedded_test_server()->GetURL("/site_isolation/blank.html?2"); 337 GURL url2 = embedded_test_server()->GetURL("/site_isolation/blank.html?2");
338 NavigateToURLContentInitiated(shell(), url2, true, true); 338 NavigateToURLContentInitiated(shell(), url2, true, true);
339 339
340 // There should be one history entry. url2 should have replaced url1. 340 // There should be one history entry. url2 should have replaced url1.
341 EXPECT_TRUE(controller.GetPendingEntry() == nullptr); 341 EXPECT_TRUE(controller.GetPendingEntry() == nullptr);
342 EXPECT_EQ(1, controller.GetEntryCount()); 342 EXPECT_EQ(1, controller.GetEntryCount());
343 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); 343 EXPECT_EQ(0, controller.GetCurrentEntryIndex());
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 // cancelled. 405 // cancelled.
406 IN_PROC_BROWSER_TEST_P(CrossSiteTransferTest, NoLeakOnCrossSiteCancel) { 406 IN_PROC_BROWSER_TEST_P(CrossSiteTransferTest, NoLeakOnCrossSiteCancel) {
407 const NavigationController& controller = 407 const NavigationController& controller =
408 shell()->web_contents()->GetController(); 408 shell()->web_contents()->GetController();
409 409
410 // Navigate to a starting URL, so there is a history entry to replace. 410 // Navigate to a starting URL, so there is a history entry to replace.
411 GURL url1 = embedded_test_server()->GetURL("/site_isolation/blank.html?1"); 411 GURL url1 = embedded_test_server()->GetURL("/site_isolation/blank.html?1");
412 EXPECT_TRUE(NavigateToURL(shell(), url1)); 412 EXPECT_TRUE(NavigateToURL(shell(), url1));
413 413
414 // Force all future navigations to transfer. 414 // Force all future navigations to transfer.
415 ShellContentBrowserClient::SetSwapProcessesForRedirect(true); 415 ShellContentBrowserClient::SetTransferAllNavigations(true);
416 416
417 NoTransferRequestDelegate no_transfer_request_delegate; 417 NoTransferRequestDelegate no_transfer_request_delegate;
418 WebContentsDelegate* old_delegate = shell()->web_contents()->GetDelegate(); 418 WebContentsDelegate* old_delegate = shell()->web_contents()->GetDelegate();
419 shell()->web_contents()->SetDelegate(&no_transfer_request_delegate); 419 shell()->web_contents()->SetDelegate(&no_transfer_request_delegate);
420 420
421 // Navigate to a page on A.com with entry replacement. This navigation is 421 // Navigate to a page on A.com with entry replacement. This navigation is
422 // cross-site, so the renderer will send it to the browser via OpenURL to give 422 // cross-site, so the renderer will send it to the browser via OpenURL to give
423 // to a new process. It will then be transferred into yet another process due 423 // to a new process. It will then be transferred into yet another process due
424 // to the call above. 424 // to the call above.
425 GURL url2 = 425 GURL url2 =
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 EXPECT_THAT(actual_page_body, 510 EXPECT_THAT(actual_page_body,
511 ::testing::HasSubstr("form-data; name=\"file\"")); 511 ::testing::HasSubstr("form-data; name=\"file\""));
512 } 512 }
513 513
514 INSTANTIATE_TEST_CASE_P(CrossSiteTransferTest, 514 INSTANTIATE_TEST_CASE_P(CrossSiteTransferTest,
515 CrossSiteTransferTest, 515 CrossSiteTransferTest,
516 ::testing::Values(TestParameter::LOADING_WITHOUT_MOJO, 516 ::testing::Values(TestParameter::LOADING_WITHOUT_MOJO,
517 TestParameter::LOADING_WITH_MOJO)); 517 TestParameter::LOADING_WITH_MOJO));
518 518
519 } // namespace content 519 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_browsertest.cc ('k') | content/browser/frame_host/navigation_handle_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698