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

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

Issue 1580903002: Convert ignore_limits from a SocketParam to a socket request argument. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: RespectLimits Created 4 years, 11 months 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/sequenced_socket_data_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
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 static const int kRequestNotFound; 817 static const int kRequestNotFound;
818 818
819 ClientSocketPoolTest(); 819 ClientSocketPoolTest();
820 ~ClientSocketPoolTest(); 820 ~ClientSocketPoolTest();
821 821
822 template <typename PoolType> 822 template <typename PoolType>
823 int StartRequestUsingPool( 823 int StartRequestUsingPool(
824 PoolType* socket_pool, 824 PoolType* socket_pool,
825 const std::string& group_name, 825 const std::string& group_name,
826 RequestPriority priority, 826 RequestPriority priority,
827 ClientSocketPool::RespectLimits respect_limits,
827 const scoped_refptr<typename PoolType::SocketParams>& socket_params) { 828 const scoped_refptr<typename PoolType::SocketParams>& socket_params) {
828 DCHECK(socket_pool); 829 DCHECK(socket_pool);
829 TestSocketRequest* request( 830 TestSocketRequest* request(
830 new TestSocketRequest(&request_order_, &completion_count_)); 831 new TestSocketRequest(&request_order_, &completion_count_));
831 requests_.push_back(make_scoped_ptr(request)); 832 requests_.push_back(make_scoped_ptr(request));
832 int rv = request->handle()->Init(group_name, 833 int rv = request->handle()->Init(group_name, socket_params, priority,
833 socket_params, 834 respect_limits, request->callback(),
834 priority, 835 socket_pool, BoundNetLog());
835 request->callback(),
836 socket_pool,
837 BoundNetLog());
838 if (rv != ERR_IO_PENDING) 836 if (rv != ERR_IO_PENDING)
839 request_order_.push_back(request); 837 request_order_.push_back(request);
840 return rv; 838 return rv;
841 } 839 }
842 840
843 // Provided there were n requests started, takes |index| in range 1..n 841 // Provided there were n requests started, takes |index| in range 1..n
844 // and returns order in which that request completed, in range 1..n, 842 // and returns order in which that request completed, in range 1..n,
845 // or kIndexOutOfBounds if |index| is out of bounds, or kRequestNotFound 843 // or kIndexOutOfBounds if |index| is out of bounds, or kRequestNotFound
846 // if that request did not complete (for example was canceled). 844 // if that request did not complete (for example was canceled).
847 int GetOrderOfRequest(size_t index) const; 845 int GetOrderOfRequest(size_t index) const;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 RequestPriority last_request_priority() const { 909 RequestPriority last_request_priority() const {
912 return last_request_priority_; 910 return last_request_priority_;
913 } 911 }
914 int release_count() const { return release_count_; } 912 int release_count() const { return release_count_; }
915 int cancel_count() const { return cancel_count_; } 913 int cancel_count() const { return cancel_count_; }
916 914
917 // TransportClientSocketPool implementation. 915 // TransportClientSocketPool implementation.
918 int RequestSocket(const std::string& group_name, 916 int RequestSocket(const std::string& group_name,
919 const void* socket_params, 917 const void* socket_params,
920 RequestPriority priority, 918 RequestPriority priority,
919 RespectLimits respect_limits,
921 ClientSocketHandle* handle, 920 ClientSocketHandle* handle,
922 const CompletionCallback& callback, 921 const CompletionCallback& callback,
923 const BoundNetLog& net_log) override; 922 const BoundNetLog& net_log) override;
924 923
925 void CancelRequest(const std::string& group_name, 924 void CancelRequest(const std::string& group_name,
926 ClientSocketHandle* handle) override; 925 ClientSocketHandle* handle) override;
927 void ReleaseSocket(const std::string& group_name, 926 void ReleaseSocket(const std::string& group_name,
928 scoped_ptr<StreamSocket> socket, 927 scoped_ptr<StreamSocket> socket,
929 int id) override; 928 int id) override;
930 929
(...skipping 12 matching lines...) Expand all
943 MockSOCKSClientSocketPool(int max_sockets, 942 MockSOCKSClientSocketPool(int max_sockets,
944 int max_sockets_per_group, 943 int max_sockets_per_group,
945 TransportClientSocketPool* transport_pool); 944 TransportClientSocketPool* transport_pool);
946 945
947 ~MockSOCKSClientSocketPool() override; 946 ~MockSOCKSClientSocketPool() override;
948 947
949 // SOCKSClientSocketPool implementation. 948 // SOCKSClientSocketPool implementation.
950 int RequestSocket(const std::string& group_name, 949 int RequestSocket(const std::string& group_name,
951 const void* socket_params, 950 const void* socket_params,
952 RequestPriority priority, 951 RequestPriority priority,
952 RespectLimits respect_limits,
953 ClientSocketHandle* handle, 953 ClientSocketHandle* handle,
954 const CompletionCallback& callback, 954 const CompletionCallback& callback,
955 const BoundNetLog& net_log) override; 955 const BoundNetLog& net_log) override;
956 956
957 void CancelRequest(const std::string& group_name, 957 void CancelRequest(const std::string& group_name,
958 ClientSocketHandle* handle) override; 958 ClientSocketHandle* handle) override;
959 void ReleaseSocket(const std::string& group_name, 959 void ReleaseSocket(const std::string& group_name,
960 scoped_ptr<StreamSocket> socket, 960 scoped_ptr<StreamSocket> socket,
961 int id) override; 961 int id) override;
962 962
(...skipping 30 matching lines...) Expand all
993 993
994 // Helper function to get the total data size of the MockReads in |reads|. 994 // Helper function to get the total data size of the MockReads in |reads|.
995 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); 995 int64_t CountReadBytes(const MockRead reads[], size_t reads_size);
996 996
997 // Helper function to get the total data size of the MockWrites in |writes|. 997 // Helper function to get the total data size of the MockWrites in |writes|.
998 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); 998 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size);
999 999
1000 } // namespace net 1000 } // namespace net
1001 1001
1002 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ 1002 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « net/socket/sequenced_socket_data_unittest.cc ('k') | net/socket/socket_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698