summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-name-unicode.https.window.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testing/web-platform/tests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-name-unicode.https.window.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/testing/web-platform/tests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-name-unicode.https.window.js b/testing/web-platform/tests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-name-unicode.https.window.js
new file mode 100644
index 0000000000..3458c92b65
--- /dev/null
+++ b/testing/web-platform/tests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-name-unicode.https.window.js
@@ -0,0 +1,20 @@
+// META: script=/resources/testdriver.js
+// META: script=/resources/testdriver-vendor.js
+// META: script=/bluetooth/resources/bluetooth-test.js
+// META: script=/bluetooth/resources/bluetooth-fake-devices.js
+'use strict';
+const test_desc = 'Unicode string with utf8 representation longer than 248 ' +
+ 'bytes in \'name\' must throw TypeError.';
+const expected = new DOMException(
+ 'Failed to execute \'requestDevice\' on \'Bluetooth\': ' +
+ 'A device name can\'t be longer than 248 bytes.',
+ new TypeError());
+// \u2764's UTF-8 representation is 3 bytes long.
+// 83 chars * 3 bytes/char = 249 bytes
+const unicode_name = '\u2764'.repeat(83);
+
+bluetooth_test(
+ () => assert_promise_rejects_with_message(
+ requestDeviceWithTrustedClick({filters: [{name: unicode_name}]}),
+ expected),
+ test_desc);