| 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 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1389 | 1389 |
| 1390 // Invoke the idle socket cleanup check. Only one socket should be left, the | 1390 // Invoke the idle socket cleanup check. Only one socket should be left, the |
| 1391 // used socket. Request it to make sure that it's used. | 1391 // used socket. Request it to make sure that it's used. |
| 1392 | 1392 |
| 1393 pool_->CleanupTimedOutIdleSockets(); | 1393 pool_->CleanupTimedOutIdleSockets(); |
| 1394 CapturingBoundNetLog log(CapturingNetLog::kUnbounded); | 1394 CapturingBoundNetLog log(CapturingNetLog::kUnbounded); |
| 1395 rv = InitHandle(req.handle(), "a", LOWEST, &req, pool_, log.bound()); | 1395 rv = InitHandle(req.handle(), "a", LOWEST, &req, pool_, log.bound()); |
| 1396 EXPECT_EQ(OK, rv); | 1396 EXPECT_EQ(OK, rv); |
| 1397 EXPECT_TRUE(req.handle()->is_reused()); | 1397 EXPECT_TRUE(req.handle()->is_reused()); |
| 1398 EXPECT_TRUE(LogContainsEntryWithType( | 1398 EXPECT_TRUE(LogContainsEntryWithType( |
| 1399 log.entries(), 1, NetLog::TYPE_TODO_STRING_LITERAL)); | 1399 log.entries(), 1, NetLog::TYPE_SOCKET_POOL_REUSED_AN_EXISTING_SOCKET)); |
| 1400 } | 1400 } |
| 1401 | 1401 |
| 1402 // Make sure that we process all pending requests even when we're stalling | 1402 // Make sure that we process all pending requests even when we're stalling |
| 1403 // because of multiple releasing disconnected sockets. | 1403 // because of multiple releasing disconnected sockets. |
| 1404 TEST_F(ClientSocketPoolBaseTest, MultipleReleasingDisconnectedSockets) { | 1404 TEST_F(ClientSocketPoolBaseTest, MultipleReleasingDisconnectedSockets) { |
| 1405 CreatePoolWithIdleTimeouts( | 1405 CreatePoolWithIdleTimeouts( |
| 1406 kDefaultMaxSockets, kDefaultMaxSocketsPerGroup, | 1406 kDefaultMaxSockets, kDefaultMaxSocketsPerGroup, |
| 1407 base::TimeDelta(), // Time out unused sockets immediately. | 1407 base::TimeDelta(), // Time out unused sockets immediately. |
| 1408 base::TimeDelta::FromDays(1)); // Don't time out used sockets. | 1408 base::TimeDelta::FromDays(1)); // Don't time out used sockets. |
| 1409 | 1409 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1519 TestReleasingSocketRequest request(pool_.get()); | 1519 TestReleasingSocketRequest request(pool_.get()); |
| 1520 EXPECT_EQ(ERR_IO_PENDING, InitHandle(request.handle(), "a", kDefaultPriority, | 1520 EXPECT_EQ(ERR_IO_PENDING, InitHandle(request.handle(), "a", kDefaultPriority, |
| 1521 &request, pool_, NULL)); | 1521 &request, pool_, NULL)); |
| 1522 | 1522 |
| 1523 EXPECT_EQ(OK, request.WaitForResult()); | 1523 EXPECT_EQ(OK, request.WaitForResult()); |
| 1524 } | 1524 } |
| 1525 | 1525 |
| 1526 } // namespace | 1526 } // namespace |
| 1527 | 1527 |
| 1528 } // namespace net | 1528 } // namespace net |
| OLD | NEW |