Commit 372420b2 authored by ortuno's avatar ortuno Committed by Commit bot

bluetooth: Small web-bluetooth-test.js cleanup

Two changes:
 1. Call setBluetoothFakeAdapter('') to clean up any adapters left
    by legacy tests.
 2. Change 'available' to 'supported' to match the functions name.

BUG=569709

Review-Url: https://codereview.chromium.org/2859673003
Cr-Commit-Position: refs/heads/master@{#469002}
parent b22c6827
...@@ -27,10 +27,20 @@ ...@@ -27,10 +27,20 @@
// Set it to indicate whether the platform supports BLE. For example, // Set it to indicate whether the platform supports BLE. For example,
// Windows 7 is a platform that doesn't support Low Energy. On the other // Windows 7 is a platform that doesn't support Low Energy. On the other
// hand Windows 10 is a platform that does support LE, even if there is no // hand Windows 10 is a platform that does support LE, even if there is no
// Bluetooth radio available. // Bluetooth radio present.
async setLESupported(available) { async setLESupported(supported) {
if (typeof available !== 'boolean') throw 'Type Not Supported'; // Call setBluetoothFakeAdapter() to clean up any fake adapters left over
await (await this.getFakeBluetoothInterface_()).setLESupported(available); // by legacy tests.
// Legacy tests that use setBluetoothFakeAdapter() sometimes fail to clean
// their fake adapter. This is not a problem for these tests because the
// next setBluetoothFakeAdapter() will clean it up anyway but it is a
// problem for the new tests that do not use setBluetoothFakeAdapter().
// TODO(crbug.com/569709): Remove once setBluetoothFakeAdapter is no
// longer used.
await setBluetoothFakeAdapter('');
if (typeof supported !== 'boolean') throw 'Type Not Supported';
await (await this.getFakeBluetoothInterface_()).setLESupported(supported);
} }
async getFakeBluetoothInterface_() { async getFakeBluetoothInterface_() {
......
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