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

Side by Side Diff: LayoutTests/fast/encoding/api/ascii-supersets.html

Issue 145973021: Implement "replacement" text encoding. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reworked tests, still WIP Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/encoding/api/ascii-supersets-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Encoding API: ASCII supersets</title> 2 <title>Encoding API: ASCII supersets</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/shared.js"></script> 5 <script src="resources/shared.js"></script>
6 <script> 6 <script>
7 7
8 // Encodings that have escape codes in 0x00-0x7F 8 // Encodings that have escape codes in 0x00-0x7F
9 var escape_codes = { 9 var escape_codes = {
10 'hz-gb-2312': [ 0x7E ],
11 'iso-2022-jp': [ 0x1B ], 10 'iso-2022-jp': [ 0x1B ],
12 'iso-2022-kr': [ 0x0E, 0x0F, 0x1B ] 11 'iso-2022-kr': [ 0x0E, 0x0F, 0x1B ]
13 }; 12 };
14 13
15 encodings_table.forEach(function(section) { 14 encodings_table.forEach(function(section) {
16 section.encodings.filter(function(encoding) { 15 section.encodings.filter(function(encoding) {
17 return encoding.name !== 'replacement'; 16 return encoding.name !== 'replacement';
18 }).forEach(function(encoding) { 17 }).forEach(function(encoding) {
19 if (utf_encodings.indexOf(encoding.name) !== -1) 18 if (utf_encodings.indexOf(encoding.name) !== -1)
20 return; 19 return;
21 20
22 test(function() { 21 test(function() {
23 var string = ''; 22 var string = '';
24 var bytes = []; 23 var bytes = [];
25 for (var i = 0; i < 128; ++i) { 24 for (var i = 0; i < 128; ++i) {
26 if (encoding.name in escape_codes && escape_codes[encoding.name] .indexOf(i) !== -1) 25 if (encoding.name in escape_codes && escape_codes[encoding.name] .indexOf(i) !== -1)
27 continue; 26 continue;
28 string += String.fromCharCode(i); 27 string += String.fromCharCode(i);
29 bytes.push(i); 28 bytes.push(i);
30 } 29 }
31 30
32 var decoder = new TextDecoder(encoding.name); 31 var decoder = new TextDecoder(encoding.name);
33 var decoded = decoder.decode(new Uint8Array(bytes)); 32 var decoded = decoder.decode(new Uint8Array(bytes));
34 assert_equals(decoded, string); 33 assert_equals(decoded, string);
35 }, 'ASCII superset encoding: ' + encoding.name); 34 }, 'ASCII superset encoding: ' + encoding.name);
36 }); 35 });
37 }); 36 });
38 37
39 </script> 38 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/encoding/api/ascii-supersets-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698