summaryrefslogtreecommitdiff
path: root/native_client_sdk
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2013-07-25 10:06:34 +0100
committerBen Murdoch <benm@google.com>2013-07-25 10:06:34 +0100
commitbbcdd45c55eb7c4641ab97aef9889b0fc828e7d3 (patch)
tree51387d1614b16fcf107004649d44707d271da339 /native_client_sdk
parent8a142c18176c4e279012cb218f060cfc3df087c5 (diff)
downloadchromium_org-bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3.tar.gz
Merge from Chromium at DEPS revision r213605
This commit was generated by merge_to_master.py. Change-Id: I5ef9e03bf077dac295a7904f06b3cb6dec9fe213
Diffstat (limited to 'native_client_sdk')
-rw-r--r--native_client_sdk/src/libraries/nacl_io_test/event_test.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/native_client_sdk/src/libraries/nacl_io_test/event_test.cc b/native_client_sdk/src/libraries/nacl_io_test/event_test.cc
index 33a3bb279e..1a5d9bd178 100644
--- a/native_client_sdk/src/libraries/nacl_io_test/event_test.cc
+++ b/native_client_sdk/src/libraries/nacl_io_test/event_test.cc
@@ -73,6 +73,11 @@ const int TIMEOUT_LONG = 500;
const int TIMEOUT_NEVER = -1;
const int TIMEOUT_VERY_LONG = 1000;
+// We subtract TIMEOUT_SLOP from the expected minimum timed due to rounding
+// and clock drift converting between absolute and relative time.
+// 1 for LT comparison, 1 for rounding, etc...
+const int TIMEOUT_SLOP = 2;
+
TEST(EventTest, EmitterBasic) {
ScopedRef<EventEmitterTester> emitter(new EventEmitterTester());
ScopedRef<EventEmitter> null_emitter;
@@ -300,7 +305,7 @@ TEST(EventTest, EmitterTimeout) {
memset(ev, 0, sizeof(ev));
EXPECT_TRUE(TimedListen(listener, ev, MAX_EVENTS, EXPECT_NO_EVENT,
TIMEOUT_LONG, &duration));
- EXPECT_LT(TIMEOUT_LONG - 1, duration);
+ EXPECT_LT(TIMEOUT_LONG - TIMEOUT_SLOP, duration);
EXPECT_GT(TIMEOUT_LONG + SCHEDULING_GRANULARITY, duration);
}
@@ -353,7 +358,7 @@ TEST(EventTest, EmitterSignalling) {
// Verify the wait duration, and that we only recieved the expected signal.
duration = Duration(&start, &end);
EXPECT_GT(TIMEOUT_SHORT + SCHEDULING_GRANULARITY, duration);
- EXPECT_LT(TIMEOUT_SHORT - 1, duration);
+ EXPECT_LT(TIMEOUT_SHORT - TIMEOUT_SLOP, duration);
EXPECT_EQ(USER_DATA_A, ev[0].user_data);
EXPECT_EQ(KE_EXPECTED, ev[0].events);
}