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 <objbase.h> | 7 #include <objbase.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 BrowserAccessibilityManagerWin::GetEmptyDocument(), nullptr, | 726 BrowserAccessibilityManagerWin::GetEmptyDocument(), nullptr, |
727 new BrowserAccessibilityFactory())); | 727 new BrowserAccessibilityFactory())); |
728 | 728 |
729 // Verify the root is as we expect by default. | 729 // Verify the root is as we expect by default. |
730 BrowserAccessibility* root = manager->GetRoot(); | 730 BrowserAccessibility* root = manager->GetRoot(); |
731 EXPECT_EQ(0, root->GetId()); | 731 EXPECT_EQ(0, root->GetId()); |
732 EXPECT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, root->GetRole()); | 732 EXPECT_EQ(ui::AX_ROLE_ROOT_WEB_AREA, root->GetRole()); |
733 EXPECT_EQ(1 << ui::AX_STATE_BUSY | 1 << ui::AX_STATE_READ_ONLY, | 733 EXPECT_EQ(1 << ui::AX_STATE_BUSY | 1 << ui::AX_STATE_READ_ONLY, |
734 root->GetState()); | 734 root->GetState()); |
735 | 735 |
736 int32_t unique_id = ToBrowserAccessibilityWin(root)->unique_id(); | 736 BrowserAccessibilityWin* win_root = ToBrowserAccessibilityWin(root); |
737 ASSERT_EQ(root, BrowserAccessibility::GetFromUniqueID(unique_id)); | 737 |
| 738 int32_t unique_id = win_root->unique_id(); |
| 739 ui::AXPlatformNode* node = static_cast<ui::AXPlatformNode*>( |
| 740 ui::AXPlatformNode::GetFromUniqueId(unique_id)); |
| 741 |
| 742 ui::AXPlatformNode* other_node = |
| 743 static_cast<ui::AXPlatformNode*>(win_root->GetCOM()); |
| 744 ASSERT_EQ(node, other_node); |
738 } | 745 } |
739 | 746 |
740 TEST_F(BrowserAccessibilityTest, TestIA2Attributes) { | 747 TEST_F(BrowserAccessibilityTest, TestIA2Attributes) { |
741 ui::AXNodeData pseudo_before; | 748 ui::AXNodeData pseudo_before; |
742 pseudo_before.id = 2; | 749 pseudo_before.id = 2; |
743 pseudo_before.role = ui::AX_ROLE_GENERIC_CONTAINER; | 750 pseudo_before.role = ui::AX_ROLE_GENERIC_CONTAINER; |
744 pseudo_before.AddStringAttribute(ui::AX_ATTR_HTML_TAG, "<pseudo:before>"); | 751 pseudo_before.AddStringAttribute(ui::AX_ATTR_HTML_TAG, "<pseudo:before>"); |
745 pseudo_before.AddStringAttribute(ui::AX_ATTR_DISPLAY, "none"); | 752 pseudo_before.AddStringAttribute(ui::AX_ATTR_DISPLAY, "none"); |
746 | 753 |
747 ui::AXNodeData checkbox; | 754 ui::AXNodeData checkbox; |
(...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2400 std::vector<AXEventNotificationDetails> events = {event}; | 2407 std::vector<AXEventNotificationDetails> events = {event}; |
2401 manager->OnAccessibilityEvents(events); | 2408 manager->OnAccessibilityEvents(events); |
2402 | 2409 |
2403 EXPECT_HRESULT_SUCCEEDED(ax_child1->GetCOM()->get_nRelations(&n_relations)); | 2410 EXPECT_HRESULT_SUCCEEDED(ax_child1->GetCOM()->get_nRelations(&n_relations)); |
2404 EXPECT_EQ(2, n_relations); | 2411 EXPECT_EQ(2, n_relations); |
2405 EXPECT_HRESULT_SUCCEEDED(ax_child2->GetCOM()->get_nRelations(&n_relations)); | 2412 EXPECT_HRESULT_SUCCEEDED(ax_child2->GetCOM()->get_nRelations(&n_relations)); |
2406 EXPECT_EQ(2, n_relations); | 2413 EXPECT_EQ(2, n_relations); |
2407 } | 2414 } |
2408 | 2415 |
2409 } // namespace content | 2416 } // namespace content |
OLD | NEW |