Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: content/browser/accessibility/browser_accessibility_manager_unittest.cc

Issue 143473003: Generate ax enums from idl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Caught Blink enum conversion bug! Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/strings/string16.h" 5 #include "base/strings/string16.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "content/browser/accessibility/browser_accessibility.h" 7 #include "content/browser/accessibility/browser_accessibility.h"
8 #include "content/browser/accessibility/browser_accessibility_manager.h" 8 #include "content/browser/accessibility/browser_accessibility_manager.h"
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include "content/browser/accessibility/browser_accessibility_win.h" 10 #include "content/browser/accessibility/browser_accessibility_win.h"
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 static_text.role = ui::AX_ROLE_STATIC_TEXT; 633 static_text.role = ui::AX_ROLE_STATIC_TEXT;
634 static_text.location = gfx::Rect(100, 100, 29, 18); 634 static_text.location = gfx::Rect(100, 100, 29, 18);
635 root.child_ids.push_back(2); 635 root.child_ids.push_back(2);
636 636
637 ui::AXNodeData inline_text1; 637 ui::AXNodeData inline_text1;
638 inline_text1.id = 3; 638 inline_text1.id = 3;
639 inline_text1.SetValue("Hello, "); 639 inline_text1.SetValue("Hello, ");
640 inline_text1.role = ui::AX_ROLE_INLINE_TEXT_BOX; 640 inline_text1.role = ui::AX_ROLE_INLINE_TEXT_BOX;
641 inline_text1.location = gfx::Rect(100, 100, 29, 9); 641 inline_text1.location = gfx::Rect(100, 100, 29, 9);
642 inline_text1.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, 642 inline_text1.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION,
643 blink::WebAXTextDirectionLR); 643 ui::AX_TEXT_DIRECTION_LR);
644 std::vector<int32> character_offsets1; 644 std::vector<int32> character_offsets1;
645 character_offsets1.push_back(6); // 0 645 character_offsets1.push_back(6); // 0
646 character_offsets1.push_back(11); // 1 646 character_offsets1.push_back(11); // 1
647 character_offsets1.push_back(16); // 2 647 character_offsets1.push_back(16); // 2
648 character_offsets1.push_back(21); // 3 648 character_offsets1.push_back(21); // 3
649 character_offsets1.push_back(26); // 4 649 character_offsets1.push_back(26); // 4
650 character_offsets1.push_back(29); // 5 650 character_offsets1.push_back(29); // 5
651 character_offsets1.push_back(29); // 6 (note that the space has no width) 651 character_offsets1.push_back(29); // 6 (note that the space has no width)
652 inline_text1.AddIntListAttribute( 652 inline_text1.AddIntListAttribute(
653 ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets1); 653 ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets1);
654 static_text.child_ids.push_back(3); 654 static_text.child_ids.push_back(3);
655 655
656 ui::AXNodeData inline_text2; 656 ui::AXNodeData inline_text2;
657 inline_text2.id = 4; 657 inline_text2.id = 4;
658 inline_text2.SetValue("world."); 658 inline_text2.SetValue("world.");
659 inline_text2.role = ui::AX_ROLE_INLINE_TEXT_BOX; 659 inline_text2.role = ui::AX_ROLE_INLINE_TEXT_BOX;
660 inline_text2.location = gfx::Rect(100, 109, 28, 9); 660 inline_text2.location = gfx::Rect(100, 109, 28, 9);
661 inline_text2.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, 661 inline_text2.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION,
662 blink::WebAXTextDirectionLR); 662 ui::AX_TEXT_DIRECTION_LR);
663 std::vector<int32> character_offsets2; 663 std::vector<int32> character_offsets2;
664 character_offsets2.push_back(5); 664 character_offsets2.push_back(5);
665 character_offsets2.push_back(10); 665 character_offsets2.push_back(10);
666 character_offsets2.push_back(15); 666 character_offsets2.push_back(15);
667 character_offsets2.push_back(20); 667 character_offsets2.push_back(20);
668 character_offsets2.push_back(25); 668 character_offsets2.push_back(25);
669 character_offsets2.push_back(28); 669 character_offsets2.push_back(28);
670 inline_text2.AddIntListAttribute( 670 inline_text2.AddIntListAttribute(
671 ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets2); 671 ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets2);
672 static_text.child_ids.push_back(4); 672 static_text.child_ids.push_back(4);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 static_text.role = ui::AX_ROLE_STATIC_TEXT; 729 static_text.role = ui::AX_ROLE_STATIC_TEXT;
730 static_text.location = gfx::Rect(100, 100, 60, 20); 730 static_text.location = gfx::Rect(100, 100, 60, 20);
731 root.child_ids.push_back(2); 731 root.child_ids.push_back(2);
732 732
733 ui::AXNodeData inline_text1; 733 ui::AXNodeData inline_text1;
734 inline_text1.id = 3; 734 inline_text1.id = 3;
735 inline_text1.SetValue("123"); 735 inline_text1.SetValue("123");
736 inline_text1.role = ui::AX_ROLE_INLINE_TEXT_BOX; 736 inline_text1.role = ui::AX_ROLE_INLINE_TEXT_BOX;
737 inline_text1.location = gfx::Rect(100, 100, 30, 20); 737 inline_text1.location = gfx::Rect(100, 100, 30, 20);
738 inline_text1.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, 738 inline_text1.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION,
739 blink::WebAXTextDirectionLR); 739 ui::AX_TEXT_DIRECTION_LR);
740 std::vector<int32> character_offsets1; 740 std::vector<int32> character_offsets1;
741 character_offsets1.push_back(10); // 0 741 character_offsets1.push_back(10); // 0
742 character_offsets1.push_back(20); // 1 742 character_offsets1.push_back(20); // 1
743 character_offsets1.push_back(30); // 2 743 character_offsets1.push_back(30); // 2
744 inline_text1.AddIntListAttribute( 744 inline_text1.AddIntListAttribute(
745 ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets1); 745 ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets1);
746 static_text.child_ids.push_back(3); 746 static_text.child_ids.push_back(3);
747 747
748 ui::AXNodeData inline_text2; 748 ui::AXNodeData inline_text2;
749 inline_text2.id = 4; 749 inline_text2.id = 4;
750 inline_text2.SetValue("abc"); 750 inline_text2.SetValue("abc");
751 inline_text2.role = ui::AX_ROLE_INLINE_TEXT_BOX; 751 inline_text2.role = ui::AX_ROLE_INLINE_TEXT_BOX;
752 inline_text2.location = gfx::Rect(130, 100, 30, 20); 752 inline_text2.location = gfx::Rect(130, 100, 30, 20);
753 inline_text2.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, 753 inline_text2.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION,
754 blink::WebAXTextDirectionRL); 754 ui::AX_TEXT_DIRECTION_RL);
755 std::vector<int32> character_offsets2; 755 std::vector<int32> character_offsets2;
756 character_offsets2.push_back(10); 756 character_offsets2.push_back(10);
757 character_offsets2.push_back(20); 757 character_offsets2.push_back(20);
758 character_offsets2.push_back(30); 758 character_offsets2.push_back(30);
759 inline_text2.AddIntListAttribute( 759 inline_text2.AddIntListAttribute(
760 ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets2); 760 ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets2);
761 static_text.child_ids.push_back(4); 761 static_text.child_ids.push_back(4);
762 762
763 scoped_ptr<BrowserAccessibilityManager> manager( 763 scoped_ptr<BrowserAccessibilityManager> manager(
764 BrowserAccessibilityManager::Create( 764 BrowserAccessibilityManager::Create(
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 static_text2.role = ui::AX_ROLE_STATIC_TEXT; 830 static_text2.role = ui::AX_ROLE_STATIC_TEXT;
831 static_text2.location = gfx::Rect(160, 100, 40, 20); 831 static_text2.location = gfx::Rect(160, 100, 40, 20);
832 static_text2.child_ids.push_back(7); 832 static_text2.child_ids.push_back(7);
833 833
834 ui::AXNodeData inline_text1; 834 ui::AXNodeData inline_text1;
835 inline_text1.id = 6; 835 inline_text1.id = 6;
836 inline_text1.SetValue("AB"); 836 inline_text1.SetValue("AB");
837 inline_text1.role = ui::AX_ROLE_INLINE_TEXT_BOX; 837 inline_text1.role = ui::AX_ROLE_INLINE_TEXT_BOX;
838 inline_text1.location = gfx::Rect(100, 100, 40, 20); 838 inline_text1.location = gfx::Rect(100, 100, 40, 20);
839 inline_text1.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, 839 inline_text1.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION,
840 blink::WebAXTextDirectionLR); 840 ui::AX_TEXT_DIRECTION_LR);
841 std::vector<int32> character_offsets1; 841 std::vector<int32> character_offsets1;
842 character_offsets1.push_back(20); // 0 842 character_offsets1.push_back(20); // 0
843 character_offsets1.push_back(40); // 1 843 character_offsets1.push_back(40); // 1
844 inline_text1.AddIntListAttribute( 844 inline_text1.AddIntListAttribute(
845 ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets1); 845 ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets1);
846 846
847 ui::AXNodeData inline_text2; 847 ui::AXNodeData inline_text2;
848 inline_text2.id = 7; 848 inline_text2.id = 7;
849 inline_text2.SetValue("CD"); 849 inline_text2.SetValue("CD");
850 inline_text2.role = ui::AX_ROLE_INLINE_TEXT_BOX; 850 inline_text2.role = ui::AX_ROLE_INLINE_TEXT_BOX;
851 inline_text2.location = gfx::Rect(160, 100, 40, 20); 851 inline_text2.location = gfx::Rect(160, 100, 40, 20);
852 inline_text2.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION, 852 inline_text2.AddIntAttribute(ui::AX_ATTR_TEXT_DIRECTION,
853 blink::WebAXTextDirectionLR); 853 ui::AX_TEXT_DIRECTION_LR);
854 std::vector<int32> character_offsets2; 854 std::vector<int32> character_offsets2;
855 character_offsets2.push_back(20); // 0 855 character_offsets2.push_back(20); // 0
856 character_offsets2.push_back(40); // 1 856 character_offsets2.push_back(40); // 1
857 inline_text2.AddIntListAttribute( 857 inline_text2.AddIntListAttribute(
858 ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets2); 858 ui::AX_ATTR_CHARACTER_OFFSETS, character_offsets2);
859 859
860 scoped_ptr<BrowserAccessibilityManager> manager( 860 scoped_ptr<BrowserAccessibilityManager> manager(
861 BrowserAccessibilityManager::Create( 861 BrowserAccessibilityManager::Create(
862 root, 862 root,
863 NULL, 863 NULL,
(...skipping 16 matching lines...) Expand all
880 root_accessible->GetLocalBoundsForRange(1, 2).ToString()); 880 root_accessible->GetLocalBoundsForRange(1, 2).ToString());
881 881
882 EXPECT_EQ(gfx::Rect(120, 100, 80, 20).ToString(), 882 EXPECT_EQ(gfx::Rect(120, 100, 80, 20).ToString(),
883 root_accessible->GetLocalBoundsForRange(1, 3).ToString()); 883 root_accessible->GetLocalBoundsForRange(1, 3).ToString());
884 884
885 EXPECT_EQ(gfx::Rect(100, 100, 100, 20).ToString(), 885 EXPECT_EQ(gfx::Rect(100, 100, 100, 20).ToString(),
886 root_accessible->GetLocalBoundsForRange(0, 4).ToString()); 886 root_accessible->GetLocalBoundsForRange(0, 4).ToString());
887 } 887 }
888 888
889 } // namespace content 889 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698