Commit 95be20ea authored by Joe Mason's avatar Joe Mason Committed by Commit Bot

Fix flake in EngagementTimeUtilTest

timeSinceLastEngagement_shouldReportElapsedTimeBetweenTimestamps gets
the current time twice. If the system time ticks over between calls it
will register 1 ms more than the test expects.

R=yusufo@chromium.org

Bug: 947572
Change-Id: Ic5b1bcda2300e217b66567ba54a9ccaa5e515374
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1708844
Auto-Submit: Joe Mason <joenotcharles@google.com>
Reviewed-by: default avatarYusuf Ozuysal <yusufo@chromium.org>
Commit-Queue: Joe Mason <joenotcharles@google.com>
Cr-Commit-Position: refs/heads/master@{#680002}
parent 6182df2d
......@@ -42,9 +42,10 @@ public final class EngagementTimeUtilTest {
@Test
public void timeSinceLastEngagement_shouldReportElapsedTimeBetweenTimestamps() {
long currentTimeMillis = System.currentTimeMillis();
assertEquals(TEST_ELAPSED_MS,
mEngagementTimeUtil.timeSinceLastEngagement(
System.currentTimeMillis() - (2L * TEST_ELAPSED_MS),
System.currentTimeMillis() - TEST_ELAPSED_MS));
currentTimeMillis - (2L * TEST_ELAPSED_MS),
currentTimeMillis - TEST_ELAPSED_MS));
}
}
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