Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: net/socket/socket_test_util.cc

Issue 2533063002: Fix Net.Socket.IdleSocketTimeSaving histogram (Closed)
Patch Set: self review Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/socket/socket_test_util.h ('k') | net/socket/socks_client_socket_pool.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/socket_test_util.h" 5 #include "net/socket/socket_test_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
17 #include "base/run_loop.h" 17 #include "base/run_loop.h"
18 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
19 #include "base/threading/thread_task_runner_handle.h" 19 #include "base/threading/thread_task_runner_handle.h"
20 #include "base/time/time.h" 20 #include "base/time/time.h"
21 #include "net/base/address_family.h" 21 #include "net/base/address_family.h"
22 #include "net/base/address_list.h" 22 #include "net/base/address_list.h"
23 #include "net/base/auth.h" 23 #include "net/base/auth.h"
24 #include "net/base/ip_address.h" 24 #include "net/base/ip_address.h"
25 #include "net/base/load_timing_info.h"
26 #include "net/http/http_network_session.h" 25 #include "net/http/http_network_session.h"
27 #include "net/http/http_request_headers.h" 26 #include "net/http/http_request_headers.h"
28 #include "net/http/http_response_headers.h" 27 #include "net/http/http_response_headers.h"
29 #include "net/log/net_log_source.h" 28 #include "net/log/net_log_source.h"
30 #include "net/log/net_log_source_type.h" 29 #include "net/log/net_log_source_type.h"
31 #include "net/socket/socket.h" 30 #include "net/socket/socket.h"
32 #include "net/socket/websocket_endpoint_lock_manager.h" 31 #include "net/socket/websocket_endpoint_lock_manager.h"
33 #include "net/ssl/ssl_cert_request_info.h" 32 #include "net/ssl/ssl_cert_request_info.h"
34 #include "net/ssl/ssl_connection_status_flags.h" 33 #include "net/ssl/ssl_connection_status_flags.h"
35 #include "net/ssl/ssl_info.h" 34 #include "net/ssl/ssl_info.h"
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 if (it->CancelHandle(handle)) { 1655 if (it->CancelHandle(handle)) {
1657 cancel_count_++; 1656 cancel_count_++;
1658 break; 1657 break;
1659 } 1658 }
1660 } 1659 }
1661 } 1660 }
1662 1661
1663 void MockTransportClientSocketPool::ReleaseSocket( 1662 void MockTransportClientSocketPool::ReleaseSocket(
1664 const std::string& group_name, 1663 const std::string& group_name,
1665 std::unique_ptr<StreamSocket> socket, 1664 std::unique_ptr<StreamSocket> socket,
1666 int id) { 1665 int id,
1666 const LoadTimingInfo::ConnectTiming& connect_timing) {
1667 EXPECT_EQ(1, id); 1667 EXPECT_EQ(1, id);
1668 release_count_++; 1668 release_count_++;
1669 } 1669 }
1670 1670
1671 MockSOCKSClientSocketPool::MockSOCKSClientSocketPool( 1671 MockSOCKSClientSocketPool::MockSOCKSClientSocketPool(
1672 int max_sockets, 1672 int max_sockets,
1673 int max_sockets_per_group, 1673 int max_sockets_per_group,
1674 TransportClientSocketPool* transport_pool) 1674 TransportClientSocketPool* transport_pool)
1675 : SOCKSClientSocketPool(max_sockets, 1675 : SOCKSClientSocketPool(max_sockets,
1676 max_sockets_per_group, 1676 max_sockets_per_group,
(...skipping 19 matching lines...) Expand all
1696 1696
1697 void MockSOCKSClientSocketPool::CancelRequest( 1697 void MockSOCKSClientSocketPool::CancelRequest(
1698 const std::string& group_name, 1698 const std::string& group_name,
1699 ClientSocketHandle* handle) { 1699 ClientSocketHandle* handle) {
1700 return transport_pool_->CancelRequest(group_name, handle); 1700 return transport_pool_->CancelRequest(group_name, handle);
1701 } 1701 }
1702 1702
1703 void MockSOCKSClientSocketPool::ReleaseSocket( 1703 void MockSOCKSClientSocketPool::ReleaseSocket(
1704 const std::string& group_name, 1704 const std::string& group_name,
1705 std::unique_ptr<StreamSocket> socket, 1705 std::unique_ptr<StreamSocket> socket,
1706 int id) { 1706 int id,
1707 return transport_pool_->ReleaseSocket(group_name, std::move(socket), id); 1707 const LoadTimingInfo::ConnectTiming& connect_timing) {
1708 return transport_pool_->ReleaseSocket(group_name, std::move(socket), id,
1709 connect_timing);
1708 } 1710 }
1709 1711
1710 ScopedWebSocketEndpointZeroUnlockDelay:: 1712 ScopedWebSocketEndpointZeroUnlockDelay::
1711 ScopedWebSocketEndpointZeroUnlockDelay() { 1713 ScopedWebSocketEndpointZeroUnlockDelay() {
1712 old_delay_ = 1714 old_delay_ =
1713 WebSocketEndpointLockManager::GetInstance()->SetUnlockDelayForTesting( 1715 WebSocketEndpointLockManager::GetInstance()->SetUnlockDelayForTesting(
1714 base::TimeDelta()); 1716 base::TimeDelta());
1715 } 1717 }
1716 1718
1717 ScopedWebSocketEndpointZeroUnlockDelay:: 1719 ScopedWebSocketEndpointZeroUnlockDelay::
(...skipping 26 matching lines...) Expand all
1744 } 1746 }
1745 1747
1746 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { 1748 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) {
1747 int64_t total = 0; 1749 int64_t total = 0;
1748 for (const MockWrite* write = writes; write != writes + writes_size; ++write) 1750 for (const MockWrite* write = writes; write != writes + writes_size; ++write)
1749 total += write->data_len; 1751 total += write->data_len;
1750 return total; 1752 return total;
1751 } 1753 }
1752 1754
1753 } // namespace net 1755 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/socket_test_util.h ('k') | net/socket/socks_client_socket_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698