Index: chrome/browser/site_per_process_interactive_browsertest.cc |
diff --git a/chrome/browser/site_per_process_interactive_browsertest.cc b/chrome/browser/site_per_process_interactive_browsertest.cc |
index eb7b3a26c4a95be515748c9899f08e72b60173aa..bfa28c48e3714ed67570a7400e27e7cec6ff581b 100644 |
--- a/chrome/browser/site_per_process_interactive_browsertest.cc |
+++ b/chrome/browser/site_per_process_interactive_browsertest.cc |
@@ -302,11 +302,12 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest, |
EXPECT_EQ(main_frame, web_contents->GetFocusedFrame()); |
} |
-// TODO(https://crbug.com/702330): Enable this test. |
+#if (defined(OS_LINUX) && !defined(USE_OZONE)) || defined(OS_WIN) |
alexmos
2017/04/05 00:21:13
(Carrying over the discussion from previous CL)
On
avallee
2017/04/05 15:13:00
I've fixed the test, but requires a relatively maj
alexmos
2017/04/05 18:08:33
I'm ok with that change - I think it'd be great fo
|
// Ensures that renderers know to advance focus to sibling frames and parent |
// frames in the presence of mouse click initiated focus changes. |
+// Verifies against regression of https://crbug.com/702330 |
IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest, |
- DISABLED_TabAndMouseFocusNavigation) { |
+ TabAndMouseFocusNavigation) { |
GURL main_url(embedded_test_server()->GetURL( |
"a.com", "/cross_site_iframe_factory.html?a(b,c)")); |
ui_test_utils::NavigateToURL(browser(), main_url); |
@@ -336,7 +337,6 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest, |
// iframe: 55,18;55,67 |
std::string script = |
"function onFocus(e) {" |
- " console.log(window.name+'-focused-'+ e.target.id);" |
" domAutomationController.setAutomationId(0);" |
" domAutomationController.send(window.name + '-focused-' + e.target.id);" |
"}" |
@@ -433,47 +433,60 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest, |
EXPECT_EQ("\"root-focused-input1\"", |
click_element_and_wait_for_message(main_frame_input_coords[0])); |
EXPECT_EQ(main_frame, web_contents->GetFocusedFrame()); |
+ auto frame_focused = base::MakeUnique<content::FrameFocusedObserver>(child1); |
EXPECT_EQ("\"child1-focused-input1\"", |
click_element_and_wait_for_message(child1_input_coords[0])); |
- EXPECT_EQ(child1, web_contents->GetFocusedFrame()); |
+ frame_focused->Wait(); |
+ frame_focused = base::MakeUnique<content::FrameFocusedObserver>(main_frame); |
EXPECT_EQ("\"root-focused-input1\"", press_tab_and_wait_for_message(true)); |
- EXPECT_EQ(main_frame, web_contents->GetFocusedFrame()); |
+ // EXPECT_EQ(main_frame, web_contents->GetFocusedFrame()); |
alexmos
2017/04/05 00:21:13
nit: remove commented out line
avallee
2017/04/05 15:13:00
Done.
|
+ frame_focused->Wait(); |
// Tab from child2 forward to root. |
EXPECT_EQ("\"root-focused-input2\"", |
click_element_and_wait_for_message(main_frame_input_coords[1])); |
EXPECT_EQ(main_frame, web_contents->GetFocusedFrame()); |
+ frame_focused = base::MakeUnique<content::FrameFocusedObserver>(child2); |
EXPECT_EQ("\"child2-focused-input2\"", |
click_element_and_wait_for_message(child2_input_coords[1])); |
- EXPECT_EQ(child2, web_contents->GetFocusedFrame()); |
+ frame_focused->Wait(); |
+ frame_focused = base::MakeUnique<content::FrameFocusedObserver>(main_frame); |
EXPECT_EQ("\"root-focused-input2\"", press_tab_and_wait_for_message(false)); |
- EXPECT_EQ(main_frame, web_contents->GetFocusedFrame()); |
+ frame_focused->Wait(); |
// Tab forward from child1 to child2. |
+ frame_focused = base::MakeUnique<content::FrameFocusedObserver>(child2); |
EXPECT_EQ("\"child2-focused-input1\"", |
click_element_and_wait_for_message(child2_input_coords[0])); |
- EXPECT_EQ(child2, web_contents->GetFocusedFrame()); |
+ frame_focused->Wait(); |
+ frame_focused = base::MakeUnique<content::FrameFocusedObserver>(child1); |
EXPECT_EQ("\"child1-focused-input2\"", |
click_element_and_wait_for_message(child1_input_coords[1])); |
- EXPECT_EQ(child1, web_contents->GetFocusedFrame()); |
+ frame_focused->Wait(); |
+ frame_focused = base::MakeUnique<content::FrameFocusedObserver>(child2); |
EXPECT_EQ("\"child2-focused-input1\"", press_tab_and_wait_for_message(false)); |
- EXPECT_EQ(child2, web_contents->GetFocusedFrame()); |
+ frame_focused->Wait(); |
// Tab backward from child2 to child1. |
+ frame_focused = base::MakeUnique<content::FrameFocusedObserver>(child1); |
EXPECT_EQ("\"child1-focused-input2\"", |
click_element_and_wait_for_message(child1_input_coords[1])); |
- EXPECT_EQ(child1, web_contents->GetFocusedFrame()); |
+ frame_focused->Wait(); |
+ frame_focused = base::MakeUnique<content::FrameFocusedObserver>(child2); |
EXPECT_EQ("\"child2-focused-input1\"", |
click_element_and_wait_for_message(child2_input_coords[0])); |
- EXPECT_EQ(child2, web_contents->GetFocusedFrame()); |
+ frame_focused->Wait(); |
+ frame_focused = base::MakeUnique<content::FrameFocusedObserver>(child1); |
EXPECT_EQ("\"child1-focused-input2\"", press_tab_and_wait_for_message(true)); |
- EXPECT_EQ(child1, web_contents->GetFocusedFrame()); |
+ // EXPECT_EQ(child1, web_contents->GetFocusedFrame()); |
+ frame_focused->Wait(); |
// Ensure there are no pending focus events after tabbing. |
EXPECT_EQ("\"root-focused-input1\"", |
click_element_and_wait_for_message(main_frame_input_coords[0])) |
<< "Unexpected extra focus events."; |
} |
+#endif |
namespace { |