| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_USB_MOCK_USB_DEVICE_HANDLE_H_ | 5 #ifndef DEVICE_USB_MOCK_USB_DEVICE_HANDLE_H_ |
| 6 #define DEVICE_USB_MOCK_USB_DEVICE_HANDLE_H_ | 6 #define DEVICE_USB_MOCK_USB_DEVICE_HANDLE_H_ |
| 7 | 7 |
| 8 #include "device/usb/usb_device_handle.h" | 8 #include "device/usb/usb_device_handle.h" |
| 9 | 9 |
| 10 #include <stddef.h> |
| 11 #include <stdint.h> |
| 12 |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 11 | 14 |
| 12 namespace device { | 15 namespace device { |
| 13 | 16 |
| 14 class MockUsbDeviceHandle : public UsbDeviceHandle { | 17 class MockUsbDeviceHandle : public UsbDeviceHandle { |
| 15 public: | 18 public: |
| 16 MockUsbDeviceHandle(UsbDevice* device); | 19 MockUsbDeviceHandle(UsbDevice* device); |
| 17 | 20 |
| 18 scoped_refptr<UsbDevice> GetDevice() const override; | 21 scoped_refptr<UsbDevice> GetDevice() const override; |
| 19 MOCK_METHOD0(Close, void()); | 22 MOCK_METHOD0(Close, void()); |
| 20 MOCK_METHOD2(SetConfiguration, | 23 MOCK_METHOD2(SetConfiguration, |
| 21 void(int configuration_value, const ResultCallback& callback)); | 24 void(int configuration_value, const ResultCallback& callback)); |
| 22 MOCK_METHOD2(ClaimInterface, | 25 MOCK_METHOD2(ClaimInterface, |
| 23 void(int interface_number, const ResultCallback& callback)); | 26 void(int interface_number, const ResultCallback& callback)); |
| 24 MOCK_METHOD1(ReleaseInterface, bool(int interface_number)); | 27 MOCK_METHOD1(ReleaseInterface, bool(int interface_number)); |
| 25 MOCK_METHOD3(SetInterfaceAlternateSetting, | 28 MOCK_METHOD3(SetInterfaceAlternateSetting, |
| 26 void(int interface_number, | 29 void(int interface_number, |
| 27 int alternate_setting, | 30 int alternate_setting, |
| 28 const ResultCallback& callback)); | 31 const ResultCallback& callback)); |
| 29 MOCK_METHOD1(ResetDevice, void(const ResultCallback& callback)); | 32 MOCK_METHOD1(ResetDevice, void(const ResultCallback& callback)); |
| 30 MOCK_METHOD2(ClearHalt, void(uint8 endpoint, const ResultCallback& callback)); | 33 MOCK_METHOD2(ClearHalt, |
| 34 void(uint8_t endpoint, const ResultCallback& callback)); |
| 31 MOCK_METHOD10(ControlTransfer, | 35 MOCK_METHOD10(ControlTransfer, |
| 32 void(UsbEndpointDirection direction, | 36 void(UsbEndpointDirection direction, |
| 33 TransferRequestType request_type, | 37 TransferRequestType request_type, |
| 34 TransferRecipient recipient, | 38 TransferRecipient recipient, |
| 35 uint8_t request, | 39 uint8_t request, |
| 36 uint16_t value, | 40 uint16_t value, |
| 37 uint16_t index, | 41 uint16_t index, |
| 38 scoped_refptr<net::IOBuffer> buffer, | 42 scoped_refptr<net::IOBuffer> buffer, |
| 39 size_t length, | 43 size_t length, |
| 40 unsigned int timeout, | 44 unsigned int timeout, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 60 | 64 |
| 61 private: | 65 private: |
| 62 ~MockUsbDeviceHandle() override; | 66 ~MockUsbDeviceHandle() override; |
| 63 | 67 |
| 64 UsbDevice* device_; | 68 UsbDevice* device_; |
| 65 }; | 69 }; |
| 66 | 70 |
| 67 } // namespace device | 71 } // namespace device |
| 68 | 72 |
| 69 #endif // DEVICE_USB_MOCK_USB_DEVICE_HANDLE_H_ | 73 #endif // DEVICE_USB_MOCK_USB_DEVICE_HANDLE_H_ |
| OLD | NEW |