Commit ced8acfc authored by Conley Owens's avatar Conley Owens Committed by Commit Bot

bluetooth: Update BluetoothDevice IDL tests

These tests were not functioning correctly because `assert_throws` was
not being passed an Error.  Furthermore, the use of the `expected.txt`
file is brittle since it includes a warning output with a line number.

BUG=769404

Change-Id: Ie867e6b99fc87d7c9b8b7259684f2ddd3cdc37a2
Reviewed-on: https://chromium-review.googlesource.com/688295Reviewed-by: default avatarVincent Scheib <scheib@chromium.org>
Commit-Queue: Conley Owens <cco3@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505429}
parent c2984f64
...@@ -5,27 +5,27 @@ ...@@ -5,27 +5,27 @@
<script src="../../resources/bluetooth/web-bluetooth-test.js"></script> <script src="../../resources/bluetooth/web-bluetooth-test.js"></script>
<script src="../../resources/mojo-helpers.js"></script> <script src="../../resources/mojo-helpers.js"></script>
<script> <script>
'use strict';
const test_desc_idl = 'BluetoothDevice IDL test.';
test(() => { test(() => {
assert_throws(null, () => new BluetoothDevice(), assert_throws(new TypeError(), () => new BluetoothDevice(),
'the constructor should not be callable with "new"'); 'the constructor should not be callable with "new"');
assert_throws(null, () => BluetoothDevice(), assert_throws(new TypeError(), () => BluetoothDevice(),
'the constructor should not be callable'); 'the constructor should not be callable');
}, 'BluetoothDevice IDL test'); }, test_desc_idl);
promise_test(() => { const test_desc_attr = 'BluetoothDevice attributes.';
return setUpHealthThermometerAndHeartRateDevices() let device;
.then(() => requestDeviceWithKeyDown({ promise_test(() => getHealthThermometerDevice()
filters: [{services: ['heart_rate']}]})) .then(_ => ({device} = _))
.then(device => { .then(() => {
assert_equals(device.constructor.name, 'BluetoothDevice'); assert_equals(device.constructor.name, 'BluetoothDevice');
var old_device_id = device.id;
// Attempt (and fail) to overwrite all members, verifying they are assert_throws(new TypeError(), () => device.id = 'overwritten',
// readonly. 'the device id should not be writable');
var old_device_id = device.id; assert_throws(new TypeError(), () => device.name = 'overwritten',
device.id = 'overwritten'; 'the device name should not be writable');
device.name = 'overwritten'; assert_equals(device.id, old_device_id);
assert_equals(device.id, old_device_id); assert_equals(device.name, 'Health Thermometer');
assert_equals(device.name, 'Heart Rate'); }), test_desc_attr);
});
}, 'BluetoothDevice attributes.');
</script> </script>
This is a testharness.js-based test.
FAIL BluetoothDevice IDL test Test bug: need to pass exception to assert_throws()
PASS BluetoothDevice attributes.
Harness: the test ran to completion.
CONSOLE MESSAGE: line 169: Web Bluetooth is experimental on this platform. See https://github.com/WebBluetoothCG/web-bluetooth/blob/gh-pages/implementation-status.md
This is a testharness.js-based test.
FAIL BluetoothDevice IDL test Test bug: need to pass exception to assert_throws()
PASS BluetoothDevice attributes.
Harness: the test ran to completion.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment