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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/encoding/textdecoder-fatal-single-byte.html

Issue 1990653002: Move the encoding directory from web-platform-tests/ to wpt/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
(Empty)
1 <!DOCTYPE html>
2 <title>Encoding API: Fatal flag for single byte encodings</title>
3 <script src="../../../resources/testharness.js"></script>
4 <script src="../../../resources/testharnessreport.js"></script>
5 <script>
6
7 var singleByteEncodings = [
8 {encoding: 'IBM866', bad: []},
9 {encoding: 'ISO-8859-2', bad: []},
10 {encoding: 'ISO-8859-3', bad: [0xA5, 0xAE, 0xBE, 0xC3, 0xD0, 0xE3, 0xF0]},
11 {encoding: 'ISO-8859-4', bad: []},
12 {encoding: 'ISO-8859-5', bad: []},
13 {encoding: 'ISO-8859-6', bad: [0xA1, 0xA2, 0xA3, 0xA5, 0xA6, 0xA7, 0xA8, 0x A9, 0xAA, 0xAB, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8 , 0xB9, 0xBA, 0xBC, 0xBD, 0xBE, 0xC0, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF]},
14 {encoding: 'ISO-8859-7', bad: [0xAE, 0xD2, 0xFF]},
15 {encoding: 'ISO-8859-8', bad: [0xA1, 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0x C5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2 , 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xFB, 0xFC, 0xFF]},
16 {encoding: 'ISO-8859-8-I', bad: [0xA1, 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0x D2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xFB , 0xFC, 0xFF]},
17 {encoding: 'ISO-8859-10', bad: []},
18 {encoding: 'ISO-8859-13', bad: []},
19 {encoding: 'ISO-8859-14', bad: []},
20 {encoding: 'ISO-8859-15', bad: []},
21 {encoding: 'ISO-8859-16', bad: []},
22 {encoding: 'KOI8-R', bad: []},
23 {encoding: 'KOI8-U', bad: []},
24 {encoding: 'macintosh', bad: []},
25 {encoding: 'windows-874', bad: [0xDB, 0xDC, 0xDD, 0xDE, 0xFC, 0xFD, 0xFE, 0 xFF]},
26 {encoding: 'windows-1250', bad: []},
27 {encoding: 'windows-1251', bad: []},
28 {encoding: 'windows-1252', bad: []},
29 {encoding: 'windows-1253', bad: [0xAA, 0xD2, 0xFF]},
30 {encoding: 'windows-1254', bad: []},
31 {encoding: 'windows-1255', bad: [0xCA, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xFB, 0xFC, 0xFF]},
32 {encoding: 'windows-1256', bad: []},
33 {encoding: 'windows-1257', bad: [0xA1, 0xA5]},
34 {encoding: 'windows-1258', bad: []},
35 {encoding: 'x-mac-cyrillic', bad: []},
36 ];
37
38 singleByteEncodings.forEach(function(t) {
39 for (var i = 0; i < 256; ++i) {
40 if (t.bad.indexOf(i) != -1) {
41 test(function() {
42 assert_throws(new TypeError(), function() {
43 new TextDecoder(t.encoding, {fatal: true}).decode(new Uint8A rray([i]));
44 });
45 }, 'Throw due to fatal flag: ' + t.encoding + ' doesn\'t have a poin ter ' + i);
46 }
47 else {
48 test(function() {
49 assert_equals(typeof new TextDecoder(t.encoding, {fatal: true}). decode(new Uint8Array([i])), "string");
50 }, 'Not throw: ' + t.encoding + ' has a pointer ' + i);
51 }
52 }
53 });
54
55 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698