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

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 1685213002: Propagate window coordinates to out-of-process iframes renderers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sendscreenrects
Patch Set: properly rebasing Created 4 years, 9 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 unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 5566 matching lines...) Expand 10 before | Expand all | Expand 10 after
5577 // Check that the current RenderFrameHost has stopped loading. 5577 // Check that the current RenderFrameHost has stopped loading.
5578 EXPECT_FALSE(root->child_at(0)->current_frame_host()->is_loading()); 5578 EXPECT_FALSE(root->child_at(0)->current_frame_host()->is_loading());
5579 5579
5580 // The blocked navigation should behave like an empty 200 response. Make 5580 // The blocked navigation should behave like an empty 200 response. Make
5581 // sure that the frame's document.title is empty: this double-checks both 5581 // sure that the frame's document.title is empty: this double-checks both
5582 // that the blocked URL's contents wasn't loaded, and that the old page 5582 // that the blocked URL's contents wasn't loaded, and that the old page
5583 // isn't active anymore (both of these pages have non-empty titles). 5583 // isn't active anymore (both of these pages have non-empty titles).
5584 std::string frame_title; 5584 std::string frame_title;
5585 EXPECT_TRUE(ExecuteScriptAndExtractString( 5585 EXPECT_TRUE(ExecuteScriptAndExtractString(
5586 root->child_at(0)->current_frame_host(), 5586 root->child_at(0)->current_frame_host(),
5587 "domAutomationController.send(document.title)", 5587 "domAutomationController.send(document.title)", &frame_title));
5588 &frame_title));
5589 EXPECT_EQ("", frame_title); 5588 EXPECT_EQ("", frame_title);
5590 5589
5591 // Navigate the subframe to another cross-origin page and ensure that this 5590 // Navigate the subframe to another cross-origin page and ensure that this
5592 // navigation succeeds. Use a renderer-initiated navigation to test the 5591 // navigation succeeds. Use a renderer-initiated navigation to test the
5593 // transfer logic, which used to have some issues with this. 5592 // transfer logic, which used to have some issues with this.
5594 GURL c_url(embedded_test_server()->GetURL("c.com", "/title1.html")); 5593 GURL c_url(embedded_test_server()->GetURL("c.com", "/title1.html"));
5595 EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(), "child-0", c_url)); 5594 EXPECT_TRUE(NavigateIframeToURL(shell()->web_contents(), "child-0", c_url));
5596 EXPECT_EQ(c_url, root->child_at(0)->current_url()); 5595 EXPECT_EQ(c_url, root->child_at(0)->current_url());
5597 5596
5598 // When a page gets blocked due to XFO or CSP, it is sandboxed with the 5597 // When a page gets blocked due to XFO or CSP, it is sandboxed with the
5599 // SandboxOrigin flag (i.e., its origin is set to be unique) to ensure that 5598 // SandboxOrigin flag (i.e., its origin is set to be unique) to ensure that
5600 // the blocked page is seen as cross-origin. However, those flags shouldn't 5599 // the blocked page is seen as cross-origin. However, those flags shouldn't
5601 // affect future navigations for a frame. Verify this for the above 5600 // affect future navigations for a frame. Verify this for the above
5602 // navigation. 5601 // navigation.
5603 EXPECT_EQ(c_url.GetOrigin().spec(), 5602 EXPECT_EQ(c_url.GetOrigin().spec(),
5604 root->child_at(0)->current_origin().Serialize() + "/"); 5603 root->child_at(0)->current_origin().Serialize() + "/");
5605 EXPECT_EQ(blink::WebSandboxFlags::None, 5604 EXPECT_EQ(blink::WebSandboxFlags::None,
5606 root->child_at(0)->effective_sandbox_flags()); 5605 root->child_at(0)->effective_sandbox_flags());
5607 } 5606 }
5608 } 5607 }
5609 5608
5609 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ScreenCoordinates) {
5610 GURL main_url(embedded_test_server()->GetURL(
5611 "a.com", "/cross_site_iframe_factory.html?a(b)"));
5612 NavigateToURL(shell(), main_url);
5613
5614 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
5615 ->GetFrameTree()
5616 ->root();
5617 FrameTreeNode* child = root->child_at(0);
5618
5619 const char* properties[] = {"screenX", "screenY", "outerWidth",
5620 "outerHeight"};
5621
5622 for (const char* property : properties) {
5623 std::string script = "window.domAutomationController.send(window.";
5624 script += property;
5625 script += ");";
5626 int root_value = 1;
5627 int child_value = 2;
5628 EXPECT_TRUE(ExecuteScriptAndExtractInt(root->current_frame_host(),
5629 script.c_str(), &root_value));
5630
5631 EXPECT_TRUE(ExecuteScriptAndExtractInt(child->current_frame_host(),
5632 script.c_str(), &child_value));
5633
5634 EXPECT_EQ(root_value, child_value);
5635 }
5636 }
5637
5610 } // namespace content 5638 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.cc ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698