OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/socket/websocket_endpoint_lock_manager.h" | 5 #include "net/socket/websocket_endpoint_lock_manager.h" |
6 | 6 |
7 #include "net/base/net_errors.h" | 7 #include "net/base/net_errors.h" |
8 #include "net/socket/next_proto.h" | 8 #include "net/socket/next_proto.h" |
9 #include "net/socket/socket_test_util.h" | 9 #include "net/socket/socket_test_util.h" |
10 #include "net/socket/stream_socket.h" | 10 #include "net/socket/stream_socket.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 bool called() const { return called_; } | 86 bool called() const { return called_; } |
87 | 87 |
88 private: | 88 private: |
89 bool called_; | 89 bool called_; |
90 }; | 90 }; |
91 | 91 |
92 class WebSocketEndpointLockManagerTest : public ::testing::Test { | 92 class WebSocketEndpointLockManagerTest : public ::testing::Test { |
93 protected: | 93 protected: |
94 WebSocketEndpointLockManagerTest() | 94 WebSocketEndpointLockManagerTest() |
95 : instance_(WebSocketEndpointLockManager::GetInstance()) {} | 95 : instance_(WebSocketEndpointLockManager::GetInstance()) {} |
96 virtual ~WebSocketEndpointLockManagerTest() { | 96 ~WebSocketEndpointLockManagerTest() override { |
97 // If this check fails then subsequent tests may fail. | 97 // If this check fails then subsequent tests may fail. |
98 CHECK(instance_->IsEmpty()); | 98 CHECK(instance_->IsEmpty()); |
99 } | 99 } |
100 | 100 |
101 WebSocketEndpointLockManager* instance() const { return instance_; } | 101 WebSocketEndpointLockManager* instance() const { return instance_; } |
102 | 102 |
103 IPEndPoint DummyEndpoint() { | 103 IPEndPoint DummyEndpoint() { |
104 IPAddressNumber ip_address_number; | 104 IPAddressNumber ip_address_number; |
105 CHECK(ParseIPLiteralToNumber("127.0.0.1", &ip_address_number)); | 105 CHECK(ParseIPLiteralToNumber("127.0.0.1", &ip_address_number)); |
106 return IPEndPoint(ip_address_number, 80); | 106 return IPEndPoint(ip_address_number, 80); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 instance()->UnlockEndpoint(DummyEndpoint()); | 215 instance()->UnlockEndpoint(DummyEndpoint()); |
216 EXPECT_TRUE(waiters[1].called()); | 216 EXPECT_TRUE(waiters[1].called()); |
217 instance()->RememberSocket(&dummy_sockets[1], DummyEndpoint()); | 217 instance()->RememberSocket(&dummy_sockets[1], DummyEndpoint()); |
218 | 218 |
219 UnlockDummyEndpoint(1); | 219 UnlockDummyEndpoint(1); |
220 } | 220 } |
221 | 221 |
222 } // namespace | 222 } // namespace |
223 | 223 |
224 } // namespace net | 224 } // namespace net |
OLD | NEW |