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

Side by Side 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: Turn into the 3rd side of the patch. 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharness-helpers.js"></script> 3 <script src="../resources/testharness-helpers.js"></script>
4 <script src="../resources/testharnessreport.js"></script> 4 <script src="../resources/testharnessreport.js"></script>
5 <script src="bluetooth-helpers.js"></script> 5 <script src="bluetooth-helpers.js"></script>
6 <script> 6 <script>
7 test(function(t) { assert_exists(window, "testRunner"); t.done(); }, 7 test(function(t) { assert_exists(window, "testRunner"); t.done(); },
8 "window.testRunner is required for the following tests."); 8 "window.testRunner is required for the following tests.");
9 9
10 sequential_promise_test(function() { 10 sequential_promise_test(function() {
(...skipping 20 matching lines...) Expand all
31 }, 'Reject with NotFoundError.'); 31 }, 'Reject with NotFoundError.');
32 32
33 sequential_promise_test(function() { 33 sequential_promise_test(function() {
34 testRunner.setBluetoothMockDataSet('SingleEmptyDeviceAdapter'); 34 testRunner.setBluetoothMockDataSet('SingleEmptyDeviceAdapter');
35 return navigator.bluetooth.requestDevice({ 35 return navigator.bluetooth.requestDevice({
36 filters: [{services: [genericAccessServiceUuid]}] 36 filters: [{services: [genericAccessServiceUuid]}]
37 }).then(function(device) { 37 }).then(function(device) {
38 assert_equals(device.constructor.name, "BluetoothDevice"); 38 assert_equals(device.constructor.name, "BluetoothDevice");
39 }); 39 });
40 }, 'Mock will resolve.'); 40 }, 'Mock will resolve.');
41
42 sequential_promise_test(function() {
43 testRunner.setBluetoothMockDataSet('ScanFilterCheckingAdapter');
44 return navigator.bluetooth.requestDevice({
45 filters: [
46 {services: [batteryServiceUuid]},
47 {services: [glucoseServiceUuid, heartRateServiceUuid]}
48 ],
49 optionalServices: [genericAccessServiceUuid]
50 }).catch(function(e) {
51 assert_equals(e.name, 'NotFoundError',
52 'Started discovery with an unexpected set of UUIDs.');
53 });
54 }, 'Filters restrict the platform\'s Bluetooth scan.');
55
56 sequential_promise_test(function() {
57 testRunner.setBluetoothMockDataSet('MultiDeviceAdapter');
58 return Promise.all([
59 navigator.bluetooth.requestDevice({
60 filters: [{services: [glucoseServiceUuid]}]
61 }).then(function(device) {
62 assert_equals(device.name, "Glucose Device");
63 }),
64 navigator.bluetooth.requestDevice({
65 filters: [{services: [heartRateServiceUuid]}]
66 }).then(function(device) {
67 assert_equals(device.name, "Heart Rate Device");
68 }),
69 ]);
70 }, 'Filters determine the returned devices.');
71
41 </script> 72 </script>
OLDNEW
« 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