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

Side by Side Diff: net/socket/fuzzed_socket.cc

Issue 1890193002: Add a fuzzer for HttpProxyClientSocket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NET_EXPORT_PRIVATE Created 4 years, 8 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/http/http_proxy_client_socket_fuzzer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 void FuzzedSocket::Disconnect() { 147 void FuzzedSocket::Disconnect() {
148 net_error_ = ERR_CONNECTION_CLOSED; 148 net_error_ = ERR_CONNECTION_CLOSED;
149 weak_factory_.InvalidateWeakPtrs(); 149 weak_factory_.InvalidateWeakPtrs();
150 read_pending_ = false; 150 read_pending_ = false;
151 write_pending_ = false; 151 write_pending_ = false;
152 error_pending_ = false; 152 error_pending_ = false;
153 } 153 }
154 154
155 bool FuzzedSocket::IsConnected() const { 155 bool FuzzedSocket::IsConnected() const {
156 return net_error_ != OK && !error_pending_; 156 return net_error_ == OK && !error_pending_;
157 } 157 }
158 158
159 bool FuzzedSocket::IsConnectedAndIdle() const { 159 bool FuzzedSocket::IsConnectedAndIdle() const {
160 return IsConnected(); 160 return IsConnected();
161 } 161 }
162 162
163 int FuzzedSocket::GetPeerAddress(IPEndPoint* address) const { 163 int FuzzedSocket::GetPeerAddress(IPEndPoint* address) const {
164 if (!IsConnected()) 164 if (!IsConnected())
165 return ERR_SOCKET_NOT_CONNECTED; 165 return ERR_SOCKET_NOT_CONNECTED;
166 *address = IPEndPoint(IPAddress(127, 0, 0, 1), 80); 166 *address = IPEndPoint(IPAddress(127, 0, 0, 1), 80);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 write_pending_ = false; 243 write_pending_ = false;
244 if (result <= 0) { 244 if (result <= 0) {
245 error_pending_ = false; 245 error_pending_ = false;
246 } else { 246 } else {
247 total_bytes_written_ += result; 247 total_bytes_written_ += result;
248 } 248 }
249 callback.Run(result); 249 callback.Run(result);
250 } 250 }
251 251
252 } // namespace net 252 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_proxy_client_socket_fuzzer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698