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
3 // found in the LICENSE file.
5 #ifndef DEVICE_USB_MOCK_USB_DEVICE_HANDLE_H_
6 #define DEVICE_USB_MOCK_USB_DEVICE_HANDLE_H_
8 #include "device/usb/usb_device_handle.h"
10 #include "testing/gmock/include/gmock/gmock.h"
14 class MockUsbDeviceHandle
: public UsbDeviceHandle
{
16 MockUsbDeviceHandle(UsbDevice
* device
);
18 MOCK_METHOD0(Close
, void());
19 MOCK_METHOD10(ControlTransfer
,
20 void(UsbEndpointDirection direction
,
21 TransferRequestType request_type
,
22 TransferRecipient recipient
,
26 scoped_refptr
<net::IOBuffer
> buffer
,
29 const TransferCallback
& callback
));
30 MOCK_METHOD8(IsochronousTransfer
,
31 void(UsbEndpointDirection direction
,
33 scoped_refptr
<net::IOBuffer
> buffer
,
36 unsigned int packet_length
,
38 const TransferCallback
& callback
));
39 MOCK_METHOD6(GenericTransfer
,
40 void(UsbEndpointDirection direction
,
42 scoped_refptr
<net::IOBuffer
> buffer
,
45 const TransferCallback
& callback
));
46 MOCK_METHOD1(ResetDevice
, void(const ResultCallback
& callback
));
47 MOCK_METHOD2(GetStringDescriptor
, bool(uint8_t, base::string16
*));
48 MOCK_METHOD2(SetConfiguration
,
49 void(int configuration_value
, const ResultCallback
& callback
));
50 MOCK_METHOD2(ClaimInterface
,
51 void(int interface_number
, const ResultCallback
& callback
));
52 MOCK_METHOD1(ReleaseInterface
, bool(int interface_number
));
53 MOCK_METHOD3(SetInterfaceAlternateSetting
,
54 void(int interface_number
,
55 int alternate_setting
,
56 const ResultCallback
& callback
));
57 MOCK_METHOD2(ClearHalt
, void(uint8 endpoint
, const ResultCallback
& callback
));
59 scoped_refptr
<UsbDevice
> GetDevice() const override
;
62 ~MockUsbDeviceHandle() override
;
69 #endif // DEVICE_USB_MOCK_USB_DEVICE_HANDLE_H_