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

Side by Side Diff: remoting/base/buffered_socket_writer_unittest.cc

Issue 1114353005: 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/spdy/spdy_stream_unittest.cc ('k') | remoting/signaling/xmpp_signal_strategy_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "remoting/base/buffered_socket_writer.h" 5 #include "remoting/base/buffered_socket_writer.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 27 matching lines...) Expand all
38 r); 38 r);
39 } 39 }
40 int size = data.size(); 40 int size = data.size();
41 if (write_limit_ > 0) 41 if (write_limit_ > 0)
42 size = std::min(write_limit_, size); 42 size = std::min(write_limit_, size);
43 written_data_.append(data, 0, size); 43 written_data_.append(data, 0, size);
44 return net::MockWriteResult(async_write_ ? net::ASYNC : net::SYNCHRONOUS, 44 return net::MockWriteResult(async_write_ ? net::ASYNC : net::SYNCHRONOUS,
45 size); 45 size);
46 } 46 }
47 47
48 bool AllReadDataConsumed() const override {
49 return true;
50 }
51
52 bool AllWriteDataConsumed() const override {
53 return true;
54 }
55
56 void Reset() override {} 48 void Reset() override {}
57 49
58 std::string written_data() { return written_data_; } 50 std::string written_data() { return written_data_; }
59 51
60 void set_write_limit(int limit) { write_limit_ = limit; } 52 void set_write_limit(int limit) { write_limit_ = limit; }
61 void set_async_write(bool async_write) { async_write_ = async_write; } 53 void set_async_write(bool async_write) { async_write_ = async_write; }
62 void set_next_write_error(int error) { next_write_error_ = error; } 54 void set_next_write_error(int error) { next_write_error_ = error; }
63 55
64 private: 56 private:
65 std::string written_data_; 57 std::string written_data_;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 writer_->Write(test_buffer_2_, 217 writer_->Write(test_buffer_2_,
226 base::Bind(&BufferedSocketWriterTest::Unexpected, 218 base::Bind(&BufferedSocketWriterTest::Unexpected,
227 base::Unretained(this))); 219 base::Unretained(this)));
228 base::RunLoop().RunUntilIdle(); 220 base::RunLoop().RunUntilIdle();
229 EXPECT_EQ(net::ERR_FAILED, write_error_); 221 EXPECT_EQ(net::ERR_FAILED, write_error_);
230 EXPECT_EQ(static_cast<size_t>(test_buffer_->size()), 222 EXPECT_EQ(static_cast<size_t>(test_buffer_->size()),
231 socket_data_provider_.written_data().size()); 223 socket_data_provider_.written_data().size());
232 } 224 }
233 225
234 } // namespace remoting 226 } // namespace remoting
OLDNEW
« no previous file with comments | « net/spdy/spdy_stream_unittest.cc ('k') | remoting/signaling/xmpp_signal_strategy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698