| 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_transport_client_socket_pool.h" | 5 #include "net/socket/websocket_transport_client_socket_pool.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "net/socket/transport_client_socket_pool_test_util.h" | 30 #include "net/socket/transport_client_socket_pool_test_util.h" |
| 31 #include "net/socket/websocket_endpoint_lock_manager.h" | 31 #include "net/socket/websocket_endpoint_lock_manager.h" |
| 32 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| 33 | 33 |
| 34 namespace net { | 34 namespace net { |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 const int kMaxSockets = 32; | 38 const int kMaxSockets = 32; |
| 39 const int kMaxSocketsPerGroup = 6; | 39 const int kMaxSocketsPerGroup = 6; |
| 40 const net::RequestPriority kDefaultPriority = LOW; | 40 const RequestPriority kDefaultPriority = LOW; |
| 41 | 41 |
| 42 // RunLoop doesn't support this natively but it is easy to emulate. | 42 // RunLoop doesn't support this natively but it is easy to emulate. |
| 43 void RunLoopForTimePeriod(base::TimeDelta period) { | 43 void RunLoopForTimePeriod(base::TimeDelta period) { |
| 44 base::RunLoop run_loop; | 44 base::RunLoop run_loop; |
| 45 base::Closure quit_closure(run_loop.QuitClosure()); | 45 base::Closure quit_closure(run_loop.QuitClosure()); |
| 46 base::MessageLoop::current()->PostDelayedTask( | 46 base::MessageLoop::current()->PostDelayedTask( |
| 47 FROM_HERE, quit_closure, period); | 47 FROM_HERE, quit_closure, period); |
| 48 run_loop.Run(); | 48 run_loop.Run(); |
| 49 } | 49 } |
| 50 | 50 |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 EXPECT_EQ(ERR_FAILED, request(1)->WaitForResult()); | 1081 EXPECT_EQ(ERR_FAILED, request(1)->WaitForResult()); |
| 1082 // Socket owned by ClientSocketHandle is unaffected: | 1082 // Socket owned by ClientSocketHandle is unaffected: |
| 1083 EXPECT_TRUE(request(0)->handle()->socket()); | 1083 EXPECT_TRUE(request(0)->handle()->socket()); |
| 1084 // Return it to the pool (which deletes it). | 1084 // Return it to the pool (which deletes it). |
| 1085 request(0)->handle()->Reset(); | 1085 request(0)->handle()->Reset(); |
| 1086 } | 1086 } |
| 1087 | 1087 |
| 1088 } // namespace | 1088 } // namespace |
| 1089 | 1089 |
| 1090 } // namespace net | 1090 } // namespace net |
| OLD | NEW |