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 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1953 EXPECT_EQ("http://bar.com/", DumpProxyHostSiteInstances(root)); | 1954 EXPECT_EQ("http://bar.com/", DumpProxyHostSiteInstances(root)); |
1954 | 1955 |
1955 // Navigate back to the parent's origin. | 1956 // Navigate back to the parent's origin. |
1956 url = embedded_test_server()->GetURL("/title1.html"); | 1957 url = embedded_test_server()->GetURL("/title1.html"); |
1957 NavigateFrameToURL(child, url); | 1958 NavigateFrameToURL(child, url); |
1958 EXPECT_EQ(url, observer.last_navigation_url()); | 1959 EXPECT_EQ(url, observer.last_navigation_url()); |
1959 EXPECT_TRUE(observer.last_navigation_succeeded()); | 1960 EXPECT_TRUE(observer.last_navigation_succeeded()); |
1960 EXPECT_EQ("", DumpProxyHostSiteInstances(root)); | 1961 EXPECT_EQ("", DumpProxyHostSiteInstances(root)); |
1961 } | 1962 } |
1962 | 1963 |
1964 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, | |
Charlie Reis
2015/04/15 22:46:11
I'm torn between adding this test here (where it w
| |
1965 PageTransitionForSecondaryIframeNavigation) { | |
1966 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); | |
1967 NavigateToURL(shell(), main_url); | |
1968 | |
1969 // It is safe to obtain the root frame tree node here, as it doesn't change. | |
1970 FrameTreeNode* root = | |
1971 static_cast<WebContentsImpl*>(shell()->web_contents())-> | |
1972 GetFrameTree()->root(); | |
1973 | |
1974 TestNavigationObserver observer(shell()->web_contents()); | |
1975 | |
1976 // Load same-site page into iframe. | |
1977 FrameTreeNode* child = root->child_at(0); | |
1978 GURL http_url(embedded_test_server()->GetURL("/title1.html")); | |
1979 NavigateFrameToURL(child, http_url); | |
1980 EXPECT_EQ(http_url, observer.last_navigation_url()); | |
1981 EXPECT_TRUE(observer.last_navigation_succeeded()); | |
1982 | |
1983 // Load cross-site page into iframe. | |
1984 TestFrameNavigationObserver frame_observer(child, 1); | |
1985 GURL url = embedded_test_server()->GetURL("foo.com", "/title2.html"); | |
1986 NavigateIframeToURL(shell()->web_contents(), "test", url); | |
1987 frame_observer.Wait(); | |
1988 | |
1989 EXPECT_EQ(NAVIGATION_TYPE_NEW_SUBFRAME, | |
Charlie Reis
2015/04/15 22:46:11
Please add a similar test for an initially cross-s
Nate Chapin
2015/04/17 21:48:18
That case reliably returns NAVIGATION_TYPE_NEW_SUB
Charlie Reis
2015/04/22 20:44:56
Sure, with a TODO to make it AUTO. I should be ab
| |
1990 frame_observer.load_committed_details().type); | |
1991 } | |
1992 | |
1963 } // namespace content | 1993 } // namespace content |
OLD | NEW |