summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorricea <ricea@chromium.org>2015-02-01 10:16:53 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-01 18:17:55 +0000
commitba6836202b8d60478d96fd8509ad98cd89e1ee1c (patch)
tree844ae538b15f07b48e9c1a855585ce74e8d36af0 /net
parente7b882fa2bf4b2f1fec7f4ee60d729a8502eec8e (diff)
downloadchromium_src-ba6836202b8d60478d96fd8509ad98cd89e1ee1c.zip
chromium_src-ba6836202b8d60478d96fd8509ad98cd89e1ee1c.tar.gz
chromium_src-ba6836202b8d60478d96fd8509ad98cd89e1ee1c.tar.bz2
Fix UnlockEndpointIsDelayed again.
On DrMemory and Valgrind builds, it takes more than 1ms just to post the task inside UnlockEndpoint() and then enter the message loop, so the delayed task was being executed inside RunUntilIdle(). Remove the call to RunUntilIdle() and the check that the callback wasn't called inside it. The check at 314 is sufficient to verify that at least 1ms has passed, which in normal compiles means that a delay was applied. On DrMemory and Valgrind builds, the test may just verify that everything is running very slowly, but at least it will be deterministic. BUG=451999 TEST=net_unittests Review URL: https://codereview.chromium.org/878373002 Cr-Commit-Position: refs/heads/master@{#314093}
Diffstat (limited to 'net')
-rw-r--r--net/socket/websocket_endpoint_lock_manager_unittest.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/socket/websocket_endpoint_lock_manager_unittest.cc b/net/socket/websocket_endpoint_lock_manager_unittest.cc
index 1603a3b..dbe8494 100644
--- a/net/socket/websocket_endpoint_lock_manager_unittest.cc
+++ b/net/socket/websocket_endpoint_lock_manager_unittest.cc
@@ -292,6 +292,13 @@ TEST_F(WebSocketEndpointLockManagerTest, UnlockEndpointIsAsynchronous) {
TEST_F(WebSocketEndpointLockManagerTest, UnlockEndpointIsDelayed) {
using base::TimeTicks;
+ // This 1ms delay is too short for very slow environments (usually those
+ // running memory checkers). In those environments, the code takes >1ms to run
+ // and no delay is needed. Rather than increase the delay and slow down the
+ // test everywhere, the test doesn't explicitly verify that a delay has been
+ // applied. Instead it just verifies that the whole thing took >=1ms. 1ms is
+ // easily enough for normal compiles even on Android, so the fact that there
+ // is a delay is still checked on every platform.
const base::TimeDelta unlock_delay = base::TimeDelta::FromMilliseconds(1);
instance()->SetUnlockDelayForTesting(unlock_delay);
FakeWaiter fake_waiter;
@@ -302,8 +309,6 @@ TEST_F(WebSocketEndpointLockManagerTest, UnlockEndpointIsDelayed) {
TimeTicks before_unlock = TimeTicks::Now();
instance()->UnlockEndpoint(DummyEndpoint());
- RunUntilIdle();
- EXPECT_FALSE(blocking_waiter.called());
blocking_waiter.WaitForLock();
TimeTicks after_unlock = TimeTicks::Now();
EXPECT_GE(after_unlock - before_unlock, unlock_delay);