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

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

Issue 692973005: Pass origin information for remote frame creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 9f16066cd38752be333d5af39867ef7d4618d346..a9b2f5558ac458d2ea1f4c1d28e63d282e336844 100644
--- a/content/browser/frame_host/frame_tree_browsertest.cc
+++ b/content/browser/frame_host/frame_tree_browsertest.cc
@@ -199,6 +199,42 @@ IN_PROC_BROWSER_TEST_F(FrameTreeBrowserTest, IsRenderFrameLive) {
EXPECT_TRUE(root->child_at(0)->current_frame_host()->IsRenderFrameLive());
}
+// Ensure that origins are correctly set on navigations.
+IN_PROC_BROWSER_TEST_F(FrameTreeBrowserTest, OriginSetOnNavigation) {
Charlie Reis 2014/11/13 18:00:57 Perhaps we can also add a --site-per-process test
alexmos 2014/11/18 18:25:31 Done -- please see RenderViewImplTest.OriginReplic
Charlie Reis 2014/11/19 00:46:17 Thanks!
+ host_resolver()->AddRule("*", "127.0.0.1");
+ ASSERT_TRUE(test_server()->Start());
+ GURL main_url(test_server()->GetURL("files/site_per_process_main.html"));
Charlie Reis 2014/11/13 18:00:57 nit: This isn't a site per process test, so it's a
alexmos 2014/11/18 18:25:31 Done. It doesn't matter to the test as long as th
+ 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();
+
+ EXPECT_EQ(root->current_replication_state().origin.string(),
+ main_url.GetOrigin().spec());
+ EXPECT_FALSE(root->current_replication_state().is_unique_origin);
+
+ GURL frame_url(test_server()->GetURL("files/title1.html"));
+ NavigateFrameToURL(root->child_at(0), frame_url);
+
+ EXPECT_EQ(root->child_at(0)->current_replication_state().origin.string(),
+ frame_url.GetOrigin().spec());
+ EXPECT_FALSE(root->child_at(0)->current_replication_state().is_unique_origin);
+
+ // Navigating to a data URL should set a unique origin.
+ GURL data_url("data:text/html,foo");
+ NavigateToURL(shell(), data_url);
+
+ EXPECT_TRUE(root->current_replication_state().is_unique_origin);
+
+ // Navigating to a normal URL should update origin and clear unique origin
+ // flag.
+ NavigateToURL(shell(), main_url);
+ EXPECT_EQ(root->current_replication_state().origin.string(),
+ main_url.GetOrigin().spec());
+ EXPECT_FALSE(root->current_replication_state().is_unique_origin);
+}
+
class CrossProcessFrameTreeBrowserTest : public ContentBrowserTest {
public:
CrossProcessFrameTreeBrowserTest() {}
« no previous file with comments | « no previous file | content/browser/frame_host/frame_tree_node.h » ('j') | content/browser/frame_host/frame_tree_node.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698