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

Unified Diff: LayoutTests/fast/encoding/api/ascii-supersets.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
« no previous file with comments | « no previous file | LayoutTests/fast/encoding/api/ascii-supersets-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/encoding/api/ascii-supersets.html
diff --git a/LayoutTests/fast/encoding/api/ascii-supersets.html b/LayoutTests/fast/encoding/api/ascii-supersets.html
index d336c0da10dee2edeea7495957ff2c0ee427f615..15bdbe9934246e29f21ecb817d9016fd6c7a64af 100644
--- a/LayoutTests/fast/encoding/api/ascii-supersets.html
+++ b/LayoutTests/fast/encoding/api/ascii-supersets.html
@@ -1,43 +1,39 @@
<!DOCTYPE html>
-<script src="../../../resources/js-test.js"></script>
+<title>Encoding API: ASCII supersets</title>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
<script src="resources/shared.js"></script>
<script>
-description("Supersets of ASCII decode ASCII correctly");
-
// Encodings that have escape codes in 0x00-0x7F
var escape_codes = {
- "hz-gb-2312": [ 0x7E ],
- "iso-2022-jp": [ 0x1B ],
- "iso-2022-kr": [ 0x0E, 0x0F, 0x1B ]
+ 'hz-gb-2312': [ 0x7E ],
+ 'iso-2022-jp': [ 0x1B ],
+ 'iso-2022-kr': [ 0x0E, 0x0F, 0x1B ]
};
encodings_table.forEach(function(section) {
section.encodings.forEach(function(encoding) {
- if (encoding.name === "replacement")
+ if (encoding.name === 'replacement')
return;
if (utf_encodings.indexOf(encoding.name) !== -1)
return;
- string = '';
- decoded = null;
- bytes = [];
- for (var i = 0; i < 128; ++i) {
- if (encoding.name in escape_codes && escape_codes[encoding.name].indexOf(i) !== -1)
- continue;
- string += String.fromCharCode(i);
- bytes.push(i);
- }
+ test(function() {
+ var string = '';
+ var bytes = [];
+ for (var i = 0; i < 128; ++i) {
+ if (encoding.name in escape_codes && escape_codes[encoding.name].indexOf(i) !== -1)
+ continue;
+ string += String.fromCharCode(i);
+ bytes.push(i);
+ }
- decoder = null;
- evalAndLog("decoder = new TextDecoder(" + JSON.stringify(encoding.name) + ")");
- if (decoder) {
- evalAndLog("decoded = decoder.decode(new Uint8Array(bytes))");
- // encodeURIComponent ensures output is printable
- shouldBe("encodeURIComponent(string)", "encodeURIComponent(decoded)");
- }
+ var decoder = new TextDecoder(encoding.name);
+ var decoded = decoder.decode(new Uint8Array(bytes));
+ assert_equals(decoded, string);
+ }, 'ASCII superset encoding: ' + encoding.name);
});
});
-
</script>
« 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