Avi Drissman | 6459548 | 2022-09-14 20:52:29 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "net/socket/websocket_endpoint_lock_manager.h" |
| 6 | |
Hans Wennborg | 0924470b | 2020-04-27 21:08:05 | [diff] [blame] | 7 | #include "base/check.h" |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 8 | #include "base/run_loop.h" |
| 9 | #include "base/time/time.h" |
martijn | a2e83bd | 2016-03-18 13:10:45 | [diff] [blame] | 10 | #include "net/base/ip_address.h" |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 11 | #include "net/base/net_errors.h" |
mikecirone | f22f981 | 2016-10-04 03:40:19 | [diff] [blame] | 12 | #include "net/log/net_log_with_source.h" |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 13 | #include "net/socket/next_proto.h" |
| 14 | #include "net/socket/socket_test_util.h" |
robpercival | 214763f | 2016-07-01 23:27:01 | [diff] [blame] | 15 | #include "net/test/gtest_util.h" |
Gabriel Charette | c710874 | 2019-08-23 03:31:40 | [diff] [blame] | 16 | #include "net/test/test_with_task_environment.h" |
[email protected] | a2b2cfc | 2017-12-06 09:06:08 | [diff] [blame] | 17 | #include "net/traffic_annotation/network_traffic_annotation.h" |
robpercival | 214763f | 2016-07-01 23:27:01 | [diff] [blame] | 18 | #include "testing/gmock/include/gmock/gmock.h" |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 19 | #include "testing/gtest/include/gtest/gtest.h" |
| 20 | |
robpercival | 214763f | 2016-07-01 23:27:01 | [diff] [blame] | 21 | using net::test::IsOk; |
| 22 | |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 23 | namespace net { |
| 24 | |
| 25 | namespace { |
| 26 | |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 27 | class FakeWaiter : public WebSocketEndpointLockManager::Waiter { |
| 28 | public: |
Tsuyoshi Horo | 2ec06e00 | 2022-06-09 01:38:59 | [diff] [blame] | 29 | FakeWaiter() = default; |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 30 | |
dcheng | b03027d | 2014-10-21 12:00:20 | [diff] [blame] | 31 | void GotEndpointLock() override { |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 32 | CHECK(!called_); |
| 33 | called_ = true; |
| 34 | } |
| 35 | |
| 36 | bool called() const { return called_; } |
| 37 | |
| 38 | private: |
Tsuyoshi Horo | 2ec06e00 | 2022-06-09 01:38:59 | [diff] [blame] | 39 | bool called_ = false; |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 40 | }; |
| 41 | |
ricea | 6da0ff6 | 2015-01-27 08:15:19 | [diff] [blame] | 42 | class BlockingWaiter : public FakeWaiter { |
| 43 | public: |
| 44 | void WaitForLock() { |
| 45 | while (!called()) { |
| 46 | run_loop_.Run(); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | void GotEndpointLock() override { |
| 51 | FakeWaiter::GotEndpointLock(); |
| 52 | run_loop_.Quit(); |
| 53 | } |
| 54 | |
| 55 | private: |
| 56 | base::RunLoop run_loop_; |
| 57 | }; |
| 58 | |
Gabriel Charette | 694c3c33 | 2019-08-19 14:53:05 | [diff] [blame] | 59 | class WebSocketEndpointLockManagerTest : public TestWithTaskEnvironment { |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 60 | protected: |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 61 | WebSocketEndpointLockManagerTest() { |
| 62 | websocket_endpoint_lock_manager_.SetUnlockDelayForTesting( |
| 63 | base::TimeDelta()); |
| 64 | } |
| 65 | |
dcheng | 67be2b1f | 2014-10-27 21:47:29 | [diff] [blame] | 66 | ~WebSocketEndpointLockManagerTest() override { |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 67 | // Permit any pending asynchronous unlock operations to complete. |
| 68 | RunUntilIdle(); |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 69 | // If this check fails then subsequent tests may fail. |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 70 | CHECK(websocket_endpoint_lock_manager_.IsEmpty()); |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 71 | } |
| 72 | |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 73 | IPEndPoint DummyEndpoint() { |
martijn | a2e83bd | 2016-03-18 13:10:45 | [diff] [blame] | 74 | return IPEndPoint(IPAddress::IPv4Localhost(), 80); |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | void UnlockDummyEndpoint(int times) { |
| 78 | for (int i = 0; i < times; ++i) { |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 79 | websocket_endpoint_lock_manager_.UnlockEndpoint(DummyEndpoint()); |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 80 | RunUntilIdle(); |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 81 | } |
| 82 | } |
| 83 | |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 84 | static void RunUntilIdle() { base::RunLoop().RunUntilIdle(); } |
| 85 | |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 86 | WebSocketEndpointLockManager websocket_endpoint_lock_manager_; |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 87 | }; |
| 88 | |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 89 | TEST_F(WebSocketEndpointLockManagerTest, LockEndpointReturnsOkOnce) { |
| 90 | FakeWaiter waiters[2]; |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 91 | EXPECT_THAT(websocket_endpoint_lock_manager_.LockEndpoint(DummyEndpoint(), |
| 92 | &waiters[0]), |
| 93 | IsOk()); |
| 94 | EXPECT_EQ(ERR_IO_PENDING, websocket_endpoint_lock_manager_.LockEndpoint( |
| 95 | DummyEndpoint(), &waiters[1])); |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 96 | |
| 97 | UnlockDummyEndpoint(2); |
| 98 | } |
| 99 | |
| 100 | TEST_F(WebSocketEndpointLockManagerTest, GotEndpointLockNotCalledOnOk) { |
| 101 | FakeWaiter waiter; |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 102 | EXPECT_THAT( |
| 103 | websocket_endpoint_lock_manager_.LockEndpoint(DummyEndpoint(), &waiter), |
| 104 | IsOk()); |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 105 | RunUntilIdle(); |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 106 | EXPECT_FALSE(waiter.called()); |
| 107 | |
| 108 | UnlockDummyEndpoint(1); |
| 109 | } |
| 110 | |
| 111 | TEST_F(WebSocketEndpointLockManagerTest, GotEndpointLockNotCalledImmediately) { |
| 112 | FakeWaiter waiters[2]; |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 113 | EXPECT_THAT(websocket_endpoint_lock_manager_.LockEndpoint(DummyEndpoint(), |
| 114 | &waiters[0]), |
| 115 | IsOk()); |
| 116 | EXPECT_EQ(ERR_IO_PENDING, websocket_endpoint_lock_manager_.LockEndpoint( |
| 117 | DummyEndpoint(), &waiters[1])); |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 118 | RunUntilIdle(); |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 119 | EXPECT_FALSE(waiters[1].called()); |
| 120 | |
| 121 | UnlockDummyEndpoint(2); |
| 122 | } |
| 123 | |
| 124 | TEST_F(WebSocketEndpointLockManagerTest, GotEndpointLockCalledWhenUnlocked) { |
| 125 | FakeWaiter waiters[2]; |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 126 | EXPECT_THAT(websocket_endpoint_lock_manager_.LockEndpoint(DummyEndpoint(), |
| 127 | &waiters[0]), |
| 128 | IsOk()); |
| 129 | EXPECT_EQ(ERR_IO_PENDING, websocket_endpoint_lock_manager_.LockEndpoint( |
| 130 | DummyEndpoint(), &waiters[1])); |
| 131 | websocket_endpoint_lock_manager_.UnlockEndpoint(DummyEndpoint()); |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 132 | RunUntilIdle(); |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 133 | EXPECT_TRUE(waiters[1].called()); |
| 134 | |
| 135 | UnlockDummyEndpoint(1); |
| 136 | } |
| 137 | |
| 138 | TEST_F(WebSocketEndpointLockManagerTest, |
| 139 | EndpointUnlockedIfWaiterAlreadyDeleted) { |
| 140 | FakeWaiter first_lock_holder; |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 141 | EXPECT_THAT(websocket_endpoint_lock_manager_.LockEndpoint(DummyEndpoint(), |
| 142 | &first_lock_holder), |
robpercival | 214763f | 2016-07-01 23:27:01 | [diff] [blame] | 143 | IsOk()); |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 144 | |
| 145 | { |
| 146 | FakeWaiter short_lived_waiter; |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 147 | EXPECT_EQ(ERR_IO_PENDING, websocket_endpoint_lock_manager_.LockEndpoint( |
| 148 | DummyEndpoint(), &short_lived_waiter)); |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 149 | } |
| 150 | |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 151 | websocket_endpoint_lock_manager_.UnlockEndpoint(DummyEndpoint()); |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 152 | RunUntilIdle(); |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 153 | |
| 154 | FakeWaiter second_lock_holder; |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 155 | EXPECT_THAT(websocket_endpoint_lock_manager_.LockEndpoint( |
| 156 | DummyEndpoint(), &second_lock_holder), |
robpercival | 214763f | 2016-07-01 23:27:01 | [diff] [blame] | 157 | IsOk()); |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 158 | |
| 159 | UnlockDummyEndpoint(1); |
| 160 | } |
| 161 | |
Adam Rice | a0e7139 | 2019-02-14 13:29:41 | [diff] [blame] | 162 | TEST_F(WebSocketEndpointLockManagerTest, LockReleaserWorks) { |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 163 | FakeWaiter waiters[2]; |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 164 | EXPECT_THAT(websocket_endpoint_lock_manager_.LockEndpoint(DummyEndpoint(), |
| 165 | &waiters[0]), |
| 166 | IsOk()); |
| 167 | EXPECT_EQ(ERR_IO_PENDING, websocket_endpoint_lock_manager_.LockEndpoint( |
| 168 | DummyEndpoint(), &waiters[1])); |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 169 | |
Adam Rice | a0e7139 | 2019-02-14 13:29:41 | [diff] [blame] | 170 | { |
| 171 | WebSocketEndpointLockManager::LockReleaser releaser( |
| 172 | &websocket_endpoint_lock_manager_, DummyEndpoint()); |
| 173 | } |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 174 | RunUntilIdle(); |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 175 | EXPECT_TRUE(waiters[1].called()); |
| 176 | |
| 177 | UnlockDummyEndpoint(1); |
| 178 | } |
| 179 | |
Adam Rice | a0e7139 | 2019-02-14 13:29:41 | [diff] [blame] | 180 | // UnlockEndpoint() should cause any LockReleasers for this endpoint to be |
| 181 | // unregistered. |
| 182 | TEST_F(WebSocketEndpointLockManagerTest, LockReleaserForgottenOnUnlock) { |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 183 | FakeWaiter waiter; |
[email protected] | 6bcd67d | 2014-08-05 16:31:24 | [diff] [blame] | 184 | |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 185 | EXPECT_THAT( |
| 186 | websocket_endpoint_lock_manager_.LockEndpoint(DummyEndpoint(), &waiter), |
| 187 | IsOk()); |
Adam Rice | a0e7139 | 2019-02-14 13:29:41 | [diff] [blame] | 188 | WebSocketEndpointLockManager::LockReleaser releaser( |
| 189 | &websocket_endpoint_lock_manager_, DummyEndpoint()); |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 190 | websocket_endpoint_lock_manager_.UnlockEndpoint(DummyEndpoint()); |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 191 | RunUntilIdle(); |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 192 | EXPECT_TRUE(websocket_endpoint_lock_manager_.IsEmpty()); |
[email protected] | 6bcd67d | 2014-08-05 16:31:24 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | // When ownership of the endpoint is passed to a new waiter, the new waiter can |
Adam Rice | a0e7139 | 2019-02-14 13:29:41 | [diff] [blame] | 196 | // construct another LockReleaser. |
| 197 | TEST_F(WebSocketEndpointLockManagerTest, NextWaiterCanCreateLockReleaserAgain) { |
[email protected] | 6bcd67d | 2014-08-05 16:31:24 | [diff] [blame] | 198 | FakeWaiter waiters[2]; |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 199 | EXPECT_THAT(websocket_endpoint_lock_manager_.LockEndpoint(DummyEndpoint(), |
| 200 | &waiters[0]), |
| 201 | IsOk()); |
| 202 | EXPECT_EQ(ERR_IO_PENDING, websocket_endpoint_lock_manager_.LockEndpoint( |
| 203 | DummyEndpoint(), &waiters[1])); |
[email protected] | 6bcd67d | 2014-08-05 16:31:24 | [diff] [blame] | 204 | |
Adam Rice | a0e7139 | 2019-02-14 13:29:41 | [diff] [blame] | 205 | WebSocketEndpointLockManager::LockReleaser releaser1( |
| 206 | &websocket_endpoint_lock_manager_, DummyEndpoint()); |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 207 | websocket_endpoint_lock_manager_.UnlockEndpoint(DummyEndpoint()); |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 208 | RunUntilIdle(); |
[email protected] | 6bcd67d | 2014-08-05 16:31:24 | [diff] [blame] | 209 | EXPECT_TRUE(waiters[1].called()); |
Adam Rice | a0e7139 | 2019-02-14 13:29:41 | [diff] [blame] | 210 | WebSocketEndpointLockManager::LockReleaser releaser2( |
| 211 | &websocket_endpoint_lock_manager_, DummyEndpoint()); |
[email protected] | 6bcd67d | 2014-08-05 16:31:24 | [diff] [blame] | 212 | |
| 213 | UnlockDummyEndpoint(1); |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 214 | } |
| 215 | |
Adam Rice | a0e7139 | 2019-02-14 13:29:41 | [diff] [blame] | 216 | // Destroying LockReleaser after UnlockEndpoint() does nothing. |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 217 | TEST_F(WebSocketEndpointLockManagerTest, |
Adam Rice | a0e7139 | 2019-02-14 13:29:41 | [diff] [blame] | 218 | DestroyLockReleaserAfterUnlockEndpointDoesNothing) { |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 219 | FakeWaiter waiters[3]; |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 220 | |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 221 | EXPECT_THAT(websocket_endpoint_lock_manager_.LockEndpoint(DummyEndpoint(), |
| 222 | &waiters[0]), |
| 223 | IsOk()); |
| 224 | EXPECT_EQ(ERR_IO_PENDING, websocket_endpoint_lock_manager_.LockEndpoint( |
| 225 | DummyEndpoint(), &waiters[1])); |
| 226 | EXPECT_EQ(ERR_IO_PENDING, websocket_endpoint_lock_manager_.LockEndpoint( |
| 227 | DummyEndpoint(), &waiters[2])); |
Adam Rice | a0e7139 | 2019-02-14 13:29:41 | [diff] [blame] | 228 | { |
| 229 | WebSocketEndpointLockManager::LockReleaser releaser( |
| 230 | &websocket_endpoint_lock_manager_, DummyEndpoint()); |
| 231 | websocket_endpoint_lock_manager_.UnlockEndpoint(DummyEndpoint()); |
| 232 | } |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 233 | RunUntilIdle(); |
| 234 | EXPECT_TRUE(waiters[1].called()); |
| 235 | EXPECT_FALSE(waiters[2].called()); |
| 236 | |
| 237 | UnlockDummyEndpoint(2); |
| 238 | } |
| 239 | |
| 240 | // UnlockEndpoint() should always be asynchronous. |
| 241 | TEST_F(WebSocketEndpointLockManagerTest, UnlockEndpointIsAsynchronous) { |
| 242 | FakeWaiter waiters[2]; |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 243 | EXPECT_THAT(websocket_endpoint_lock_manager_.LockEndpoint(DummyEndpoint(), |
| 244 | &waiters[0]), |
| 245 | IsOk()); |
| 246 | EXPECT_EQ(ERR_IO_PENDING, websocket_endpoint_lock_manager_.LockEndpoint( |
| 247 | DummyEndpoint(), &waiters[1])); |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 248 | |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 249 | websocket_endpoint_lock_manager_.UnlockEndpoint(DummyEndpoint()); |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 250 | EXPECT_FALSE(waiters[1].called()); |
| 251 | RunUntilIdle(); |
| 252 | EXPECT_TRUE(waiters[1].called()); |
| 253 | |
| 254 | UnlockDummyEndpoint(1); |
| 255 | } |
| 256 | |
| 257 | // UnlockEndpoint() should normally have a delay. |
| 258 | TEST_F(WebSocketEndpointLockManagerTest, UnlockEndpointIsDelayed) { |
ricea | 6da0ff6 | 2015-01-27 08:15:19 | [diff] [blame] | 259 | using base::TimeTicks; |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 260 | |
ricea | ba68362 | 2015-02-01 18:16:53 | [diff] [blame] | 261 | // This 1ms delay is too short for very slow environments (usually those |
| 262 | // running memory checkers). In those environments, the code takes >1ms to run |
| 263 | // and no delay is needed. Rather than increase the delay and slow down the |
| 264 | // test everywhere, the test doesn't explicitly verify that a delay has been |
| 265 | // applied. Instead it just verifies that the whole thing took >=1ms. 1ms is |
| 266 | // easily enough for normal compiles even on Android, so the fact that there |
| 267 | // is a delay is still checked on every platform. |
Peter Kasting | e5a38ed | 2021-10-02 03:06:35 | [diff] [blame] | 268 | const base::TimeDelta unlock_delay = base::Milliseconds(1); |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 269 | websocket_endpoint_lock_manager_.SetUnlockDelayForTesting(unlock_delay); |
ricea | 6da0ff6 | 2015-01-27 08:15:19 | [diff] [blame] | 270 | FakeWaiter fake_waiter; |
| 271 | BlockingWaiter blocking_waiter; |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 272 | EXPECT_THAT(websocket_endpoint_lock_manager_.LockEndpoint(DummyEndpoint(), |
| 273 | &fake_waiter), |
| 274 | IsOk()); |
| 275 | EXPECT_EQ(ERR_IO_PENDING, websocket_endpoint_lock_manager_.LockEndpoint( |
| 276 | DummyEndpoint(), &blocking_waiter)); |
ricea | 6da0ff6 | 2015-01-27 08:15:19 | [diff] [blame] | 277 | |
| 278 | TimeTicks before_unlock = TimeTicks::Now(); |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 279 | websocket_endpoint_lock_manager_.UnlockEndpoint(DummyEndpoint()); |
ricea | 6da0ff6 | 2015-01-27 08:15:19 | [diff] [blame] | 280 | blocking_waiter.WaitForLock(); |
| 281 | TimeTicks after_unlock = TimeTicks::Now(); |
| 282 | EXPECT_GE(after_unlock - before_unlock, unlock_delay); |
Bence Béky | da280c6 | 2018-04-12 15:08:37 | [diff] [blame] | 283 | websocket_endpoint_lock_manager_.SetUnlockDelayForTesting(base::TimeDelta()); |
ricea | bafe0f2 | 2015-01-23 05:31:25 | [diff] [blame] | 284 | UnlockDummyEndpoint(1); |
| 285 | } |
| 286 | |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 287 | } // namespace |
| 288 | |
| 289 | } // namespace net |