| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 2567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2578 params_, | 2578 params_, |
| 2579 kDefaultPriority, | 2579 kDefaultPriority, |
| 2580 callback.callback(), | 2580 callback.callback(), |
| 2581 pool_.get(), | 2581 pool_.get(), |
| 2582 BoundNetLog())); | 2582 BoundNetLog())); |
| 2583 | 2583 |
| 2584 // Second job will be started during the first callback, and will | 2584 // Second job will be started during the first callback, and will |
| 2585 // asynchronously complete with OK. | 2585 // asynchronously complete with OK. |
| 2586 connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); | 2586 connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); |
| 2587 pool_->Flush(); | 2587 pool_->Flush(); |
| 2588 EXPECT_EQ(ERR_ABORTED, callback.WaitForResult()); | 2588 EXPECT_EQ(ERR_NETWORK_CHANGED, callback.WaitForResult()); |
| 2589 EXPECT_EQ(OK, callback.WaitForNestedResult()); | 2589 EXPECT_EQ(OK, callback.WaitForNestedResult()); |
| 2590 } | 2590 } |
| 2591 | 2591 |
| 2592 // Cancel a pending socket request while we're at max sockets, | 2592 // Cancel a pending socket request while we're at max sockets, |
| 2593 // and verify that the backup socket firing doesn't cause a crash. | 2593 // and verify that the backup socket firing doesn't cause a crash. |
| 2594 TEST_F(ClientSocketPoolBaseTest, BackupSocketCancelAtMaxSockets) { | 2594 TEST_F(ClientSocketPoolBaseTest, BackupSocketCancelAtMaxSockets) { |
| 2595 // Max 4 sockets globally, max 4 sockets per group. | 2595 // Max 4 sockets globally, max 4 sockets per group. |
| 2596 CreatePool(kDefaultMaxSockets, kDefaultMaxSockets); | 2596 CreatePool(kDefaultMaxSockets, kDefaultMaxSockets); |
| 2597 pool_->EnableConnectBackupJobs(); | 2597 pool_->EnableConnectBackupJobs(); |
| 2598 | 2598 |
| (...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3524 // complete. | 3524 // complete. |
| 3525 EXPECT_EQ(1, pool_->NumConnectJobsInGroup("a")); | 3525 EXPECT_EQ(1, pool_->NumConnectJobsInGroup("a")); |
| 3526 EXPECT_EQ(0, pool_->NumUnassignedConnectJobsInGroup("a")); | 3526 EXPECT_EQ(0, pool_->NumUnassignedConnectJobsInGroup("a")); |
| 3527 EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); | 3527 EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); |
| 3528 EXPECT_EQ(1, pool_->NumActiveSocketsInGroup("a")); | 3528 EXPECT_EQ(1, pool_->NumActiveSocketsInGroup("a")); |
| 3529 } | 3529 } |
| 3530 | 3530 |
| 3531 } // namespace | 3531 } // namespace |
| 3532 | 3532 |
| 3533 } // namespace net | 3533 } // namespace net |
| OLD | NEW |