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

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

Issue 1114383003: Add AllReadDataConsumed and AllWriteDataConsumed methods to SocketDataProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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.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
48 void Reset() override {} 56 void Reset() override {}
49 57
50 std::string written_data() { return written_data_; } 58 std::string written_data() { return written_data_; }
51 59
52 void set_write_limit(int limit) { write_limit_ = limit; } 60 void set_write_limit(int limit) { write_limit_ = limit; }
53 void set_async_write(bool async_write) { async_write_ = async_write; } 61 void set_async_write(bool async_write) { async_write_ = async_write; }
54 void set_next_write_error(int error) { next_write_error_ = error; } 62 void set_next_write_error(int error) { next_write_error_ = error; }
55 63
56 private: 64 private:
57 std::string written_data_; 65 std::string written_data_;
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 writer_->Write(test_buffer_2_, 225 writer_->Write(test_buffer_2_,
218 base::Bind(&BufferedSocketWriterTest::Unexpected, 226 base::Bind(&BufferedSocketWriterTest::Unexpected,
219 base::Unretained(this))); 227 base::Unretained(this)));
220 base::RunLoop().RunUntilIdle(); 228 base::RunLoop().RunUntilIdle();
221 EXPECT_EQ(net::ERR_FAILED, write_error_); 229 EXPECT_EQ(net::ERR_FAILED, write_error_);
222 EXPECT_EQ(static_cast<size_t>(test_buffer_->size()), 230 EXPECT_EQ(static_cast<size_t>(test_buffer_->size()),
223 socket_data_provider_.written_data().size()); 231 socket_data_provider_.written_data().size());
224 } 232 }
225 233
226 } // namespace remoting 234 } // namespace remoting
OLDNEW
« no previous file with comments | « net/socket/socket_test_util.cc ('k') | remoting/signaling/xmpp_signal_strategy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698