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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "content/browser/frame_host/frame_navigation_entry.h" | 15 #include "content/browser/frame_host/frame_navigation_entry.h" |
| 16 #include "content/browser/frame_host/frame_tree.h" | 16 #include "content/browser/frame_host/frame_tree.h" |
| 17 #include "content/browser/frame_host/navigation_entry_impl.h" | 17 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 18 #include "content/browser/web_contents/web_contents_impl.h" | 18 #include "content/browser/web_contents/web_contents_impl.h" |
| 19 #include "content/common/site_isolation_policy.h" | 19 #include "content/common/site_isolation_policy.h" |
| 20 #include "content/public/browser/render_view_host.h" | 20 #include "content/public/browser/render_view_host.h" |
| 21 #include "content/public/browser/resource_controller.h" | 21 #include "content/public/browser/resource_controller.h" |
| 22 #include "content/public/browser/resource_dispatcher_host.h" | 22 #include "content/public/browser/resource_dispatcher_host.h" |
| 23 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 23 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
| 24 #include "content/public/browser/resource_throttle.h" | 24 #include "content/public/browser/resource_throttle.h" |
| 25 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 26 #include "content/public/browser/web_contents_observer.h" | 26 #include "content/public/browser/web_contents_observer.h" |
| 27 #include "content/public/common/bindings_policy.h" | 27 #include "content/public/common/bindings_policy.h" |
| 28 #include "content/public/common/browser_side_navigation_policy.h" | |
| 28 #include "content/public/common/url_constants.h" | 29 #include "content/public/common/url_constants.h" |
| 29 #include "content/public/test/browser_test_utils.h" | 30 #include "content/public/test/browser_test_utils.h" |
| 30 #include "content/public/test/content_browser_test.h" | 31 #include "content/public/test/content_browser_test.h" |
| 31 #include "content/public/test/content_browser_test_utils.h" | 32 #include "content/public/test/content_browser_test_utils.h" |
| 32 #include "content/public/test/test_navigation_observer.h" | 33 #include "content/public/test/test_navigation_observer.h" |
| 33 #include "content/public/test/test_utils.h" | 34 #include "content/public/test/test_utils.h" |
| 34 #include "content/shell/browser/shell.h" | 35 #include "content/shell/browser/shell.h" |
| 35 #include "content/shell/common/shell_switches.h" | 36 #include "content/shell/common/shell_switches.h" |
| 36 #include "content/test/content_browser_test_utils_internal.h" | 37 #include "content/test/content_browser_test_utils_internal.h" |
| 37 #include "net/dns/mock_host_resolver.h" | 38 #include "net/dns/mock_host_resolver.h" |
| (...skipping 2559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2597 controller.GetLastCommittedEntry()->GetFrameEntry(foo_subframe); | 2598 controller.GetLastCommittedEntry()->GetFrameEntry(foo_subframe); |
| 2598 std::string named_subframe_name = "foo"; | 2599 std::string named_subframe_name = "foo"; |
| 2599 EXPECT_EQ(named_subframe_name, foo_subframe_entry->frame_unique_name()); | 2600 EXPECT_EQ(named_subframe_name, foo_subframe_entry->frame_unique_name()); |
| 2600 | 2601 |
| 2601 // 4. Navigating in the subframes cross-process shouldn't change their names. | 2602 // 4. Navigating in the subframes cross-process shouldn't change their names. |
| 2602 // TODO(creis): Fix the unnamed case in https://crbug.com/502317. | 2603 // TODO(creis): Fix the unnamed case in https://crbug.com/502317. |
| 2603 GURL bar_url(embedded_test_server()->GetURL( | 2604 GURL bar_url(embedded_test_server()->GetURL( |
| 2604 "bar.com", "/navigation_controller/simple_page_1.html")); | 2605 "bar.com", "/navigation_controller/simple_page_1.html")); |
| 2605 NavigateFrameToURL(foo_subframe, bar_url); | 2606 NavigateFrameToURL(foo_subframe, bar_url); |
| 2606 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); | 2607 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); |
| 2607 EXPECT_NE(main_site_instance, | 2608 |
| 2608 foo_subframe->current_frame_host()->GetSiteInstance()); | 2609 // PlzNavigate: when ran just with PlzNavigate enabled, and not in |
|
Charlie Reis
2016/01/26 17:21:46
nit: s/ran/run/, drop comma.
clamy
2016/01/27 10:50:42
Done.
| |
| 2610 // site-per-process-mode the subframe should be in the same SiteInstance as | |
| 2611 // its parent. | |
| 2612 if (!SiteIsolationPolicy::AreCrossProcessFramesPossible()) { | |
| 2613 EXPECT_TRUE(IsBrowserSideNavigationEnabled()); | |
|
Charlie Reis
2016/01/26 17:21:46
We shouldn't assume PlzNavigate is the only way fo
clamy
2016/01/27 10:50:42
Done.
| |
| 2614 EXPECT_EQ(main_site_instance, | |
| 2615 foo_subframe->current_frame_host()->GetSiteInstance()); | |
| 2616 } else { | |
| 2617 EXPECT_NE(main_site_instance, | |
| 2618 foo_subframe->current_frame_host()->GetSiteInstance()); | |
| 2619 } | |
| 2620 | |
| 2609 foo_subframe_entry = | 2621 foo_subframe_entry = |
| 2610 controller.GetLastCommittedEntry()->GetFrameEntry(foo_subframe); | 2622 controller.GetLastCommittedEntry()->GetFrameEntry(foo_subframe); |
| 2611 EXPECT_EQ(named_subframe_name, foo_subframe_entry->frame_unique_name()); | 2623 EXPECT_EQ(named_subframe_name, foo_subframe_entry->frame_unique_name()); |
| 2612 } | 2624 } |
| 2613 | 2625 |
| 2614 // Verifies that item sequence numbers and document sequence numbers update | 2626 // Verifies that item sequence numbers and document sequence numbers update |
| 2615 // properly for main frames and subframes. | 2627 // properly for main frames and subframes. |
| 2616 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, | 2628 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
| 2617 FrameNavigationEntry_SequenceNumbers) { | 2629 FrameNavigationEntry_SequenceNumbers) { |
| 2618 const NavigationControllerImpl& controller = | 2630 const NavigationControllerImpl& controller = |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3187 EXPECT_EQ(original_url, capturer.all_params()[1].url); | 3199 EXPECT_EQ(original_url, capturer.all_params()[1].url); |
| 3188 EXPECT_EQ(original_url, shell()->web_contents()->GetLastCommittedURL()); | 3200 EXPECT_EQ(original_url, shell()->web_contents()->GetLastCommittedURL()); |
| 3189 } | 3201 } |
| 3190 | 3202 |
| 3191 // Make sure the renderer is still alive. | 3203 // Make sure the renderer is still alive. |
| 3192 EXPECT_TRUE( | 3204 EXPECT_TRUE( |
| 3193 ExecuteScript(shell()->web_contents(), "console.log('Success');")); | 3205 ExecuteScript(shell()->web_contents(), "console.log('Success');")); |
| 3194 } | 3206 } |
| 3195 | 3207 |
| 3196 } // namespace content | 3208 } // namespace content |
| OLD | NEW |