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

Unified Diff: LayoutTests/bluetooth/requestDevice.html

Issue 1174843002: Add tests for RequestDeviceOptions and clean up. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@pinned
Patch Set: Sync Created 5 years, 6 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
« no previous file with comments | « LayoutTests/bluetooth/idl-BluetoothDevice.html ('k') | public/platform/modules/bluetooth/WebBluetooth.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/bluetooth/requestDevice.html
diff --git a/LayoutTests/bluetooth/requestDevice.html b/LayoutTests/bluetooth/requestDevice.html
index 932d985dde5c7bb6797c71d9e4fa636634f0a257..e07c4e441fcb11de7b0fc5e35e5c092ed377f1b8 100644
--- a/LayoutTests/bluetooth/requestDevice.html
+++ b/LayoutTests/bluetooth/requestDevice.html
@@ -38,4 +38,35 @@ sequential_promise_test(function() {
assert_equals(device.constructor.name, "BluetoothDevice");
});
}, 'Mock will resolve.');
+
+sequential_promise_test(function() {
+ testRunner.setBluetoothMockDataSet('ScanFilterCheckingAdapter');
+ return navigator.bluetooth.requestDevice({
+ filters: [
+ {services: [batteryServiceUuid]},
+ {services: [glucoseServiceUuid, heartRateServiceUuid]}
+ ],
+ optionalServices: [genericAccessServiceUuid]
+ }).catch(function(e) {
scheib 2015/06/15 23:47:14 Would be nice to have a .then(/* verify something
Jeffrey Yasskin 2015/06/16 01:31:33 With your suggestion on the browser side, I can dr
scheib 2015/06/16 03:11:48 This one is nearly identical to "An extra filter d
Jeffrey Yasskin 2015/06/16 17:18:08 The important thing for this test is the ScanFilte
+ assert_equals(e.name, 'NotFoundError',
+ 'Started discovery with an unexpected set of UUIDs.');
+ });
+}, 'Filters restrict the platform\'s Bluetooth scan.');
+
+sequential_promise_test(function() {
+ testRunner.setBluetoothMockDataSet('MultiDeviceAdapter');
+ return Promise.all([
+ navigator.bluetooth.requestDevice({
+ filters: [{services: [glucoseServiceUuid]}]
+ }).then(function(device) {
+ assert_equals(device.name, "Glucose Device");
+ }),
+ navigator.bluetooth.requestDevice({
+ filters: [{services: [heartRateServiceUuid]}]
+ }).then(function(device) {
+ assert_equals(device.name, "Heart Rate Device");
+ }),
+ ]);
+}, 'Filters determine the returned devices.');
+
scheib 2015/06/15 23:47:14 Hmm, more test ideas to consider: - Multiple devi
Jeffrey Yasskin 2015/06/16 01:31:33 So these two are basically "doesn't crash" tests?
scheib 2015/06/16 03:11:48 Yes, not essential, but not a bad idea.
Jeffrey Yasskin 2015/06/16 17:18:08 Here's an issue for wiring up the dialog in a test
</script>
« no previous file with comments | « LayoutTests/bluetooth/idl-BluetoothDevice.html ('k') | public/platform/modules/bluetooth/WebBluetooth.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698