OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/fuzzed_datagram_client_socket.h" | 5 #include "net/socket/fuzzed_datagram_client_socket.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 return OK; | 79 return OK; |
80 } | 80 } |
81 | 81 |
82 int FuzzedDatagramClientSocket::GetLocalAddress(IPEndPoint* address) const { | 82 int FuzzedDatagramClientSocket::GetLocalAddress(IPEndPoint* address) const { |
83 if (!connected_) | 83 if (!connected_) |
84 return ERR_SOCKET_NOT_CONNECTED; | 84 return ERR_SOCKET_NOT_CONNECTED; |
85 *address = IPEndPoint(IPAddress(1, 2, 3, 4), 43210); | 85 *address = IPEndPoint(IPAddress(1, 2, 3, 4), 43210); |
86 return OK; | 86 return OK; |
87 } | 87 } |
88 | 88 |
89 void FuzzedDatagramClientSocket::UseNonBlockingIO() {} | |
90 | |
91 const NetLogWithSource& FuzzedDatagramClientSocket::NetLog() const { | 89 const NetLogWithSource& FuzzedDatagramClientSocket::NetLog() const { |
92 return net_log_; | 90 return net_log_; |
93 } | 91 } |
94 | 92 |
95 int FuzzedDatagramClientSocket::Read(IOBuffer* buf, | 93 int FuzzedDatagramClientSocket::Read(IOBuffer* buf, |
96 int buf_len, | 94 int buf_len, |
97 const CompletionCallback& callback) { | 95 const CompletionCallback& callback) { |
98 CHECK(!callback.is_null()); | 96 CHECK(!callback.is_null()); |
99 CHECK_GT(buf_len, 0); | 97 CHECK_GT(buf_len, 0); |
100 CHECK(!read_pending_); | 98 CHECK(!read_pending_); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 const net::CompletionCallback& callback, | 185 const net::CompletionCallback& callback, |
188 int result) { | 186 int result) { |
189 CHECK(connected_); | 187 CHECK(connected_); |
190 CHECK(write_pending_); | 188 CHECK(write_pending_); |
191 | 189 |
192 write_pending_ = false; | 190 write_pending_ = false; |
193 callback.Run(result); | 191 callback.Run(result); |
194 } | 192 } |
195 | 193 |
196 } // namespace net | 194 } // namespace net |
OLD | NEW |