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

Unified Diff: device/serial/test_serial_io_handler.h

Issue 401563002: Add a partial Mojo serial connection interface and implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/serial/serial_service_unittest.cc ('k') | device/serial/test_serial_io_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/serial/test_serial_io_handler.h
diff --git a/device/serial/test_serial_io_handler.h b/device/serial/test_serial_io_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..7f0073c126e7b9d7fc91d7f969860d030250aafb
--- /dev/null
+++ b/device/serial/test_serial_io_handler.h
@@ -0,0 +1,60 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_SERIAL_TEST_SERIAL_IO_HANDLER_H_
+#define DEVICE_SERIAL_TEST_SERIAL_IO_HANDLER_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "device/serial/serial.mojom.h"
+#include "device/serial/serial_io_handler.h"
+
+namespace device {
+
+class TestSerialIoHandler : public SerialIoHandler {
+ public:
+ TestSerialIoHandler();
+
+ static scoped_refptr<SerialIoHandler> Create();
+
+ // SerialIoHandler overrides.
+ virtual void Open(const std::string& port,
+ const OpenCompleteCallback& callback) OVERRIDE;
+ virtual bool ConfigurePort(const serial::ConnectionOptions& options) OVERRIDE;
+ virtual void ReadImpl() OVERRIDE;
+ virtual void CancelReadImpl() OVERRIDE;
+ virtual void WriteImpl() OVERRIDE;
+ virtual void CancelWriteImpl() OVERRIDE;
+ virtual serial::DeviceControlSignalsPtr GetControlSignals() const OVERRIDE;
+ virtual serial::ConnectionInfoPtr GetPortInfo() const OVERRIDE;
+ virtual bool Flush() const OVERRIDE;
+ virtual bool SetControlSignals(
+ const serial::HostControlSignals& signals) OVERRIDE;
+
+ serial::ConnectionInfo* connection_info() { return &info_; }
+ serial::DeviceControlSignals* device_control_signals() {
+ return &device_control_signals_;
+ }
+ bool dtr() { return dtr_; }
+ bool rts() { return rts_; }
+ int flushes() { return flushes_; }
+
+ protected:
+ virtual ~TestSerialIoHandler();
+
+ private:
+ bool opened_;
+ serial::ConnectionInfo info_;
+ serial::DeviceControlSignals device_control_signals_;
+ bool dtr_;
+ bool rts_;
+ mutable int flushes_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestSerialIoHandler);
+};
+
+} // namespace device
+
+#endif // DEVICE_SERIAL_TEST_SERIAL_IO_HANDLER_H_
« no previous file with comments | « device/serial/serial_service_unittest.cc ('k') | device/serial/test_serial_io_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698