Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(668)

Unified Diff: third_party/WebKit/LayoutTests/bluetooth/characteristicvaluechanged.html

Issue 1815483003: bluetooth: Create Mojo equivalent of SetBluetoothMockDataSet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-mojo
Patch Set: MMerge with ToT Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/bluetooth/characteristicvaluechanged.html
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristicvaluechanged.html b/third_party/WebKit/LayoutTests/bluetooth/characteristicvaluechanged.html
index 88841a131bab03919a5cd3e9546ace1b6e09fb86..f50fc6f5196e1dc1bf1c9474e2c88d080476973d 100644
--- a/third_party/WebKit/LayoutTests/bluetooth/characteristicvaluechanged.html
+++ b/third_party/WebKit/LayoutTests/bluetooth/characteristicvaluechanged.html
@@ -8,8 +8,9 @@ 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 => device.gatt.connect())
.then(gattServer => gattServer.getPrimaryService('heart_rate'))
.then(service => service.getCharacteristic('body_sensor_location'))
@@ -30,8 +31,9 @@ promise_test(() => {
}, 'Reading a characteristic should fire an event.');
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 => gattServer.getPrimaryService('heart_rate'))
.then(service => service.getCharacteristic('body_sensor_location'))
@@ -55,35 +57,39 @@ promise_test(() => {
}, 'Add multiple event listeners then readValue().');
promise_test(() => {
- testRunner.setBluetoothMockDataSet('HeartRateAdapter');
let char;
- return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]})
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('heart_rate'))
- .then(service => service.getCharacteristic('heart_rate_measurement'))
- .then(characteristic => {
- char = characteristic;
- return assert_event_fires_after_promise(characteristic,
- 'startNotifications',
- 'characteristicvaluechanged');
- }).then(() => char.stopNotifications())
- .then(() => assert_no_events(char, 'characteristicvaluechanged'));
+ return setBluetoothFakeAdapter('HeartRateAdapter')
+ .then(() => requestDeviceWithKeyDown({
+ filters: [{services: ['heart_rate']}]}))
+ .then(device => device.gatt.connect())
+ .then(gattServer => gattServer.getPrimaryService('heart_rate'))
+ .then(service => service.getCharacteristic('heart_rate_measurement'))
+ .then(characteristic => {
+ char = characteristic;
+ return assert_event_fires_after_promise(characteristic,
+ 'startNotifications',
+ 'characteristicvaluechanged');
+ })
+ .then(() => char.stopNotifications())
+ .then(() => assert_no_events(char, 'characteristicvaluechanged'));
}, 'Starting notifications should fire an event.');
promise_test(() => {
- testRunner.setBluetoothMockDataSet('HeartRateAdapter');
let char;
- return requestDeviceWithKeyDown({filters: [{services: ['heart_rate']}]})
- .then(device => device.gatt.connect())
- .then(gattServer => gattServer.getPrimaryService('heart_rate'))
- .then(service => service.getCharacteristic('heart_rate_measurement'))
- .then(characteristic => {
- char = characteristic;
- return assert_event_fires_after_promise(characteristic,
- 'startNotifications',
- 'characteristicvaluechanged',
- 3 /* add 3 listeners */);
- }).then(() => char.stopNotifications())
- .then(() => assert_no_events(char, 'characteristicvaluechanged'));
+ return setBluetoothFakeAdapter('HeartRateAdapter')
+ .then(() => requestDeviceWithKeyDown({
+ filters: [{services: ['heart_rate']}]}))
+ .then(device => device.gatt.connect())
+ .then(gattServer => gattServer.getPrimaryService('heart_rate'))
+ .then(service => service.getCharacteristic('heart_rate_measurement'))
+ .then(characteristic => {
+ char = characteristic;
+ return assert_event_fires_after_promise(characteristic,
+ 'startNotifications',
+ 'characteristicvaluechanged',
+ 3 /* add 3 listeners */);
+ })
+ .then(() => char.stopNotifications())
+ .then(() => assert_no_events(char, 'characteristicvaluechanged'));
}, 'Add multiple event listeners then startNotifications().');
</script>

Powered by Google App Engine
This is Rietveld 408576698