Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / device / usb / mock_usb_device_handle.h
blobb07ff2a96e46c6abfbcd8edb7a9503389bd457a0
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"
12 namespace device {
14 class MockUsbDeviceHandle : public UsbDeviceHandle {
15 public:
16 MockUsbDeviceHandle(UsbDevice* device);
18 MOCK_METHOD0(Close, void());
19 MOCK_METHOD10(ControlTransfer,
20 void(UsbEndpointDirection direction,
21 TransferRequestType request_type,
22 TransferRecipient recipient,
23 uint8 request,
24 uint16 value,
25 uint16 index,
26 scoped_refptr<net::IOBuffer> buffer,
27 size_t length,
28 unsigned int timeout,
29 const TransferCallback& callback));
30 MOCK_METHOD8(IsochronousTransfer,
31 void(UsbEndpointDirection direction,
32 uint8 endpoint,
33 scoped_refptr<net::IOBuffer> buffer,
34 size_t length,
35 unsigned int packets,
36 unsigned int packet_length,
37 unsigned int timeout,
38 const TransferCallback& callback));
39 MOCK_METHOD6(GenericTransfer,
40 void(UsbEndpointDirection direction,
41 uint8 endpoint,
42 scoped_refptr<net::IOBuffer> buffer,
43 size_t length,
44 unsigned int timeout,
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;
61 private:
62 ~MockUsbDeviceHandle() override;
64 UsbDevice* device_;
67 } // namespace device
69 #endif // DEVICE_USB_MOCK_USB_DEVICE_HANDLE_H_