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 2315613002: Extracted NetLog class's inner enum types into their own enum classes and (Closed)
Patch Set: Ran "git cl format" on code. Much formatting ensued. Created 4 years, 3 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/fuzzed_socket.cc ('k') | net/socket/socks5_client_socket.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 #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" 25 #include "net/base/load_timing_info.h"
26 #include "net/http/http_network_session.h" 26 #include "net/http/http_network_session.h"
27 #include "net/http/http_request_headers.h" 27 #include "net/http/http_request_headers.h"
28 #include "net/http/http_response_headers.h" 28 #include "net/http/http_response_headers.h"
29 #include "net/log/net_log_source_type.h"
29 #include "net/socket/socket.h" 30 #include "net/socket/socket.h"
30 #include "net/socket/websocket_endpoint_lock_manager.h" 31 #include "net/socket/websocket_endpoint_lock_manager.h"
31 #include "net/ssl/ssl_cert_request_info.h" 32 #include "net/ssl/ssl_cert_request_info.h"
32 #include "net/ssl/ssl_connection_status_flags.h" 33 #include "net/ssl/ssl_connection_status_flags.h"
33 #include "net/ssl/ssl_info.h" 34 #include "net/ssl/ssl_info.h"
34 #include "testing/gtest/include/gtest/gtest.h" 35 #include "testing/gtest/include/gtest/gtest.h"
35 36
36 #define NET_TRACE(level, s) VLOG(level) << s << __FUNCTION__ << "() " 37 #define NET_TRACE(level, s) VLOG(level) << s << __FUNCTION__ << "() "
37 38
38 namespace net { 39 namespace net {
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 855
855 void MockClientSocket::RunCallback(const CompletionCallback& callback, 856 void MockClientSocket::RunCallback(const CompletionCallback& callback,
856 int result) { 857 int result) {
857 if (!callback.is_null()) 858 if (!callback.is_null())
858 callback.Run(result); 859 callback.Run(result);
859 } 860 }
860 861
861 MockTCPClientSocket::MockTCPClientSocket(const AddressList& addresses, 862 MockTCPClientSocket::MockTCPClientSocket(const AddressList& addresses,
862 net::NetLog* net_log, 863 net::NetLog* net_log,
863 SocketDataProvider* data) 864 SocketDataProvider* data)
864 : MockClientSocket(BoundNetLog::Make(net_log, NetLog::SOURCE_NONE)), 865 : MockClientSocket(BoundNetLog::Make(net_log, NetLogSourceType::NONE)),
865 addresses_(addresses), 866 addresses_(addresses),
866 data_(data), 867 data_(data),
867 read_offset_(0), 868 read_offset_(0),
868 read_data_(SYNCHRONOUS, ERR_UNEXPECTED), 869 read_data_(SYNCHRONOUS, ERR_UNEXPECTED),
869 need_read_data_(true), 870 need_read_data_(true),
870 peer_closed_connection_(false), 871 peer_closed_connection_(false),
871 pending_read_buf_(NULL), 872 pending_read_buf_(NULL),
872 pending_read_buf_len_(0), 873 pending_read_buf_len_(0),
873 was_used_to_convey_data_(false) { 874 was_used_to_convey_data_(false) {
874 DCHECK(data_); 875 DCHECK(data_);
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 net::NetLog* net_log) 1252 net::NetLog* net_log)
1252 : connected_(false), 1253 : connected_(false),
1253 data_(data), 1254 data_(data),
1254 read_offset_(0), 1255 read_offset_(0),
1255 read_data_(SYNCHRONOUS, ERR_UNEXPECTED), 1256 read_data_(SYNCHRONOUS, ERR_UNEXPECTED),
1256 need_read_data_(true), 1257 need_read_data_(true),
1257 source_port_(123), 1258 source_port_(123),
1258 network_(NetworkChangeNotifier::kInvalidNetworkHandle), 1259 network_(NetworkChangeNotifier::kInvalidNetworkHandle),
1259 pending_read_buf_(NULL), 1260 pending_read_buf_(NULL),
1260 pending_read_buf_len_(0), 1261 pending_read_buf_len_(0),
1261 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_NONE)), 1262 net_log_(BoundNetLog::Make(net_log, NetLogSourceType::NONE)),
1262 weak_factory_(this) { 1263 weak_factory_(this) {
1263 DCHECK(data_); 1264 DCHECK(data_);
1264 data_->Initialize(this); 1265 data_->Initialize(this);
1265 peer_addr_ = data->connect_data().peer_addr; 1266 peer_addr_ = data->connect_data().peer_addr;
1266 } 1267 }
1267 1268
1268 MockUDPClientSocket::~MockUDPClientSocket() { 1269 MockUDPClientSocket::~MockUDPClientSocket() {
1269 if (data_) 1270 if (data_)
1270 data_->DetachSocket(); 1271 data_->DetachSocket();
1271 } 1272 }
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
1731 } 1732 }
1732 1733
1733 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) { 1734 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size) {
1734 int64_t total = 0; 1735 int64_t total = 0;
1735 for (const MockWrite* write = writes; write != writes + writes_size; ++write) 1736 for (const MockWrite* write = writes; write != writes + writes_size; ++write)
1736 total += write->data_len; 1737 total += write->data_len;
1737 return total; 1738 return total;
1738 } 1739 }
1739 1740
1740 } // namespace net 1741 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/fuzzed_socket.cc ('k') | net/socket/socks5_client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698