| 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 #ifndef DEVICE_SERIAL_TEST_SERIAL_IO_HANDLER_H_ | 5 #ifndef DEVICE_SERIAL_TEST_SERIAL_IO_HANDLER_H_ |
| 6 #define DEVICE_SERIAL_TEST_SERIAL_IO_HANDLER_H_ | 6 #define DEVICE_SERIAL_TEST_SERIAL_IO_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "device/serial/serial.mojom.h" | 11 #include "device/serial/serial.mojom.h" |
| 12 #include "device/serial/serial_io_handler.h" | 12 #include "device/serial/serial_io_handler.h" |
| 13 | 13 |
| 14 namespace device { | 14 namespace device { |
| 15 | 15 |
| 16 class TestSerialIoHandler : public SerialIoHandler { | 16 class TestSerialIoHandler : public SerialIoHandler { |
| 17 public: | 17 public: |
| 18 TestSerialIoHandler(); | 18 TestSerialIoHandler(); |
| 19 | 19 |
| 20 static scoped_refptr<SerialIoHandler> Create(); | 20 static scoped_refptr<SerialIoHandler> Create(); |
| 21 | 21 |
| 22 // SerialIoHandler overrides. | 22 // SerialIoHandler overrides. |
| 23 virtual void Open(const std::string& port, | 23 virtual void Open(const std::string& port, |
| 24 const OpenCompleteCallback& callback) OVERRIDE; | 24 const OpenCompleteCallback& callback) override; |
| 25 virtual bool ConfigurePort(const serial::ConnectionOptions& options) OVERRIDE; | 25 virtual bool ConfigurePort(const serial::ConnectionOptions& options) override; |
| 26 virtual void ReadImpl() OVERRIDE; | 26 virtual void ReadImpl() override; |
| 27 virtual void CancelReadImpl() OVERRIDE; | 27 virtual void CancelReadImpl() override; |
| 28 virtual void WriteImpl() OVERRIDE; | 28 virtual void WriteImpl() override; |
| 29 virtual void CancelWriteImpl() OVERRIDE; | 29 virtual void CancelWriteImpl() override; |
| 30 virtual serial::DeviceControlSignalsPtr GetControlSignals() const OVERRIDE; | 30 virtual serial::DeviceControlSignalsPtr GetControlSignals() const override; |
| 31 virtual serial::ConnectionInfoPtr GetPortInfo() const OVERRIDE; | 31 virtual serial::ConnectionInfoPtr GetPortInfo() const override; |
| 32 virtual bool Flush() const OVERRIDE; | 32 virtual bool Flush() const override; |
| 33 virtual bool SetControlSignals( | 33 virtual bool SetControlSignals( |
| 34 const serial::HostControlSignals& signals) OVERRIDE; | 34 const serial::HostControlSignals& signals) override; |
| 35 | 35 |
| 36 serial::ConnectionInfo* connection_info() { return &info_; } | 36 serial::ConnectionInfo* connection_info() { return &info_; } |
| 37 serial::DeviceControlSignals* device_control_signals() { | 37 serial::DeviceControlSignals* device_control_signals() { |
| 38 return &device_control_signals_; | 38 return &device_control_signals_; |
| 39 } | 39 } |
| 40 bool dtr() { return dtr_; } | 40 bool dtr() { return dtr_; } |
| 41 bool rts() { return rts_; } | 41 bool rts() { return rts_; } |
| 42 int flushes() { return flushes_; } | 42 int flushes() { return flushes_; } |
| 43 // This callback will be called when this IoHandler processes its next write, | 43 // This callback will be called when this IoHandler processes its next write, |
| 44 // instead of the normal behavior of echoing the data to reads. | 44 // instead of the normal behavior of echoing the data to reads. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 58 mutable int flushes_; | 58 mutable int flushes_; |
| 59 std::string buffer_; | 59 std::string buffer_; |
| 60 base::Closure send_callback_; | 60 base::Closure send_callback_; |
| 61 | 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(TestSerialIoHandler); | 62 DISALLOW_COPY_AND_ASSIGN(TestSerialIoHandler); |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 } // namespace device | 65 } // namespace device |
| 66 | 66 |
| 67 #endif // DEVICE_SERIAL_TEST_SERIAL_IO_HANDLER_H_ | 67 #endif // DEVICE_SERIAL_TEST_SERIAL_IO_HANDLER_H_ |
| OLD | NEW |