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" |
21 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
22 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
23 #include "content/public/browser/notification_types.h" | 24 #include "content/public/browser/notification_types.h" |
24 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
25 #include "content/public/test/browser_test_utils.h" | 26 #include "content/public/test/browser_test_utils.h" |
26 #include "content/public/test/content_browser_test_utils.h" | 27 #include "content/public/test/content_browser_test_utils.h" |
27 #include "content/public/test/test_navigation_observer.h" | 28 #include "content/public/test/test_navigation_observer.h" |
28 #include "content/public/test/test_utils.h" | 29 #include "content/public/test/test_utils.h" |
29 #include "content/shell/browser/shell.h" | 30 #include "content/shell/browser/shell.h" |
30 #include "content/test/content_browser_test_utils_internal.h" | 31 #include "content/test/content_browser_test_utils_internal.h" |
(...skipping 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2037 " Site A\n" | 2038 " Site A\n" |
2038 " |--Site A\n" | 2039 " |--Site A\n" |
2039 " +--Site A\n" | 2040 " +--Site A\n" |
2040 " |--Site A\n" | 2041 " |--Site A\n" |
2041 " +--Site A\n" | 2042 " +--Site A\n" |
2042 " +--Site A\n" | 2043 " +--Site A\n" |
2043 "Where A = http://127.0.0.1/", | 2044 "Where A = http://127.0.0.1/", |
2044 DepictFrameTree(root)); | 2045 DepictFrameTree(root)); |
2045 } | 2046 } |
2046 | 2047 |
| 2048 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| 2049 PageTransitionForSecondaryIframeNavigation) { |
| 2050 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); |
| 2051 NavigateToURL(shell(), main_url); |
| 2052 |
| 2053 // It is safe to obtain the root frame tree node here, as it doesn't change. |
| 2054 FrameTreeNode* root = |
| 2055 static_cast<WebContentsImpl*>(shell()->web_contents())-> |
| 2056 GetFrameTree()->root(); |
| 2057 |
| 2058 TestNavigationObserver observer(shell()->web_contents()); |
| 2059 |
| 2060 // Load same-site page into iframe. |
| 2061 FrameTreeNode* child = root->child_at(0); |
| 2062 GURL http_url(embedded_test_server()->GetURL("/title1.html")); |
| 2063 NavigateFrameToURL(child, http_url); |
| 2064 EXPECT_EQ(http_url, observer.last_navigation_url()); |
| 2065 EXPECT_TRUE(observer.last_navigation_succeeded()); |
| 2066 |
| 2067 // Load cross-site page into iframe. |
| 2068 TestFrameNavigationObserver frame_observer(child, 1); |
| 2069 GURL url = embedded_test_server()->GetURL("foo.com", "/title2.html"); |
| 2070 NavigateIframeToURL(shell()->web_contents(), "test", url); |
| 2071 frame_observer.Wait(); |
| 2072 |
| 2073 EXPECT_EQ(NAVIGATION_TYPE_NEW_SUBFRAME, |
| 2074 frame_observer.load_committed_details().type); |
| 2075 } |
| 2076 |
2047 } // namespace content | 2077 } // namespace content |
OLD | NEW |