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

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: Fix build dependencies Created 4 years, 8 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 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 } 736 }
737 }; 737 };
738 738
739 INSTANTIATE_TEST_CASE_P(WebViewTests, WebViewTest, testing::Bool()); 739 INSTANTIATE_TEST_CASE_P(WebViewTests, WebViewTest, testing::Bool());
740 740
741 // The following test suits are created to group tests based on specific 741 // The following test suits are created to group tests based on specific
742 // features of <webview>. 742 // features of <webview>.
743 // These features current would not work with 743 // These features current would not work with
744 // --use-cross-process-frames-for-guest and is disabled on 744 // --use-cross-process-frames-for-guest and is disabled on
745 // UseCrossProcessFramesForGuests. 745 // UseCrossProcessFramesForGuests.
746 class WebViewAccessibilityTest : public WebViewTest {};
747 INSTANTIATE_TEST_CASE_P(WebViewTests,
748 WebViewAccessibilityTest,
749 testing::Values(false));
750
746 class WebViewNewWindowTest : public WebViewTest {}; 751 class WebViewNewWindowTest : public WebViewTest {};
747 INSTANTIATE_TEST_CASE_P(WebViewTests, 752 INSTANTIATE_TEST_CASE_P(WebViewTests,
748 WebViewNewWindowTest, 753 WebViewNewWindowTest,
749 testing::Values(false)); 754 testing::Values(false));
750 755
751 class WebViewSizeTest : public WebViewTest {}; 756 class WebViewSizeTest : public WebViewTest {};
752 INSTANTIATE_TEST_CASE_P(WebViewTests, WebViewSizeTest, testing::Values(false)); 757 INSTANTIATE_TEST_CASE_P(WebViewTests, WebViewSizeTest, testing::Values(false));
753 758
754 class WebViewSpeechAPITest : public WebViewTest {}; 759 class WebViewSpeechAPITest : public WebViewTest {};
755 INSTANTIATE_TEST_CASE_P(WebViewTests, 760 INSTANTIATE_TEST_CASE_P(WebViewTests,
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after
2698 "web_view/shim", NEEDS_TEST_SERVER); 2703 "web_view/shim", NEEDS_TEST_SERVER);
2699 } 2704 }
2700 2705
2701 // Tests that a WebView accessible resource can actually be loaded from a 2706 // Tests that a WebView accessible resource can actually be loaded from a
2702 // webpage in a WebView. 2707 // webpage in a WebView.
2703 IN_PROC_BROWSER_TEST_P(WebViewTest, LoadWebviewAccessibleResource) { 2708 IN_PROC_BROWSER_TEST_P(WebViewTest, LoadWebviewAccessibleResource) {
2704 TestHelper("testLoadWebviewAccessibleResource", 2709 TestHelper("testLoadWebviewAccessibleResource",
2705 "web_view/load_webview_accessible_resource", NEEDS_TEST_SERVER); 2710 "web_view/load_webview_accessible_resource", NEEDS_TEST_SERVER);
2706 } 2711 }
2707 2712
2713 IN_PROC_BROWSER_TEST_P(WebViewAccessibilityTest, FocusAccessibility) {
2714 LoadAppWithGuest("web_view/focus_accessibility");
2715 content::WebContents* web_contents = GetFirstAppWindowWebContents();
2716 content::EnableAccessibilityForWebContents(web_contents);
2717 content::WebContents* guest_web_contents = GetGuestWebContents();
2718 content::EnableAccessibilityForWebContents(guest_web_contents);
2719
2720 // Wait for focus to land on the "root web area" role, representing
2721 // focus on the main document itself.
2722 while (content::GetFocusedAccessibilityNodeInfo(web_contents).role !=
2723 ui::AX_ROLE_ROOT_WEB_AREA) {
2724 content::WaitForAccessibilityFocusChange();
2725 }
2726
2727 // Now keep pressing the Tab key until focus lands on a button.
2728 while (content::GetFocusedAccessibilityNodeInfo(web_contents).role !=
2729 ui::AX_ROLE_BUTTON) {
2730 content::SimulateKeyPress(
2731 web_contents, ui::VKEY_TAB, false, false, false, false);
2732 content::WaitForAccessibilityFocusChange();
2733 }
2734
2735 // Ensure that we hit the button inside the guest frame labeled
2736 // "Guest button".
2737 ui::AXNodeData node_data =
2738 content::GetFocusedAccessibilityNodeInfo(web_contents);
2739 EXPECT_EQ("Guest button", node_data.GetStringAttribute(ui::AX_ATTR_NAME));
2740 }
2741
2708 class WebViewGuestScrollTest 2742 class WebViewGuestScrollTest
2709 : public WebViewTestBase, 2743 : public WebViewTestBase,
2710 public testing::WithParamInterface<testing::tuple<bool, bool>> { 2744 public testing::WithParamInterface<testing::tuple<bool, bool>> {
2711 protected: 2745 protected:
2712 WebViewGuestScrollTest() {} 2746 WebViewGuestScrollTest() {}
2713 ~WebViewGuestScrollTest() {} 2747 ~WebViewGuestScrollTest() {}
2714 2748
2715 void SetUpCommandLine(base::CommandLine* command_line) override { 2749 void SetUpCommandLine(base::CommandLine* command_line) override {
2716 WebViewTestBase::SetUpCommandLine(command_line); 2750 WebViewTestBase::SetUpCommandLine(command_line);
2717 2751
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
3113 // 4 tasks expected. The order is arbitrary. 3147 // 4 tasks expected. The order is arbitrary.
3114 // Tab: about:blank, 3148 // Tab: about:blank,
3115 // Background Page: <webview> task manager test, 3149 // Background Page: <webview> task manager test,
3116 // App: <webview> task manager test, 3150 // App: <webview> task manager test,
3117 // Webview: WebViewed test content. 3151 // Webview: WebViewed test content.
3118 EXPECT_EQ(4U, task_manager.tasks().size()); 3152 EXPECT_EQ(4U, task_manager.tasks().size());
3119 EXPECT_TRUE(HasExpectedGuestTask(task_manager, guest_contents)); 3153 EXPECT_TRUE(HasExpectedGuestTask(task_manager, guest_contents));
3120 } 3154 }
3121 3155
3122 #endif // defined(ENABLE_TASK_MANAGER) 3156 #endif // defined(ENABLE_TASK_MANAGER)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698