Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1067)

Unified Diff: content/browser/frame_host/frame_tree_browsertest.cc

Issue 444503002: Start using RenderFrameProxyHost objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Create view IFF frame is main frame Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/frame_host/frame_tree.cc ('k') | content/browser/frame_host/navigation_controller_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/frame_tree_browsertest.cc
diff --git a/content/browser/frame_host/frame_tree_browsertest.cc b/content/browser/frame_host/frame_tree_browsertest.cc
index bc5f1cb04ff32d92ed415cfc66933323e8d33ff5..287506c50e61db7450f0a030d3c2daab9901f3c5 100644
--- a/content/browser/frame_host/frame_tree_browsertest.cc
+++ b/content/browser/frame_host/frame_tree_browsertest.cc
@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/command_line.h"
#include "content/browser/frame_host/frame_tree.h"
#include "content/browser/frame_host/frame_tree_node.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
+#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
@@ -15,6 +17,7 @@
#include "content/public/test/test_navigation_observer.h"
#include "content/public/test/test_utils.h"
#include "content/shell/browser/shell.h"
+#include "content/test/content_browser_test_utils_internal.h"
#include "net/dns/mock_host_resolver.h"
namespace content {
@@ -155,4 +158,66 @@ IN_PROC_BROWSER_TEST_F(FrameTreeBrowserTest, NavigateWithLeftoverFrames) {
EXPECT_EQ(0UL, root->child_count());
}
+class CrossProcessFrameTreeBrowserTest : public ContentBrowserTest {
+ public:
+ CrossProcessFrameTreeBrowserTest() {}
+
+ virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE {
+ command_line->AppendSwitch(switches::kSitePerProcess);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CrossProcessFrameTreeBrowserTest);
+};
+
+// Ensure that we can complete a cross-process subframe navigation.
+#if defined(OS_ANDROID)
+#define MAYBE_CreateCrossProcessSubframeProxies DISABLED_CreateCrossProcessSubframeProxies
+#else
+#define MAYBE_CreateCrossProcessSubframeProxies CreateCrossProcessSubframeProxies
+#endif
+IN_PROC_BROWSER_TEST_F(CrossProcessFrameTreeBrowserTest,
+ MAYBE_CreateCrossProcessSubframeProxies) {
+ host_resolver()->AddRule("*", "127.0.0.1");
+ ASSERT_TRUE(test_server()->Start());
+ GURL main_url(test_server()->GetURL("files/site_per_process_main.html"));
+ NavigateToURL(shell(), main_url);
+
+ // It is safe to obtain the root frame tree node here, as it doesn't change.
+ FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
+ ->GetFrameTree()->root();
+
+ // Load same-site page into iframe.
+ GURL http_url(test_server()->GetURL("files/title1.html"));
+ NavigateFrameToURL(root->child_at(0), http_url);
+
+ // These must stay in scope with replace_host.
+ GURL::Replacements replace_host;
+ std::string foo_com("foo.com");
+
+ // Load cross-site page into iframe.
+ GURL cross_site_url(test_server()->GetURL("files/title2.html"));
+ replace_host.SetHostStr(foo_com);
+ cross_site_url = cross_site_url.ReplaceComponents(replace_host);
+ NavigateFrameToURL(root->child_at(0), cross_site_url);
+
+ // Ensure that we have created a new process for the subframe.
+ ASSERT_EQ(1U, root->child_count());
+ FrameTreeNode* child = root->child_at(0);
+ SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance();
+ RenderViewHost* rvh = child->current_frame_host()->render_view_host();
+ RenderProcessHost* rph = child->current_frame_host()->GetProcess();
+
+ EXPECT_NE(shell()->web_contents()->GetRenderViewHost(), rvh);
+ EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance);
+ EXPECT_NE(shell()->web_contents()->GetRenderProcessHost(), rph);
+
+ // Ensure that the root node has a proxy for the child node's SiteInstance.
+ EXPECT_TRUE(root->render_manager()->proxy_hosts_[site_instance->GetId()]);
+
+ // Also ensure that the child has a proxy for the root node's SiteInstance.
+ EXPECT_TRUE(child->render_manager()->proxy_hosts_[
+ root->current_frame_host()->GetSiteInstance()->GetId()]);
+}
+
} // namespace content
« no previous file with comments | « content/browser/frame_host/frame_tree.cc ('k') | content/browser/frame_host/navigation_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698