| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "device/serial/test_serial_io_handler.h" | 5 #include "device/serial/test_serial_io_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "device/serial/serial.mojom.h" | 8 #include "device/serial/serial.mojom.h" |
| 9 | 9 |
| 10 namespace device { | 10 namespace device { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 void TestSerialIoHandler::ReadImpl() { | 46 void TestSerialIoHandler::ReadImpl() { |
| 47 } | 47 } |
| 48 | 48 |
| 49 void TestSerialIoHandler::CancelReadImpl() { | 49 void TestSerialIoHandler::CancelReadImpl() { |
| 50 QueueReadCompleted(0, read_cancel_reason()); | 50 QueueReadCompleted(0, read_cancel_reason()); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void TestSerialIoHandler::WriteImpl() { | 53 void TestSerialIoHandler::WriteImpl() { |
| 54 DCHECK(pending_read_buffer()); | 54 DCHECK(pending_read_buffer()); |
| 55 DCHECK_LE(pending_write_buffer_len(), pending_read_buffer_len()); | 55 DCHECK_LE(pending_write_buffer_len(), pending_read_buffer_len()); |
| 56 memcpy(pending_read_buffer()->data(), | 56 memcpy(pending_read_buffer(), |
| 57 pending_write_buffer()->data(), | 57 pending_write_buffer(), |
| 58 pending_write_buffer_len()); | 58 pending_write_buffer_len()); |
| 59 QueueReadCompleted(pending_write_buffer_len(), serial::RECEIVE_ERROR_NONE); | 59 QueueReadCompleted(pending_write_buffer_len(), serial::RECEIVE_ERROR_NONE); |
| 60 QueueWriteCompleted(pending_write_buffer_len(), serial::SEND_ERROR_NONE); | 60 QueueWriteCompleted(pending_write_buffer_len(), serial::SEND_ERROR_NONE); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void TestSerialIoHandler::CancelWriteImpl() { | 63 void TestSerialIoHandler::CancelWriteImpl() { |
| 64 QueueWriteCompleted(0, write_cancel_reason()); | 64 QueueWriteCompleted(0, write_cancel_reason()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 serial::DeviceControlSignalsPtr TestSerialIoHandler::GetControlSignals() const { | 67 serial::DeviceControlSignalsPtr TestSerialIoHandler::GetControlSignals() const { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 87 dtr_ = signals.dtr; | 87 dtr_ = signals.dtr; |
| 88 if (signals.has_rts) | 88 if (signals.has_rts) |
| 89 rts_ = signals.rts; | 89 rts_ = signals.rts; |
| 90 return true; | 90 return true; |
| 91 } | 91 } |
| 92 | 92 |
| 93 TestSerialIoHandler::~TestSerialIoHandler() { | 93 TestSerialIoHandler::~TestSerialIoHandler() { |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace device | 96 } // namespace device |
| OLD | NEW |