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

Unified Diff: LayoutTests/fast/encoding/api/streaming-decode.html

Issue 240283013: Convert Encoding API tests to W3C testharness.js (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move UTF-16 surrogate tests to separate file Created 6 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/encoding/api/streaming-decode.html
diff --git a/LayoutTests/fast/encoding/api/streaming-decode.html b/LayoutTests/fast/encoding/api/streaming-decode.html
index 53e6c3cbfafc355c052452ec43aec03a46cdb4e8..34ffccc0161a644bda48a424fdb73612c96b8b3b 100644
--- a/LayoutTests/fast/encoding/api/streaming-decode.html
+++ b/LayoutTests/fast/encoding/api/streaming-decode.html
@@ -1,28 +1,28 @@
<!DOCTYPE html>
-<script src="../../../resources/js-test.js"></script>
+<title>Encoding API: Streaming decode</title>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
<script src="resources/shared.js"></script>
<script>
-description("Test streaming decoding using the Encoding API.");
-
-evalAndLog("string = '\\x00123ABCabc\\x80\\xFF\\u0100\\u1000\\uFFFD\\uD800\\uDC00\\uDBFF\\uDFFF'");
+var string = '\\x00123ABCabc\\x80\\xFF\\u0100\\u1000\\uFFFD\\uD800\\uDC00\\uDBFF\\uDFFF';
utf_encodings.forEach(function (encoding) {
- debug("");
- evalAndLog("encoded = new TextEncoder('" + encoding + "').encode(string)");
-
for (var len = 1; len <= 5; ++len) {
- evalAndLog("out = ''");
- evalAndLog("decoder = new TextDecoder('" + encoding + "')");
- for (var i = 0; i < encoded.length; i += len) {
- var sub = [];
- for (var j = i; j < encoded.length && j < i + len; ++j) {
- sub.push(encoded[j]);
+ test(function() {
+ var encoded = new TextEncoder(encoding).encode(string);
+
+ var out = '';
+ var decoder = new TextDecoder(encoding);
+ for (var i = 0; i < encoded.length; i += len) {
+ var sub = [];
+ for (var j = i; j < encoded.length && j < i + len; ++j)
+ sub.push(encoded[j]);
+ out += decoder.decode(new Uint8Array(sub), {stream: true});
}
- evalAndLog("out += decoder.decode(new Uint8Array(" + JSON.stringify(sub) + "), {stream: true})");
- }
- evalAndLog("out += decoder.decode()");
- shouldBeEqualToString("out", string);
+ out += decoder.decode();
+ assert_equals(out, string);
+ }, 'Streaming decode: ' + encoding + ', ' + len + ' byte window');
}
});
« no previous file with comments | « LayoutTests/fast/encoding/api/resources/shared.js ('k') | LayoutTests/fast/encoding/api/streaming-decode-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698