| Index: third_party/WebKit/LayoutTests/bluetooth/readValue.html
|
| diff --git a/third_party/WebKit/LayoutTests/bluetooth/readValue.html b/third_party/WebKit/LayoutTests/bluetooth/readValue.html
|
| index d67a6b617799cb0e65c65c9ebaffbb4513799e98..73b7b1415e15564d461a487293d24077f2f50077 100644
|
| --- a/third_party/WebKit/LayoutTests/bluetooth/readValue.html
|
| +++ b/third_party/WebKit/LayoutTests/bluetooth/readValue.html
|
| @@ -9,61 +9,67 @@ 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']}],
|
| - optionalServices: ['generic_access']})
|
| + return setBluetoothFakeAdapter('HeartRateAdapter')
|
| + .then(() => requestDeviceWithKeyDown({
|
| + filters: [{services: ['heart_rate']}],
|
| + optionalServices: ['generic_access']}))
|
| .then(device => device.gatt.connect())
|
| .then(gattServer => gattServer.getPrimaryService('generic_access'))
|
| .then(service => service.getCharacteristic('gap.device_name'))
|
| .then(characteristic => {
|
| - testRunner.setBluetoothMockDataSet('EmptyAdapter');
|
| - return assert_promise_rejects_with_message(
|
| - characteristic.readValue(), new DOMException(
|
| - 'Bluetooth Device is no longer in range.',
|
| - 'NetworkError'),
|
| - 'Device went out of range');
|
| + return setBluetoothFakeAdapter('EmptyAdapter')
|
| + .then(() => assert_promise_rejects_with_message(
|
| + characteristic.readValue(),
|
| + new DOMException(
|
| + 'Bluetooth Device is no longer in range.',
|
| + 'NetworkError'),
|
| + 'Device went out of range'));
|
| });
|
| }, 'Device goes out of range. Reject with NetworkError.');
|
|
|
| promise_test(() => {
|
| - testRunner.setBluetoothMockDataSet('HeartRateAdapter');
|
| - return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}],
|
| - optionalServices: ['generic_access']})
|
| + return setBluetoothFakeAdapter('HeartRateAdapter')
|
| + .then(() => requestDeviceWithKeyDown({
|
| + filters: [{services: ['heart_rate']}],
|
| + optionalServices: ['generic_access']}))
|
| .then(device => device.gatt.connect())
|
| .then(gattServer => gattServer.getPrimaryService('generic_access'))
|
| .then(service => service.getCharacteristic('gap.device_name'))
|
| .then(characteristic => {
|
| - testRunner.setBluetoothMockDataSet('MissingServiceHeartRateAdapter');
|
| - return assert_promise_rejects_with_message(
|
| - characteristic.readValue(), new DOMException(
|
| - 'GATT Service no longer exists.',
|
| - 'InvalidStateError'),
|
| - 'Service got removed.');
|
| + return setBluetoothFakeAdapter('MissingServiceHeartRateAdapter')
|
| + .then(() => assert_promise_rejects_with_message(
|
| + characteristic.readValue(),
|
| + new DOMException(
|
| + 'GATT Service no longer exists.',
|
| + 'InvalidStateError'),
|
| + 'Service got removed.'));
|
| });
|
| }, 'Service gets removed. Reject with InvalidStateError.');
|
|
|
| promise_test(() => {
|
| - testRunner.setBluetoothMockDataSet('HeartRateAdapter');
|
| - return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}],
|
| - optionalServices: ['generic_access']})
|
| + return setBluetoothFakeAdapter('HeartRateAdapter')
|
| + .then(() => requestDeviceWithKeyDown({
|
| + filters: [{services: ['heart_rate']}],
|
| + optionalServices: ['generic_access']}))
|
| .then(device => device.gatt.connect())
|
| .then(gattService => gattService.getPrimaryService('generic_access'))
|
| .then(service => service.getCharacteristic('gap.device_name'))
|
| .then(characteristic => {
|
| - testRunner.setBluetoothMockDataSet(
|
| - 'MissingCharacteristicHeartRateAdapter');
|
| - return assert_promise_rejects_with_message(
|
| - characteristic.readValue(), new DOMException(
|
| - 'GATT Characteristic no longer exists.',
|
| - 'InvalidStateError'),
|
| - 'Characteristic got removed.');
|
| + return setBluetoothFakeAdapter('MissingCharacteristicHeartRateAdapter')
|
| + .then(() => assert_promise_rejects_with_message(
|
| + characteristic.readValue(),
|
| + new DOMException(
|
| + 'GATT Characteristic no longer exists.',
|
| + 'InvalidStateError'),
|
| + 'Characteristic got removed.'));
|
| });
|
| }, 'Characteristic gets removed. Reject with InvalidStateError.');
|
|
|
| gatt_errors_tests.forEach(testSpec => {
|
| promise_test(() => {
|
| - testRunner.setBluetoothMockDataSet('FailingGATTOperationsAdapter');
|
| - return requestDeviceWithKeyDown({filters: [{services: [errorUUID(0xA0)]}]})
|
| + return setBluetoothFakeAdapter('FailingGATTOperationsAdapter')
|
| + .then(() => requestDeviceWithKeyDown({
|
| + filters: [{services: [errorUUID(0xA0)]}]}))
|
| .then(device => device.gatt.connect())
|
| .then(gattServer => gattServer.getPrimaryService(errorUUID(0xA0)))
|
| .then(service => service.getCharacteristic(testSpec.uuid))
|
| @@ -77,9 +83,10 @@ gatt_errors_tests.forEach(testSpec => {
|
| });
|
|
|
| promise_test(() => {
|
| - testRunner.setBluetoothMockDataSet('HeartRateAdapter');
|
| - return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}],
|
| - optionalServices: ['generic_access']})
|
| + return setBluetoothFakeAdapter('HeartRateAdapter')
|
| + .then(() => requestDeviceWithKeyDown({
|
| + filters: [{services: ['heart_rate']}],
|
| + optionalServices: ['generic_access']}))
|
| .then(device => device.gatt.connect())
|
| .then(gattServer => gattServer.getPrimaryService('generic_access'))
|
| .then(service => service.getCharacteristic('gap.device_name'))
|
| @@ -92,9 +99,10 @@ promise_test(() => {
|
| }, 'Request for characteristic. Should return right characteristic');
|
|
|
| promise_test(() => {
|
| - testRunner.setBluetoothMockDataSet('HeartRateAdapter');
|
| - return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}],
|
| - optionalServices: ['generic_access']})
|
| + return setBluetoothFakeAdapter('HeartRateAdapter')
|
| + .then(() => requestDeviceWithKeyDown({
|
| + filters: [{services: ['heart_rate']}],
|
| + optionalServices: ['generic_access']}))
|
| .then(device => device.gatt.connect())
|
| .then(gattServer => gattServer.getPrimaryService('generic_access'))
|
| .then(service => service.getCharacteristic('gap.device_name'))
|
|
|