#include "services/device/usb/fake_usb_device_handle.h"
#include <algorithm>
#include <utility>
#include "base/functional/callback.h"
#include "base/memory/ref_counted_memory.h"
#include "base/notreached.h"
#include "services/device/usb/usb_device.h"
namespace device {
UsbControlTransferRecipient;
UsbControlTransferType;
UsbTransferDirection;
UsbTransferStatus;
FakeUsbDeviceHandle::FakeUsbDeviceHandle(const uint8_t* data, size_t size)
: … { … }
scoped_refptr<UsbDevice> FakeUsbDeviceHandle::GetDevice() const { … }
void FakeUsbDeviceHandle::Close() { … }
void FakeUsbDeviceHandle::SetConfiguration(int configuration_value,
ResultCallback callback) { … }
void FakeUsbDeviceHandle::ClaimInterface(int interface_number,
ResultCallback callback) { … }
void FakeUsbDeviceHandle::ReleaseInterface(int interface_number,
ResultCallback callback) { … }
void FakeUsbDeviceHandle::SetInterfaceAlternateSetting(
int interface_number,
int alternate_setting,
ResultCallback callback) { … }
void FakeUsbDeviceHandle::ResetDevice(ResultCallback callback) { … }
void FakeUsbDeviceHandle::ClearHalt(mojom::UsbTransferDirection direction,
uint8_t endpoint_number,
ResultCallback callback) { … }
void FakeUsbDeviceHandle::ControlTransfer(
UsbTransferDirection direction,
UsbControlTransferType request_type,
UsbControlTransferRecipient recipient,
uint8_t request,
uint16_t value,
uint16_t index,
scoped_refptr<base::RefCountedBytes> buffer,
unsigned int timeout,
UsbDeviceHandle::TransferCallback callback) { … }
void FakeUsbDeviceHandle::IsochronousTransferIn(
uint8_t endpoint_number,
const std::vector<uint32_t>& packet_lengths,
unsigned int timeout,
IsochronousTransferCallback callback) { … }
void FakeUsbDeviceHandle::IsochronousTransferOut(
uint8_t endpoint_number,
scoped_refptr<base::RefCountedBytes> buffer,
const std::vector<uint32_t>& packet_lengths,
unsigned int timeout,
IsochronousTransferCallback callback) { … }
void FakeUsbDeviceHandle::GenericTransfer(
UsbTransferDirection direction,
uint8_t endpoint_number,
scoped_refptr<base::RefCountedBytes> buffer,
unsigned int timeout,
TransferCallback callback) { … }
const mojom::UsbInterfaceInfo* FakeUsbDeviceHandle::FindInterfaceByEndpoint(
uint8_t endpoint_address) { … }
FakeUsbDeviceHandle::~FakeUsbDeviceHandle() = default;
}