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

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

Issue 1126113003: Revert of Add AllReadDataConsumed and AllWriteDataConsumed methods to SocketDataProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/socket_test_util.h ('k') | remoting/base/buffered_socket_writer_unittest.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 <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 // written. Otherwise return the error code. 241 // written. Otherwise return the error code.
242 int result = 242 int result =
243 next_write.result == OK ? next_write.data_len : next_write.result; 243 next_write.result == OK ? next_write.data_len : next_write.result;
244 return MockWriteResult(next_write.mode, result); 244 return MockWriteResult(next_write.mode, result);
245 } 245 }
246 246
247 void StaticSocketDataProvider::Reset() { 247 void StaticSocketDataProvider::Reset() {
248 helper_.Reset(); 248 helper_.Reset();
249 } 249 }
250 250
251 bool StaticSocketDataProvider::AllReadDataConsumed() const {
252 return helper_.at_read_eof();
253 }
254
255 bool StaticSocketDataProvider::AllWriteDataConsumed() const {
256 return helper_.at_write_eof();
257 }
258
259 DynamicSocketDataProvider::DynamicSocketDataProvider() 251 DynamicSocketDataProvider::DynamicSocketDataProvider()
260 : short_read_limit_(0), 252 : short_read_limit_(0),
261 allow_unconsumed_reads_(false) { 253 allow_unconsumed_reads_(false) {
262 } 254 }
263 255
264 DynamicSocketDataProvider::~DynamicSocketDataProvider() {} 256 DynamicSocketDataProvider::~DynamicSocketDataProvider() {}
265 257
266 MockRead DynamicSocketDataProvider::OnRead() { 258 MockRead DynamicSocketDataProvider::OnRead() {
267 if (reads_.empty()) 259 if (reads_.empty())
268 return MockRead(SYNCHRONOUS, ERR_UNEXPECTED); 260 return MockRead(SYNCHRONOUS, ERR_UNEXPECTED);
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 } 593 }
602 594
603 void SequencedSocketData::Reset() { 595 void SequencedSocketData::Reset() {
604 helper_.Reset(); 596 helper_.Reset();
605 sequence_number_ = 0; 597 sequence_number_ = 0;
606 read_state_ = IDLE; 598 read_state_ = IDLE;
607 write_state_ = IDLE; 599 write_state_ = IDLE;
608 weak_factory_.InvalidateWeakPtrs(); 600 weak_factory_.InvalidateWeakPtrs();
609 } 601 }
610 602
611 bool SequencedSocketData::AllReadDataConsumed() const {
612 return helper_.at_read_eof();
613 }
614
615 bool SequencedSocketData::AllWriteDataConsumed() const {
616 return helper_.at_write_eof();
617 }
618
619 bool SequencedSocketData::at_read_eof() const { 603 bool SequencedSocketData::at_read_eof() const {
620 return helper_.at_read_eof(); 604 return helper_.at_read_eof();
621 } 605 }
622 606
623 bool SequencedSocketData::at_write_eof() const { 607 bool SequencedSocketData::at_write_eof() const {
624 return helper_.at_read_eof(); 608 return helper_.at_read_eof();
625 } 609 }
626 610
627 void SequencedSocketData::MaybePostReadCompleteTask() { 611 void SequencedSocketData::MaybePostReadCompleteTask() {
628 NET_TRACE(1, " ****** ") << " current: " << sequence_number_; 612 NET_TRACE(1, " ****** ") << " current: " << sequence_number_;
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after
2195 2179
2196 const char kSOCKS5OkRequest[] = 2180 const char kSOCKS5OkRequest[] =
2197 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 }; 2181 { 0x05, 0x01, 0x00, 0x03, 0x04, 'h', 'o', 's', 't', 0x00, 0x50 };
2198 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest); 2182 const int kSOCKS5OkRequestLength = arraysize(kSOCKS5OkRequest);
2199 2183
2200 const char kSOCKS5OkResponse[] = 2184 const char kSOCKS5OkResponse[] =
2201 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 }; 2185 { 0x05, 0x00, 0x00, 0x01, 127, 0, 0, 1, 0x00, 0x50 };
2202 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse); 2186 const int kSOCKS5OkResponseLength = arraysize(kSOCKS5OkResponse);
2203 2187
2204 } // namespace net 2188 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/socket_test_util.h ('k') | remoting/base/buffered_socket_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698