Make CallAfterTimeoutTest less flaky

This commit is contained in:
Sebastian Messmer 2015-11-26 16:40:45 +01:00
parent ee89bb7ffb
commit 347e3584ee

View File

@ -37,8 +37,12 @@ TEST_F(CallAfterTimeoutTest, NoReset_2) {
TEST_F(CallAfterTimeoutTest, DoesntCallTwice) { TEST_F(CallAfterTimeoutTest, DoesntCallTwice) {
auto obj = callAfterTimeout(milliseconds(50)); auto obj = callAfterTimeout(milliseconds(50));
sleep_for(milliseconds(150)); // Wait until it was called
while(!called) {
sleep_for(milliseconds(10));
}
EXPECT_TRUE(called); EXPECT_TRUE(called);
// Test that it isn't called again
called = false; called = false;
sleep_for(milliseconds(150)); sleep_for(milliseconds(150));
EXPECT_FALSE(called); EXPECT_FALSE(called);