blob: f5407057fb23b7d23ec0ccb32b9c9d66c07f8f45 [file] [log] [blame]
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
test(function() {
assert_throws(null, function() { new BluetoothDevice(); },
'the constructor should not be callable with "new"');
assert_throws(null, function() { BluetoothDevice(); },
'the constructor should not be callable');
}, 'BluetoothDevice IDL test');
test(function(t) { assert_exists(window, "testRunner"); t.done(); },
"window.testRunner is required for the following tests.");
async_test(function(t) {
testRunner.setBluetoothMockDataSet('Single Empty Device');
navigator.bluetooth.requestDevice()
.then(
t.step_func(function(device) {
assert_equals(device.constructor.name, "BluetoothDevice");
// Attempt (and fail) to overwrite all members, verifying they are readonly.
device.instanceID = "overwritten";
device.name = "overwritten";
device.deviceClass = "overwritten";
device.vendorIDSource = "overwritten";
device.vendorID = "overwritten";
device.productID = "overwritten";
device.productVersion = "overwritten";
device.paired = "overwritten";
device.uuids = "overwritten"
assert_equals(device.instanceID, "Empty Mock Device instanceID");
assert_equals(device.name, "Empty Mock Device name");
assert_equals(device.deviceClass, 0x1F00);
assert_equals(device.vendorIDSource, "bluetooth");
assert_equals(device.vendorID, 0xFFFF);
assert_equals(device.productID, 1);
assert_equals(device.productVersion, 2);
assert_equals(device.paired, true);
assert_equals(device.uuids[0], "00001800-0000-1000-8000-00805f9b34fb");
assert_equals(device.uuids[1], "00001801-0000-1000-8000-00805f9b34fb");
t.done();
}),
t.step_func(function() { assert_unreached('Mock was set to resolve.'); }));
}, 'BluetoothDevice attributes.');
</script>