Index: third_party/WebKit/LayoutTests/resources/bluetooth/web-bluetooth-test.js |
diff --git a/third_party/WebKit/LayoutTests/resources/bluetooth/web-bluetooth-test.js b/third_party/WebKit/LayoutTests/resources/bluetooth/web-bluetooth-test.js |
index eee28a3e18d1cc4748815f38276b702f755942a7..a178488da5b2ab64b37b3b3a6889e13fd992effa 100644 |
--- a/third_party/WebKit/LayoutTests/resources/bluetooth/web-bluetooth-test.js |
+++ b/third_party/WebKit/LayoutTests/resources/bluetooth/web-bluetooth-test.js |
@@ -27,10 +27,20 @@ |
// 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 |
// hand Windows 10 is a platform that does support LE, even if there is no |
- // Bluetooth radio available. |
- async setLESupported(available) { |
- if (typeof available !== 'boolean') throw 'Type Not Supported'; |
- await (await this.getFakeBluetoothInterface_()).setLESupported(available); |
+ // Bluetooth radio present. |
+ async setLESupported(supported) { |
+ // Call setBluetoothFakeAdapter() to clean up any fake adapters left over |
+ // 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_() { |