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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/encoding/textencoder-constructor-non-utf.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: Legacy encodings</title> 2 <title>Encoding API: Legacy encodings</title>
3 <script src="../../../resources/testharness.js"></script> 3 <script src="../../../resources/testharness.js"></script>
4 <script src="../../../resources/testharnessreport.js"></script> 4 <script src="../../../resources/testharnessreport.js"></script>
5 <script src="resources/encodings.js"></script> 5 <script src="resources/encodings.js"></script>
6 <script> 6 <script>
7 7
8 encodings_table.forEach(function(section) { 8 encodings_table.forEach(function(section) {
9 section.encodings.filter(function(encoding) { 9 section.encodings.forEach(function(encoding) {
10 return encoding.name !== 'replacement'; 10 if (encoding.name !== 'replacement') {
11 }).forEach(function(encoding) {
12 if (utf_encodings.indexOf(encoding.name) !== -1) {
13 test(function() { 11 test(function() {
14 assert_equals(new TextDecoder(encoding.name).encoding, encoding. name); 12 assert_equals(new TextDecoder(encoding.name).encoding, encoding. name);
15 assert_equals(new TextEncoder(encoding.name).encoding, encoding. name); 13 }, 'Encoding argument supported for decode: ' + encoding.name);
16 }, 'UTF encodings are supported for encode and decode: ' + encoding. name);
17 } else {
18 test(function() {
19 assert_equals(new TextDecoder(encoding.name).encoding, encoding. name);
20 assert_throws(new RangeError(), function() { new TextEncoder(enc oding.name); });
21 }, 'Non-UTF encodings supported only for decode, not encode: ' + enc oding.name);
22 } 14 }
15
16 test(function() {
17 assert_equals(new TextEncoder(encoding.name).encoding, 'utf-8');
18 }, 'Encoding argument not considered for encode: ' + encoding.name);
23 }); 19 });
24 }); 20 });
25 21
26 </script> 22 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698