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

Side by Side Diff: LayoutTests/fast/encoding/api/streaming-decode.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
(Empty)
1 <!DOCTYPE html>
2 <title>Encoding API: Streaming decode</title>
3 <script src="../../../resources/testharness.js"></script>
4 <script src="../../../resources/testharnessreport.js"></script>
5 <script src="resources/shared.js"></script>
6 <script>
7
8 var string = '\\x00123ABCabc\\x80\\xFF\\u0100\\u1000\\uFFFD\\uD800\\uDC00\\uDBFF \\uDFFF';
9
10 utf_encodings.forEach(function (encoding) {
11 for (var len = 1; len <= 5; ++len) {
12 test(function() {
13 var encoded = new TextEncoder(encoding).encode(string);
14
15 var out = '';
16 var decoder = new TextDecoder(encoding);
17 for (var i = 0; i < encoded.length; i += len) {
18 var sub = [];
19 for (var j = i; j < encoded.length && j < i + len; ++j)
20 sub.push(encoded[j]);
21 out += decoder.decode(new Uint8Array(sub), {stream: true});
22 }
23 out += decoder.decode();
24 assert_equals(out, string);
25 }, 'Streaming decode: ' + encoding + ', ' + len + ' byte window');
26 }
27 });
28
29 </script>
OLDNEW
« no previous file with comments | « LayoutTests/fast/encoding/api/resources/shared.js ('k') | LayoutTests/fast/encoding/api/textdecoder-ignorebom.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698