| 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_TEST_USB_TEST_GADGET_H_ | 5 #ifndef DEVICE_TEST_USB_TEST_GADGET_H_ |
| 6 #define DEVICE_TEST_USB_TEST_GADGET_H_ | 6 #define DEVICE_TEST_USB_TEST_GADGET_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 12 | 13 |
| 14 namespace base { |
| 15 class SingleThreadTaskRunner; |
| 16 } |
| 17 |
| 13 namespace device { | 18 namespace device { |
| 14 | 19 |
| 15 class UsbDevice; | 20 class UsbDevice; |
| 16 | 21 |
| 17 class UsbTestGadget { | 22 class UsbTestGadget { |
| 18 public: | 23 public: |
| 19 enum Type { | 24 enum Type { |
| 20 DEFAULT = 0, | 25 DEFAULT = 0, |
| 21 KEYBOARD, | 26 KEYBOARD, |
| 22 MOUSE, | 27 MOUSE, |
| 23 HID_ECHO, | 28 HID_ECHO, |
| 24 ECHO, | 29 ECHO, |
| 25 }; | 30 }; |
| 26 | 31 |
| 27 virtual ~UsbTestGadget() {} | 32 virtual ~UsbTestGadget() {} |
| 28 | 33 |
| 29 static bool IsTestEnabled(); | 34 static bool IsTestEnabled(); |
| 30 static scoped_ptr<UsbTestGadget> Claim(); | 35 static scoped_ptr<UsbTestGadget> Claim( |
| 36 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); |
| 31 | 37 |
| 32 virtual bool Unclaim() = 0; | 38 virtual bool Unclaim() = 0; |
| 33 virtual bool Disconnect() = 0; | 39 virtual bool Disconnect() = 0; |
| 34 virtual bool Reconnect() = 0; | 40 virtual bool Reconnect() = 0; |
| 35 virtual bool SetType(Type type) = 0; | 41 virtual bool SetType(Type type) = 0; |
| 36 | 42 |
| 37 virtual UsbDevice* GetDevice() const = 0; | 43 virtual UsbDevice* GetDevice() const = 0; |
| 38 virtual const std::string& GetSerialNumber() const = 0; | |
| 39 | 44 |
| 40 protected: | 45 protected: |
| 41 UsbTestGadget() {} | 46 UsbTestGadget() {} |
| 42 | 47 |
| 43 private: | 48 private: |
| 44 DISALLOW_COPY_AND_ASSIGN(UsbTestGadget); | 49 DISALLOW_COPY_AND_ASSIGN(UsbTestGadget); |
| 45 }; | 50 }; |
| 46 | 51 |
| 47 } // namespace device | 52 } // namespace device |
| 48 | 53 |
| 49 #endif // DEVICE_TEST_USB_TEST_GADGET_H_ | 54 #endif // DEVICE_TEST_USB_TEST_GADGET_H_ |
| OLD | NEW |