Commit 34645ead authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

False positives in dump ax tests related to last lines of expectations

When an expectations file for accessibility dump tree or event tests
has more lines than the actual output, the test must fail.

Without this change, the following will produce false positives
in our test results:
- Expected events the end of event expectations, but are not fired,
- Expected objects at the end of the object hierarchy that do not
exist in the actual object hierarchy.

Bug: None
Change-Id: I4bb65bb73b0d8af7380c85e59c7891c466c95fc0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2015429
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Auto-Submit: Aaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735749}
parent 2fe77415
...@@ -371,6 +371,7 @@ void DumpAccessibilityTestBase::RunTestForPlatform( ...@@ -371,6 +371,7 @@ void DumpAccessibilityTestBase::RunTestForPlatform(
} }
// Validate against the expectation file. // Validate against the expectation file.
actual_lines.push_back(kMarkEndOfFile);
bool matches_expectation = test_helper.ValidateAgainstExpectation( bool matches_expectation = test_helper.ValidateAgainstExpectation(
file_path, expected_file, actual_lines, *expected_lines); file_path, expected_file, actual_lines, *expected_lines);
EXPECT_TRUE(matches_expectation); EXPECT_TRUE(matches_expectation);
......
...@@ -18,10 +18,11 @@ namespace content { ...@@ -18,10 +18,11 @@ namespace content {
namespace { namespace {
const char kCommentToken = '#'; const char kCommentToken = '#';
const char kMarkSkipFile[] = "#<skip"; const char kMarkSkipFile[] = "#<skip";
const char kMarkEndOfFile[] = "<-- End-of-file -->";
const char kSignalDiff[] = "*"; const char kSignalDiff[] = "*";
} // namespace } // namespace
const char kMarkEndOfFile[] = "<-- End-of-file -->";
DumpAccessibilityTestHelper::DumpAccessibilityTestHelper( DumpAccessibilityTestHelper::DumpAccessibilityTestHelper(
AccessibilityTestExpectationsLocator* test_locator) AccessibilityTestExpectationsLocator* test_locator)
: test_locator_(test_locator) {} : test_locator_(test_locator) {}
...@@ -122,7 +123,6 @@ bool DumpAccessibilityTestHelper::ValidateAgainstExpectation( ...@@ -122,7 +123,6 @@ bool DumpAccessibilityTestHelper::ValidateAgainstExpectation(
diff += "------\n"; diff += "------\n";
diff += base::JoinString(actual_lines, "\n"); diff += base::JoinString(actual_lines, "\n");
diff += "\n"; diff += "\n";
diff += kMarkEndOfFile;
LOG(ERROR) << "Diff:\n" << diff; LOG(ERROR) << "Diff:\n" << diff;
} else { } else {
LOG(INFO) << "Test output matches expectations."; LOG(INFO) << "Test output matches expectations.";
......
...@@ -13,6 +13,9 @@ class FilePath; ...@@ -13,6 +13,9 @@ class FilePath;
namespace content { namespace content {
// Sentinal value to mark end of actual/expected results.
extern const char kMarkEndOfFile[];
class AccessibilityTestExpectationsLocator; class AccessibilityTestExpectationsLocator;
// A helper class for writing accessibility tree dump tests. // A helper class for writing accessibility tree dump tests.
......
CHILDREN-CHANGED index:2 CHILD:(role=ROLE_LIST_ITEM) role=ROLE_LIST ENABLED,SENSITIVE,SHOWING,VISIBLE CHILDREN-CHANGED index:2 CHILD:(role=ROLE_LIST_ITEM) role=ROLE_LIST ENABLED,SENSITIVE,SHOWING,VISIBLE
STATE-CHANGE:DEFUNCT:TRUE role=ROLE_INVALID name='(null)' DEFUNCT \ No newline at end of file
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<body> <body>
<div id="ch1" aria-label="columnheader1" role="columnheader"></div> <div role="grid">
<div id="ch2" aria-label="columnheader2" role="columnheader"></div> <div role="row">
<div id="ch3" aria-label="columnheader3" role="columnheader"></div> <div id="ch1" aria-label="columnheader1" role="columnheader"></div>
<div id="ch4" aria-label="columnheader4" role="columnheader"></div> <div id="ch2" aria-label="columnheader2" role="columnheader"></div>
<div id="ch5" aria-label="columnheader5" role="columnheader" aria-sort="ascending"></div> <div id="ch3" aria-label="columnheader3" role="columnheader"></div>
<div id="ch4" aria-label="columnheader4" role="columnheader"></div>
<div id="ch5" aria-label="columnheader5" role="columnheader" aria-sort="ascending"></div>
</div>
</div>
<script> <script>
function go() { function go() {
// Set aria-sort from default 'none'->'none'; should not fire an event. // Set aria-sort from default 'none'->'none'; should not fire an event.
......
FullDescription changed on role=group FullDescription changed on role=group
Text_TextChanged on role=document \ No newline at end of file
EVENT_OBJECT_LIVEREGIONCHANGED on <div#live> role=DIV EVENT_OBJECT_LIVEREGIONCHANGED on <div#live> role=DIV
IA2_EVENT_TEXT_INSERTED on <div#live> role=DIV new_text={'After' start=0 end=5} IA2_EVENT_TEXT_INSERTED on <div#live> role=DIV new_text={'After' start=0 end=5}
IA2_EVENT_TEXT_REMOVED on <div#live> role=DIV old_text={'Before' start=0 end=6} \ No newline at end of file
android.webkit.WebView focusable focused scrollable android.webkit.WebView focusable focused scrollable
++android.view.View role_description='heading 1' heading interesting name='A non focusable child of a control should not be interesting on Android' ++android.view.View role_description='heading 1' heading interesting name='A non focusable child of a control should not be interesting on Android'
++android.view.View interesting name='Div with click handler' ++android.view.View interesting name='Div with click handler'
++android.widget.Button role_description='button' interesting name='I am interesting' ++android.widget.Button role_description='button' interesting name='I am interesting'
++++android.view.View name='I should not be interesting' \ No newline at end of file
...@@ -13,5 +13,4 @@ rootWebArea ...@@ -13,5 +13,4 @@ rootWebArea
++++++inlineTextBox name='This is the now active dialog. Of course it should be in the tree. ' ++++++inlineTextBox name='This is the now active dialog. Of course it should be in the tree. '
++++button name='This is in the active dialog and should be in the tree.' ++++button name='This is in the active dialog and should be in the tree.'
++++++staticText name='This is in the active dialog and should be in the tree.' ++++++staticText name='This is in the active dialog and should be in the tree.'
++++++++inlineTextBox name='This is in the active dialog and should be in the tree.' ++++++++inlineTextBox name='This is in the active dialog and should be in the tree.'
++genericContainer \ No newline at end of file
android.webkit.WebView focusable focused scrollable android.webkit.WebView focusable focused scrollable
++android.widget.EditText clickable editable_text focusable multiline hint='Done' ++android.widget.EditText clickable editable_text focusable multiline hint='Done'
++++android.view.View ++++android.view.View
++++android.view.View
++++++android.view.View
++++android.view.View ++++android.view.View
\ No newline at end of file
[document web] [document web]
++[section] name='Done' selectable-text ++[section] name='Done' selectable-text
++++[section] ++++[section]
++++[section]
++++++[section]
++++[section] ++++[section]
\ No newline at end of file
AXWebArea AXWebArea
++AXTextArea AXDescription='Done' ++AXTextArea AXDescription='Done'
++++AXGroup ++++AXGroup
++++AXGroup
++++++AXGroup
++++AXGroup ++++AXGroup
\ No newline at end of file
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