| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/accessibility/browser_accessibility_win.h" | 5 #include "content/browser/accessibility/browser_accessibility_win.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 manager.reset(); | 725 manager.reset(); |
| 726 ASSERT_EQ(0, CountedBrowserAccessibility::num_instances()); | 726 ASSERT_EQ(0, CountedBrowserAccessibility::num_instances()); |
| 727 } | 727 } |
| 728 | 728 |
| 729 TEST_F(BrowserAccessibilityTest, TestCreateEmptyDocument) { | 729 TEST_F(BrowserAccessibilityTest, TestCreateEmptyDocument) { |
| 730 // Try creating an empty document with busy state. Readonly is | 730 // Try creating an empty document with busy state. Readonly is |
| 731 // set automatically. | 731 // set automatically. |
| 732 CountedBrowserAccessibility::reset(); | 732 CountedBrowserAccessibility::reset(); |
| 733 const int32_t busy_state = 1 << ui::AX_STATE_BUSY; | 733 const int32_t busy_state = 1 << ui::AX_STATE_BUSY; |
| 734 const int32_t readonly_state = 1 << ui::AX_STATE_READ_ONLY; | 734 const int32_t readonly_state = 1 << ui::AX_STATE_READ_ONLY; |
| 735 const int32_t enabled_state = 1 << ui::AX_STATE_ENABLED; | |
| 736 std::unique_ptr<BrowserAccessibilityManager> manager( | 735 std::unique_ptr<BrowserAccessibilityManager> manager( |
| 737 new BrowserAccessibilityManagerWin( | 736 new BrowserAccessibilityManagerWin( |
| 738 BrowserAccessibilityManagerWin::GetEmptyDocument(), nullptr, | 737 BrowserAccessibilityManagerWin::GetEmptyDocument(), nullptr, |
| 739 new CountedBrowserAccessibilityFactory())); | 738 new CountedBrowserAccessibilityFactory())); |
| 740 | 739 |
| 741 // Verify the root is as we expect by default. | 740 // Verify the root is as we expect by default. |
| 742 BrowserAccessibility* root = manager->GetRoot(); | 741 BrowserAccessibility* root = manager->GetRoot(); |
| 743 EXPECT_EQ(0, root->GetId()); | 742 EXPECT_EQ(0, root->GetId()); |
| 744 EXPECT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, root->GetRole()); | 743 EXPECT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, root->GetRole()); |
| 745 EXPECT_EQ(busy_state | readonly_state | enabled_state, root->GetState()); | 744 EXPECT_EQ(busy_state | readonly_state, root->GetState()); |
| 746 | 745 |
| 747 // Tree with a child textfield. | 746 // Tree with a child textfield. |
| 748 ui::AXNodeData tree1_1; | 747 ui::AXNodeData tree1_1; |
| 749 tree1_1.id = 1; | 748 tree1_1.id = 1; |
| 750 tree1_1.role = ui::AX_ROLE_ROOT_WEB_AREA; | 749 tree1_1.role = ui::AX_ROLE_ROOT_WEB_AREA; |
| 751 tree1_1.child_ids.push_back(2); | 750 tree1_1.child_ids.push_back(2); |
| 752 | 751 |
| 753 ui::AXNodeData tree1_2; | 752 ui::AXNodeData tree1_2; |
| 754 tree1_2.id = 2; | 753 tree1_2.id = 2; |
| 755 tree1_2.role = ui::AX_ROLE_TEXT_FIELD; | 754 tree1_2.role = ui::AX_ROLE_TEXT_FIELD; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 TEST_F(BrowserAccessibilityTest, EmptyDocHasUniqueIdWin) { | 814 TEST_F(BrowserAccessibilityTest, EmptyDocHasUniqueIdWin) { |
| 816 std::unique_ptr<BrowserAccessibilityManagerWin> manager( | 815 std::unique_ptr<BrowserAccessibilityManagerWin> manager( |
| 817 new BrowserAccessibilityManagerWin( | 816 new BrowserAccessibilityManagerWin( |
| 818 BrowserAccessibilityManagerWin::GetEmptyDocument(), nullptr, | 817 BrowserAccessibilityManagerWin::GetEmptyDocument(), nullptr, |
| 819 new CountedBrowserAccessibilityFactory())); | 818 new CountedBrowserAccessibilityFactory())); |
| 820 | 819 |
| 821 // Verify the root is as we expect by default. | 820 // Verify the root is as we expect by default. |
| 822 BrowserAccessibility* root = manager->GetRoot(); | 821 BrowserAccessibility* root = manager->GetRoot(); |
| 823 EXPECT_EQ(0, root->GetId()); | 822 EXPECT_EQ(0, root->GetId()); |
| 824 EXPECT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, root->GetRole()); | 823 EXPECT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, root->GetRole()); |
| 825 EXPECT_EQ(1 << ui::AX_STATE_BUSY | | 824 EXPECT_EQ(1 << ui::AX_STATE_BUSY | 1 << ui::AX_STATE_READ_ONLY, |
| 826 1 << ui::AX_STATE_READ_ONLY | | |
| 827 1 << ui::AX_STATE_ENABLED, | |
| 828 root->GetState()); | 825 root->GetState()); |
| 829 | 826 |
| 830 int32_t unique_id = ToBrowserAccessibilityWin(root)->unique_id(); | 827 int32_t unique_id = ToBrowserAccessibilityWin(root)->unique_id(); |
| 831 ASSERT_EQ(root, BrowserAccessibility::GetFromUniqueID(unique_id)); | 828 ASSERT_EQ(root, BrowserAccessibility::GetFromUniqueID(unique_id)); |
| 832 } | 829 } |
| 833 | 830 |
| 834 TEST_F(BrowserAccessibilityTest, TestIA2Attributes) { | 831 TEST_F(BrowserAccessibilityTest, TestIA2Attributes) { |
| 835 ui::AXNodeData pseudo_before; | 832 ui::AXNodeData pseudo_before; |
| 836 pseudo_before.id = 2; | 833 pseudo_before.id = 2; |
| 837 pseudo_before.role = ui::AX_ROLE_DIV; | 834 pseudo_before.role = ui::AX_ROLE_DIV; |
| (...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2465 std::vector<AXEventNotificationDetails> events = {event}; | 2462 std::vector<AXEventNotificationDetails> events = {event}; |
| 2466 manager->OnAccessibilityEvents(events); | 2463 manager->OnAccessibilityEvents(events); |
| 2467 | 2464 |
| 2468 EXPECT_HRESULT_SUCCEEDED(ax_child1->get_nRelations(&n_relations)); | 2465 EXPECT_HRESULT_SUCCEEDED(ax_child1->get_nRelations(&n_relations)); |
| 2469 EXPECT_EQ(2, n_relations); | 2466 EXPECT_EQ(2, n_relations); |
| 2470 EXPECT_HRESULT_SUCCEEDED(ax_child2->get_nRelations(&n_relations)); | 2467 EXPECT_HRESULT_SUCCEEDED(ax_child2->get_nRelations(&n_relations)); |
| 2471 EXPECT_EQ(2, n_relations); | 2468 EXPECT_EQ(2, n_relations); |
| 2472 } | 2469 } |
| 2473 | 2470 |
| 2474 } // namespace content | 2471 } // namespace content |
| OLD | NEW |