Commit 9609d21f authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

Remove unnecessary code for computing role string

Bug: None
Change-Id: I1c0e69f6d9ac9bc38ff530de1d5034e893d1797e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2521214Reviewed-by: default avatarKevin Babbitt <kbabbitt@microsoft.com>
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826961}
parent bbe61764
......@@ -31,351 +31,10 @@ namespace {
// Map role value to string, matching Safari/Mac platform implementation to
// avoid rebaselining web tests.
std::string RoleToString(ax::mojom::Role role) {
std::string result = "AXRole: AX";
switch (role) {
case ax::mojom::Role::kAbbr:
return result.append("Abbr");
case ax::mojom::Role::kAlertDialog:
return result.append("AlertDialog");
case ax::mojom::Role::kAlert:
return result.append("Alert");
case ax::mojom::Role::kAnchor:
return result.append("Anchor");
case ax::mojom::Role::kApplication:
return result.append("Application");
case ax::mojom::Role::kArticle:
return result.append("Article");
case ax::mojom::Role::kAudio:
return result.append("Audio");
case ax::mojom::Role::kBanner:
return result.append("Banner");
case ax::mojom::Role::kBlockquote:
return result.append("Blockquote");
case ax::mojom::Role::kButton:
return result.append("Button");
case ax::mojom::Role::kCanvas:
return result.append("Canvas");
case ax::mojom::Role::kCaption:
return result.append("Caption");
case ax::mojom::Role::kCell:
return result.append("Cell");
case ax::mojom::Role::kCode:
return result.append("Code");
case ax::mojom::Role::kCheckBox:
return result.append("CheckBox");
case ax::mojom::Role::kColorWell:
return result.append("ColorWell");
case ax::mojom::Role::kColumnHeader:
return result.append("ColumnHeader");
case ax::mojom::Role::kColumn:
return result.append("Column");
case ax::mojom::Role::kComboBoxGrouping:
return result.append("ComboBoxGrouping");
case ax::mojom::Role::kComboBoxMenuButton:
return result.append("ComboBoxMenuButton");
case ax::mojom::Role::kComment:
return result.append("Comment");
case ax::mojom::Role::kComplementary:
return result.append("Complementary");
case ax::mojom::Role::kContentDeletion:
return result.append("ContentDeletion");
case ax::mojom::Role::kContentInsertion:
return result.append("ContentInsertion");
case ax::mojom::Role::kContentInfo:
return result.append("ContentInfo");
case ax::mojom::Role::kDate:
return result.append("DateField");
case ax::mojom::Role::kDateTime:
return result.append("DateTimeField");
case ax::mojom::Role::kDefinition:
return result.append("Definition");
case ax::mojom::Role::kDescriptionListDetail:
return result.append("DescriptionListDetail");
case ax::mojom::Role::kDescriptionList:
return result.append("DescriptionList");
case ax::mojom::Role::kDescriptionListTerm:
return result.append("DescriptionListTerm");
case ax::mojom::Role::kDetails:
return result.append("Details");
case ax::mojom::Role::kDialog:
return result.append("Dialog");
case ax::mojom::Role::kDirectory:
return result.append("Directory");
case ax::mojom::Role::kDisclosureTriangle:
return result.append("DisclosureTriangle");
case ax::mojom::Role::kDocAbstract:
return result.append("DocAbstract");
case ax::mojom::Role::kDocAcknowledgments:
return result.append("DocAcknowledgments");
case ax::mojom::Role::kDocAfterword:
return result.append("DocAfterword");
case ax::mojom::Role::kDocAppendix:
return result.append("DocAppendix");
case ax::mojom::Role::kDocBackLink:
return result.append("DocBackLink");
case ax::mojom::Role::kDocBiblioEntry:
return result.append("DocBiblioEntry");
case ax::mojom::Role::kDocBibliography:
return result.append("DocBibliography");
case ax::mojom::Role::kDocBiblioRef:
return result.append("DocBiblioRef");
case ax::mojom::Role::kDocChapter:
return result.append("DocChapter");
case ax::mojom::Role::kDocColophon:
return result.append("DocColophon");
case ax::mojom::Role::kDocConclusion:
return result.append("DocConclusion");
case ax::mojom::Role::kDocCover:
return result.append("DocCover");
case ax::mojom::Role::kDocCredit:
return result.append("DocCredit");
case ax::mojom::Role::kDocCredits:
return result.append("DocCredits");
case ax::mojom::Role::kDocDedication:
return result.append("DocDedication");
case ax::mojom::Role::kDocEndnote:
return result.append("DocEndnote");
case ax::mojom::Role::kDocEndnotes:
return result.append("DocEndnotes");
case ax::mojom::Role::kDocEpigraph:
return result.append("DocEpigraph");
case ax::mojom::Role::kDocEpilogue:
return result.append("DocEpilogue");
case ax::mojom::Role::kDocErrata:
return result.append("DocErrata");
case ax::mojom::Role::kDocExample:
return result.append("DocExample");
case ax::mojom::Role::kDocFootnote:
return result.append("DocFootnote");
case ax::mojom::Role::kDocForeword:
return result.append("DocForeword");
case ax::mojom::Role::kDocGlossary:
return result.append("DocGlossary");
case ax::mojom::Role::kDocGlossRef:
return result.append("DocGlossRef");
case ax::mojom::Role::kDocIndex:
return result.append("DocIndex");
case ax::mojom::Role::kDocIntroduction:
return result.append("DocIntroduction");
case ax::mojom::Role::kDocNoteRef:
return result.append("DocNoteRef");
case ax::mojom::Role::kDocNotice:
return result.append("DocNotice");
case ax::mojom::Role::kDocPageBreak:
return result.append("DocPageBreak");
case ax::mojom::Role::kDocPageList:
return result.append("DocPageList");
case ax::mojom::Role::kDocPart:
return result.append("DocPart");
case ax::mojom::Role::kDocPreface:
return result.append("DocPreface");
case ax::mojom::Role::kDocPrologue:
return result.append("DocPrologue");
case ax::mojom::Role::kDocPullquote:
return result.append("DocPullquote");
case ax::mojom::Role::kDocQna:
return result.append("DocQna");
case ax::mojom::Role::kDocSubtitle:
return result.append("DocSubtitle");
case ax::mojom::Role::kDocTip:
return result.append("DocTip");
case ax::mojom::Role::kDocToc:
return result.append("DocToc");
case ax::mojom::Role::kDocument:
return result.append("Document");
case ax::mojom::Role::kEmbeddedObject:
return result.append("EmbeddedObject");
case ax::mojom::Role::kEmphasis:
return result.append("Emphasis");
case ax::mojom::Role::kFigcaption:
return result.append("Figcaption");
case ax::mojom::Role::kFigure:
return result.append("Figure");
case ax::mojom::Role::kFooter:
return result.append("Footer");
case ax::mojom::Role::kFooterAsNonLandmark:
return result.append("FooterAsNonLandmark");
case ax::mojom::Role::kForm:
return result.append("Form");
case ax::mojom::Role::kGenericContainer:
return result.append("GenericContainer");
case ax::mojom::Role::kGraphicsDocument:
return result.append("GraphicsDocument");
case ax::mojom::Role::kGraphicsObject:
return result.append("GraphicsObject");
case ax::mojom::Role::kGraphicsSymbol:
return result.append("GraphicsSymbol");
case ax::mojom::Role::kGrid:
return result.append("Grid");
case ax::mojom::Role::kGroup:
return result.append("Group");
case ax::mojom::Role::kHeader:
return result.append("Header");
case ax::mojom::Role::kHeaderAsNonLandmark:
return result.append("HeaderAsNonLandmark");
case ax::mojom::Role::kHeading:
return result.append("Heading");
case ax::mojom::Role::kIgnored:
return result.append("Ignored");
case ax::mojom::Role::kImageMap:
return result.append("ImageMap");
case ax::mojom::Role::kImage:
return result.append("Image");
case ax::mojom::Role::kInlineTextBox:
return result.append("InlineTextBox");
case ax::mojom::Role::kInputTime:
return result.append("InputTime");
case ax::mojom::Role::kLabelText:
return result.append("Label");
case ax::mojom::Role::kLayoutTable:
return result.append("LayoutTable");
case ax::mojom::Role::kLayoutTableCell:
return result.append("LayoutTableCell");
case ax::mojom::Role::kLayoutTableRow:
return result.append("LayoutTableRow");
case ax::mojom::Role::kLegend:
return result.append("Legend");
case ax::mojom::Role::kLink:
return result.append("Link");
case ax::mojom::Role::kLineBreak:
return result.append("LineBreak");
case ax::mojom::Role::kListBoxOption:
return result.append("ListBoxOption");
case ax::mojom::Role::kListBox:
return result.append("ListBox");
case ax::mojom::Role::kListItem:
return result.append("ListItem");
case ax::mojom::Role::kListMarker:
return result.append("ListMarker");
case ax::mojom::Role::kList:
return result.append("List");
case ax::mojom::Role::kLog:
return result.append("Log");
case ax::mojom::Role::kMain:
return result.append("Main");
case ax::mojom::Role::kMark:
return result.append("Mark");
case ax::mojom::Role::kMarquee:
return result.append("Marquee");
case ax::mojom::Role::kMath:
return result.append("Math");
case ax::mojom::Role::kMenuBar:
return result.append("MenuBar");
case ax::mojom::Role::kMenuItem:
return result.append("MenuItem");
case ax::mojom::Role::kMenuItemCheckBox:
return result.append("MenuItemCheckBox");
case ax::mojom::Role::kMenuItemRadio:
return result.append("MenuItemRadio");
case ax::mojom::Role::kMenuListOption:
return result.append("MenuListOption");
case ax::mojom::Role::kMenuListPopup:
return result.append("MenuListPopup");
case ax::mojom::Role::kMenu:
return result.append("Menu");
case ax::mojom::Role::kMeter:
return result.append("Meter");
case ax::mojom::Role::kNavigation:
return result.append("Navigation");
case ax::mojom::Role::kNone:
return result.append("None");
case ax::mojom::Role::kNote:
return result.append("Note");
case ax::mojom::Role::kParagraph:
return result.append("Paragraph");
case ax::mojom::Role::kPluginObject:
return result.append("PluginObject");
case ax::mojom::Role::kPopUpButton:
return result.append("PopUpButton");
case ax::mojom::Role::kPre:
return result.append("Pre");
case ax::mojom::Role::kPresentational:
return result.append("Presentational");
case ax::mojom::Role::kProgressIndicator:
return result.append("ProgressIndicator");
case ax::mojom::Role::kRadioButton:
return result.append("RadioButton");
case ax::mojom::Role::kRadioGroup:
return result.append("RadioGroup");
case ax::mojom::Role::kRegion:
return result.append("Region");
case ax::mojom::Role::kRow:
return result.append("Row");
case ax::mojom::Role::kRowGroup:
return result.append("RowGroup");
case ax::mojom::Role::kRowHeader:
return result.append("RowHeader");
case ax::mojom::Role::kRuby:
return result.append("Ruby");
case ax::mojom::Role::kRubyAnnotation:
return result.append("RubyAnnotation");
case ax::mojom::Role::kSection:
return result.append("Section");
case ax::mojom::Role::kSvgRoot:
return result.append("SVGRoot");
case ax::mojom::Role::kScrollBar:
return result.append("ScrollBar");
case ax::mojom::Role::kSearch:
return result.append("Search");
case ax::mojom::Role::kSearchBox:
return result.append("SearchBox");
case ax::mojom::Role::kSlider:
return result.append("Slider");
case ax::mojom::Role::kSliderThumb:
return result.append("SliderThumb");
case ax::mojom::Role::kSpinButton:
return result.append("SpinButton");
case ax::mojom::Role::kSplitter:
return result.append("Splitter");
case ax::mojom::Role::kStaticText:
return result.append("StaticText");
case ax::mojom::Role::kStatus:
return result.append("Status");
case ax::mojom::Role::kStrong:
return result.append("Strong");
case ax::mojom::Role::kSwitch:
return result.append("Switch");
case ax::mojom::Role::kSuggestion:
return result.append("Suggestion");
case ax::mojom::Role::kTabList:
return result.append("TabList");
case ax::mojom::Role::kTabPanel:
return result.append("TabPanel");
case ax::mojom::Role::kTab:
return result.append("Tab");
case ax::mojom::Role::kTableHeaderContainer:
return result.append("TableHeaderContainer");
case ax::mojom::Role::kTable:
return result.append("Table");
case ax::mojom::Role::kTextField:
return result.append("TextField");
case ax::mojom::Role::kTextFieldWithComboBox:
return result.append("TextFieldWithComboBox");
case ax::mojom::Role::kTime:
return result.append("Time");
case ax::mojom::Role::kTimer:
return result.append("Timer");
case ax::mojom::Role::kToggleButton:
return result.append("ToggleButton");
case ax::mojom::Role::kToolbar:
return result.append("Toolbar");
case ax::mojom::Role::kTreeGrid:
return result.append("TreeGrid");
case ax::mojom::Role::kTreeItem:
return result.append("TreeItem");
case ax::mojom::Role::kTree:
return result.append("Tree");
case ax::mojom::Role::kUnknown:
return result.append("Unknown");
case ax::mojom::Role::kTooltip:
return result.append("UserInterfaceTooltip");
case ax::mojom::Role::kVideo:
return result.append("Video");
case ax::mojom::Role::kRootWebArea:
return result.append("WebArea");
default:
return result.append("Unknown");
}
constexpr int kSkipPrefixLen = 7; /// Length of "Role::k"
std::ostringstream result;
result << role;
return "AXRole: AX" + result.str().substr(kSkipPrefixLen);
}
std::string GetStringValue(const blink::WebAXObject& object) {
......
......@@ -70,11 +70,11 @@ AXRole.
}, "Test computed AX role for <input type=color>");
test(function () {
check("idate", "AXRole: AXDateField");
check("idate", "AXRole: AXDate");
}, "Test computed AX role for <input type=date>");
test(function () {
check("idatetimelocal", "AXRole: AXDateTimeField");
check("idatetimelocal", "AXRole: AXDateTime");
}, "Test computed AX role for <input type=datetime-local>");
test(function () {
......@@ -82,7 +82,7 @@ AXRole.
}, "Test computed AX role for <input type=file>");
test(function () {
check("imonth", "AXRole: AXDateTimeField");
check("imonth", "AXRole: AXDateTime");
}, "Test computed AX role for <input type=month>");
test(function () {
......@@ -122,7 +122,7 @@ AXRole.
}, "Test computed AX role for <input type=time>");
test(function () {
check("iweek", "AXRole: AXDateTimeField");
check("iweek", "AXRole: AXDateTime");
}, "Test computed AX role for <input type=week>");
test(function () {
......
......@@ -4,7 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS axContainer.childAtIndex(0).role is "AXRole: AXSplitter"
PASS axContainer.childAtIndex(1).role is "AXRole: AXParagraph"
PASS axContainer.childAtIndex(2).role is "AXRole: AXLabel"
PASS axContainer.childAtIndex(2).role is "AXRole: AXLabelText"
PASS axContainer.childAtIndex(3).role is "AXRole: AXForm"
PASS axContainer.childAtIndex(4).role is "AXRole: AXGenericContainer"
PASS successfullyParsed is true
......
......@@ -23,7 +23,7 @@ if (window.testRunner && window.accessibilityController) {
shouldBe('axContainer.childAtIndex(0).role', '"AXRole: AXSplitter"');
shouldBe('axContainer.childAtIndex(1).role', '"AXRole: AXParagraph"');
shouldBe('axContainer.childAtIndex(2).role', '"AXRole: AXLabel"');
shouldBe('axContainer.childAtIndex(2).role', '"AXRole: AXLabelText"');
shouldBe('axContainer.childAtIndex(3).role', '"AXRole: AXForm"');
shouldBe('axContainer.childAtIndex(4).role', '"AXRole: AXGenericContainer"');
}
......
......@@ -13,7 +13,7 @@ test(function(t) {
// Ensure that it's valid.
var axLabel = axButton.nameElementAtIndex(0);
assert_equals(axLabel.isValid, true);
assert_equals(axLabel.role, 'AXRole: AXLabel');
assert_equals(axLabel.role, 'AXRole: AXLabelText');
// Now un-hide the label.
var label = document.getElementById('label');
......@@ -35,7 +35,7 @@ test(function(t) {
assert_equals(axLabel.isValid, false);
assert_equals(axLabel2.isValid, false);
assert_equals(axLabel3.isValid, true);
assert_equals(axLabel3.role, 'AXRole: AXLabel');
assert_equals(axLabel3.role, 'AXRole: AXLabelText');
assert_equals(axLabel.isEqual(axLabel3), false);
assert_equals(axLabel2.isEqual(axLabel3), false);
}, "Accessibility objects for display:none elements");
......
......@@ -50,15 +50,15 @@ PASS elem.role is "AXRole: AXMenuItemCheckBox"
menu_radio_id
PASS elem.role is "AXRole: AXMenuItemRadio"
input_date_id
PASS elem.role is "AXRole: AXDateField"
PASS elem.role is "AXRole: AXDate"
input_datetime_id
PASS elem.role is "AXRole: AXTextField"
input_datetime-local_id
PASS elem.role is "AXRole: AXDateTimeField"
PASS elem.role is "AXRole: AXDateTime"
input_month_id
PASS elem.role is "AXRole: AXDateTimeField"
PASS elem.role is "AXRole: AXDateTime"
input_week_id
PASS elem.role is "AXRole: AXDateTimeField"
PASS elem.role is "AXRole: AXDateTime"
input_file_id
PASS elem.role is "AXRole: AXButton"
input_number_id
......
......@@ -112,11 +112,11 @@ if (window.testRunner && window.accessibilityController) {
hasRole("menu_checkbox_id", "AXRole: AXMenuItemCheckBox");
hasRole("menu_radio_id", "AXRole: AXMenuItemRadio");
hasRole("input_date_id", "AXRole: AXDateField");
hasRole("input_date_id", "AXRole: AXDate");
hasRole("input_datetime_id", "AXRole: AXTextField");
hasRole("input_datetime-local_id", "AXRole: AXDateTimeField");
hasRole("input_month_id", "AXRole: AXDateTimeField");
hasRole("input_week_id", "AXRole: AXDateTimeField");
hasRole("input_datetime-local_id", "AXRole: AXDateTime");
hasRole("input_month_id", "AXRole: AXDateTime");
hasRole("input_week_id", "AXRole: AXDateTime");
hasRole("input_file_id", "AXRole: AXButton");
hasRole("input_number_id", "AXRole: AXSpinButton");
......
......@@ -19,7 +19,7 @@
<script>
test(function(t) {
var axWebArea = accessibilityController.rootElement;
assert_equals(axWebArea.role, "AXRole: AXWebArea");
assert_equals(axWebArea.role, "AXRole: AXRootWebArea");
assert_true(axWebArea.isScrollableContainer);
assert_equals(axWebArea.scrollOffsetY, 0);
......
......@@ -24,7 +24,7 @@ async_test((t) => {
assert_equals(window.pageXOffset, 0);
accessibilityController.addNotificationListener(t.step_func((target, notification) => {
if (target.role == 'AXRole: AXWebArea' && notification == 'LayoutComplete') {
if (target.role == 'AXRole: AXRootWebArea' && notification == 'LayoutComplete') {
console.log('Got notification on web area');
accessibilityController.removeNotificationListener();
assert_equals(window.pageXOffset, 500);
......
......@@ -25,7 +25,7 @@ async_test((t) => {
assert_equals(window.pageXOffset, 0);
accessibilityController.addNotificationListener(t.step_func((target, notification) => {
if (target.role == 'AXRole: AXWebArea' && notification == 'LayoutComplete') {
if (target.role == 'AXRole: AXRootWebArea' && notification == 'LayoutComplete') {
console.log('Got notification on web area');
accessibilityController.removeNotificationListener();
assert_equals(window.pageYOffset, 500);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment