Index: chrome/browser/apps/guest_view/web_view_browsertest.cc |
diff --git a/chrome/browser/apps/guest_view/web_view_browsertest.cc b/chrome/browser/apps/guest_view/web_view_browsertest.cc |
index 8c4f9db408c4d34299f5f513774f89ef338b387b..f4e2ee1127008fe6e04d14519dd72c9e05f99eee 100644 |
--- a/chrome/browser/apps/guest_view/web_view_browsertest.cc |
+++ b/chrome/browser/apps/guest_view/web_view_browsertest.cc |
@@ -2705,6 +2705,35 @@ IN_PROC_BROWSER_TEST_P(WebViewTest, LoadWebviewAccessibleResource) { |
"web_view/load_webview_accessible_resource", NEEDS_TEST_SERVER); |
} |
+IN_PROC_BROWSER_TEST_P(WebViewTest, FocusAccessibility) { |
+ LoadAppWithGuest("web_view/focus_accessibility"); |
+ content::WebContents* web_contents = GetFirstAppWindowWebContents(); |
+ content::EnableAccessibilityForWebContents(web_contents); |
+ content::WebContents* guest_web_contents = GetGuestWebContents(); |
+ content::EnableAccessibilityForWebContents(guest_web_contents); |
+ |
+ // Wait for focus to land on the "root web area" role, representing |
+ // focus on the main document itself. |
+ while (content::GetFocusedAccessibilityNodeInfo(web_contents).role != |
+ ui::AX_ROLE_ROOT_WEB_AREA) { |
+ content::WaitForAccessibilityFocusChange(); |
+ } |
+ |
+ // Now keep pressing the Tab key until focus lands on a button. |
+ while (content::GetFocusedAccessibilityNodeInfo(web_contents).role != |
+ ui::AX_ROLE_BUTTON) { |
+ content::SimulateKeyPress( |
+ web_contents, ui::VKEY_TAB, false, false, false, false); |
+ content::WaitForAccessibilityFocusChange(); |
+ } |
+ |
+ // Ensure that we hit the button inside the guest frame labeled |
+ // "Guest button". |
+ ui::AXNodeData node_data = |
+ content::GetFocusedAccessibilityNodeInfo(web_contents); |
+ EXPECT_EQ("Guest button", node_data.GetStringAttribute(ui::AX_ATTR_NAME)); |
+} |
+ |
class WebViewGuestScrollTest |
: public WebViewTestBase, |
public testing::WithParamInterface<testing::tuple<bool, bool>> { |