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

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

Issue 404613005: Start using RenderFrameProxyHost objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bug fix + ncarter review comments addressed Created 6 years, 5 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
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..4af5249e40e0e8c1413f1ac1a58755994cca8969 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,56 @@ 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.
+IN_PROC_BROWSER_TEST_F(CrossProcessFrameTreeBrowserTest, VerifyProxyCreation) {
Charlie Reis 2014/07/24 22:36:29 nit: VerifyProxyCreation makes it sound like a net
kenrb 2014/07/25 23:42:05 I've changed the test name but left the class name
+ 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()]);
Charlie Reis 2014/07/24 22:36:29 Are we creating the proxy in the subframe for the
nasko 2014/07/25 07:13:20 That should be created by the virtue of cross-proc
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698