Commit 442bdc90 authored by Maggie Cai's avatar Maggie Cai Committed by Commit Bot

Revert "Speculative fix for MagnifierE2ETest.MovesDockedMagnifierToActiveDescendant"

This reverts commit a92eb9b7.

Reason for revert: Looks like the test failure is still there for Linux ChromiumOS MSan Tests and Linux Chromium OS ASan LSan Tests (1)
First fail occurance: https://ci.chromium.org/p/chromium/builders/ci/Linux%20Chromium%20OS%20ASan%20LSan%20Tests%20%281%29/38932 and https://ci.chromium.org/p/chromium/builders/ci/Linux%20ChromiumOS%20MSan%20Tests/21447
Revert this CL so I can revert https://crrev.com/c/2552163

Original change's description:
> Speculative fix for MagnifierE2ETest.MovesDockedMagnifierToActiveDescendant
>
> The test was failing/flaky on some MSAN bots, presumably because the
> listener was registered after the event was fired.
>
> Introduce a helper class that allows us to easily register the listener,
> perform the event, then wait for the listener to have fired.
>
> TBR=josiahk@chromium.org, dtseng@chromium.org
>
> Bug: 1145612
> Test: Runs locally but real test will be whether this fixes failures on
> the 'Linux ChromiumOS MSan Tests bot'
>
> Change-Id: I16303d96b101113e80ab4f484b4e604faeab4c88
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2560622
> Reviewed-by: Pavol Marko <pmarko@chromium.org>
> Commit-Queue: Pavol Marko <pmarko@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#830991}

TBR=dtseng@chromium.org,pmarko@chromium.org,josiahk@chromium.org

Change-Id: I609372a222b15106cd1bf3c2c7bb10758214e136
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1145612
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2560446Reviewed-by: default avatarMaggie Cai <mxcai@chromium.org>
Commit-Queue: Maggie Cai <mxcai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#831244}
parent bfeff6b1
......@@ -14,33 +14,18 @@ DockedMagnifierE2ETest = class extends E2ETestBase {
constructor() {
super();
window.RoleType = chrome.automation.RoleType;
}
/**
* Registers a listener for
* chrome.accessibilityPrivate.onMagnifierBoundsChanged in the ctor. After
* that, the test code can perform the action, and then use
* waitForNextMagnifierBounds() to be wait for the previously-registered
* listener to be called.
*
* @private
*/
this.nextMagnifierBoundsWaiter_ = class {
constructor() {
this.promise_ = new Promise(resolve => {
const listener = (magnifierBounds) => {
chrome.accessibilityPrivate.onMagnifierBoundsChanged.removeListener(
listener);
resolve(magnifierBounds);
};
chrome.accessibilityPrivate.onMagnifierBoundsChanged.addListener(
listener);
});
}
async waitForNextMagnifierBounds() {
return this.promise_;
}
};
async getNextMagnifierBounds() {
return new Promise(resolve => {
const listener = (magnifierBounds) => {
chrome.accessibilityPrivate.onMagnifierBoundsChanged.removeListener(
listener);
resolve(magnifierBounds);
};
chrome.accessibilityPrivate.onMagnifierBoundsChanged.addListener(
listener);
});
}
/** @override */
......@@ -75,18 +60,18 @@ TEST_F(
const group = root.find({role: RoleType.GROUP});
// Focus and move magnifier to top.
// Then verify magnifier contain top and not banana.
const boundsWaiter1 = new this.nextMagnifierBoundsWaiter_();
top.focus();
let bounds = await boundsWaiter1.waitForNextMagnifierBounds();
// Verify magnifier contain top and not banana.
let bounds = await this.getNextMagnifierBounds();
assertTrue(RectUtil.contains(bounds, top.location));
assertFalse(RectUtil.contains(bounds, banana.location));
// Click group to change active descendant to banana.
// Then verify magnifier bounds contain banana.
const boundsWaiter2 = new this.nextMagnifierBoundsWaiter_();
group.doDefault();
bounds = await boundsWaiter2.waitForNextMagnifierBounds();
// Verify magnifier bounds contain banana.
bounds = await this.getNextMagnifierBounds();
assertFalse(RectUtil.contains(bounds, top.location));
assertTrue(RectUtil.contains(bounds, banana.location));
});
......
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