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 @@
<script src="../../resources/bluetooth/web-bluetooth-test.js"></script>
<script src="../../resources/mojo-helpers.js"></script>
<script>
'use strict';
const test_desc_idl = 'BluetoothDevice IDL test.';
test(() => {
assert_throws(null, () => new BluetoothDevice(),
'the constructor should not be callable with "new"');
assert_throws(null, () => BluetoothDevice(),
'the constructor should not be callable');
}, 'BluetoothDevice IDL test');
assert_throws(new TypeError(), () => new BluetoothDevice(),
'the constructor should not be callable with "new"');
assert_throws(new TypeError(), () => BluetoothDevice(),
'the constructor should not be callable');
}, test_desc_idl);
promise_test(() => {
return setUpHealthThermometerAndHeartRateDevices()
.then(() => requestDeviceWithKeyDown({
filters: [{services: ['heart_rate']}]}))
.then(device => {
assert_equals(device.constructor.name, 'BluetoothDevice');
// Attempt (and fail) to overwrite all members, verifying they are
// readonly.
var old_device_id = device.id;
device.id = 'overwritten';
device.name = 'overwritten';
assert_equals(device.id, old_device_id);
assert_equals(device.name, 'Heart Rate');
});
}, 'BluetoothDevice attributes.');
const test_desc_attr = 'BluetoothDevice attributes.';
let device;
promise_test(() => getHealthThermometerDevice()
.then(_ => ({device} = _))
.then(() => {
assert_equals(device.constructor.name, 'BluetoothDevice');
var old_device_id = device.id;
assert_throws(new TypeError(), () => device.id = 'overwritten',
'the device id should not be writable');
assert_throws(new TypeError(), () => device.name = 'overwritten',
'the device name should not be writable');
assert_equals(device.id, old_device_id);
assert_equals(device.name, 'Health Thermometer');
}), test_desc_attr);
</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