This directory contains Chromium only Web Bluetooth API web tests.
The tests in this directory are currently undergoing a refactoring in order to migrate them into
//third_party/blink/web_tests/external/wpt/bluetooth so that other implementers are able to reuse the tests for their own implementation. See the web-platform-tests Bluetooth README for more details.
These tests are currently using the legacy BluetoothFakeAdapter test infrastructure which defines several mock Bluetooth devices with specific characteristics and behaviors. This test infrastructure lacks granular control over the test devices, which ends up requiring workarounds and hacks resulting in flaky tests. The new FakeBluetooth test infrastructure produces dynamic test devices that can be controlled during a test. For more details on the refactoring effort, see the Web Bluetooth Testing design document.
TODO(https://crbug.com/509038): Update this document when the remaining tests have been submitted to W3C Web Platform Tests.
There are still a few APIs missing from FakeBluetooth that need to be implemented in order to refactor the remaining tests in this directory. A list of the APIs needed by these tests can be found in the Web Bluetooth Test API Dependencies spreadsheet.
Several Web Bluetooth tests share common test logic. For these tests, the
script-tests directory contains templates that are used by the
CALLS() keyword with functions delimited by a
| character. A test will be created for each function in the
generate.py. Note that for each subdirectory in
script-tests there is a matching directory under
bluetooth. The generator will expand
CALLS functions into the corresponding directory.
./script-tests/server/get-same-object.js contains the following code:
gattServer.CALLS([ getPrimaryService('heart_rate')| getPrimaryServices()| getPrimaryServices('heart_rate')[UUID]]),
The functions in
CALLS() will be expanded to generate 3 test files prefixed with
bluetooth/server/getPrimaryService/gen-get-same-object.html bluetooth/server/getPrimaryServices/gen-get-same-object.html bluetooth/server/getPrimaryServices/gen-get-same-object-with-uuid.html
To generate the tests in
script-tests, run the following command from the source root:
$ python third_party/blink/web_tests/bluetooth/generate.py
To check that generated tests are correct and that there are no obsolete tests, or tests for which a template does not exist anymore, run:
$ python third_party/blink/web_tests/bluetooth/generate_test.py
More details can be found in
Mailing list: firstname.lastname@example.org
Bug tracker: Blink>Bluetooth