diff options
author | Hiroki Sato <hirokisato@google.com> | 2022-02-09 12:25:23 +0900 |
---|---|---|
committer | Hiroki Sato <hirokisato@google.com> | 2022-02-09 14:23:01 +0900 |
commit | 7427c8c9cb4d8fdc8a4f2b71d462afb8837d7c39 (patch) | |
tree | 38593c67ad1bd0ae9c9a19b8dab29cc911d6027e | |
parent | 62aca04b1cbd6581b6ec2d3404ab2ed75355c1be (diff) | |
download | cts-7427c8c9cb4d8fdc8a4f2b71d462afb8837d7c39.tar.gz |
Refine sleep length in AccessibilityEventTest
In View, some accessibility event is throttled using a value from
ViewConfiguration.getSendRecurringAccessibilityEventsInterval().
This change adjusts the sleep length in the corresponding tests to
deflake them.
Bug: 217097407
Bug: 215792992
Test: android.view.accessibility.cts.AccessibilityEventTest
Change-Id: If0fca1c8c5d27088822082a8c723a30eddd867b4
-rw-r--r-- | tests/accessibility/src/android/view/accessibility/cts/AccessibilityEventTest.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/accessibility/src/android/view/accessibility/cts/AccessibilityEventTest.java b/tests/accessibility/src/android/view/accessibility/cts/AccessibilityEventTest.java index 85026b6b72a..1c17037f87c 100644 --- a/tests/accessibility/src/android/view/accessibility/cts/AccessibilityEventTest.java +++ b/tests/accessibility/src/android/view/accessibility/cts/AccessibilityEventTest.java @@ -64,6 +64,9 @@ public class AccessibilityEventTest { private static final long IDLE_TIMEOUT_MS = 500; private static final long DEFAULT_TIMEOUT_MS = 1000; + // From ViewConfiguration.SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS + private static final long SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS = 100; + private EventReportingLinearLayout mParentView; private View mChildView; private TextView mTextView; @@ -148,10 +151,10 @@ public class AccessibilityEventTest { mChildView.scrollTo(0, 25); mChildView.scrollTo(0, 50); mChildView.scrollTo(0, 100); - Thread.sleep(150); + Thread.sleep(SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS * 2); mChildView.scrollTo(0, 150); mChildView.scrollTo(0, 175); - Thread.sleep(50); + Thread.sleep(SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS / 2); mChildView.scrollTo(0, 200); } catch (InterruptedException e) { fail("Interrupted while dispatching event bursts."); @@ -213,7 +216,7 @@ public class AccessibilityEventTest { mChildView.scrollTo(0, 25); mChildView.scrollTo(5, 50); mChildView.scrollTo(7, 100); - Thread.sleep(100); + Thread.sleep(SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS * 2); mChildView.scrollTo(0, 25); mChildView.scrollTo(5, 50); mChildView.scrollTo(7, 100); @@ -260,10 +263,10 @@ public class AccessibilityEventTest { sendStateDescriptionChangedEvent(mChildView); sendStateDescriptionChangedEvent(mChildView); sendStateDescriptionChangedEvent(mChildView); - Thread.sleep(150); + Thread.sleep(SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS * 2); sendStateDescriptionChangedEvent(mChildView); sendStateDescriptionChangedEvent(mChildView); - Thread.sleep(50); + Thread.sleep(SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS / 2); sendStateDescriptionChangedEvent(mChildView); } catch (InterruptedException e) { fail("Interrupted while dispatching event bursts."); |