Commit 332cd442 authored by Ovidio Henriquez's avatar Ovidio Henriquez Committed by Commit Bot

bluetooth: Error for unsupported environment

This change adds a thrown error message for browser environments
that do not implement Web Bluetooth Test API. The message also
points to the README file that has more information.

BUG=509038

Change-Id: Ic5906a32aca5a4169184e07f6ca804170eb863c9
Reviewed-on: https://chromium-review.googlesource.com/858484Reviewed-by: default avatarConley Owens <cco3@chromium.org>
Reviewed-by: default avatarVincent Scheib <scheib@chromium.org>
Commit-Queue: Ovidio Henriquez <odejesush@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531983}
parent cef9a685
......@@ -9,6 +9,19 @@ the API to be loaded as needed.
The Chromium implementation is provided by
`../resources/chromium/web-bluetooth-test.js`.
The Chromium implementation is not included in stable Chrome builds since it
would add too much to the binary size. On Chromium infrastructure, it is run
using the `content_shell` executable.
In the future, Chromium `src/device/bluetooth` may be refactored into a Mojo
service. At this point, it would be possible to add the necessary testing hooks
into stable Chrome without substantially increasing the binary size, similar to
WebUSB.
These bluetooth tests are upstreamed here because other browsers can reuse them
by implementing the [Web Bluetooth Testing API], even if only on their internal
infrastructure.
[Web Bluetooth Testing API]: https://docs.google.com/document/d/1Nhv_oVDCodd1pEH_jj9k8gF4rPGb_84VYaZ9IG8M_WY/
# Generated gen-* files from generator.py
......@@ -45,4 +58,4 @@ Usage:
$ python generate.py
```
More details documented in `generate.py`.
\ No newline at end of file
More details documented in `generate.py`.
......@@ -377,4 +377,12 @@ class FakeRemoteGATTDescriptor {
}
}
navigator.bluetooth.test = new FakeBluetooth();
// If this line fails, it means that current environment does not support the
// Web Bluetooth Test API.
try {
navigator.bluetooth.test = new FakeBluetooth();
} catch {
throw 'Web Bluetooth Test API is not implemented on this ' +
'environment. See the bluetooth README at ' +
'https://github.com/w3c/web-platform-tests/blob/master/bluetooth/README.md#web-bluetooth-testing';
}
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