OLD | NEW |
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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 base::IgnoreResult(&BufferedSocketWriter::Write), | 146 base::IgnoreResult(&BufferedSocketWriter::Write), |
147 base::Unretained(writer_.get()), test_buffer_2_, | 147 base::Unretained(writer_.get()), test_buffer_2_, |
148 base::Closure())); | 148 base::Closure())); |
149 base::RunLoop().RunUntilIdle(); | 149 base::RunLoop().RunUntilIdle(); |
150 VerifyWrittenData(); | 150 VerifyWrittenData(); |
151 } | 151 } |
152 | 152 |
153 base::MessageLoop message_loop_; | 153 base::MessageLoop message_loop_; |
154 net::NetLog net_log_; | 154 net::NetLog net_log_; |
155 SocketDataProvider socket_data_provider_; | 155 SocketDataProvider socket_data_provider_; |
156 scoped_ptr<net::StreamSocket> socket_; | 156 std::unique_ptr<net::StreamSocket> socket_; |
157 scoped_ptr<BufferedSocketWriter> writer_; | 157 std::unique_ptr<BufferedSocketWriter> writer_; |
158 scoped_refptr<net::IOBufferWithSize> test_buffer_; | 158 scoped_refptr<net::IOBufferWithSize> test_buffer_; |
159 scoped_refptr<net::IOBufferWithSize> test_buffer_2_; | 159 scoped_refptr<net::IOBufferWithSize> test_buffer_2_; |
160 int write_error_; | 160 int write_error_; |
161 }; | 161 }; |
162 | 162 |
163 // Test synchronous write. | 163 // Test synchronous write. |
164 TEST_F(BufferedSocketWriterTest, WriteFull) { | 164 TEST_F(BufferedSocketWriterTest, WriteFull) { |
165 StartWriter(); | 165 StartWriter(); |
166 TestWrite(); | 166 TestWrite(); |
167 } | 167 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 writer_->Write(test_buffer_, base::Closure()); | 251 writer_->Write(test_buffer_, base::Closure()); |
252 writer_->Write(test_buffer_2_, base::Closure()); | 252 writer_->Write(test_buffer_2_, base::Closure()); |
253 | 253 |
254 StartWriter(); | 254 StartWriter(); |
255 base::RunLoop().RunUntilIdle(); | 255 base::RunLoop().RunUntilIdle(); |
256 | 256 |
257 VerifyWrittenData(); | 257 VerifyWrittenData(); |
258 } | 258 } |
259 | 259 |
260 } // namespace remoting | 260 } // namespace remoting |
OLD | NEW |