Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f6c0cd4 authored by Chris Wren's avatar Chris Wren
Browse files

avoid race condition on very fast tests

most of the use cases for this involve uiautomator tests,
which are slow anyway. In this case it may be possible for
the checkpoint to record the current time, and then the
test event arrive before the clock ticks over to the
next millisecond, which would cause them to be ignored.

If this fixes the flakiness we should consider a more gneeral fix.

Test: runtest --path frameworks/base/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
Bug: 35138327
Change-Id: Idc4aec50df1a75be710c5a69522af058f7e68ec1
parent 57066148
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -79,6 +79,12 @@ public class StatusBarTest extends SysuiTestCase {


        mMetricsReader = new MetricsReader();
        mMetricsReader = new MetricsReader();
        mMetricsReader.checkpoint(); // clear out old logs
        mMetricsReader.checkpoint(); // clear out old logs
        try {
            // pause so that no new events arrive in the rest of this millisecond.
            Thread.sleep(2);
        } catch (InterruptedException e) {
            // pass
        }
    }
    }


    @Test
    @Test