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_METHOD6(BulkTransfer
,
31 void(UsbEndpointDirection direction
,
33 scoped_refptr
<net::IOBuffer
> buffer
,
36 const TransferCallback
& callback
));
37 MOCK_METHOD6(InterruptTransfer
,
38 void(UsbEndpointDirection direction
,
40 scoped_refptr
<net::IOBuffer
> buffer
,
43 const TransferCallback
& callback
));
44 MOCK_METHOD8(IsochronousTransfer
,
45 void(UsbEndpointDirection direction
,
47 scoped_refptr
<net::IOBuffer
> buffer
,
50 unsigned int packet_length
,
52 const TransferCallback
& callback
));
53 MOCK_METHOD1(ResetDevice
, void(const ResultCallback
& callback
));
54 MOCK_METHOD2(GetStringDescriptor
, bool(uint8_t, base::string16
*));
55 MOCK_METHOD2(SetConfiguration
,
56 void(int configuration_value
, const ResultCallback
& callback
));
57 MOCK_METHOD2(ClaimInterface
,
58 void(int interface_number
, const ResultCallback
& callback
));
59 MOCK_METHOD1(ReleaseInterface
, bool(int interface_number
));
60 MOCK_METHOD3(SetInterfaceAlternateSetting
,
61 void(int interface_number
,
62 int alternate_setting
,
63 const ResultCallback
& callback
));
65 scoped_refptr
<UsbDevice
> GetDevice() const override
;
68 ~MockUsbDeviceHandle() override
;
75 #endif // DEVICE_USB_MOCK_USB_DEVICE_HANDLE_H_