Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/frame_host/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 568 | 568 |
| 569 // Check that we will not trigger a DCHECK in renderer for cross-process | 569 // Check that we will not trigger a DCHECK in renderer for cross-process |
| 570 // replacement navigations. | 570 // replacement navigations. |
| 571 // See https://crbug.com/611679. | 571 // See https://crbug.com/611679. |
| 572 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, | 572 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
| 573 PageIDUpdatedOnPageReplacement) { | 573 PageIDUpdatedOnPageReplacement) { |
| 574 NavigationController& controller = shell()->web_contents()->GetController(); | 574 NavigationController& controller = shell()->web_contents()->GetController(); |
| 575 const GURL page_url = embedded_test_server()->GetURL( | 575 const GURL page_url = embedded_test_server()->GetURL( |
| 576 "/navigation_controller/simple_page_1.html"); | 576 "/navigation_controller/simple_page_1.html"); |
| 577 | 577 |
| 578 // Use data scheme first so that the next page will be loaded | 578 // Use a chrome:// url first so that the next page will be loaded |
| 579 // in a separate site instance. | 579 // in a separate site instance. |
| 580 EXPECT_TRUE(NavigateToURL(shell(), GURL("data:text/html,page1"))); | 580 GURL initial_url(std::string(kChromeUIScheme) + |
| 581 url::kStandardSchemeSeparator + kChromeUIGpuHost); | |
| 582 EXPECT_TRUE(NavigateToURL(shell(), initial_url)); | |
| 581 EXPECT_EQ(1, controller.GetEntryCount()); | 583 EXPECT_EQ(1, controller.GetEntryCount()); |
| 582 EXPECT_NE(-1, shell()->web_contents()->GetMaxPageID()); | 584 EXPECT_NE(-1, shell()->web_contents()->GetMaxPageID()); |
| 585 int initial_renderer_id = | |
| 586 shell()->web_contents()->GetRenderProcessHost()->GetID(); | |
|
nasko
2016/09/14 22:33:22
nit: Usually SiteInstance is used for comparison w
| |
| 583 | 587 |
| 584 // Now navigate and replace the current entry. | 588 // Now navigate and replace the current entry. |
| 585 RendererLocationReplace(shell(), page_url); | 589 RendererLocationReplace(shell(), page_url); |
| 590 | |
| 591 // Verify that process swap actually occured. | |
| 592 EXPECT_NE(initial_renderer_id, | |
| 593 shell()->web_contents()->GetRenderProcessHost()->GetID()); | |
| 594 | |
| 595 // The navigation entry should have been replaced. | |
| 586 EXPECT_EQ(1, controller.GetEntryCount()); | 596 EXPECT_EQ(1, controller.GetEntryCount()); |
| 587 | 597 |
| 588 // Page ID should be updated. | 598 // Page ID should be updated. |
| 589 EXPECT_NE(-1, shell()->web_contents()->GetMaxPageID()); | 599 EXPECT_NE(-1, shell()->web_contents()->GetMaxPageID()); |
| 590 | 600 |
| 591 // Reload the page and verify that we don't hit | 601 // Reload the page and verify that we don't hit |
| 592 // a DCHECK in |RenderFrameImpl::NavigateInternal|. | 602 // a DCHECK in |RenderFrameImpl::NavigateInternal|. |
| 593 controller.Reload(false); | 603 controller.Reload(false); |
| 594 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); | 604 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); |
| 595 | 605 |
| (...skipping 5321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5917 &headers)); | 5927 &headers)); |
| 5918 | 5928 |
| 5919 // Verify the Origin and Referer headers. | 5929 // Verify the Origin and Referer headers. |
| 5920 EXPECT_THAT(headers, ::testing::HasSubstr("Origin: null")); | 5930 EXPECT_THAT(headers, ::testing::HasSubstr("Origin: null")); |
| 5921 EXPECT_THAT(headers, | 5931 EXPECT_THAT(headers, |
| 5922 ::testing::ContainsRegex( | 5932 ::testing::ContainsRegex( |
| 5923 "Referer: http://a.com:.*/form_that_posts_cross_site.html")); | 5933 "Referer: http://a.com:.*/form_that_posts_cross_site.html")); |
| 5924 } | 5934 } |
| 5925 | 5935 |
| 5926 } // namespace content | 5936 } // namespace content |
| OLD | NEW |