blob: 37e9ee06bd1e78bf0990ea6cbf2948afb38c68e9 [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>
'use strict';
bluetooth_test(() => {
// \u2764's UTF-8 respresentation is 3 bytes long.
// 83 chars * 3 bytes/char = 249 bytes
const unicode_name = '\u2764'.repeat(83);
return assert_promise_rejects_with_message(
requestDeviceWithKeyDown({filters: [{namePrefix: unicode_name}]}),
new DOMException(
'Failed to execute \'requestDevice\' on \'Bluetooth\': ' +
'A device name can\'t be longer than 248 bytes.',
'TypeError'));
}, 'Unicode string with utf8 representation longer than 248 bytes in ' +
'\'namePrefix\' must throw NotFoundError.');
</script>