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

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

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/client_socket_pool_base_unittest.cc ('k') | net/socket/socket_test_util.cc » ('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 #ifndef NET_SOCKET_SOCKET_TEST_UTIL_H_ 5 #ifndef NET_SOCKET_SOCKET_TEST_UTIL_H_
6 #define NET_SOCKET_SOCKET_TEST_UTIL_H_ 6 #define NET_SOCKET_SOCKET_TEST_UTIL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <cstring> 11 #include <cstring>
12 #include <deque> 12 #include <deque>
13 #include <memory> 13 #include <memory>
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/callback.h" 17 #include "base/callback.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "base/memory/ptr_util.h" 20 #include "base/memory/ptr_util.h"
21 #include "base/memory/ref_counted.h" 21 #include "base/memory/ref_counted.h"
22 #include "base/memory/scoped_vector.h" 22 #include "base/memory/scoped_vector.h"
23 #include "base/memory/weak_ptr.h" 23 #include "base/memory/weak_ptr.h"
24 #include "base/strings/string16.h" 24 #include "base/strings/string16.h"
25 #include "base/time/time.h" 25 #include "base/time/time.h"
26 #include "net/base/address_list.h" 26 #include "net/base/address_list.h"
27 #include "net/base/io_buffer.h" 27 #include "net/base/io_buffer.h"
28 #include "net/base/load_timing_info.h"
28 #include "net/base/net_errors.h" 29 #include "net/base/net_errors.h"
29 #include "net/base/test_completion_callback.h" 30 #include "net/base/test_completion_callback.h"
30 #include "net/http/http_auth_controller.h" 31 #include "net/http/http_auth_controller.h"
31 #include "net/http/http_proxy_client_socket_pool.h" 32 #include "net/http/http_proxy_client_socket_pool.h"
32 #include "net/log/net_log_with_source.h" 33 #include "net/log/net_log_with_source.h"
33 #include "net/socket/client_socket_factory.h" 34 #include "net/socket/client_socket_factory.h"
34 #include "net/socket/client_socket_handle.h" 35 #include "net/socket/client_socket_handle.h"
35 #include "net/socket/connection_attempts.h" 36 #include "net/socket/connection_attempts.h"
36 #include "net/socket/datagram_client_socket.h" 37 #include "net/socket/datagram_client_socket.h"
37 #include "net/socket/socket_performance_watcher.h" 38 #include "net/socket/socket_performance_watcher.h"
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 int RequestSocket(const std::string& group_name, 939 int RequestSocket(const std::string& group_name,
939 const void* socket_params, 940 const void* socket_params,
940 RequestPriority priority, 941 RequestPriority priority,
941 RespectLimits respect_limits, 942 RespectLimits respect_limits,
942 ClientSocketHandle* handle, 943 ClientSocketHandle* handle,
943 const CompletionCallback& callback, 944 const CompletionCallback& callback,
944 const NetLogWithSource& net_log) override; 945 const NetLogWithSource& net_log) override;
945 946
946 void CancelRequest(const std::string& group_name, 947 void CancelRequest(const std::string& group_name,
947 ClientSocketHandle* handle) override; 948 ClientSocketHandle* handle) override;
948 void ReleaseSocket(const std::string& group_name, 949 void ReleaseSocket(
949 std::unique_ptr<StreamSocket> socket, 950 const std::string& group_name,
950 int id) override; 951 std::unique_ptr<StreamSocket> socket,
952 int id,
953 const LoadTimingInfo::ConnectTiming& connect_timing) override;
951 954
952 private: 955 private:
953 ClientSocketFactory* client_socket_factory_; 956 ClientSocketFactory* client_socket_factory_;
954 std::vector<std::unique_ptr<MockConnectJob>> job_list_; 957 std::vector<std::unique_ptr<MockConnectJob>> job_list_;
955 RequestPriority last_request_priority_; 958 RequestPriority last_request_priority_;
956 int release_count_; 959 int release_count_;
957 int cancel_count_; 960 int cancel_count_;
958 961
959 DISALLOW_COPY_AND_ASSIGN(MockTransportClientSocketPool); 962 DISALLOW_COPY_AND_ASSIGN(MockTransportClientSocketPool);
960 }; 963 };
(...skipping 10 matching lines...) Expand all
971 int RequestSocket(const std::string& group_name, 974 int RequestSocket(const std::string& group_name,
972 const void* socket_params, 975 const void* socket_params,
973 RequestPriority priority, 976 RequestPriority priority,
974 RespectLimits respect_limits, 977 RespectLimits respect_limits,
975 ClientSocketHandle* handle, 978 ClientSocketHandle* handle,
976 const CompletionCallback& callback, 979 const CompletionCallback& callback,
977 const NetLogWithSource& net_log) override; 980 const NetLogWithSource& net_log) override;
978 981
979 void CancelRequest(const std::string& group_name, 982 void CancelRequest(const std::string& group_name,
980 ClientSocketHandle* handle) override; 983 ClientSocketHandle* handle) override;
981 void ReleaseSocket(const std::string& group_name, 984 void ReleaseSocket(
982 std::unique_ptr<StreamSocket> socket, 985 const std::string& group_name,
983 int id) override; 986 std::unique_ptr<StreamSocket> socket,
987 int id,
988 const LoadTimingInfo::ConnectTiming& connect_timing) override;
984 989
985 private: 990 private:
986 TransportClientSocketPool* const transport_pool_; 991 TransportClientSocketPool* const transport_pool_;
987 992
988 DISALLOW_COPY_AND_ASSIGN(MockSOCKSClientSocketPool); 993 DISALLOW_COPY_AND_ASSIGN(MockSOCKSClientSocketPool);
989 }; 994 };
990 995
991 // Convenience class to temporarily set the WebSocketEndpointLockManager unlock 996 // Convenience class to temporarily set the WebSocketEndpointLockManager unlock
992 // delay to zero for testing purposes. Automatically restores the original value 997 // delay to zero for testing purposes. Automatically restores the original value
993 // when destroyed. 998 // when destroyed.
(...skipping 21 matching lines...) Expand all
1015 1020
1016 // Helper function to get the total data size of the MockReads in |reads|. 1021 // Helper function to get the total data size of the MockReads in |reads|.
1017 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); 1022 int64_t CountReadBytes(const MockRead reads[], size_t reads_size);
1018 1023
1019 // Helper function to get the total data size of the MockWrites in |writes|. 1024 // Helper function to get the total data size of the MockWrites in |writes|.
1020 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); 1025 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size);
1021 1026
1022 } // namespace net 1027 } // namespace net
1023 1028
1024 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ 1029 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « net/socket/client_socket_pool_base_unittest.cc ('k') | net/socket/socket_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698