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(
}
// Validate against the expectation file.
actual_lines.push_back(kMarkEndOfFile);
bool matches_expectation = test_helper.ValidateAgainstExpectation(
file_path, expected_file, actual_lines, *expected_lines);
EXPECT_TRUE(matches_expectation);
......
......@@ -18,10 +18,11 @@ namespace content {
namespace {
const char kCommentToken = '#';
const char kMarkSkipFile[] = "#<skip";
const char kMarkEndOfFile[] = "<-- End-of-file -->";
const char kSignalDiff[] = "*";
} // namespace
const char kMarkEndOfFile[] = "<-- End-of-file -->";
DumpAccessibilityTestHelper::DumpAccessibilityTestHelper(
AccessibilityTestExpectationsLocator* test_locator)
: test_locator_(test_locator) {}
......@@ -122,7 +123,6 @@ bool DumpAccessibilityTestHelper::ValidateAgainstExpectation(
diff += "------\n";
diff += base::JoinString(actual_lines, "\n");
diff += "\n";
diff += kMarkEndOfFile;
LOG(ERROR) << "Diff:\n" << diff;
} else {
LOG(INFO) << "Test output matches expectations.";
......
......@@ -13,6 +13,9 @@ class FilePath;
namespace content {
// Sentinal value to mark end of actual/expected results.
extern const char kMarkEndOfFile[];
class AccessibilityTestExpectationsLocator;
// 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
\ No newline at end of file
STATE-CHANGE:DEFUNCT:TRUE role=ROLE_INVALID name='(null)' DEFUNCT
<!DOCTYPE html>
<html>
<body>
<div role="grid">
<div role="row">
<div id="ch1" aria-label="columnheader1" role="columnheader"></div>
<div id="ch2" aria-label="columnheader2" role="columnheader"></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>
function go() {
// Set aria-sort from default 'none'->'none'; should not fire an event.
......
FullDescription changed on role=group
\ No newline at end of file
Text_TextChanged on role=document
EVENT_OBJECT_LIVEREGIONCHANGED on <div#live> role=DIV
IA2_EVENT_TEXT_INSERTED on <div#live> role=DIV new_text={'After' start=0 end=5}
\ No newline at end of file
IA2_EVENT_TEXT_REMOVED on <div#live> role=DIV old_text={'Before' start=0 end=6}
......@@ -2,4 +2,3 @@ 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 interesting name='Div with click handler'
++android.widget.Button role_description='button' interesting name='I am interesting'
\ No newline at end of file
++++android.view.View name='I should not be interesting'
......@@ -14,4 +14,3 @@ rootWebArea
++++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.'
++++++++inlineTextBox name='This is in the active dialog and should be in the tree.'
\ No newline at end of file
++genericContainer
......@@ -2,5 +2,3 @@ android.webkit.WebView focusable focused scrollable
++android.widget.EditText clickable editable_text focusable multiline hint='Done'
++++android.view.View
++++android.view.View
\ No newline at end of file
++++++android.view.View
++++android.view.View
\ No newline at end of file
......@@ -2,5 +2,3 @@
++[section] name='Done' selectable-text
++++[section]
++++[section]
\ No newline at end of file
++++++[section]
++++[section]
\ No newline at end of file
......@@ -2,5 +2,3 @@ AXWebArea
++AXTextArea AXDescription='Done'
++++AXGroup
++++AXGroup
\ No newline at end of file
++++++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