OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
3 <script src="../../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
4 <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> | 4 <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> |
5 <script> | 5 <script> |
6 promise_test(() => { | 6 promise_test(() => { |
7 // \u2764's UTF-8 respresentation is 3 bytes long. | 7 // \u2764's UTF-8 respresentation is 3 bytes long. |
8 // 83 chars * 3 bytes/char = 249 bytes | 8 // 83 chars * 3 bytes/char = 249 bytes |
9 let unicode_name = generate_string(83, '\u2764'); | 9 let unicode_name = '\u2764'.repeat(83); |
10 return assert_promise_rejects_with_message( | 10 return assert_promise_rejects_with_message( |
11 requestDeviceWithKeyDown({filters: [{namePrefix: unicode_name}]}), | 11 requestDeviceWithKeyDown({filters: [{namePrefix: unicode_name}]}), |
12 new DOMException( | 12 new DOMException( |
13 'Failed to execute \'requestDevice\' on \'Bluetooth\': ' + | 13 'Failed to execute \'requestDevice\' on \'Bluetooth\': ' + |
14 'A device name can\'t be longer than 248 bytes.', | 14 'A device name can\'t be longer than 248 bytes.', |
15 'TypeError')); | 15 'TypeError')); |
16 }, 'Unicode string in \'namePrefix\' with utf8 representation greater than ' + | 16 }, 'Unicode string in \'namePrefix\' with utf8 representation greater than ' + |
17 '248 bytes must throw TypeError.'); | 17 '248 bytes must throw TypeError.'); |
18 </script> | 18 </script> |
OLD | NEW |