Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/encoding/api-invalid-label.html

Issue 1899623002: Import latest web-platform-tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: handle new failures Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Encoding API: invalid label</title> 2 <title>Encoding API: invalid label</title>
3 <meta name="timeout" content="long"> 3 <meta name="timeout" content="long">
4 <script src="../../../resources/testharness.js"></script> 4 <script src="../../../resources/testharness.js"></script>
5 <script src="../../../resources/testharnessreport.js"></script> 5 <script src="../../../resources/testharnessreport.js"></script>
6 <script src="resources/encodings.js"></script> 6 <script src="resources/encodings.js"></script>
7 <script> 7 <script>
8 var tests = ["invalid-invalidLabel"]; 8 var tests = ["invalid-invalidLabel"];
9 setup(function() { 9 setup(function() {
10 encodings_table.forEach(function(section) { 10 encodings_table.forEach(function(section) {
11 section.encodings.filter(function(encoding) { 11 section.encodings.filter(function(encoding) {
12 return encoding.name !== 'replacement'; 12 return encoding.name !== 'replacement';
13 }).forEach(function(encoding) { 13 }).forEach(function(encoding) {
14 encoding.labels.forEach(function(label) { 14 encoding.labels.forEach(function(label) {
15 ["\u0000", "\u000b", "\u00a0", "\u2028", "\u2029"].forEach(function(ws) { 15 ["\u0000", "\u000b", "\u00a0", "\u2028", "\u2029"].forEach(function(ws) {
16 tests.push(ws + label); 16 tests.push(ws + label);
17 tests.push(label + ws); 17 tests.push(label + ws);
18 tests.push(ws + label + ws); 18 tests.push(ws + label + ws);
19 }); 19 });
20 }); 20 });
21 }); 21 });
22 }); 22 });
23 }); 23 });
24 24
25 tests.forEach(function(input) { 25 tests.forEach(function(input) {
26 test(function() { 26 test(function() {
27 assert_throws(new RangeError(), function() { new TextEncoder(input); });
28 }, 'Invalid label ' + format_value(input) + ' should be rejected by TextEncode r.');
29
30 test(function() {
31 assert_throws(new RangeError(), function() { new TextDecoder(input); }); 27 assert_throws(new RangeError(), function() { new TextDecoder(input); });
32 }, 'Invalid label ' + format_value(input) + ' should be rejected by TextDecode r.'); 28 }, 'Invalid label ' + format_value(input) + ' should be rejected by TextDecode r.');
33 }); 29 });
34 </script> 30 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698