summaryrefslogtreecommitdiff
path: root/osi
diff options
context:
space:
mode:
authorMarie Janssen <jamuraa@google.com>2015-12-29 15:34:55 -0800
committerMarie Janssen <jamuraa@google.com>2015-12-29 16:01:17 -0800
commitac786e364a0ba90cbc8768068f98361fe4fe3f8a (patch)
tree53368c3fa7635d0b93e188a14bb817854fcb336d /osi
parentec636244e297b456cae4247b3bfae120701bc35f (diff)
downloadandroid-system-bt-ac786e364a0ba90cbc8768068f98361fe4fe3f8a.tar.gz
android-system-bt-ac786e364a0ba90cbc8768068f98361fe4fe3f8a.tar.xz
Fix flaky AlarmTest.test_set_long_*
The "long" tests need some leeway for the timer to be checked because sometimes it takes ~1-2ms to check timers for wakelock scheduling. Bug: 26140385 Change-Id: I362166f1d93a811f3933776294775b594226ab30
Diffstat (limited to 'osi')
-rw-r--r--osi/test/alarm_test.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/osi/test/alarm_test.cpp b/osi/test/alarm_test.cpp
index 1b4895c..88beaf5 100644
--- a/osi/test/alarm_test.cpp
+++ b/osi/test/alarm_test.cpp
@@ -109,7 +109,7 @@ TEST_F(AlarmTest, test_set_short) {
TEST_F(AlarmTest, test_set_long) {
alarm_t *alarm = alarm_new();
- alarm_set(alarm, TIMER_INTERVAL_FOR_WAKELOCK_IN_MS, cb, NULL);
+ alarm_set(alarm, TIMER_INTERVAL_FOR_WAKELOCK_IN_MS + EPSILON_MS, cb, NULL);
EXPECT_EQ(cb_counter, 0);
EXPECT_FALSE(WakeLockHeld());
@@ -180,8 +180,8 @@ TEST_F(AlarmTest, test_set_long_long) {
alarm_new()
};
- alarm_set(alarm[0], TIMER_INTERVAL_FOR_WAKELOCK_IN_MS, cb, NULL);
- alarm_set(alarm[1], 2 * TIMER_INTERVAL_FOR_WAKELOCK_IN_MS + EPSILON_MS, cb, NULL);
+ alarm_set(alarm[0], TIMER_INTERVAL_FOR_WAKELOCK_IN_MS + EPSILON_MS, cb, NULL);
+ alarm_set(alarm[1], 2 * (TIMER_INTERVAL_FOR_WAKELOCK_IN_MS + EPSILON_MS), cb, NULL);
EXPECT_EQ(cb_counter, 0);
EXPECT_FALSE(WakeLockHeld());