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

Side by Side Diff: chrome/browser/apps/guest_view/web_view_browsertest.cc

Issue 1815933002: Fix WebView accessibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add browser test for focusing into a web view Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <queue> 5 #include <queue>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 2687 matching lines...) Expand 10 before | Expand all | Expand 10 after
2698 "web_view/shim", NEEDS_TEST_SERVER); 2698 "web_view/shim", NEEDS_TEST_SERVER);
2699 } 2699 }
2700 2700
2701 // Tests that a WebView accessible resource can actually be loaded from a 2701 // Tests that a WebView accessible resource can actually be loaded from a
2702 // webpage in a WebView. 2702 // webpage in a WebView.
2703 IN_PROC_BROWSER_TEST_P(WebViewTest, LoadWebviewAccessibleResource) { 2703 IN_PROC_BROWSER_TEST_P(WebViewTest, LoadWebviewAccessibleResource) {
2704 TestHelper("testLoadWebviewAccessibleResource", 2704 TestHelper("testLoadWebviewAccessibleResource",
2705 "web_view/load_webview_accessible_resource", NEEDS_TEST_SERVER); 2705 "web_view/load_webview_accessible_resource", NEEDS_TEST_SERVER);
2706 } 2706 }
2707 2707
2708 IN_PROC_BROWSER_TEST_P(WebViewTest, FocusAccessibility) {
2709 LoadAppWithGuest("web_view/focus_accessibility");
2710 content::WebContents* web_contents = GetFirstAppWindowWebContents();
2711 content::EnableAccessibilityForWebContents(web_contents);
2712 content::WebContents* guest_web_contents = GetGuestWebContents();
2713 content::EnableAccessibilityForWebContents(guest_web_contents);
2714
2715 // Wait for focus to land on the "root web area" role, representing
2716 // focus on the main document itself.
2717 while (content::GetFocusedAccessibilityNodeInfo(web_contents).role !=
2718 ui::AX_ROLE_ROOT_WEB_AREA) {
2719 content::WaitForAccessibilityFocusChange();
2720 }
2721
2722 // Now keep pressing the Tab key until focus lands on a button.
2723 while (content::GetFocusedAccessibilityNodeInfo(web_contents).role !=
2724 ui::AX_ROLE_BUTTON) {
2725 content::SimulateKeyPress(
2726 web_contents, ui::VKEY_TAB, false, false, false, false);
2727 content::WaitForAccessibilityFocusChange();
2728 }
2729
2730 // Ensure that we hit the button inside the guest frame labeled
2731 // "Guest button".
2732 ui::AXNodeData node_data =
2733 content::GetFocusedAccessibilityNodeInfo(web_contents);
2734 EXPECT_EQ("Guest button", node_data.GetStringAttribute(ui::AX_ATTR_NAME));
2735 }
2736
2708 class WebViewGuestScrollTest 2737 class WebViewGuestScrollTest
2709 : public WebViewTestBase, 2738 : public WebViewTestBase,
2710 public testing::WithParamInterface<testing::tuple<bool, bool>> { 2739 public testing::WithParamInterface<testing::tuple<bool, bool>> {
2711 protected: 2740 protected:
2712 WebViewGuestScrollTest() {} 2741 WebViewGuestScrollTest() {}
2713 ~WebViewGuestScrollTest() {} 2742 ~WebViewGuestScrollTest() {}
2714 2743
2715 void SetUpCommandLine(base::CommandLine* command_line) override { 2744 void SetUpCommandLine(base::CommandLine* command_line) override {
2716 WebViewTestBase::SetUpCommandLine(command_line); 2745 WebViewTestBase::SetUpCommandLine(command_line);
2717 2746
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
3113 // 4 tasks expected. The order is arbitrary. 3142 // 4 tasks expected. The order is arbitrary.
3114 // Tab: about:blank, 3143 // Tab: about:blank,
3115 // Background Page: <webview> task manager test, 3144 // Background Page: <webview> task manager test,
3116 // App: <webview> task manager test, 3145 // App: <webview> task manager test,
3117 // Webview: WebViewed test content. 3146 // Webview: WebViewed test content.
3118 EXPECT_EQ(4U, task_manager.tasks().size()); 3147 EXPECT_EQ(4U, task_manager.tasks().size());
3119 EXPECT_TRUE(HasExpectedGuestTask(task_manager, guest_contents)); 3148 EXPECT_TRUE(HasExpectedGuestTask(task_manager, guest_contents));
3120 } 3149 }
3121 3150
3122 #endif // defined(ENABLE_TASK_MANAGER) 3151 #endif // defined(ENABLE_TASK_MANAGER)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698