| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/client_socket_pool_base.h" | 5 #include "net/socket/client_socket_pool_base.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/platform_thread.h" | 10 #include "base/platform_thread.h" |
| (...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1274 // run through the MessageLoop once to get it completely released. | 1274 // run through the MessageLoop once to get it completely released. |
| 1275 handle_->socket()->Disconnect(); | 1275 handle_->socket()->Disconnect(); |
| 1276 handle_->Reset(); | 1276 handle_->Reset(); |
| 1277 { | 1277 { |
| 1278 MessageLoop::ScopedNestableTaskAllower nestable( | 1278 MessageLoop::ScopedNestableTaskAllower nestable( |
| 1279 MessageLoop::current()); | 1279 MessageLoop::current()); |
| 1280 MessageLoop::current()->RunAllPending(); | 1280 MessageLoop::current()->RunAllPending(); |
| 1281 } | 1281 } |
| 1282 within_callback_ = true; | 1282 within_callback_ = true; |
| 1283 TestCompletionCallback next_job_callback; | 1283 TestCompletionCallback next_job_callback; |
| 1284 scoped_refptr<TestSocketParams> params = new TestSocketParams(); | 1284 scoped_refptr<TestSocketParams> params(new TestSocketParams()); |
| 1285 int rv = handle_->Init("a", | 1285 int rv = handle_->Init("a", |
| 1286 params, | 1286 params, |
| 1287 kDefaultPriority, | 1287 kDefaultPriority, |
| 1288 &next_job_callback, | 1288 &next_job_callback, |
| 1289 pool_, | 1289 pool_, |
| 1290 BoundNetLog()); | 1290 BoundNetLog()); |
| 1291 switch (next_job_type_) { | 1291 switch (next_job_type_) { |
| 1292 case TestConnectJob::kMockJob: | 1292 case TestConnectJob::kMockJob: |
| 1293 EXPECT_EQ(OK, rv); | 1293 EXPECT_EQ(OK, rv); |
| 1294 break; | 1294 break; |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2080 ClientSocketHandle* handle() { return &handle_; } | 2080 ClientSocketHandle* handle() { return &handle_; } |
| 2081 | 2081 |
| 2082 int WaitForResult() { | 2082 int WaitForResult() { |
| 2083 return callback_.WaitForResult(); | 2083 return callback_.WaitForResult(); |
| 2084 } | 2084 } |
| 2085 | 2085 |
| 2086 virtual void RunWithParams(const Tuple1<int>& params) { | 2086 virtual void RunWithParams(const Tuple1<int>& params) { |
| 2087 callback_.RunWithParams(params); | 2087 callback_.RunWithParams(params); |
| 2088 if (reset_releasing_handle_) | 2088 if (reset_releasing_handle_) |
| 2089 handle_.Reset(); | 2089 handle_.Reset(); |
| 2090 scoped_refptr<TestSocketParams> con_params = new TestSocketParams(); | 2090 scoped_refptr<TestSocketParams> con_params(new TestSocketParams()); |
| 2091 EXPECT_EQ(expected_result_, handle2_.Init("a", | 2091 EXPECT_EQ(expected_result_, handle2_.Init("a", |
| 2092 con_params, | 2092 con_params, |
| 2093 kDefaultPriority, | 2093 kDefaultPriority, |
| 2094 &callback2_, | 2094 &callback2_, |
| 2095 pool_, | 2095 pool_, |
| 2096 BoundNetLog())); | 2096 BoundNetLog())); |
| 2097 } | 2097 } |
| 2098 | 2098 |
| 2099 private: | 2099 private: |
| 2100 TestClientSocketPool* const pool_; | 2100 TestClientSocketPool* const pool_; |
| (...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2992 ASSERT_EQ(OK, callback1.WaitForResult()); | 2992 ASSERT_EQ(OK, callback1.WaitForResult()); |
| 2993 | 2993 |
| 2994 handle1.Reset(); | 2994 handle1.Reset(); |
| 2995 | 2995 |
| 2996 EXPECT_EQ(1, pool_->IdleSocketCountInGroup("a")); | 2996 EXPECT_EQ(1, pool_->IdleSocketCountInGroup("a")); |
| 2997 } | 2997 } |
| 2998 | 2998 |
| 2999 } // namespace | 2999 } // namespace |
| 3000 | 3000 |
| 3001 } // namespace net | 3001 } // namespace net |
| OLD | NEW |