OLD | NEW |
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 "remoting/protocol/connection_tester.h" | 5 #include "remoting/protocol/connection_tester.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 int message_size, | 266 int message_size, |
267 int message_count) | 267 int message_count) |
268 : host_pipe_(host_pipe), | 268 : host_pipe_(host_pipe), |
269 client_pipe_(client_pipe), | 269 client_pipe_(client_pipe), |
270 message_size_(message_size), | 270 message_size_(message_size), |
271 message_count_(message_count) {} | 271 message_count_(message_count) {} |
272 MessagePipeConnectionTester::~MessagePipeConnectionTester() {} | 272 MessagePipeConnectionTester::~MessagePipeConnectionTester() {} |
273 | 273 |
274 void MessagePipeConnectionTester::RunAndCheckResults() { | 274 void MessagePipeConnectionTester::RunAndCheckResults() { |
275 host_pipe_->Start(this); | 275 host_pipe_->Start(this); |
| 276 } |
276 | 277 |
| 278 void MessagePipeConnectionTester::OnMessagePipeOpen() { |
277 for (int i = 0; i < message_count_; ++i) { | 279 for (int i = 0; i < message_count_; ++i) { |
278 std::unique_ptr<VideoPacket> message(new VideoPacket()); | 280 std::unique_ptr<VideoPacket> message(new VideoPacket()); |
279 message->mutable_data()->resize(message_size_); | 281 message->mutable_data()->resize(message_size_); |
280 for (int p = 0; p < message_size_; ++p) { | 282 for (int p = 0; p < message_size_; ++p) { |
281 message->mutable_data()[0] = static_cast<char>(i + p); | 283 message->mutable_data()[0] = static_cast<char>(i + p); |
282 } | 284 } |
283 client_pipe_->Send(message.get(), base::Closure()); | 285 client_pipe_->Send(message.get(), base::Closure()); |
284 sent_messages_.push_back(std::move(message)); | 286 sent_messages_.push_back(std::move(message)); |
285 } | 287 } |
286 | 288 |
(...skipping 13 matching lines...) Expand all Loading... |
300 } | 302 } |
301 } | 303 } |
302 | 304 |
303 void MessagePipeConnectionTester::OnMessagePipeClosed() { | 305 void MessagePipeConnectionTester::OnMessagePipeClosed() { |
304 run_loop_.Quit(); | 306 run_loop_.Quit(); |
305 FAIL(); | 307 FAIL(); |
306 } | 308 } |
307 | 309 |
308 } // namespace protocol | 310 } // namespace protocol |
309 } // namespace remoting | 311 } // namespace remoting |
OLD | NEW |