Commit 74934b2d authored by Joanmarie Diggs's avatar Joanmarie Diggs Committed by Commit Bot

Test AtkRelationType instances found in content browser tests

* Add support in AXPlatformNodeAuraLinux::AddAccessibilityTreeProperties
  and use in  AccessibilityTreeFormatterAuraLinux::ProcessTreeForOutput.
* By default, output all relation types but embedded-by (which appears
  on all top-level documents).
* Update auralinux expectations where relations are implemented.

Bug: 946016
Change-Id: I8792ddf23f23ad74b1b378f9cfb01f906b967590
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1540283
Commit-Queue: Martin Robinson <mrobinson@igalia.com>
Auto-Submit: Joanmarie Diggs <joanmarie.diggs@gmail.com>
Reviewed-by: default avatarMartin Robinson <mrobinson@igalia.com>
Cr-Commit-Position: refs/heads/master@{#644607}
parent 10f73dff
...@@ -319,6 +319,18 @@ base::string16 AccessibilityTreeFormatterAuraLinux::ProcessTreeForOutput( ...@@ -319,6 +319,18 @@ base::string16 AccessibilityTreeFormatterAuraLinux::ProcessTreeForOutput(
WriteAttribute(false, state_value, &line); WriteAttribute(false, state_value, &line);
} }
const base::ListValue* relations_value;
node.GetList("relations", &relations_value);
for (auto it = relations_value->begin(); it != relations_value->end(); ++it) {
std::string relation_value;
if (it->GetAsString(&relation_value)) {
// By default, exclude embedded-by because that should appear on every
// top-level document object. The other relation types are less common
// and thus almost always of interest when testing.
WriteAttribute(relation_value != "embedded-by", relation_value, &line);
}
}
for (const char* attribute_name : ATK_OBJECT_ATTRIBUTES) { for (const char* attribute_name : ATK_OBJECT_ATTRIBUTES) {
std::string attribute_value; std::string attribute_value;
if (node.GetString(attribute_name, &attribute_value)) { if (node.GetString(attribute_name, &attribute_value)) {
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
++[link] name='Title2' explicit-name:true ++[link] name='Title2' explicit-name:true
++++[text] name='InnerText2' ++++[text] name='InnerText2'
++[text] name=' ' ++[text] name=' '
++[link] name='LabelledBy3' explicit-name:true ++[link] name='LabelledBy3' labelled-by explicit-name:true
++++[text] name='InnerText3' ++++[text] name='InnerText3'
++[link] name='Title4' explicit-name:true ++[link] name='Title4' explicit-name:true
++[link] name='Label5' explicit-name:true ++[link] name='Label5' explicit-name:true
++[link] name='LabelledBy6' explicit-name:true ++[link] name='LabelledBy6' labelled-by explicit-name:true
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
++[push button] name='InnerText0' ++[push button] name='InnerText0'
++[push button] name='InnerText1' description='Title1' ++[push button] name='InnerText1' description='Title1'
++[push button] name='AriaLabel2' description='Title2' explicit-name:true ++[push button] name='AriaLabel2' description='Title2' explicit-name:true
++[push button] name='LabelledBy3' description='Title3' explicit-name:true ++[push button] name='LabelledBy3' description='Title3' labelled-by explicit-name:true
++[push button] name='LabelledBy4' description='DescribedBy4' explicit-name:true ++[push button] name='LabelledBy4' description='DescribedBy4' labelled-by described-by explicit-name:true
++[push button] name='InnerText5' description='DescribedBy5' ++[push button] name='InnerText5' description='DescribedBy5' described-by
++[push button] name='Outer inner' ++[push button] name='Outer inner'
++[push button] name='Outer inner1' ++[push button] name='Outer inner1'
++[push button] name='Outer grandchild' ++[push button] name='Outer grandchild'
[document web] [document web]
++[table] name='Browser and Engine' cols=2 headers=('Browser', 'Engine'); rows=3 headers=(NONE); caption=true; spans=(all: 1x1) ++[table] name='Browser and Engine' labelled-by cols=2 headers=('Browser', 'Engine'); rows=3 headers=(NONE); caption=true; spans=(all: 1x1)
++++[caption] ++++[caption] label-for
++++++[text] name='Browser and Engine' ++++++[text] name='Browser and Engine'
++++[table row] ++++[table row]
++++++[column header] name='Browser' (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) ++++++[column header] name='Browser' (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0)
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
++[check box] name='Title0' checkable:true explicit-name:true ++[check box] name='Title0' checkable:true explicit-name:true
++[check box] name='Label1' description='Title1' checkable:true explicit-name:true ++[check box] name='Label1' description='Title1' checkable:true explicit-name:true
++[check box] name='AriaLabel2' description='Title2' checkable:true explicit-name:true ++[check box] name='AriaLabel2' description='Title2' checkable:true explicit-name:true
++[check box] name='LabelledBy3' description='Title3' checkable:true explicit-name:true ++[check box] name='LabelledBy3' description='Title3' labelled-by checkable:true explicit-name:true
++[check box] name='LabelledBy4' description='DescribedBy4' checkable:true explicit-name:true ++[check box] name='LabelledBy4' description='DescribedBy4' labelled-by described-by checkable:true explicit-name:true
++[check box] description='DescribedBy5' checkable:true ++[check box] description='DescribedBy5' described-by checkable:true
[document web] [document web]
++[section] name='label' editable selectable-text ++[section] name='label' editable selectable-text
++[section] description='description' editable selectable-text ++[section] description='description' editable selectable-text described-by
++[section] name='title' editable selectable-text ++[section] name='title' editable selectable-text
++[paragraph] ++[paragraph] description-for
++++[text] name='description' ++++[text] name='description'
[document web] [document web]
++[form] ++[form]
++++[panel] name='Browser Engines:' ++++[panel] name='Browser Engines:' labelled-by
++++++[label] ++++++[label] label-for
++++++++[text] name='Browser Engines:' ++++++++[text] name='Browser Engines:'
[document web] [document web]
++[panel] name='Fig.1 - A green Box' ++[panel] name='Fig.1 - A green Box' labelled-by
++++[image] name='This is a green box.' ++++[image] name='This is a green box.'
++++[caption] ++++[caption] label-for
++++++[text] name='Fig.1 - A green Box' ++++++[text] name='Fig.1 - A green Box'
[document web] focusable focused [document web] focusable focused
++[section] ++[section]
++++[label] ++++[label] label-for
++++++[text] name='Choose a pokemon ' ++++++[text] name='Choose a pokemon '
++++++[combo box] name='Choose a pokemon' editable focusable selectable-text autocomplete:list haspopup:listbox ++++++[combo box] name='Choose a pokemon' editable focusable selectable-text labelled-by autocomplete:list haspopup:listbox
[document web] [document web]
++[entry] name='Title0' explicit-name:true ++[entry] name='Title0' explicit-name:true
++[entry] name='Label1' description='Title1' explicit-name:true ++[entry] name='Label1' description='Title1' labelled-by explicit-name:true
++[entry] name='AriaLabel2' description='Title2' explicit-name:true ++[entry] name='AriaLabel2' description='Title2' explicit-name:true
++[entry] name='LabelledBy3' description='Title3' explicit-name:true ++[entry] name='LabelledBy3' description='Title3' labelled-by explicit-name:true
++[entry] name='Placeholder4' explicit-name:true ++[entry] name='Placeholder4' explicit-name:true
++[entry] name='ARIA Placeholder4a' explicit-name:true ++[entry] name='ARIA Placeholder4a' explicit-name:true
++[entry] name='Placeholder4b' explicit-name:true ++[entry] name='Placeholder4b' explicit-name:true
++[entry] name='Placeholder5' description='Title5' explicit-name:true ++[entry] name='Placeholder5' description='Title5' explicit-name:true
++[entry] name='LabelledBy6' description='DescribedBy6' explicit-name:true ++[entry] name='LabelledBy6' description='DescribedBy6' labelled-by described-by explicit-name:true
++[entry] name='AriaLabel7' description='DescribedBy7' explicit-name:true ++[entry] name='AriaLabel7' description='DescribedBy7' described-by explicit-name:true
\ No newline at end of file
[document web] [document web]
++[section] ++[section]
++++[label] ++++[label] label-for
++++++[text] name='l1' ++++++[text] name='l1'
++++[entry] name='l1' single-line ++++[entry] name='l1' single-line labelled-by
++++[label] ++++[label] label-for
++++++[text] name='l2' ++++++[text] name='l2'
++++[entry] name='l2' single-line labelled-by
++++[entry] name='l2' single-line ++++[entry] name='l2' single-line
++++[entry] name='l2' single-line ++++[entry] name='l2' single-line
++++[entry] name='l2' single-line ++++[label] label-for
++++[label]
++++++[text] name='Email' ++++++[text] name='Email'
++++[section] ++++[section] label-for
++++[entry] name='Email' single-line ++++[entry] name='Email' single-line labelled-by
++++[entry] name='Email' single-line ++++[entry] name='Email' single-line labelled-by
++++[entry] name='l5' multi-line ++++[entry] name='l5' multi-line
++++[entry] name='l6' multi-line ++++[entry] name='l6' multi-line
++++[entry] name='Name' description='Description' single-line ++++[entry] name='Name' description='Description' single-line
[document web] [document web]
++[section] ++[section]
++++[label] ++++[label] label-for
++++++[text] name='Default: ' ++++++[text] name='Default: '
++++++[entry] name='Default:' selectable-text ++++++[entry] name='Default:' selectable-text labelled-by
++++[label] ++++[label] label-for
++++++[text] name='Button: ' ++++++[text] name='Button: '
++++++[push button] name='Button:' ++++++[push button] name='Button:' labelled-by
++++[check box] name='Checkbox:' checkable:true ++++[check box] name='Checkbox:' checkable:true
++++[label] ++++[label] label-for
++++++[text] name='Color: ' ++++++[text] name='Color: '
++++++[push button] name='Color:' ++++++[push button] name='Color:' labelled-by
++++[label] ++++[label] label-for
++++++[text] name='Email: ' ++++++[text] name='Email: '
++++++[entry] name='Email:' selectable-text text-input-type:email ++++++[entry] name='Email:' selectable-text labelled-by text-input-type:email
++++[label] ++++[label] label-for
++++++[text] name='File: ' ++++++[text] name='File: '
++++++[push button] name='File:' ++++++[push button] name='File:' labelled-by
++++[label] ++++[label] label-for
++++++[text] name='Image: ' ++++++[text] name='Image: '
++++++[push button] name='Image:' ++++++[push button] name='Image:' labelled-by
++++[label] ++++[label] label-for
++++++[text] name='Number: ' ++++++[text] name='Number: '
++++++[spin button] name='Number:' selectable-text text-input-type:number current=0.000000 minimum=0.000000 maximum=0.000000 ++++++[spin button] name='Number:' selectable-text labelled-by text-input-type:number current=0.000000 minimum=0.000000 maximum=0.000000
++++[label] ++++[label] label-for
++++++[text] name='Password: ' ++++++[text] name='Password: '
++++++[password text] name='Password:' selectable-text text-input-type:password ++++++[password text] name='Password:' selectable-text labelled-by text-input-type:password
++++[radio button] name='Radio:' checkable:true ++++[radio button] name='Radio:' checkable:true
++++[label] ++++[label] label-for
++++++[text] name='Range: ' ++++++[text] name='Range: '
++++++[slider] name='Range:' horizontal current=50.000000 minimum=0.000000 maximum=100.000000 ++++++[slider] name='Range:' horizontal labelled-by current=50.000000 minimum=0.000000 maximum=100.000000
++++[label] ++++[label] label-for
++++++[text] name='Reset: ' ++++++[text] name='Reset: '
++++++[push button] name='Reset:' ++++++[push button] name='Reset:' labelled-by
++++[label] ++++[label] label-for
++++++[text] name='Search: ' ++++++[text] name='Search: '
++++++[entry] name='Search:' selectable-text text-input-type:search ++++++[entry] name='Search:' selectable-text labelled-by text-input-type:search
++++[label] ++++[label] label-for
++++++[text] name='Submit: ' ++++++[text] name='Submit: '
++++++[push button] name='Submit:' ++++++[push button] name='Submit:' labelled-by
++++[label] ++++[label] label-for
++++++[text] name='Tel: ' ++++++[text] name='Tel: '
++++++[entry] name='Tel:' selectable-text text-input-type:tel ++++++[entry] name='Tel:' selectable-text labelled-by text-input-type:tel
++++[label] ++++[label] label-for
++++++[text] name='Text: ' ++++++[text] name='Text: '
++++++[entry] name='Text:' selectable-text text-input-type:text ++++++[entry] name='Text:' selectable-text labelled-by text-input-type:text
++++[label] ++++[label] label-for
++++++[text] name='Url: ' ++++++[text] name='Url: '
++++++[entry] name='Url:' selectable-text text-input-type:url ++++++[entry] name='Url:' selectable-text labelled-by text-input-type:url
\ No newline at end of file
[document web] focusable focused [document web] focusable focused
++[form] ++[form]
++++[panel] name='Browser Engines:' ++++[panel] name='Browser Engines:' labelled-by
++++++[label] ++++++[label] label-for
++++++++[text] name='Browser Engines:' ++++++++[text] name='Browser Engines:'
++++++[text] name='Browser: ' ++++++[text] name='Browser: '
++++++[entry] editable focusable single-line selectable-text ++++++[entry] editable focusable single-line selectable-text
......
...@@ -2744,6 +2744,15 @@ void AXPlatformNodeAuraLinux::AddAccessibilityTreeProperties( ...@@ -2744,6 +2744,15 @@ void AXPlatformNodeAuraLinux::AddAccessibilityTreeProperties(
} }
dict->Set("states", std::move(states)); dict->Set("states", std::move(states));
AtkRelationSet* relation_set = atk_object_ref_relation_set(atk_object_);
auto relations = std::make_unique<base::ListValue>();
for (int i = ATK_RELATION_NULL; i < ATK_RELATION_LAST_DEFINED; i++) {
AtkRelationType relation_type = static_cast<AtkRelationType>(i);
if (atk_relation_set_contains(relation_set, relation_type))
relations->AppendString(atk_relation_type_get_name(relation_type));
}
dict->Set("relations", std::move(relations));
AtkAttributeSet* attributes = atk_object_get_attributes(atk_object_); AtkAttributeSet* attributes = atk_object_get_attributes(atk_object_);
for (AtkAttributeSet* attr = attributes; attr; attr = attr->next) { for (AtkAttributeSet* attr = attributes; attr; attr = attr->next) {
AtkAttribute* attribute = static_cast<AtkAttribute*>(attr->data); AtkAttribute* attribute = static_cast<AtkAttribute*>(attr->data);
......
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