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

Side by Side Diff: LayoutTests/bluetooth/idl-BluetoothDevice.html

Issue 1182973002: Implement the Blink side of RequestDeviceOptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@pinned
Patch Set: Prepare readValue.html for a mock data change 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/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 <script src="bluetooth-helpers.js"></script> 4 <script src="bluetooth-helpers.js"></script>
5 <script> 5 <script>
6 test(function() { 6 test(function() {
7 assert_throws(null, function() { new BluetoothDevice(); }, 7 assert_throws(null, function() { new BluetoothDevice(); },
8 'the constructor should not be callable with "new"'); 8 'the constructor should not be callable with "new"');
9 assert_throws(null, function() { BluetoothDevice(); }, 9 assert_throws(null, function() { BluetoothDevice(); },
10 'the constructor should not be callable'); 10 'the constructor should not be callable');
11 }, 'BluetoothDevice IDL test'); 11 }, 'BluetoothDevice IDL test');
12 12
13 test(function(t) { assert_exists(window, "testRunner"); t.done(); }, 13 test(function(t) { assert_exists(window, "testRunner"); t.done(); },
14 "window.testRunner is required for the following tests."); 14 "window.testRunner is required for the following tests.");
15 15
16 sequential_promise_test(function() { 16 sequential_promise_test(function() {
17 testRunner.setBluetoothMockDataSet('SingleEmptyDeviceAdapter'); 17 testRunner.setBluetoothMockDataSet('SingleEmptyDeviceAdapter');
18 return navigator.bluetooth.requestDevice().then(function(device) { 18 return navigator.bluetooth.requestDevice({
19 filters: [{services: [genericAccessServiceUuid]}]
20 }).then(function(device) {
19 assert_equals(device.constructor.name, "BluetoothDevice"); 21 assert_equals(device.constructor.name, "BluetoothDevice");
20 22
21 // Attempt (and fail) to overwrite all members, verifying they are readonly. 23 // Attempt (and fail) to overwrite all members, verifying they are readonly.
22 device.instanceID = "overwritten"; 24 device.instanceID = "overwritten";
23 device.name = "overwritten"; 25 device.name = "overwritten";
24 device.deviceClass = "overwritten"; 26 device.deviceClass = "overwritten";
25 device.vendorIDSource = "overwritten"; 27 device.vendorIDSource = "overwritten";
26 device.vendorID = "overwritten"; 28 device.vendorID = "overwritten";
27 device.productID = "overwritten"; 29 device.productID = "overwritten";
28 device.productVersion = "overwritten"; 30 device.productVersion = "overwritten";
29 device.paired = "overwritten"; 31 device.paired = "overwritten";
30 device.uuids = "overwritten"; 32 device.uuids = "overwritten";
31 33
32 assert_equals(device.instanceID, "Empty Mock Device instanceID"); 34 assert_equals(device.instanceID, "Empty Mock Device instanceID");
33 assert_equals(device.name, "Empty Mock Device name"); 35 assert_equals(device.name.slice(0, 17), "Empty Mock Device");
34 assert_equals(device.deviceClass, 0x1F00); 36 assert_equals(device.deviceClass, 0x1F00);
35 assert_equals(device.vendorIDSource, "bluetooth"); 37 assert_equals(device.vendorIDSource, "bluetooth");
36 assert_equals(device.vendorID, 0xFFFF); 38 assert_equals(device.vendorID, 0xFFFF);
37 assert_equals(device.productID, 1); 39 assert_equals(device.productID, 1);
38 assert_equals(device.productVersion, 2); 40 assert_equals(device.productVersion, 2);
39 assert_equals(device.paired, true); 41 assert_equals(device.paired, true);
40 assert_equals(device.uuids[0], "00001800-0000-1000-8000-00805f9b34fb"); 42 assert_equals(device.uuids[0], genericAccessServiceUuid);
41 assert_equals(device.uuids[1], "00001801-0000-1000-8000-00805f9b34fb"); 43 assert_equals(device.uuids[1], genericAttributeServiceUuid);
42 }); 44 });
43 }, 'BluetoothDevice attributes.'); 45 }, 'BluetoothDevice attributes.');
44 </script> 46 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698