| 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "base/win/scoped_bstr.h" | 7 #include "base/win/scoped_bstr.h" |
| 8 #include "base/win/scoped_comptr.h" | 8 #include "base/win/scoped_comptr.h" |
| 9 #include "base/win/scoped_variant.h" | 9 #include "base/win/scoped_variant.h" |
| 10 #include "content/browser/accessibility/browser_accessibility_manager.h" | 10 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 | 477 |
| 478 // Delete the manager and test that all BrowserAccessibility instances are | 478 // Delete the manager and test that all BrowserAccessibility instances are |
| 479 // deleted. | 479 // deleted. |
| 480 manager.reset(); | 480 manager.reset(); |
| 481 ASSERT_EQ(0, CountedBrowserAccessibility::num_instances()); | 481 ASSERT_EQ(0, CountedBrowserAccessibility::num_instances()); |
| 482 } | 482 } |
| 483 | 483 |
| 484 TEST_F(BrowserAccessibilityTest, TestSimpleHypertext) { | 484 TEST_F(BrowserAccessibilityTest, TestSimpleHypertext) { |
| 485 const std::string text1_name = "One two three."; | 485 const std::string text1_name = "One two three."; |
| 486 const std::string text2_name = " Four five six."; | 486 const std::string text2_name = " Four five six."; |
| 487 const size_t text_name_len = text1_name.length() + text2_name.length(); |
| 487 | 488 |
| 488 ui::AXNodeData text1; | 489 ui::AXNodeData text1; |
| 489 text1.id = 11; | 490 text1.id = 11; |
| 490 text1.role = ui::AX_ROLE_STATIC_TEXT; | 491 text1.role = ui::AX_ROLE_STATIC_TEXT; |
| 491 text1.state = 1 << ui::AX_STATE_READ_ONLY; | 492 text1.state = 1 << ui::AX_STATE_READ_ONLY; |
| 492 text1.SetName(text1_name); | 493 text1.SetName(text1_name); |
| 493 | 494 |
| 494 ui::AXNodeData text2; | 495 ui::AXNodeData text2; |
| 495 text2.id = 12; | 496 text2.id = 12; |
| 496 text2.role = ui::AX_ROLE_STATIC_TEXT; | 497 text2.role = ui::AX_ROLE_STATIC_TEXT; |
| 497 text2.state = 1 << ui::AX_STATE_READ_ONLY; | 498 text2.state = 1 << ui::AX_STATE_READ_ONLY; |
| 498 text2.SetName(text2_name); | 499 text2.SetName(text2_name); |
| 499 | 500 |
| 500 ui::AXNodeData root; | 501 ui::AXNodeData root; |
| 501 root.id = 1; | 502 root.id = 1; |
| 502 root.role = ui::AX_ROLE_ROOT_WEB_AREA; | 503 root.role = ui::AX_ROLE_ROOT_WEB_AREA; |
| 503 root.state = 1 << ui::AX_STATE_READ_ONLY; | 504 root.state = 1 << ui::AX_STATE_READ_ONLY; |
| 504 root.child_ids.push_back(11); | 505 root.child_ids.push_back(text1.id); |
| 505 root.child_ids.push_back(12); | 506 root.child_ids.push_back(text2.id); |
| 506 | 507 |
| 507 CountedBrowserAccessibility::reset(); | 508 CountedBrowserAccessibility::reset(); |
| 508 scoped_ptr<BrowserAccessibilityManager> manager( | 509 scoped_ptr<BrowserAccessibilityManager> manager( |
| 509 BrowserAccessibilityManager::Create( | 510 BrowserAccessibilityManager::Create( |
| 510 MakeAXTreeUpdate(root, text1, text2), | 511 MakeAXTreeUpdate(root, text1, text2), nullptr, |
| 511 NULL, new CountedBrowserAccessibilityFactory())); | 512 new CountedBrowserAccessibilityFactory())); |
| 512 ASSERT_EQ(3, CountedBrowserAccessibility::num_instances()); | 513 ASSERT_EQ(3, CountedBrowserAccessibility::num_instances()); |
| 513 | 514 |
| 514 BrowserAccessibilityWin* root_obj = | 515 BrowserAccessibilityWin* root_obj = |
| 515 manager->GetRoot()->ToBrowserAccessibilityWin(); | 516 manager->GetRoot()->ToBrowserAccessibilityWin(); |
| 516 | 517 |
| 517 long text_len; | 518 long text_len; |
| 518 ASSERT_EQ(S_OK, root_obj->get_nCharacters(&text_len)); | 519 EXPECT_EQ(S_OK, root_obj->get_nCharacters(&text_len)); |
| 520 EXPECT_EQ(text_name_len, text_len); |
| 519 | 521 |
| 520 base::win::ScopedBstr text; | 522 base::win::ScopedBstr text; |
| 521 ASSERT_EQ(S_OK, root_obj->get_text(0, text_len, text.Receive())); | 523 EXPECT_EQ(S_OK, root_obj->get_text(0, text_name_len, text.Receive())); |
| 522 EXPECT_EQ(text1_name + text2_name, base::UTF16ToUTF8(base::string16(text))); | 524 EXPECT_EQ(text1_name + text2_name, base::UTF16ToUTF8(base::string16(text))); |
| 523 | 525 |
| 524 long hyperlink_count; | 526 long hyperlink_count; |
| 525 ASSERT_EQ(S_OK, root_obj->get_nHyperlinks(&hyperlink_count)); | 527 EXPECT_EQ(S_OK, root_obj->get_nHyperlinks(&hyperlink_count)); |
| 526 EXPECT_EQ(0, hyperlink_count); | 528 EXPECT_EQ(0, hyperlink_count); |
| 527 | 529 |
| 528 base::win::ScopedComPtr<IAccessibleHyperlink> hyperlink; | 530 base::win::ScopedComPtr<IAccessibleHyperlink> hyperlink; |
| 529 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(-1, hyperlink.Receive())); | 531 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(-1, hyperlink.Receive())); |
| 530 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(0, hyperlink.Receive())); | 532 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(0, hyperlink.Receive())); |
| 531 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(28, hyperlink.Receive())); | 533 EXPECT_EQ(E_INVALIDARG, |
| 532 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(29, hyperlink.Receive())); | 534 root_obj->get_hyperlink(text_name_len, hyperlink.Receive())); |
| 535 EXPECT_EQ(E_INVALIDARG, |
| 536 root_obj->get_hyperlink(text_name_len + 1, hyperlink.Receive())); |
| 533 | 537 |
| 534 long hyperlink_index; | 538 long hyperlink_index; |
| 535 EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(0, &hyperlink_index)); | 539 EXPECT_EQ(S_FALSE, root_obj->get_hyperlinkIndex(0, &hyperlink_index)); |
| 536 EXPECT_EQ(-1, hyperlink_index); | 540 EXPECT_EQ(-1, hyperlink_index); |
| 537 EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(28, &hyperlink_index)); | 541 // Invalid arguments should not be modified. |
| 538 EXPECT_EQ(-1, hyperlink_index); | 542 hyperlink_index = -2; |
| 543 EXPECT_EQ(E_INVALIDARG, |
| 544 root_obj->get_hyperlinkIndex(text_name_len, &hyperlink_index)); |
| 545 EXPECT_EQ(-2, hyperlink_index); |
| 539 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlinkIndex(-1, &hyperlink_index)); | 546 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlinkIndex(-1, &hyperlink_index)); |
| 540 EXPECT_EQ(-1, hyperlink_index); | 547 EXPECT_EQ(-2, hyperlink_index); |
| 541 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlinkIndex(29, &hyperlink_index)); | 548 EXPECT_EQ(E_INVALIDARG, |
| 542 EXPECT_EQ(-1, hyperlink_index); | 549 root_obj->get_hyperlinkIndex(text_name_len + 1, &hyperlink_index)); |
| 543 | 550 EXPECT_EQ(-2, hyperlink_index); |
| 544 // Delete the manager and test that all BrowserAccessibility instances are | 551 |
| 545 // deleted. | |
| 546 manager.reset(); | 552 manager.reset(); |
| 547 ASSERT_EQ(0, CountedBrowserAccessibility::num_instances()); | 553 ASSERT_EQ(0, CountedBrowserAccessibility::num_instances()); |
| 548 } | 554 } |
| 549 | 555 |
| 550 TEST_F(BrowserAccessibilityTest, TestComplexHypertext) { | 556 TEST_F(BrowserAccessibilityTest, TestComplexHypertext) { |
| 551 const std::string text1_name = "One two three."; | 557 const base::string16 text1_name = L"One two three."; |
| 552 const std::string text2_name = " Four five six."; | 558 const base::string16 combo_box_name = L"City:"; |
| 553 const std::string button1_text_name = "red"; | 559 const base::string16 combo_box_value = L"Happyland"; |
| 554 const std::string link1_text_name = "blue"; | 560 const base::string16 text2_name = L" Four five six."; |
| 561 const base::string16 check_box_name = L"I agree"; |
| 562 const base::string16 check_box_value = L"Checked"; |
| 563 const base::string16 button_text_name = L"Red"; |
| 564 const base::string16 link_text_name = L"Blue"; |
| 565 // Each control (combo / check box, button and link) will be represented by an |
| 566 // embedded object character. |
| 567 const base::string16 embed(1, BrowserAccessibilityWin::kEmbeddedCharacter); |
| 568 const base::string16 root_hypertext = |
| 569 text1_name + embed + text2_name + embed + embed + embed; |
| 570 const size_t root_hypertext_len = root_hypertext.length(); |
| 555 | 571 |
| 556 ui::AXNodeData text1; | 572 ui::AXNodeData text1; |
| 557 text1.id = 11; | 573 text1.id = 11; |
| 558 text1.role = ui::AX_ROLE_STATIC_TEXT; | 574 text1.role = ui::AX_ROLE_STATIC_TEXT; |
| 559 text1.state = 1 << ui::AX_STATE_READ_ONLY; | 575 text1.state = 1 << ui::AX_STATE_READ_ONLY; |
| 560 text1.SetName(text1_name); | 576 text1.SetName(base::UTF16ToUTF8(text1_name)); |
| 577 |
| 578 ui::AXNodeData combo_box; |
| 579 combo_box.id = 12; |
| 580 combo_box.role = ui::AX_ROLE_COMBO_BOX; |
| 581 combo_box.SetName(base::UTF16ToUTF8(combo_box_name)); |
| 582 combo_box.SetValue(base::UTF16ToUTF8(combo_box_value)); |
| 561 | 583 |
| 562 ui::AXNodeData text2; | 584 ui::AXNodeData text2; |
| 563 text2.id = 12; | 585 text2.id = 13; |
| 564 text2.role = ui::AX_ROLE_STATIC_TEXT; | 586 text2.role = ui::AX_ROLE_STATIC_TEXT; |
| 565 text2.state = 1 << ui::AX_STATE_READ_ONLY; | 587 text2.state = 1 << ui::AX_STATE_READ_ONLY; |
| 566 text2.SetName(text2_name); | 588 text2.SetName(base::UTF16ToUTF8(text2_name)); |
| 567 | 589 |
| 568 ui::AXNodeData button1, button1_text; | 590 ui::AXNodeData check_box; |
| 569 button1.id = 13; | 591 check_box.id = 14; |
| 570 button1_text.id = 15; | 592 check_box.role = ui::AX_ROLE_CHECK_BOX; |
| 571 button1_text.SetName(button1_text_name); | 593 check_box.state = 1 << ui::AX_STATE_CHECKED; |
| 572 button1.role = ui::AX_ROLE_BUTTON; | 594 check_box.SetName(base::UTF16ToUTF8(check_box_name)); |
| 573 button1_text.role = ui::AX_ROLE_STATIC_TEXT; | 595 check_box.SetValue(base::UTF16ToUTF8(check_box_value)); |
| 574 button1.state = 1 << ui::AX_STATE_READ_ONLY; | 596 |
| 575 button1_text.state = 1 << ui::AX_STATE_READ_ONLY; | 597 ui::AXNodeData button, button_text; |
| 576 button1.child_ids.push_back(15); | 598 button.id = 15; |
| 577 | 599 button_text.id = 17; |
| 578 ui::AXNodeData link1, link1_text; | 600 button_text.SetName(base::UTF16ToUTF8(button_text_name)); |
| 579 link1.id = 14; | 601 button.role = ui::AX_ROLE_BUTTON; |
| 580 link1_text.id = 16; | 602 button_text.role = ui::AX_ROLE_STATIC_TEXT; |
| 581 link1_text.SetName(link1_text_name); | 603 button.state = 1 << ui::AX_STATE_READ_ONLY; |
| 582 link1.role = ui::AX_ROLE_LINK; | 604 button_text.state = 1 << ui::AX_STATE_READ_ONLY; |
| 583 link1_text.role = ui::AX_ROLE_STATIC_TEXT; | 605 button.child_ids.push_back(button_text.id); |
| 584 link1.state = 1 << ui::AX_STATE_READ_ONLY; | 606 |
| 585 link1_text.state = 1 << ui::AX_STATE_READ_ONLY; | 607 ui::AXNodeData link, link_text; |
| 586 link1.child_ids.push_back(16); | 608 link.id = 16; |
| 609 link_text.id = 18; |
| 610 link_text.SetName(base::UTF16ToUTF8(link_text_name)); |
| 611 link.role = ui::AX_ROLE_LINK; |
| 612 link_text.role = ui::AX_ROLE_STATIC_TEXT; |
| 613 link.state = 1 << ui::AX_STATE_READ_ONLY; |
| 614 link_text.state = 1 << ui::AX_STATE_READ_ONLY; |
| 615 link.child_ids.push_back(link_text.id); |
| 587 | 616 |
| 588 ui::AXNodeData root; | 617 ui::AXNodeData root; |
| 589 root.id = 1; | 618 root.id = 1; |
| 590 root.role = ui::AX_ROLE_ROOT_WEB_AREA; | 619 root.role = ui::AX_ROLE_ROOT_WEB_AREA; |
| 591 root.state = 1 << ui::AX_STATE_READ_ONLY; | 620 root.state = 1 << ui::AX_STATE_READ_ONLY; |
| 592 root.child_ids.push_back(11); | 621 root.child_ids.push_back(text1.id); |
| 593 root.child_ids.push_back(13); | 622 root.child_ids.push_back(combo_box.id); |
| 594 root.child_ids.push_back(12); | 623 root.child_ids.push_back(text2.id); |
| 595 root.child_ids.push_back(14); | 624 root.child_ids.push_back(check_box.id); |
| 625 root.child_ids.push_back(button.id); |
| 626 root.child_ids.push_back(link.id); |
| 596 | 627 |
| 597 CountedBrowserAccessibility::reset(); | 628 CountedBrowserAccessibility::reset(); |
| 598 scoped_ptr<BrowserAccessibilityManager> manager( | 629 scoped_ptr<BrowserAccessibilityManager> manager( |
| 599 BrowserAccessibilityManager::Create( | 630 BrowserAccessibilityManager::Create( |
| 600 MakeAXTreeUpdate(root, | 631 MakeAXTreeUpdate(root, text1, combo_box, text2, check_box, button, |
| 601 text1, button1, button1_text, | 632 button_text, link, link_text), |
| 602 text2, link1, link1_text), | 633 nullptr, new CountedBrowserAccessibilityFactory())); |
| 603 NULL, new CountedBrowserAccessibilityFactory())); | 634 ASSERT_EQ(9, CountedBrowserAccessibility::num_instances()); |
| 604 ASSERT_EQ(7, CountedBrowserAccessibility::num_instances()); | |
| 605 | 635 |
| 606 BrowserAccessibilityWin* root_obj = | 636 BrowserAccessibilityWin* root_obj = |
| 607 manager->GetRoot()->ToBrowserAccessibilityWin(); | 637 manager->GetRoot()->ToBrowserAccessibilityWin(); |
| 608 | 638 |
| 609 long text_len; | 639 long text_len; |
| 610 ASSERT_EQ(S_OK, root_obj->get_nCharacters(&text_len)); | 640 EXPECT_EQ(S_OK, root_obj->get_nCharacters(&text_len)); |
| 641 EXPECT_EQ(root_hypertext_len, text_len); |
| 611 | 642 |
| 612 base::win::ScopedBstr text; | 643 base::win::ScopedBstr text; |
| 613 ASSERT_EQ(S_OK, root_obj->get_text(0, text_len, text.Receive())); | 644 EXPECT_EQ(S_OK, root_obj->get_text(0, root_hypertext_len, text.Receive())); |
| 614 const std::string embed = base::UTF16ToUTF8( | 645 EXPECT_STREQ(root_hypertext.c_str(), text); |
| 615 base::string16(1, BrowserAccessibilityWin::kEmbeddedCharacter)); | |
| 616 EXPECT_EQ(text1_name + embed + text2_name + embed, | |
| 617 base::UTF16ToUTF8(base::string16(text))); | |
| 618 text.Reset(); | 646 text.Reset(); |
| 619 | 647 |
| 620 long hyperlink_count; | 648 long hyperlink_count; |
| 621 ASSERT_EQ(S_OK, root_obj->get_nHyperlinks(&hyperlink_count)); | 649 EXPECT_EQ(S_OK, root_obj->get_nHyperlinks(&hyperlink_count)); |
| 622 EXPECT_EQ(2, hyperlink_count); | 650 EXPECT_EQ(4, hyperlink_count); |
| 623 | 651 |
| 624 base::win::ScopedComPtr<IAccessibleHyperlink> hyperlink; | 652 base::win::ScopedComPtr<IAccessibleHyperlink> hyperlink; |
| 625 base::win::ScopedComPtr<IAccessibleText> hypertext; | 653 base::win::ScopedComPtr<IAccessibleText> hypertext; |
| 626 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(-1, hyperlink.Receive())); | 654 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(-1, hyperlink.Receive())); |
| 627 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(2, hyperlink.Receive())); | 655 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(4, hyperlink.Receive())); |
| 628 EXPECT_EQ(E_INVALIDARG, root_obj->get_hyperlink(28, hyperlink.Receive())); | 656 |
| 629 | 657 // Get the text of the combo box. |
| 658 // It should be its value. |
| 630 EXPECT_EQ(S_OK, root_obj->get_hyperlink(0, hyperlink.Receive())); | 659 EXPECT_EQ(S_OK, root_obj->get_hyperlink(0, hyperlink.Receive())); |
| 660 EXPECT_EQ(S_OK, hyperlink.QueryInterface(hypertext.Receive())); |
| 631 EXPECT_EQ(S_OK, | 661 EXPECT_EQ(S_OK, |
| 632 hyperlink.QueryInterface<IAccessibleText>(hypertext.Receive())); | 662 hypertext->get_text(0, IA2_TEXT_OFFSET_LENGTH, text.Receive())); |
| 633 EXPECT_EQ(S_OK, hypertext->get_text(0, 3, text.Receive())); | 663 EXPECT_STREQ(combo_box_value.c_str(), text); |
| 634 EXPECT_STREQ(button1_text_name.c_str(), | 664 text.Reset(); |
| 635 base::UTF16ToUTF8(base::string16(text)).c_str()); | 665 hyperlink.Release(); |
| 636 text.Reset(); | 666 hypertext.Release(); |
| 637 hyperlink.Release(); | 667 |
| 638 hypertext.Release(); | 668 // Get the text of the check box. |
| 639 | 669 // It should be its name. |
| 640 EXPECT_EQ(S_OK, root_obj->get_hyperlink(1, hyperlink.Receive())); | 670 EXPECT_EQ(S_OK, root_obj->get_hyperlink(1, hyperlink.Receive())); |
| 671 EXPECT_EQ(S_OK, hyperlink.QueryInterface(hypertext.Receive())); |
| 641 EXPECT_EQ(S_OK, | 672 EXPECT_EQ(S_OK, |
| 642 hyperlink.QueryInterface<IAccessibleText>(hypertext.Receive())); | 673 hypertext->get_text(0, IA2_TEXT_OFFSET_LENGTH, text.Receive())); |
| 674 EXPECT_STREQ(check_box_name.c_str(), text); |
| 675 text.Reset(); |
| 676 hyperlink.Release(); |
| 677 hypertext.Release(); |
| 678 |
| 679 // Get the text of the button. |
| 680 EXPECT_EQ(S_OK, root_obj->get_hyperlink(2, hyperlink.Receive())); |
| 681 EXPECT_EQ(S_OK, hyperlink.QueryInterface(hypertext.Receive())); |
| 682 EXPECT_EQ(S_OK, |
| 683 hypertext->get_text(0, IA2_TEXT_OFFSET_LENGTH, text.Receive())); |
| 684 EXPECT_STREQ(button_text_name.c_str(), text); |
| 685 text.Reset(); |
| 686 hyperlink.Release(); |
| 687 hypertext.Release(); |
| 688 |
| 689 // Get the text of the link. |
| 690 EXPECT_EQ(S_OK, root_obj->get_hyperlink(3, hyperlink.Receive())); |
| 691 EXPECT_EQ(S_OK, hyperlink.QueryInterface(hypertext.Receive())); |
| 643 EXPECT_EQ(S_OK, hypertext->get_text(0, 4, text.Receive())); | 692 EXPECT_EQ(S_OK, hypertext->get_text(0, 4, text.Receive())); |
| 644 EXPECT_STREQ(link1_text_name.c_str(), | 693 EXPECT_STREQ(link_text_name.c_str(), text); |
| 645 base::UTF16ToUTF8(base::string16(text)).c_str()); | |
| 646 text.Reset(); | 694 text.Reset(); |
| 647 hyperlink.Release(); | 695 hyperlink.Release(); |
| 648 hypertext.Release(); | 696 hypertext.Release(); |
| 649 | 697 |
| 650 long hyperlink_index; | 698 long hyperlink_index; |
| 651 EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(0, &hyperlink_index)); | 699 EXPECT_EQ(S_FALSE, root_obj->get_hyperlinkIndex(0, &hyperlink_index)); |
| 652 EXPECT_EQ(-1, hyperlink_index); | 700 EXPECT_EQ(-1, hyperlink_index); |
| 653 EXPECT_EQ(E_FAIL, root_obj->get_hyperlinkIndex(28, &hyperlink_index)); | 701 // Invalid arguments should not be modified. |
| 654 EXPECT_EQ(-1, hyperlink_index); | 702 hyperlink_index = -2; |
| 703 EXPECT_EQ(E_INVALIDARG, |
| 704 root_obj->get_hyperlinkIndex(root_hypertext_len, &hyperlink_index)); |
| 705 EXPECT_EQ(-2, hyperlink_index); |
| 655 EXPECT_EQ(S_OK, root_obj->get_hyperlinkIndex(14, &hyperlink_index)); | 706 EXPECT_EQ(S_OK, root_obj->get_hyperlinkIndex(14, &hyperlink_index)); |
| 656 EXPECT_EQ(0, hyperlink_index); | 707 EXPECT_EQ(0, hyperlink_index); |
| 657 EXPECT_EQ(S_OK, root_obj->get_hyperlinkIndex(30, &hyperlink_index)); | 708 EXPECT_EQ(S_OK, root_obj->get_hyperlinkIndex(30, &hyperlink_index)); |
| 658 EXPECT_EQ(1, hyperlink_index); | 709 EXPECT_EQ(1, hyperlink_index); |
| 659 | 710 EXPECT_EQ(S_OK, root_obj->get_hyperlinkIndex(31, &hyperlink_index)); |
| 660 // Delete the manager and test that all BrowserAccessibility instances are | 711 EXPECT_EQ(2, hyperlink_index); |
| 661 // deleted. | 712 EXPECT_EQ(S_OK, root_obj->get_hyperlinkIndex(32, &hyperlink_index)); |
| 713 EXPECT_EQ(3, hyperlink_index); |
| 714 |
| 662 manager.reset(); | 715 manager.reset(); |
| 663 ASSERT_EQ(0, CountedBrowserAccessibility::num_instances()); | 716 ASSERT_EQ(0, CountedBrowserAccessibility::num_instances()); |
| 664 } | 717 } |
| 665 | 718 |
| 666 TEST_F(BrowserAccessibilityTest, TestCreateEmptyDocument) { | 719 TEST_F(BrowserAccessibilityTest, TestCreateEmptyDocument) { |
| 667 // Try creating an empty document with busy state. Readonly is | 720 // Try creating an empty document with busy state. Readonly is |
| 668 // set automatically. | 721 // set automatically. |
| 669 CountedBrowserAccessibility::reset(); | 722 CountedBrowserAccessibility::reset(); |
| 670 const int32 busy_state = 1 << ui::AX_STATE_BUSY; | 723 const int32 busy_state = 1 << ui::AX_STATE_BUSY; |
| 671 const int32 readonly_state = 1 << ui::AX_STATE_READ_ONLY; | 724 const int32 readonly_state = 1 << ui::AX_STATE_READ_ONLY; |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1422 } | 1475 } |
| 1423 | 1476 |
| 1424 TEST_F(BrowserAccessibilityTest, TestSanitizeStringAttributeForIA2) { | 1477 TEST_F(BrowserAccessibilityTest, TestSanitizeStringAttributeForIA2) { |
| 1425 base::string16 input(L"\\:=,;"); | 1478 base::string16 input(L"\\:=,;"); |
| 1426 base::string16 output; | 1479 base::string16 output; |
| 1427 BrowserAccessibilityWin::SanitizeStringAttributeForIA2(input, &output); | 1480 BrowserAccessibilityWin::SanitizeStringAttributeForIA2(input, &output); |
| 1428 EXPECT_EQ(L"\\\\\\:\\=\\,\\;", output); | 1481 EXPECT_EQ(L"\\\\\\:\\=\\,\\;", output); |
| 1429 } | 1482 } |
| 1430 | 1483 |
| 1431 } // namespace content | 1484 } // namespace content |
| OLD | NEW |