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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef DEVICE_SERIAL_TEST_SERIAL_IO_HANDLER_H_
6 #define DEVICE_SERIAL_TEST_SERIAL_IO_HANDLER_H_
7
8 #include <string>
9
10 #include "base/callback.h"
11 #include "device/serial/serial.mojom.h"
12 #include "device/serial/serial_io_handler.h"
13
14 namespace device {
15
16 class TestSerialIoHandler : public SerialIoHandler {
17 public:
18 TestSerialIoHandler();
19
20 static scoped_refptr<SerialIoHandler> Create();
21
22 // SerialIoHandler overrides.
23 virtual void Open(const std::string& port,
24 const OpenCompleteCallback& callback) OVERRIDE;
25 virtual bool ConfigurePort(const serial::ConnectionOptions& options) OVERRIDE;
26 virtual void ReadImpl() OVERRIDE;
27 virtual void CancelReadImpl() OVERRIDE;
28 virtual void WriteImpl() OVERRIDE;
29 virtual void CancelWriteImpl() OVERRIDE;
30 virtual serial::DeviceControlSignalsPtr GetControlSignals() const OVERRIDE;
31 virtual serial::ConnectionInfoPtr GetPortInfo() const OVERRIDE;
32 virtual bool Flush() const OVERRIDE;
33 virtual bool SetControlSignals(
34 const serial::HostControlSignals& signals) OVERRIDE;
35
36 serial::ConnectionInfo* connection_info() { return &info_; }
37 serial::DeviceControlSignals* device_control_signals() {
38 return &device_control_signals_;
39 }
40 bool dtr() { return dtr_; }
41 bool rts() { return rts_; }
42 int flushes() { return flushes_; }
43
44 protected:
45 virtual ~TestSerialIoHandler();
46
47 private:
48 bool opened_;
49 serial::ConnectionInfo info_;
50 serial::DeviceControlSignals device_control_signals_;
51 bool dtr_;
52 bool rts_;
53 mutable int flushes_;
54
55 DISALLOW_COPY_AND_ASSIGN(TestSerialIoHandler);
56 };
57
58 } // namespace device
59
60 #endif // DEVICE_SERIAL_TEST_SERIAL_IO_HANDLER_H_
OLDNEW
« 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