OLD | NEW |
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 "content/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "content/browser/frame_host/cross_process_frame_connector.h" | 13 #include "content/browser/frame_host/cross_process_frame_connector.h" |
14 #include "content/browser/frame_host/frame_tree.h" | 14 #include "content/browser/frame_host/frame_tree.h" |
15 #include "content/browser/frame_host/navigator.h" | 15 #include "content/browser/frame_host/navigator.h" |
16 #include "content/browser/frame_host/render_frame_proxy_host.h" | 16 #include "content/browser/frame_host/render_frame_proxy_host.h" |
17 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 17 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
18 #include "content/browser/renderer_host/render_view_host_impl.h" | 18 #include "content/browser/renderer_host/render_view_host_impl.h" |
19 #include "content/browser/web_contents/web_contents_impl.h" | 19 #include "content/browser/web_contents/web_contents_impl.h" |
20 #include "content/common/frame_messages.h" | 20 #include "content/common/frame_messages.h" |
21 #include "content/public/browser/navigation_details.h" | |
22 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
23 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
24 #include "content/public/browser/notification_types.h" | 23 #include "content/public/browser/notification_types.h" |
25 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
26 #include "content/public/test/browser_test_utils.h" | 25 #include "content/public/test/browser_test_utils.h" |
27 #include "content/public/test/content_browser_test_utils.h" | 26 #include "content/public/test/content_browser_test_utils.h" |
28 #include "content/public/test/test_navigation_observer.h" | 27 #include "content/public/test/test_navigation_observer.h" |
29 #include "content/public/test/test_utils.h" | 28 #include "content/public/test/test_utils.h" |
30 #include "content/shell/browser/shell.h" | 29 #include "content/shell/browser/shell.h" |
31 #include "content/test/content_browser_test_utils_internal.h" | 30 #include "content/test/content_browser_test_utils_internal.h" |
(...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2027 " Site A\n" | 2026 " Site A\n" |
2028 " |--Site A\n" | 2027 " |--Site A\n" |
2029 " +--Site A\n" | 2028 " +--Site A\n" |
2030 " |--Site A\n" | 2029 " |--Site A\n" |
2031 " +--Site A\n" | 2030 " +--Site A\n" |
2032 " +--Site A\n" | 2031 " +--Site A\n" |
2033 "Where A = http://127.0.0.1/", | 2032 "Where A = http://127.0.0.1/", |
2034 DepictFrameTree(root)); | 2033 DepictFrameTree(root)); |
2035 } | 2034 } |
2036 | 2035 |
2037 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | |
2038 PageTransitionForSecondaryIframeNavigation) { | |
2039 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); | |
2040 NavigateToURL(shell(), main_url); | |
2041 | |
2042 // It is safe to obtain the root frame tree node here, as it doesn't change. | |
2043 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | |
2044 ->GetFrameTree() | |
2045 ->root(); | |
2046 | |
2047 TestNavigationObserver observer(shell()->web_contents()); | |
2048 | |
2049 // Load same-site page into iframe. | |
2050 FrameTreeNode* child = root->child_at(0); | |
2051 GURL http_url(embedded_test_server()->GetURL("/title1.html")); | |
2052 NavigateFrameToURL(child, http_url); | |
2053 EXPECT_EQ(http_url, observer.last_navigation_url()); | |
2054 EXPECT_TRUE(observer.last_navigation_succeeded()); | |
2055 | |
2056 // Load cross-site page into iframe. | |
2057 TestFrameNavigationObserver frame_observer(child, 1); | |
2058 GURL url = embedded_test_server()->GetURL("foo.com", "/title2.html"); | |
2059 NavigateIframeToURL(shell()->web_contents(), "test", url); | |
2060 frame_observer.Wait(); | |
2061 | |
2062 EXPECT_EQ(NAVIGATION_TYPE_NEW_SUBFRAME, | |
2063 frame_observer.load_committed_details().type); | |
2064 } | |
2065 | |
2066 } // namespace content | 2036 } // namespace content |
OLD | NEW |