blob: 0e6c7959ba2ddd3654838b6e488775d32f553f63 [file] [log] [blame]
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/bluetooth/bluetooth-helpers.js"></script>
<script src="../../resources/bluetooth/web-bluetooth-test.js"></script>
<script src="../../resources/mojo-helpers.js"></script>
<script>
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');
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.');
</script>