| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 3340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3351 base::TimeDelta::FromMilliseconds(500)); | 3351 base::TimeDelta::FromMilliseconds(500)); |
| 3352 pool_->RequestSockets("a", ¶ms_, 1, BoundNetLog()); | 3352 pool_->RequestSockets("a", ¶ms_, 1, BoundNetLog()); |
| 3353 EXPECT_EQ(1, pool_->NumConnectJobsInGroup("a")); | 3353 EXPECT_EQ(1, pool_->NumConnectJobsInGroup("a")); |
| 3354 EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); | 3354 EXPECT_EQ(0, pool_->IdleSocketCountInGroup("a")); |
| 3355 | 3355 |
| 3356 // Verify the backup timer doesn't create a backup job, by making | 3356 // Verify the backup timer doesn't create a backup job, by making |
| 3357 // the backup job a pending job instead of a waiting job, so it | 3357 // the backup job a pending job instead of a waiting job, so it |
| 3358 // *would* complete if it were created. | 3358 // *would* complete if it were created. |
| 3359 connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); | 3359 connect_job_factory_->set_job_type(TestConnectJob::kMockPendingJob); |
| 3360 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 3360 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
| 3361 new MessageLoop::QuitTask(), 1000); | 3361 MessageLoop::QuitClosure(), 1000); |
| 3362 MessageLoop::current()->Run(); | 3362 MessageLoop::current()->Run(); |
| 3363 EXPECT_FALSE(pool_->HasGroup("a")); | 3363 EXPECT_FALSE(pool_->HasGroup("a")); |
| 3364 } | 3364 } |
| 3365 | 3365 |
| 3366 TEST_F(ClientSocketPoolBaseTest, PreconnectWithBackupJob) { | 3366 TEST_F(ClientSocketPoolBaseTest, PreconnectWithBackupJob) { |
| 3367 CreatePool(kDefaultMaxSockets, kDefaultMaxSocketsPerGroup); | 3367 CreatePool(kDefaultMaxSockets, kDefaultMaxSocketsPerGroup); |
| 3368 pool_->EnableConnectBackupJobs(); | 3368 pool_->EnableConnectBackupJobs(); |
| 3369 | 3369 |
| 3370 // Make the ConnectJob hang forever. | 3370 // Make the ConnectJob hang forever. |
| 3371 connect_job_factory_->set_job_type(TestConnectJob::kMockWaitingJob); | 3371 connect_job_factory_->set_job_type(TestConnectJob::kMockWaitingJob); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3504 params_, | 3504 params_, |
| 3505 kDefaultPriority, | 3505 kDefaultPriority, |
| 3506 &callback, | 3506 &callback, |
| 3507 pool_.get(), | 3507 pool_.get(), |
| 3508 BoundNetLog())); | 3508 BoundNetLog())); |
| 3509 } | 3509 } |
| 3510 | 3510 |
| 3511 } // namespace | 3511 } // namespace |
| 3512 | 3512 |
| 3513 } // namespace net | 3513 } // namespace net |
| OLD | NEW |