| 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_socket.h" | 5 #include "net/socket/fuzzed_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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 } | 233 } |
| 234 | 234 |
| 235 void FuzzedSocket::ClearConnectionAttempts() {} | 235 void FuzzedSocket::ClearConnectionAttempts() {} |
| 236 | 236 |
| 237 void FuzzedSocket::AddConnectionAttempts(const ConnectionAttempts& attempts) {} | 237 void FuzzedSocket::AddConnectionAttempts(const ConnectionAttempts& attempts) {} |
| 238 | 238 |
| 239 int64_t FuzzedSocket::GetTotalReceivedBytes() const { | 239 int64_t FuzzedSocket::GetTotalReceivedBytes() const { |
| 240 return total_bytes_read_; | 240 return total_bytes_read_; |
| 241 } | 241 } |
| 242 | 242 |
| 243 void FuzzedSocket::DumpMemoryStats( |
| 244 base::trace_event::MemoryAllocatorDump* dump) const {} |
| 245 |
| 243 Error FuzzedSocket::ConsumeReadWriteErrorFromData() { | 246 Error FuzzedSocket::ConsumeReadWriteErrorFromData() { |
| 244 return data_provider_->PickValueInArray(kReadWriteErrors); | 247 return data_provider_->PickValueInArray(kReadWriteErrors); |
| 245 } | 248 } |
| 246 | 249 |
| 247 void FuzzedSocket::OnReadComplete(const CompletionCallback& callback, | 250 void FuzzedSocket::OnReadComplete(const CompletionCallback& callback, |
| 248 int result) { | 251 int result) { |
| 249 CHECK(read_pending_); | 252 CHECK(read_pending_); |
| 250 read_pending_ = false; | 253 read_pending_ = false; |
| 251 if (result <= 0) { | 254 if (result <= 0) { |
| 252 error_pending_ = false; | 255 error_pending_ = false; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 272 int result) { | 275 int result) { |
| 273 CHECK(connect_pending_); | 276 CHECK(connect_pending_); |
| 274 connect_pending_ = false; | 277 connect_pending_ = false; |
| 275 if (result < 0) | 278 if (result < 0) |
| 276 error_pending_ = false; | 279 error_pending_ = false; |
| 277 net_error_ = result; | 280 net_error_ = result; |
| 278 callback.Run(result); | 281 callback.Run(result); |
| 279 } | 282 } |
| 280 | 283 |
| 281 } // namespace net | 284 } // namespace net |
| OLD | NEW |