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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 1852903002: Create an interactive site-per-process browsertest class and move DocumentHasFocus there. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: thestig's comments Created 4 years, 8 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 | « chrome/test/BUILD.gn ('k') | content/public/test/browser_test_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/site_per_process_browsertest.cc
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
index 30381e2f13cdade5a085c90d8ca6dc13d1512968..7140ce35c4b48b4a137d1b4a2aec06cd0cb28a95 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -4339,79 +4339,6 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DocumentActiveElement) {
grandchild->current_url().spec());
}
-// Check that document.hasFocus() works properly with out-of-process iframes.
-// The test builds a page with four cross-site frames and then focuses them one
-// by one, checking the value of document.hasFocus() in all frames. For any
-// given focused frame, document.hasFocus() should return true for that frame
-// and all its ancestor frames.
-// Disabled due to flakes; see https://crbug.com/559273.
-IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, DISABLED_DocumentHasFocus) {
- GURL main_url(embedded_test_server()->GetURL(
- "a.com", "/cross_site_iframe_factory.html?a(b(c),d)"));
- EXPECT_TRUE(NavigateToURL(shell(), main_url));
-
- FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
- ->GetFrameTree()
- ->root();
-
- EXPECT_EQ(
- " Site A ------------ proxies for B C D\n"
- " |--Site B ------- proxies for A C D\n"
- " | +--Site C -- proxies for A B D\n"
- " +--Site D ------- proxies for A B C\n"
- "Where A = http://a.com/\n"
- " B = http://b.com/\n"
- " C = http://c.com/\n"
- " D = http://d.com/",
- DepictFrameTree(root));
-
- FrameTreeNode* child1 = root->child_at(0);
- FrameTreeNode* child2 = root->child_at(1);
- FrameTreeNode* grandchild = root->child_at(0)->child_at(0);
-
- // Helper function to check document.hasFocus() for a given frame.
- auto document_has_focus = [](FrameTreeNode* node) {
- bool hasFocus = false;
- EXPECT_TRUE(ExecuteScriptAndExtractBool(
- node->current_frame_host(),
- "window.domAutomationController.send(document.hasFocus())",
- &hasFocus));
- return hasFocus;
- };
-
- // The main frame should be focused to start with.
- EXPECT_EQ(root, root->frame_tree()->GetFocusedFrame());
-
- EXPECT_TRUE(document_has_focus(root));
- EXPECT_FALSE(document_has_focus(child1));
- EXPECT_FALSE(document_has_focus(grandchild));
- EXPECT_FALSE(document_has_focus(child2));
-
- FocusFrame(child1);
- EXPECT_EQ(child1, root->frame_tree()->GetFocusedFrame());
-
- EXPECT_TRUE(document_has_focus(root));
- EXPECT_TRUE(document_has_focus(child1));
- EXPECT_FALSE(document_has_focus(grandchild));
- EXPECT_FALSE(document_has_focus(child2));
-
- FocusFrame(grandchild);
- EXPECT_EQ(grandchild, root->frame_tree()->GetFocusedFrame());
-
- EXPECT_TRUE(document_has_focus(root));
- EXPECT_TRUE(document_has_focus(child1));
- EXPECT_TRUE(document_has_focus(grandchild));
- EXPECT_FALSE(document_has_focus(child2));
-
- FocusFrame(child2);
- EXPECT_EQ(child2, root->frame_tree()->GetFocusedFrame());
-
- EXPECT_TRUE(document_has_focus(root));
- EXPECT_FALSE(document_has_focus(child1));
- EXPECT_FALSE(document_has_focus(grandchild));
- EXPECT_TRUE(document_has_focus(child2));
-}
-
// Check that window.focus works for cross-process subframes.
IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, SubframeWindowFocus) {
GURL main_url(embedded_test_server()->GetURL(
« no previous file with comments | « chrome/test/BUILD.gn ('k') | content/public/test/browser_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698