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/udp/fuzzed_datagram_client_socket.h" | 5 #include "net/udp/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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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() {} | 89 void FuzzedDatagramClientSocket::UseNonBlockingIO() {} |
90 | 90 |
91 const BoundNetLog& FuzzedDatagramClientSocket::NetLog() const { | 91 const NetLogWithSource& FuzzedDatagramClientSocket::NetLog() const { |
92 return net_log_; | 92 return net_log_; |
93 } | 93 } |
94 | 94 |
95 int FuzzedDatagramClientSocket::Read(IOBuffer* buf, | 95 int FuzzedDatagramClientSocket::Read(IOBuffer* buf, |
96 int buf_len, | 96 int buf_len, |
97 const CompletionCallback& callback) { | 97 const CompletionCallback& callback) { |
98 CHECK(!callback.is_null()); | 98 CHECK(!callback.is_null()); |
99 CHECK_GT(buf_len, 0); | 99 CHECK_GT(buf_len, 0); |
100 CHECK(!read_pending_); | 100 CHECK(!read_pending_); |
101 | 101 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 const net::CompletionCallback& callback, | 187 const net::CompletionCallback& callback, |
188 int result) { | 188 int result) { |
189 CHECK(connected_); | 189 CHECK(connected_); |
190 CHECK(write_pending_); | 190 CHECK(write_pending_); |
191 | 191 |
192 write_pending_ = false; | 192 write_pending_ = false; |
193 callback.Run(result); | 193 callback.Run(result); |
194 } | 194 } |
195 | 195 |
196 } // namespace net | 196 } // namespace net |
OLD | NEW |