Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Unified Diff: net/socket/websocket_endpoint_lock_manager_unittest.cc

Issue 878373002: Fix UnlockEndpointIsDelayed again. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/valgrind/gtest_exclude/net_unittests.gtest.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/websocket_endpoint_lock_manager_unittest.cc
diff --git a/net/socket/websocket_endpoint_lock_manager_unittest.cc b/net/socket/websocket_endpoint_lock_manager_unittest.cc
index 1603a3bf5cfef0dcfae83260e6b1eff0aa636f72..dbe8494f4f88baaf304d4b9a4e1c933b629e92a3 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);
« no previous file with comments | « no previous file | tools/valgrind/gtest_exclude/net_unittests.gtest.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698