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

Side by Side Diff: LayoutTests/fast/encoding/api/utf-round-trip.html

Issue 1196733003: Remove duplicate Encoding API tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Encoding API: UTF encoding round trips</title> 2 <title>Encoding API: UTF encoding round trips</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/encodings.js"></script>
6 <script> 6 <script>
7 7
8 var BATCH_SIZE = 0x1000; // Convert in batches spanning this many code points. 8 var BATCH_SIZE = 0x1000; // Convert in batches spanning this many code points.
9 var SKIP_SIZE = 0x77; // For efficiency, don't test every code point. 9 var SKIP_SIZE = 0x77; // For efficiency, don't test every code point.
10 10
11 function fromCodePoint(cp) { 11 function fromCodePoint(cp) {
12 if (0xD800 <= cp && cp <= 0xDFFF) throw new Error('Invalid code point'); 12 if (0xD800 <= cp && cp <= 0xDFFF) throw new Error('Invalid code point');
13 13
14 if (cp <= 0xFFFF) 14 if (cp <= 0xFFFF)
15 return String.fromCharCode(cp); 15 return String.fromCharCode(cp);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 for (var i = 0; i < 0x10FFFF; i += BATCH_SIZE) { 70 for (var i = 0; i < 0x10FFFF; i += BATCH_SIZE) {
71 var string = makeBatch(i); 71 var string = makeBatch(i);
72 var encoded = encode_utf8(string); 72 var encoded = encode_utf8(string);
73 var expected = decode_utf8(encoded); 73 var expected = decode_utf8(encoded);
74 var actual = new TextDecoder('UTF-8').decode(new Uint8Array(encoded)); 74 var actual = new TextDecoder('UTF-8').decode(new Uint8Array(encoded));
75 assert_equals(actual, expected); 75 assert_equals(actual, expected);
76 } 76 }
77 }, 'UTF-8 decoding (compare against decodeURIComponent/escape)'); 77 }, 'UTF-8 decoding (compare against decodeURIComponent/escape)');
78 78
79 </script> 79 </script>
OLDNEW
« no previous file with comments | « LayoutTests/fast/encoding/api/textencoder-labels.html ('k') | LayoutTests/fast/encoding/api/utf16-surrogates.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698