Commit 42d2353c authored by Vincent Scheib's avatar Vincent Scheib Committed by Commit Bot

USB/WebUSB documentation, adding README.md files in several locations.

Bug: 740070
Change-Id: I9d0a7371c22856a641ad88910d55ba844aca4191
Reviewed-on: https://chromium-review.googlesource.com/572332
Commit-Queue: Vincent Scheib <scheib@chromium.org>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488481}
parent babe3efd
# USB
`device/usb` abstracts [Universal Serial Bus](https://en.wikipedia.org/wiki/USB)
concepts across multiple platforms.
Clients should use the [public Mojo interface](/device/usb/public/interfaces).
## USB ID Repository
`/third_party/usb_ids/usb.ids` is imported regularly to provide human-readable
descriptions of USB devices.
## Ongoing Work transitioning away from `libusb`
`UsbService` is implemented by `UsbServiceImpl` based on `third_party/libusb`.
Work is ongoing to implement each platform directly, without using `libusb`.
* `UsbServiceAndroid` done.
* `UsbServiceLinux` done.
* macOS not started.
* `UsbServiceWin` in progress. Enable via `chrome://flags/#new-usb-backend`
## Testing
### Unit Tests
Standard use of `*_unittest.cc` files for must code coverage.
### Fuzzers
[libFuzzer] tests are in `*_fuzzer.cc` files. They test for bad input from
devices, e.g. when parsing device descriptors during device enumeration.
[libFuzzer]: /testing/libfuzzer/README.md
### Gadget Tests
[USB/HID API Testing with Gadgets] describes a framework for testing the Chrome
USB, HID and serial device APIs with real devices on generally accessible
hardware.
[USB/HID API Testing with Gadgets]: https://docs.google.com/document/d/1O9jTlOAyeCwZX_XRbmQmNFidcJo8QZQSaodP-wmyess
Unit tests using the gadget can be run manually with a hardware "gadget". These
unit tests all call [UsbTestGadget::Claim].
[UsbTestGadget::Claim]: https://cs.chromium.org/search/?q=UsbTestGadget::Claim&type=cs
...@@ -26,8 +26,8 @@ namespace usb { ...@@ -26,8 +26,8 @@ namespace usb {
class PermissionProvider; class PermissionProvider;
// Implementation of the public DeviceManager interface. This interface can be // Implements the public Mojo UsbDeviceManager interface by wrapping the
// requested from the devices app located at "devices", if available. // UsbService instance.
class DeviceManagerImpl : public mojom::UsbDeviceManager, class DeviceManagerImpl : public mojom::UsbDeviceManager,
public UsbService::Observer { public UsbService::Observer {
public: public:
......
This directory contains Chromium-specific test resources. This directory contains Chromium-specific test resources.
The files `mojo_bindings.js` and `*.mojom.js` are automatically generated by the The files `mojo_bindings.js` and `*.mojom.js` are manually copied from the
Chromium build process and should not be edited manually. Chromium build process's generated files and should not be edited manually.
# WebUSB Testing
WebUSB testing relies on the [WebUSB Testing API] which must be
provided by browsers under test.
In this test suite `resources/usb-helpers.js` detects and triggers
the API to be loaded as needed.
The Chromium implementation is provided by
`../resources/chromium/webusb-test.js`.
[WebUSB Testing API]: https://wicg.github.io/webusb/test/
# WebUSB Blink Module
`Source/modules/webusb` implements the renderer process details and bindings
for the [WebUSB specification]. It communicates with the browser process through the [public Mojo interface] of `//device/usb` to the [UsbService].
[WebUSB specification]: https://wicg.github.io/webusb/
[public Mojo interface]: /device/usb/public/interfaces
[UsbService]: /device/usb/usb_service.h
## Testing
WebUSB is primarily tested in [Web Platform Tests].
Chromium implementation details are tested in [Layout Tests].
[Web Platform Tests]: ../../../LayoutTests/external/wpt/webusb/
[Layout Tests]: ../../../LayoutTests/usb/
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment