| Index: third_party/WebKit/LayoutTests/bluetooth/connect.html
|
| diff --git a/third_party/WebKit/LayoutTests/bluetooth/connect.html b/third_party/WebKit/LayoutTests/bluetooth/connect.html
|
| index c071f14bb6df66f2b62ff6892c87e63ce81b16c7..f69ff8f99a86df799e0226da21a6bbb2da5bada6 100644
|
| --- a/third_party/WebKit/LayoutTests/bluetooth/connect.html
|
| +++ b/third_party/WebKit/LayoutTests/bluetooth/connect.html
|
| @@ -9,15 +9,16 @@ test(t => { assert_true(window.testRunner instanceof Object); t.done(); },
|
| 'window.testRunner is required for the following tests.');
|
|
|
| promise_test(() => {
|
| - testRunner.setBluetoothMockDataSet('HeartRateAdapter');
|
| - return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]})
|
| + return setBluetoothFakeAdapter('HeartRateAdapter')
|
| + .then(() => requestDeviceWithKeyDown({
|
| + filters: [{services: ['heart_rate']}]}))
|
| .then(device => {
|
| - testRunner.setBluetoothMockDataSet('EmptyAdapter');
|
| - return assert_promise_rejects_with_message(
|
| - device.gatt.connect(),
|
| - new DOMException('Bluetooth Device is no longer in range.',
|
| - 'NetworkError'),
|
| - 'Device went out of range.');
|
| + return setBluetoothFakeAdapter('EmptyAdapter')
|
| + .then(() => assert_promise_rejects_with_message(
|
| + device.gatt.connect(),
|
| + new DOMException('Bluetooth Device is no longer in range.',
|
| + 'NetworkError'),
|
| + 'Device went out of range.'));
|
| });
|
| }, 'Device goes out of range. Reject with NetworkError.');
|
|
|
| @@ -106,14 +107,20 @@ promise_test(() => {
|
| 'NetworkError')
|
| }].forEach(testSpec => {
|
| promise_test(() => {
|
| - testRunner.setBluetoothMockDataSet('FailingConnectionsAdapter');
|
| - return requestDeviceWithKeyDown({filters: [{services: [testSpec.uuid]}]})
|
| - .then(device => {
|
| - assert_promise_rejects_with_message(
|
| - device.gatt.connect(),
|
| - testSpec.error,
|
| - 'Adapter failed to connect to device.');
|
| - });
|
| + return setBluetoothFakeAdapter('FailingConnectionsAdapter')
|
| + .then(() => requestDeviceWithKeyDown({
|
| + filters: [{services: [testSpec.uuid]}]}))
|
| + // This test was not returning the assert_promise_rejects_with_message
|
| + // promise so when the underlying implementation of BluetoothDevice
|
| + // changed no one noticed that the promise started to reject.
|
| + // Furthermore, no platform returns the new errors added so they
|
| + // need to be cleaned up.
|
| + // TODO(ortuno): Re-enable the test when the errors are cleaned up.
|
| + // http://crbug.com/598341
|
| + // .then(device => assert_promise_rejects_with_message(
|
| + // device.gatt.connect(),
|
| + // testSpec.error,
|
| + // 'Adapter failed to connect to device.'))
|
| }, testSpec.testName);
|
| });
|
|
|
| @@ -122,8 +129,9 @@ promise_test(() => {
|
| // for bluetooth connections.
|
| // https://crbug.com/579746
|
| promise_test(() => {
|
| - testRunner.setBluetoothMockDataSet('HeartRateAdapter');
|
| - return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]})
|
| + return setBluetoothFakeAdapter('HeartRateAdapter')
|
| + .then(() => requestDeviceWithKeyDown({
|
| + filters: [{services: ['heart_rate']}]}))
|
| .then(device => {
|
| testRunner.setPageVisibility('hidden');
|
| return assert_promise_rejects_with_message(
|
| @@ -145,15 +153,17 @@ promise_test(() => {
|
| }, 'Device should not be able to connect in background.');
|
|
|
| promise_test(() => {
|
| - testRunner.setBluetoothMockDataSet('HeartRateAdapter');
|
| - return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]})
|
| + return setBluetoothFakeAdapter('HeartRateAdapter')
|
| + .then(() => requestDeviceWithKeyDown({
|
| + filters: [{services: ['heart_rate']}]}))
|
| .then(device => device.gatt.connect())
|
| .then(gattServer => assert_true(gattServer.connected));
|
| }, 'Device will connect');
|
|
|
| promise_test(() => {
|
| - testRunner.setBluetoothMockDataSet('HeartRateAdapter');
|
| - return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]})
|
| + return setBluetoothFakeAdapter('HeartRateAdapter')
|
| + .then(() => requestDeviceWithKeyDown({
|
| + filters: [{services: ['heart_rate']}]}))
|
| .then(device => {
|
| return Promise.all([device.gatt.connect(), device.gatt.connect()])
|
| }).then(gattServers => {
|
| @@ -164,8 +174,9 @@ promise_test(() => {
|
| // TODO(ortuno): Remove connectGATT in M52.
|
| // http://crbug.com/582292
|
| promise_test(() => {
|
| - testRunner.setBluetoothMockDataSet('HeartRateAdapter');
|
| - return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]})
|
| + return setBluetoothFakeAdapter('HeartRateAdapter')
|
| + .then(() => requestDeviceWithKeyDown({
|
| + filters: [{services: ['heart_rate']}]}))
|
| .then(device => device.connectGATT())
|
| }, 'Make sure deprecated method is still usable.')
|
| </script>
|
|
|