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

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: rebase (focus controller change in ToT) Created 3 years, 7 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 | « no previous file | chrome/test/data/extensions/platform_apps/web_view/focus/embedder.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a945705cc3bf6d59eaa5aa6098ab2968c29a2f7b..bfc6749a8b77a34d88fabcc3a110106f901b984a 100644
--- a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
+++ b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
@@ -718,6 +718,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) {
+ 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::kLeft, 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());
+}
+
// Flaky on Mac and Linux - https://crbug.com/707648
#if defined(OS_MACOSX) || defined(OS_LINUX)
#define MAYBE_Focus_FocusTracksEmbedder DISABLED_Focus_FocusTracksEmbedder
« no previous file with comments | « no previous file | chrome/test/data/extensions/platform_apps/web_view/focus/embedder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698