mock_usb_device.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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.
  4. #ifndef SERVICES_DEVICE_USB_MOCK_USB_DEVICE_H_
  5. #define SERVICES_DEVICE_USB_MOCK_USB_DEVICE_H_
  6. #include <stdint.h>
  7. #include <string>
  8. #include <vector>
  9. #include "services/device/usb/usb_device.h"
  10. #include "services/device/usb/usb_device_handle.h"
  11. #include "testing/gmock/include/gmock/gmock.h"
  12. namespace device {
  13. class MockUsbDevice : public UsbDevice {
  14. public:
  15. MockUsbDevice(uint16_t vendor_id, uint16_t product_id);
  16. MockUsbDevice(uint16_t vendor_id,
  17. uint16_t product_id,
  18. const std::string& manufacturer_string,
  19. const std::string& product_string,
  20. const std::string& serial_number);
  21. void Open(OpenCallback callback) override { OpenInternal(callback); }
  22. MOCK_METHOD1(OpenInternal, void(OpenCallback&));
  23. void AddMockConfig(mojom::UsbConfigurationInfoPtr config);
  24. // Public wrappers around protected functions.
  25. void ActiveConfigurationChanged(int configuration_value);
  26. void NotifyDeviceRemoved();
  27. private:
  28. ~MockUsbDevice() override;
  29. };
  30. } // namespace device
  31. #endif // SERVICES_DEVICE_USB_MOCK_USB_DEVICE_H_