OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/platform_thread.h" | 9 #include "base/platform_thread.h" |
10 #include "base/scoped_vector.h" | 10 #include "base/scoped_vector.h" |
11 #include "net/base/load_log.h" | 11 #include "net/base/load_log.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 class TestConnectJobDelegate : public ConnectJob::Delegate { | 320 class TestConnectJobDelegate : public ConnectJob::Delegate { |
321 public: | 321 public: |
322 TestConnectJobDelegate() | 322 TestConnectJobDelegate() |
323 : have_result_(false), waiting_for_result_(false), result_(OK) {} | 323 : have_result_(false), waiting_for_result_(false), result_(OK) {} |
324 virtual ~TestConnectJobDelegate() {} | 324 virtual ~TestConnectJobDelegate() {} |
325 | 325 |
326 virtual void OnConnectJobComplete(int result, ConnectJob* job) { | 326 virtual void OnConnectJobComplete(int result, ConnectJob* job) { |
327 result_ = result; | 327 result_ = result; |
328 scoped_ptr<ClientSocket> socket(job->ReleaseSocket()); | 328 scoped_ptr<ClientSocket> socket(job->ReleaseSocket()); |
329 if (result == OK) { | 329 if (result == OK) { |
330 EXPECT_FALSE(socket.get() == NULL); | 330 EXPECT_TRUE(socket.get() != NULL); |
331 } else { | 331 } else { |
332 EXPECT_TRUE(socket.get() == NULL); | 332 EXPECT_EQ(NULL, socket.get()); |
333 } | 333 } |
334 delete job; | 334 delete job; |
335 have_result_ = true; | 335 have_result_ = true; |
336 if (waiting_for_result_) | 336 if (waiting_for_result_) |
337 MessageLoop::current()->Quit(); | 337 MessageLoop::current()->Quit(); |
338 } | 338 } |
339 | 339 |
340 int WaitForResult() { | 340 int WaitForResult() { |
341 DCHECK(!waiting_for_result_); | 341 DCHECK(!waiting_for_result_); |
342 while (!have_result_) { | 342 while (!have_result_) { |
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1756 // Closing idle sockets should not get us into trouble, but in the bug | 1756 // Closing idle sockets should not get us into trouble, but in the bug |
1757 // we were hitting a CHECK here. | 1757 // we were hitting a CHECK here. |
1758 EXPECT_EQ(2, pool_->IdleSocketCountInGroup("a")); | 1758 EXPECT_EQ(2, pool_->IdleSocketCountInGroup("a")); |
1759 pool_->CloseIdleSockets(); | 1759 pool_->CloseIdleSockets(); |
1760 EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); | 1760 EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); |
1761 } | 1761 } |
1762 | 1762 |
1763 } // namespace | 1763 } // namespace |
1764 | 1764 |
1765 } // namespace net | 1765 } // namespace net |
OLD | NEW |