blob: 1f8df9814019d2abaa93e4c3ad097f4d924fafd6 [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: [{name: 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 ' +
'\'name\' must throw TypeError.');
</script>