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" | |
Charlie Reis
2016/01/27 17:24:17
nit: No longer needed.
clamy
2016/01/28 13:11:15
Done.
| |
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 // When run just with subframe navigation entries enabled and not in |
2610 // site-per-process-mode the subframe should be in the same SiteInstance as | |
2611 // its parent. | |
2612 if (!SiteIsolationPolicy::AreCrossProcessFramesPossible()) { | |
2613 EXPECT_EQ(main_site_instance, | |
2614 foo_subframe->current_frame_host()->GetSiteInstance()); | |
2615 } else { | |
2616 EXPECT_NE(main_site_instance, | |
2617 foo_subframe->current_frame_host()->GetSiteInstance()); | |
2618 } | |
2619 | |
2609 foo_subframe_entry = | 2620 foo_subframe_entry = |
2610 controller.GetLastCommittedEntry()->GetFrameEntry(foo_subframe); | 2621 controller.GetLastCommittedEntry()->GetFrameEntry(foo_subframe); |
2611 EXPECT_EQ(named_subframe_name, foo_subframe_entry->frame_unique_name()); | 2622 EXPECT_EQ(named_subframe_name, foo_subframe_entry->frame_unique_name()); |
2612 } | 2623 } |
2613 | 2624 |
2614 // Verifies that item sequence numbers and document sequence numbers update | 2625 // Verifies that item sequence numbers and document sequence numbers update |
2615 // properly for main frames and subframes. | 2626 // properly for main frames and subframes. |
2616 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, | 2627 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, |
2617 FrameNavigationEntry_SequenceNumbers) { | 2628 FrameNavigationEntry_SequenceNumbers) { |
2618 const NavigationControllerImpl& controller = | 2629 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); | 3198 EXPECT_EQ(original_url, capturer.all_params()[1].url); |
3188 EXPECT_EQ(original_url, shell()->web_contents()->GetLastCommittedURL()); | 3199 EXPECT_EQ(original_url, shell()->web_contents()->GetLastCommittedURL()); |
3189 } | 3200 } |
3190 | 3201 |
3191 // Make sure the renderer is still alive. | 3202 // Make sure the renderer is still alive. |
3192 EXPECT_TRUE( | 3203 EXPECT_TRUE( |
3193 ExecuteScript(shell()->web_contents(), "console.log('Success');")); | 3204 ExecuteScript(shell()->web_contents(), "console.log('Success');")); |
3194 } | 3205 } |
3195 | 3206 |
3196 } // namespace content | 3207 } // namespace content |
OLD | NEW |