OLD | NEW |
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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 } | 731 } |
732 }; | 732 }; |
733 | 733 |
734 INSTANTIATE_TEST_CASE_P(WebViewTests, WebViewTest, testing::Bool()); | 734 INSTANTIATE_TEST_CASE_P(WebViewTests, WebViewTest, testing::Bool()); |
735 | 735 |
736 // The following test suits are created to group tests based on specific | 736 // The following test suits are created to group tests based on specific |
737 // features of <webview>. | 737 // features of <webview>. |
738 // These features current would not work with | 738 // These features current would not work with |
739 // --use-cross-process-frames-for-guest and is disabled on | 739 // --use-cross-process-frames-for-guest and is disabled on |
740 // UseCrossProcessFramesForGuests. | 740 // UseCrossProcessFramesForGuests. |
| 741 class WebViewAccessibilityTest : public WebViewTest {}; |
| 742 INSTANTIATE_TEST_CASE_P(WebViewTests, |
| 743 WebViewAccessibilityTest, |
| 744 testing::Values(false)); |
| 745 |
741 class WebViewNewWindowTest : public WebViewTest {}; | 746 class WebViewNewWindowTest : public WebViewTest {}; |
742 INSTANTIATE_TEST_CASE_P(WebViewTests, | 747 INSTANTIATE_TEST_CASE_P(WebViewTests, |
743 WebViewNewWindowTest, | 748 WebViewNewWindowTest, |
744 testing::Values(false)); | 749 testing::Values(false)); |
745 | 750 |
746 class WebViewSizeTest : public WebViewTest {}; | 751 class WebViewSizeTest : public WebViewTest {}; |
747 INSTANTIATE_TEST_CASE_P(WebViewTests, WebViewSizeTest, testing::Values(false)); | 752 INSTANTIATE_TEST_CASE_P(WebViewTests, WebViewSizeTest, testing::Values(false)); |
748 | 753 |
749 class WebViewSpeechAPITest : public WebViewTest {}; | 754 class WebViewSpeechAPITest : public WebViewTest {}; |
750 INSTANTIATE_TEST_CASE_P(WebViewTests, | 755 INSTANTIATE_TEST_CASE_P(WebViewTests, |
(...skipping 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2657 "web_view/shim", NEEDS_TEST_SERVER); | 2662 "web_view/shim", NEEDS_TEST_SERVER); |
2658 } | 2663 } |
2659 | 2664 |
2660 // Tests that a WebView accessible resource can actually be loaded from a | 2665 // Tests that a WebView accessible resource can actually be loaded from a |
2661 // webpage in a WebView. | 2666 // webpage in a WebView. |
2662 IN_PROC_BROWSER_TEST_P(WebViewTest, LoadWebviewAccessibleResource) { | 2667 IN_PROC_BROWSER_TEST_P(WebViewTest, LoadWebviewAccessibleResource) { |
2663 TestHelper("testLoadWebviewAccessibleResource", | 2668 TestHelper("testLoadWebviewAccessibleResource", |
2664 "web_view/load_webview_accessible_resource", NEEDS_TEST_SERVER); | 2669 "web_view/load_webview_accessible_resource", NEEDS_TEST_SERVER); |
2665 } | 2670 } |
2666 | 2671 |
| 2672 IN_PROC_BROWSER_TEST_P(WebViewAccessibilityTest, FocusAccessibility) { |
| 2673 LoadAppWithGuest("web_view/focus_accessibility"); |
| 2674 content::WebContents* web_contents = GetFirstAppWindowWebContents(); |
| 2675 content::EnableAccessibilityForWebContents(web_contents); |
| 2676 content::WebContents* guest_web_contents = GetGuestWebContents(); |
| 2677 content::EnableAccessibilityForWebContents(guest_web_contents); |
| 2678 |
| 2679 // Wait for focus to land on the "root web area" role, representing |
| 2680 // focus on the main document itself. |
| 2681 while (content::GetFocusedAccessibilityNodeInfo(web_contents).role != |
| 2682 ui::AX_ROLE_ROOT_WEB_AREA) { |
| 2683 content::WaitForAccessibilityFocusChange(); |
| 2684 } |
| 2685 |
| 2686 // Now keep pressing the Tab key until focus lands on a button. |
| 2687 while (content::GetFocusedAccessibilityNodeInfo(web_contents).role != |
| 2688 ui::AX_ROLE_BUTTON) { |
| 2689 content::SimulateKeyPress( |
| 2690 web_contents, ui::VKEY_TAB, false, false, false, false); |
| 2691 content::WaitForAccessibilityFocusChange(); |
| 2692 } |
| 2693 |
| 2694 // Ensure that we hit the button inside the guest frame labeled |
| 2695 // "Guest button". |
| 2696 ui::AXNodeData node_data = |
| 2697 content::GetFocusedAccessibilityNodeInfo(web_contents); |
| 2698 EXPECT_EQ("Guest button", node_data.GetStringAttribute(ui::AX_ATTR_NAME)); |
| 2699 } |
| 2700 |
2667 class WebViewGuestScrollTest | 2701 class WebViewGuestScrollTest |
2668 : public WebViewTestBase, | 2702 : public WebViewTestBase, |
2669 public testing::WithParamInterface<testing::tuple<bool, bool>> { | 2703 public testing::WithParamInterface<testing::tuple<bool, bool>> { |
2670 protected: | 2704 protected: |
2671 WebViewGuestScrollTest() {} | 2705 WebViewGuestScrollTest() {} |
2672 ~WebViewGuestScrollTest() {} | 2706 ~WebViewGuestScrollTest() {} |
2673 | 2707 |
2674 void SetUpCommandLine(base::CommandLine* command_line) override { | 2708 void SetUpCommandLine(base::CommandLine* command_line) override { |
2675 WebViewTestBase::SetUpCommandLine(command_line); | 2709 WebViewTestBase::SetUpCommandLine(command_line); |
2676 | 2710 |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3072 // 4 tasks expected. The order is arbitrary. | 3106 // 4 tasks expected. The order is arbitrary. |
3073 // Tab: about:blank, | 3107 // Tab: about:blank, |
3074 // Background Page: <webview> task manager test, | 3108 // Background Page: <webview> task manager test, |
3075 // App: <webview> task manager test, | 3109 // App: <webview> task manager test, |
3076 // Webview: WebViewed test content. | 3110 // Webview: WebViewed test content. |
3077 EXPECT_EQ(4U, task_manager.tasks().size()); | 3111 EXPECT_EQ(4U, task_manager.tasks().size()); |
3078 EXPECT_TRUE(HasExpectedGuestTask(task_manager, guest_contents)); | 3112 EXPECT_TRUE(HasExpectedGuestTask(task_manager, guest_contents)); |
3079 } | 3113 } |
3080 | 3114 |
3081 #endif // defined(ENABLE_TASK_MANAGER) | 3115 #endif // defined(ENABLE_TASK_MANAGER) |
OLD | NEW |