| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 hr = text_dispatch.QueryInterface(text_accessible.Receive()); | 224 hr = text_dispatch.QueryInterface(text_accessible.Receive()); |
| 225 ASSERT_EQ(S_OK, hr); | 225 ASSERT_EQ(S_OK, hr); |
| 226 | 226 |
| 227 base::win::ScopedVariant childid_self(CHILDID_SELF); | 227 base::win::ScopedVariant childid_self(CHILDID_SELF); |
| 228 base::win::ScopedBstr name; | 228 base::win::ScopedBstr name; |
| 229 hr = text_accessible->get_accName(childid_self, name.Receive()); | 229 hr = text_accessible->get_accName(childid_self, name.Receive()); |
| 230 ASSERT_EQ(S_OK, hr); | 230 ASSERT_EQ(S_OK, hr); |
| 231 EXPECT_EQ(L"old text", base::string16(name)); | 231 EXPECT_EQ(L"old text", base::string16(name)); |
| 232 name.Reset(); | 232 name.Reset(); |
| 233 | 233 |
| 234 text_dispatch.Release(); | 234 text_dispatch.Reset(); |
| 235 text_accessible.Release(); | 235 text_accessible.Reset(); |
| 236 | 236 |
| 237 // Notify the BrowserAccessibilityManager that the text child has changed. | 237 // Notify the BrowserAccessibilityManager that the text child has changed. |
| 238 AXContentNodeData text2; | 238 AXContentNodeData text2; |
| 239 text2.id = 2; | 239 text2.id = 2; |
| 240 text2.role = ui::AX_ROLE_STATIC_TEXT; | 240 text2.role = ui::AX_ROLE_STATIC_TEXT; |
| 241 text2.SetName("new text"); | 241 text2.SetName("new text"); |
| 242 AXEventNotificationDetails param; | 242 AXEventNotificationDetails param; |
| 243 param.event_type = ui::AX_EVENT_CHILDREN_CHANGED; | 243 param.event_type = ui::AX_EVENT_CHILDREN_CHANGED; |
| 244 param.update.nodes.push_back(text2); | 244 param.update.nodes.push_back(text2); |
| 245 param.id = text2.id; | 245 param.id = text2.id; |
| 246 std::vector<AXEventNotificationDetails> events; | 246 std::vector<AXEventNotificationDetails> events; |
| 247 events.push_back(param); | 247 events.push_back(param); |
| 248 manager->OnAccessibilityEvents(events); | 248 manager->OnAccessibilityEvents(events); |
| 249 | 249 |
| 250 // Query for the text IAccessible and verify that it now returns "new text" | 250 // Query for the text IAccessible and verify that it now returns "new text" |
| 251 // as its value. | 251 // as its value. |
| 252 hr = ToBrowserAccessibilityWin(manager->GetRoot())->get_accChild( | 252 hr = ToBrowserAccessibilityWin(manager->GetRoot())->get_accChild( |
| 253 one, text_dispatch.Receive()); | 253 one, text_dispatch.Receive()); |
| 254 ASSERT_EQ(S_OK, hr); | 254 ASSERT_EQ(S_OK, hr); |
| 255 | 255 |
| 256 hr = text_dispatch.QueryInterface(text_accessible.Receive()); | 256 hr = text_dispatch.QueryInterface(text_accessible.Receive()); |
| 257 ASSERT_EQ(S_OK, hr); | 257 ASSERT_EQ(S_OK, hr); |
| 258 | 258 |
| 259 hr = text_accessible->get_accName(childid_self, name.Receive()); | 259 hr = text_accessible->get_accName(childid_self, name.Receive()); |
| 260 ASSERT_EQ(S_OK, hr); | 260 ASSERT_EQ(S_OK, hr); |
| 261 EXPECT_EQ(L"new text", base::string16(name)); | 261 EXPECT_EQ(L"new text", base::string16(name)); |
| 262 | 262 |
| 263 text_dispatch.Release(); | 263 text_dispatch.Reset(); |
| 264 text_accessible.Release(); | 264 text_accessible.Reset(); |
| 265 | 265 |
| 266 // Delete the manager and test that all BrowserAccessibility instances are | 266 // Delete the manager and test that all BrowserAccessibility instances are |
| 267 // deleted. | 267 // deleted. |
| 268 manager.reset(); | 268 manager.reset(); |
| 269 ASSERT_EQ(0, CountedBrowserAccessibility::num_instances()); | 269 ASSERT_EQ(0, CountedBrowserAccessibility::num_instances()); |
| 270 } | 270 } |
| 271 | 271 |
| 272 TEST_F(BrowserAccessibilityTest, TestChildrenChangeNoLeaks) { | 272 TEST_F(BrowserAccessibilityTest, TestChildrenChangeNoLeaks) { |
| 273 // Create ui::AXNodeData objects for a simple document tree, | 273 // Create ui::AXNodeData objects for a simple document tree, |
| 274 // representing the accessibility information used to initialize | 274 // representing the accessibility information used to initialize |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(4, hyperlink.Receive())); | 664 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(4, hyperlink.Receive())); |
| 665 | 665 |
| 666 // Get the text of the combo box. | 666 // Get the text of the combo box. |
| 667 // It should be its value. | 667 // It should be its value. |
| 668 EXPECT_EQ(S_OK, root_obj->get_hyperlink(0, hyperlink.Receive())); | 668 EXPECT_EQ(S_OK, root_obj->get_hyperlink(0, hyperlink.Receive())); |
| 669 EXPECT_EQ(S_OK, hyperlink.QueryInterface(hypertext.Receive())); | 669 EXPECT_EQ(S_OK, hyperlink.QueryInterface(hypertext.Receive())); |
| 670 EXPECT_EQ(S_OK, | 670 EXPECT_EQ(S_OK, |
| 671 hypertext->get_text(0, IA2_TEXT_OFFSET_LENGTH, text.Receive())); | 671 hypertext->get_text(0, IA2_TEXT_OFFSET_LENGTH, text.Receive())); |
| 672 EXPECT_STREQ(combo_box_value.c_str(), text); | 672 EXPECT_STREQ(combo_box_value.c_str(), text); |
| 673 text.Reset(); | 673 text.Reset(); |
| 674 hyperlink.Release(); | 674 hyperlink.Reset(); |
| 675 hypertext.Release(); | 675 hypertext.Reset(); |
| 676 | 676 |
| 677 // Get the text of the check box. | 677 // Get the text of the check box. |
| 678 // It should be its name. | 678 // It should be its name. |
| 679 EXPECT_EQ(S_OK, root_obj->get_hyperlink(1, hyperlink.Receive())); | 679 EXPECT_EQ(S_OK, root_obj->get_hyperlink(1, hyperlink.Receive())); |
| 680 EXPECT_EQ(S_OK, hyperlink.QueryInterface(hypertext.Receive())); | 680 EXPECT_EQ(S_OK, hyperlink.QueryInterface(hypertext.Receive())); |
| 681 EXPECT_EQ(S_OK, | 681 EXPECT_EQ(S_OK, |
| 682 hypertext->get_text(0, IA2_TEXT_OFFSET_LENGTH, text.Receive())); | 682 hypertext->get_text(0, IA2_TEXT_OFFSET_LENGTH, text.Receive())); |
| 683 EXPECT_STREQ(check_box_name.c_str(), text); | 683 EXPECT_STREQ(check_box_name.c_str(), text); |
| 684 text.Reset(); | 684 text.Reset(); |
| 685 hyperlink.Release(); | 685 hyperlink.Reset(); |
| 686 hypertext.Release(); | 686 hypertext.Reset(); |
| 687 | 687 |
| 688 // Get the text of the button. | 688 // Get the text of the button. |
| 689 EXPECT_EQ(S_OK, root_obj->get_hyperlink(2, hyperlink.Receive())); | 689 EXPECT_EQ(S_OK, root_obj->get_hyperlink(2, hyperlink.Receive())); |
| 690 EXPECT_EQ(S_OK, hyperlink.QueryInterface(hypertext.Receive())); | 690 EXPECT_EQ(S_OK, hyperlink.QueryInterface(hypertext.Receive())); |
| 691 EXPECT_EQ(S_OK, | 691 EXPECT_EQ(S_OK, |
| 692 hypertext->get_text(0, IA2_TEXT_OFFSET_LENGTH, text.Receive())); | 692 hypertext->get_text(0, IA2_TEXT_OFFSET_LENGTH, text.Receive())); |
| 693 EXPECT_STREQ(button_text_name.c_str(), text); | 693 EXPECT_STREQ(button_text_name.c_str(), text); |
| 694 text.Reset(); | 694 text.Reset(); |
| 695 hyperlink.Release(); | 695 hyperlink.Reset(); |
| 696 hypertext.Release(); | 696 hypertext.Reset(); |
| 697 | 697 |
| 698 // Get the text of the link. | 698 // Get the text of the link. |
| 699 EXPECT_EQ(S_OK, root_obj->get_hyperlink(3, hyperlink.Receive())); | 699 EXPECT_EQ(S_OK, root_obj->get_hyperlink(3, hyperlink.Receive())); |
| 700 EXPECT_EQ(S_OK, hyperlink.QueryInterface(hypertext.Receive())); | 700 EXPECT_EQ(S_OK, hyperlink.QueryInterface(hypertext.Receive())); |
| 701 EXPECT_EQ(S_OK, hypertext->get_text(0, 4, text.Receive())); | 701 EXPECT_EQ(S_OK, hypertext->get_text(0, 4, text.Receive())); |
| 702 EXPECT_STREQ(link_text_name.c_str(), text); | 702 EXPECT_STREQ(link_text_name.c_str(), text); |
| 703 text.Reset(); | 703 text.Reset(); |
| 704 hyperlink.Release(); | 704 hyperlink.Reset(); |
| 705 hypertext.Release(); | 705 hypertext.Reset(); |
| 706 | 706 |
| 707 long hyperlink_index; | 707 long hyperlink_index; |
| 708 EXPECT_EQ(S_FALSE, root_obj->get_hyperlinkIndex(0, &hyperlink_index)); | 708 EXPECT_EQ(S_FALSE, root_obj->get_hyperlinkIndex(0, &hyperlink_index)); |
| 709 EXPECT_EQ(-1, hyperlink_index); | 709 EXPECT_EQ(-1, hyperlink_index); |
| 710 // Invalid arguments should not be modified. | 710 // Invalid arguments should not be modified. |
| 711 hyperlink_index = -2; | 711 hyperlink_index = -2; |
| 712 EXPECT_EQ(E_INVALIDARG, | 712 EXPECT_EQ(E_INVALIDARG, |
| 713 root_obj->get_hyperlinkIndex(root_hypertext_len, &hyperlink_index)); | 713 root_obj->get_hyperlinkIndex(root_hypertext_len, &hyperlink_index)); |
| 714 EXPECT_EQ(-2, hyperlink_index); | 714 EXPECT_EQ(-2, hyperlink_index); |
| 715 EXPECT_EQ(S_OK, root_obj->get_hyperlinkIndex(14, &hyperlink_index)); | 715 EXPECT_EQ(S_OK, root_obj->get_hyperlinkIndex(14, &hyperlink_index)); |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 EXPECT_EQ(offset, start); | 1173 EXPECT_EQ(offset, start); |
| 1174 EXPECT_LT(offset, end); | 1174 EXPECT_LT(offset, end); |
| 1175 LONG space_offset = static_cast<LONG>(line1.find(' ', offset)); | 1175 LONG space_offset = static_cast<LONG>(line1.find(' ', offset)); |
| 1176 EXPECT_EQ(space_offset + 1, end); | 1176 EXPECT_EQ(space_offset + 1, end); |
| 1177 LONG length = end - start; | 1177 LONG length = end - start; |
| 1178 EXPECT_STREQ(text.substr(start, length).c_str(), word); | 1178 EXPECT_STREQ(text.substr(start, length).c_str(), word); |
| 1179 word.Reset(); | 1179 word.Reset(); |
| 1180 offset = end; | 1180 offset = end; |
| 1181 } | 1181 } |
| 1182 | 1182 |
| 1183 textarea_object.Release(); | 1183 textarea_object.Reset(); |
| 1184 text_field_object.Release(); | 1184 text_field_object.Reset(); |
| 1185 | 1185 |
| 1186 manager.reset(); | 1186 manager.reset(); |
| 1187 ASSERT_EQ(0, CountedBrowserAccessibility::num_instances()); | 1187 ASSERT_EQ(0, CountedBrowserAccessibility::num_instances()); |
| 1188 } | 1188 } |
| 1189 | 1189 |
| 1190 TEST_F(BrowserAccessibilityTest, TestCaretAndSelectionInSimpleFields) { | 1190 TEST_F(BrowserAccessibilityTest, TestCaretAndSelectionInSimpleFields) { |
| 1191 ui::AXNodeData root; | 1191 ui::AXNodeData root; |
| 1192 root.id = 1; | 1192 root.id = 1; |
| 1193 root.role = ui::AX_ROLE_ROOT_WEB_AREA; | 1193 root.role = ui::AX_ROLE_ROOT_WEB_AREA; |
| 1194 root.state = (1 << ui::AX_STATE_READ_ONLY) | (1 << ui::AX_STATE_FOCUSABLE); | 1194 root.state = (1 << ui::AX_STATE_READ_ONLY) | (1 << ui::AX_STATE_FOCUSABLE); |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1623 base::win::ScopedVariant anchor; | 1623 base::win::ScopedVariant anchor; |
| 1624 base::win::ScopedVariant anchor_target; | 1624 base::win::ScopedVariant anchor_target; |
| 1625 base::win::ScopedBstr bstr; | 1625 base::win::ScopedBstr bstr; |
| 1626 | 1626 |
| 1627 base::string16 div_hypertext(L"Click "); | 1627 base::string16 div_hypertext(L"Click "); |
| 1628 div_hypertext.push_back(BrowserAccessibilityWin::kEmbeddedCharacter); | 1628 div_hypertext.push_back(BrowserAccessibilityWin::kEmbeddedCharacter); |
| 1629 | 1629 |
| 1630 // div_accessible and link_accessible are the only IA2 hyperlinks. | 1630 // div_accessible and link_accessible are the only IA2 hyperlinks. |
| 1631 EXPECT_HRESULT_FAILED(root_accessible->QueryInterface( | 1631 EXPECT_HRESULT_FAILED(root_accessible->QueryInterface( |
| 1632 IID_IAccessibleHyperlink, reinterpret_cast<void**>(hyperlink.Receive()))); | 1632 IID_IAccessibleHyperlink, reinterpret_cast<void**>(hyperlink.Receive()))); |
| 1633 hyperlink.Release(); | 1633 hyperlink.Reset(); |
| 1634 EXPECT_HRESULT_SUCCEEDED(div_accessible->QueryInterface( | 1634 EXPECT_HRESULT_SUCCEEDED(div_accessible->QueryInterface( |
| 1635 IID_IAccessibleHyperlink, reinterpret_cast<void**>(hyperlink.Receive()))); | 1635 IID_IAccessibleHyperlink, reinterpret_cast<void**>(hyperlink.Receive()))); |
| 1636 hyperlink.Release(); | 1636 hyperlink.Reset(); |
| 1637 EXPECT_HRESULT_FAILED(text_accessible->QueryInterface( | 1637 EXPECT_HRESULT_FAILED(text_accessible->QueryInterface( |
| 1638 IID_IAccessibleHyperlink, reinterpret_cast<void**>(hyperlink.Receive()))); | 1638 IID_IAccessibleHyperlink, reinterpret_cast<void**>(hyperlink.Receive()))); |
| 1639 hyperlink.Release(); | 1639 hyperlink.Reset(); |
| 1640 EXPECT_HRESULT_SUCCEEDED(link_accessible->QueryInterface( | 1640 EXPECT_HRESULT_SUCCEEDED(link_accessible->QueryInterface( |
| 1641 IID_IAccessibleHyperlink, reinterpret_cast<void**>(hyperlink.Receive()))); | 1641 IID_IAccessibleHyperlink, reinterpret_cast<void**>(hyperlink.Receive()))); |
| 1642 hyperlink.Release(); | 1642 hyperlink.Reset(); |
| 1643 | 1643 |
| 1644 EXPECT_HRESULT_SUCCEEDED(root_accessible->nActions(&n_actions)); | 1644 EXPECT_HRESULT_SUCCEEDED(root_accessible->nActions(&n_actions)); |
| 1645 EXPECT_EQ(0, n_actions); | 1645 EXPECT_EQ(0, n_actions); |
| 1646 EXPECT_HRESULT_SUCCEEDED(div_accessible->nActions(&n_actions)); | 1646 EXPECT_HRESULT_SUCCEEDED(div_accessible->nActions(&n_actions)); |
| 1647 EXPECT_EQ(1, n_actions); | 1647 EXPECT_EQ(1, n_actions); |
| 1648 EXPECT_HRESULT_SUCCEEDED(text_accessible->nActions(&n_actions)); | 1648 EXPECT_HRESULT_SUCCEEDED(text_accessible->nActions(&n_actions)); |
| 1649 EXPECT_EQ(0, n_actions); | 1649 EXPECT_EQ(0, n_actions); |
| 1650 EXPECT_HRESULT_SUCCEEDED(link_accessible->nActions(&n_actions)); | 1650 EXPECT_HRESULT_SUCCEEDED(link_accessible->nActions(&n_actions)); |
| 1651 EXPECT_EQ(1, n_actions); | 1651 EXPECT_EQ(1, n_actions); |
| 1652 | 1652 |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2407 relation_type.Reset(); | 2407 relation_type.Reset(); |
| 2408 | 2408 |
| 2409 EXPECT_HRESULT_SUCCEEDED(describedby_relation->get_nTargets(&n_targets)); | 2409 EXPECT_HRESULT_SUCCEEDED(describedby_relation->get_nTargets(&n_targets)); |
| 2410 EXPECT_EQ(2, n_targets); | 2410 EXPECT_EQ(2, n_targets); |
| 2411 | 2411 |
| 2412 EXPECT_HRESULT_SUCCEEDED( | 2412 EXPECT_HRESULT_SUCCEEDED( |
| 2413 describedby_relation->get_target(0, target.Receive())); | 2413 describedby_relation->get_target(0, target.Receive())); |
| 2414 target.QueryInterface(ax_target.Receive()); | 2414 target.QueryInterface(ax_target.Receive()); |
| 2415 EXPECT_HRESULT_SUCCEEDED(ax_target->get_uniqueID(&unique_id)); | 2415 EXPECT_HRESULT_SUCCEEDED(ax_target->get_uniqueID(&unique_id)); |
| 2416 EXPECT_EQ(-ax_child1->unique_id(), unique_id); | 2416 EXPECT_EQ(-ax_child1->unique_id(), unique_id); |
| 2417 ax_target.Release(); | 2417 ax_target.Reset(); |
| 2418 target.Release(); | 2418 target.Reset(); |
| 2419 | 2419 |
| 2420 EXPECT_HRESULT_SUCCEEDED( | 2420 EXPECT_HRESULT_SUCCEEDED( |
| 2421 describedby_relation->get_target(1, target.Receive())); | 2421 describedby_relation->get_target(1, target.Receive())); |
| 2422 target.QueryInterface(ax_target.Receive()); | 2422 target.QueryInterface(ax_target.Receive()); |
| 2423 EXPECT_HRESULT_SUCCEEDED(ax_target->get_uniqueID(&unique_id)); | 2423 EXPECT_HRESULT_SUCCEEDED(ax_target->get_uniqueID(&unique_id)); |
| 2424 EXPECT_EQ(-ax_child2->unique_id(), unique_id); | 2424 EXPECT_EQ(-ax_child2->unique_id(), unique_id); |
| 2425 ax_target.Release(); | 2425 ax_target.Reset(); |
| 2426 target.Release(); | 2426 target.Reset(); |
| 2427 describedby_relation.Release(); | 2427 describedby_relation.Reset(); |
| 2428 | 2428 |
| 2429 // Test the reverse relations. | 2429 // Test the reverse relations. |
| 2430 EXPECT_HRESULT_SUCCEEDED(ax_child1->get_nRelations(&n_relations)); | 2430 EXPECT_HRESULT_SUCCEEDED(ax_child1->get_nRelations(&n_relations)); |
| 2431 EXPECT_EQ(1, n_relations); | 2431 EXPECT_EQ(1, n_relations); |
| 2432 | 2432 |
| 2433 EXPECT_HRESULT_SUCCEEDED( | 2433 EXPECT_HRESULT_SUCCEEDED( |
| 2434 ax_child1->get_relation(0, description_for_relation.Receive())); | 2434 ax_child1->get_relation(0, description_for_relation.Receive())); |
| 2435 EXPECT_HRESULT_SUCCEEDED( | 2435 EXPECT_HRESULT_SUCCEEDED( |
| 2436 description_for_relation->get_relationType(relation_type.Receive())); | 2436 description_for_relation->get_relationType(relation_type.Receive())); |
| 2437 EXPECT_EQ(L"descriptionFor", base::string16(relation_type)); | 2437 EXPECT_EQ(L"descriptionFor", base::string16(relation_type)); |
| 2438 relation_type.Reset(); | 2438 relation_type.Reset(); |
| 2439 | 2439 |
| 2440 EXPECT_HRESULT_SUCCEEDED(description_for_relation->get_nTargets(&n_targets)); | 2440 EXPECT_HRESULT_SUCCEEDED(description_for_relation->get_nTargets(&n_targets)); |
| 2441 EXPECT_EQ(1, n_targets); | 2441 EXPECT_EQ(1, n_targets); |
| 2442 | 2442 |
| 2443 EXPECT_HRESULT_SUCCEEDED( | 2443 EXPECT_HRESULT_SUCCEEDED( |
| 2444 description_for_relation->get_target(0, target.Receive())); | 2444 description_for_relation->get_target(0, target.Receive())); |
| 2445 target.QueryInterface(ax_target.Receive()); | 2445 target.QueryInterface(ax_target.Receive()); |
| 2446 EXPECT_HRESULT_SUCCEEDED(ax_target->get_uniqueID(&unique_id)); | 2446 EXPECT_HRESULT_SUCCEEDED(ax_target->get_uniqueID(&unique_id)); |
| 2447 EXPECT_EQ(-ax_root->unique_id(), unique_id); | 2447 EXPECT_EQ(-ax_root->unique_id(), unique_id); |
| 2448 ax_target.Release(); | 2448 ax_target.Reset(); |
| 2449 target.Release(); | 2449 target.Reset(); |
| 2450 description_for_relation.Release(); | 2450 description_for_relation.Reset(); |
| 2451 | 2451 |
| 2452 EXPECT_HRESULT_SUCCEEDED(ax_child2->get_nRelations(&n_relations)); | 2452 EXPECT_HRESULT_SUCCEEDED(ax_child2->get_nRelations(&n_relations)); |
| 2453 EXPECT_EQ(1, n_relations); | 2453 EXPECT_EQ(1, n_relations); |
| 2454 | 2454 |
| 2455 EXPECT_HRESULT_SUCCEEDED( | 2455 EXPECT_HRESULT_SUCCEEDED( |
| 2456 ax_child2->get_relation(0, description_for_relation.Receive())); | 2456 ax_child2->get_relation(0, description_for_relation.Receive())); |
| 2457 EXPECT_HRESULT_SUCCEEDED( | 2457 EXPECT_HRESULT_SUCCEEDED( |
| 2458 description_for_relation->get_relationType(relation_type.Receive())); | 2458 description_for_relation->get_relationType(relation_type.Receive())); |
| 2459 EXPECT_EQ(L"descriptionFor", base::string16(relation_type)); | 2459 EXPECT_EQ(L"descriptionFor", base::string16(relation_type)); |
| 2460 relation_type.Reset(); | 2460 relation_type.Reset(); |
| 2461 | 2461 |
| 2462 EXPECT_HRESULT_SUCCEEDED(description_for_relation->get_nTargets(&n_targets)); | 2462 EXPECT_HRESULT_SUCCEEDED(description_for_relation->get_nTargets(&n_targets)); |
| 2463 EXPECT_EQ(1, n_targets); | 2463 EXPECT_EQ(1, n_targets); |
| 2464 | 2464 |
| 2465 EXPECT_HRESULT_SUCCEEDED( | 2465 EXPECT_HRESULT_SUCCEEDED( |
| 2466 description_for_relation->get_target(0, target.Receive())); | 2466 description_for_relation->get_target(0, target.Receive())); |
| 2467 target.QueryInterface(ax_target.Receive()); | 2467 target.QueryInterface(ax_target.Receive()); |
| 2468 EXPECT_HRESULT_SUCCEEDED(ax_target->get_uniqueID(&unique_id)); | 2468 EXPECT_HRESULT_SUCCEEDED(ax_target->get_uniqueID(&unique_id)); |
| 2469 EXPECT_EQ(-ax_root->unique_id(), unique_id); | 2469 EXPECT_EQ(-ax_root->unique_id(), unique_id); |
| 2470 ax_target.Release(); | 2470 ax_target.Reset(); |
| 2471 target.Release(); | 2471 target.Reset(); |
| 2472 | 2472 |
| 2473 // Try adding one more relation. | 2473 // Try adding one more relation. |
| 2474 std::vector<int32_t> labelledby_ids = {3}; | 2474 std::vector<int32_t> labelledby_ids = {3}; |
| 2475 child1.AddIntListAttribute(ui::AX_ATTR_LABELLEDBY_IDS, labelledby_ids); | 2475 child1.AddIntListAttribute(ui::AX_ATTR_LABELLEDBY_IDS, labelledby_ids); |
| 2476 AXEventNotificationDetails event; | 2476 AXEventNotificationDetails event; |
| 2477 event.event_type = ui::AX_EVENT_ARIA_ATTRIBUTE_CHANGED; | 2477 event.event_type = ui::AX_EVENT_ARIA_ATTRIBUTE_CHANGED; |
| 2478 event.update.nodes.push_back(child1); | 2478 event.update.nodes.push_back(child1); |
| 2479 event.id = child1.id; | 2479 event.id = child1.id; |
| 2480 std::vector<AXEventNotificationDetails> events = {event}; | 2480 std::vector<AXEventNotificationDetails> events = {event}; |
| 2481 manager->OnAccessibilityEvents(events); | 2481 manager->OnAccessibilityEvents(events); |
| 2482 | 2482 |
| 2483 EXPECT_HRESULT_SUCCEEDED(ax_child1->get_nRelations(&n_relations)); | 2483 EXPECT_HRESULT_SUCCEEDED(ax_child1->get_nRelations(&n_relations)); |
| 2484 EXPECT_EQ(2, n_relations); | 2484 EXPECT_EQ(2, n_relations); |
| 2485 EXPECT_HRESULT_SUCCEEDED(ax_child2->get_nRelations(&n_relations)); | 2485 EXPECT_HRESULT_SUCCEEDED(ax_child2->get_nRelations(&n_relations)); |
| 2486 EXPECT_EQ(2, n_relations); | 2486 EXPECT_EQ(2, n_relations); |
| 2487 } | 2487 } |
| 2488 | 2488 |
| 2489 } // namespace content | 2489 } // namespace content |
| OLD | NEW |