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

Unified Diff: LayoutTests/fast/encoding/api/latin-1.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/latin-1.html
diff --git a/LayoutTests/fast/encoding/api/latin-1.html b/LayoutTests/fast/encoding/api/latin-1.html
index 853204f6468b5092aebc4f4dd0df0cc096697f1c..6d8fafa95101b329df591946803da96fe64a4407 100644
--- a/LayoutTests/fast/encoding/api/latin-1.html
+++ b/LayoutTests/fast/encoding/api/latin-1.html
@@ -1,37 +1,36 @@
-B<!DOCTYPE html>
-<script src="../../../resources/js-test.js"></script>
+<!DOCTYPE html>
+<title>Encoding API: Latin-1 decoders</title>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
<script src="resources/shared.js"></script>
<script>
-description("Verify that Latin-1 decoders (windows-1252, iso-8859-1, us-ascii, etc) decode identically.");
-
// Blink uses separate decoder object intances for these encoding aliases,
// so test that they are behaving identically.
-var labels;
-encodings_table.forEach(function(section) {
- section.encodings.forEach(function(encoding) {
- if (encoding.name === "windows-1252")
- labels = encoding.labels;
+test(function() {
+
+ var labels;
+ encodings_table.forEach(function(section) {
+ section.encodings.forEach(function(encoding) {
+ if (encoding.name === 'windows-1252')
+ labels = encoding.labels;
+ });
});
-});
-labels = labels.filter(function(label) { return label !== 'windows-1252'; });
-
-evalAndLog("array = new Uint8Array(256)");
-debug("initialize array to 0...255");
-for (var cp = 0; cp <= 255; ++cp) {
- array[cp] = cp;
-}
-
-evalAndLog("windows1252 = new TextDecoder('windows-1252')");
-
-labels.forEach(function(label) {
- decoder = null;
- evalAndLog("decoder = new TextDecoder(" + JSON.stringify(label) + ")");
- // Above may throw if encoding unsupported.
- if (decoder) {
- shouldBe("decoder.decode(array)", "windows1252.decode(array)");
+ labels = labels.filter(function(label) { return label !== 'windows-1252'; });
+
+ var array = new Uint8Array(256);
+ for (var cp = 0; cp <= 255; ++cp) {
+ array[cp] = cp;
}
-});
+
+ var windows1252 = new TextDecoder('windows-1252');
+
+ labels.forEach(function(label) {
+ var decoder = new TextDecoder(label);
+ assert_equals(decoder.decode(array), windows1252.decode(array));
+ });
+
+}, 'Latin-1 decoders (windows-1252, iso-8859-1, us-ascii, etc) decode identically.');
</script>
« no previous file with comments | « LayoutTests/fast/encoding/api/fatal-flag-expected.txt ('k') | LayoutTests/fast/encoding/api/latin-1-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698