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

Unified Diff: chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc

Issue 2732913005: <webview>: Add test to confirm the TAB key will escape the view. (Closed)
Patch Set: Fix clearFocusedElement, only if focusing a child frame. Created 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
diff --git a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
index dd439fbf60ee619e27630c12bef3b599cffcb734..9585b0bbac86984feb0ae71ea3adcdebf0c16253 100644
--- a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
+++ b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
@@ -670,6 +670,33 @@ IN_PROC_BROWSER_TEST_P(WebViewFocusInteractiveTest, Focus_FocusEvent) {
TestHelper("testFocusEvent", "web_view/focus", NO_TEST_SERVER);
}
+IN_PROC_BROWSER_TEST_P(WebViewFocusInteractiveTest, Focus_FocusTakeFocus) {
alexmos 2017/03/10 07:08:33 Since this is also a problem for OOPIFs without <w
avallee 2017/03/13 19:18:10 Let me add this in then. Just to be clear, I think
alexmos 2017/03/16 17:37:11 Yes, exactly. I'm just thinking of following the
avallee 2017/05/10 18:42:16 Test created and enabled (flaky but quite rarely)
+ TestHelper("testFocusTakeFocus", "web_view/focus", NO_TEST_SERVER);
+
+ // Compute where to click in the window to focus the guest input box.
+ int clickX, clickY;
+ EXPECT_TRUE(content::ExecuteScriptAndExtractInt(
+ embedder_web_contents(),
+ "domAutomationController.send(Math.floor(window.clickX));", &clickX));
+ EXPECT_TRUE(content::ExecuteScriptAndExtractInt(
+ embedder_web_contents(),
+ "domAutomationController.send(Math.floor(window.clickY));", &clickY));
+
+ ExtensionTestMessageListener next_step_listener("TEST_STEP_PASSED", false);
+ next_step_listener.set_failure_message("TEST_STEP_FAILED");
+ content::SimulateMouseClickAt(
+ (GetParam() ? guest_web_contents() : embedder_web_contents()), 0,
+ blink::WebMouseEvent::Button::Left, gfx::Point(clickX, clickY));
+ ASSERT_TRUE(next_step_listener.WaitUntilSatisfied());
+
+ // TAB back out to the embedder's input.
+ next_step_listener.Reset();
+ content::SimulateKeyPress(embedder_web_contents(), ui::DomKey::TAB,
+ ui::DomCode::TAB, ui::VKEY_TAB, false, false, false,
+ false);
+ ASSERT_TRUE(next_step_listener.WaitUntilSatisfied());
+}
+
IN_PROC_BROWSER_TEST_P(WebViewFocusInteractiveTest, Focus_FocusTracksEmbedder) {
content::WebContents* embedder_web_contents = NULL;

Powered by Google App Engine
This is Rietveld 408576698