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

Unified Diff: LayoutTests/fast/encoding/api/legacy-encode.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/legacy-encode.html
diff --git a/LayoutTests/fast/encoding/api/legacy-encode.html b/LayoutTests/fast/encoding/api/legacy-encode.html
index f01b93b460760042f0b947ffcd025338e07e4dfb..186e2731722d001ec001a74e4faf6984ccc7aa25 100644
--- a/LayoutTests/fast/encoding/api/legacy-encode.html
+++ b/LayoutTests/fast/encoding/api/legacy-encode.html
@@ -1,20 +1,25 @@
<!DOCTYPE html>
-<script src="../../../resources/js-test.js"></script>
+<title>Encoding API: Legacy encodings</title>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
<script src="resources/shared.js"></script>
<script>
-description("Non-UTF encodings supported only for decode, not encode");
-
encodings_table.forEach(function(section) {
section.encodings.forEach(function(encoding) {
if (encoding.name === "replacement")
return;
+
if (utf_encodings.indexOf(encoding.name) !== -1) {
- shouldBeEqualToString("new TextDecoder(" + JSON.stringify(encoding.name) + ").encoding", encoding.name);
- shouldBeEqualToString("new TextEncoder(" + JSON.stringify(encoding.name) + ").encoding", encoding.name);
+ test(function() {
+ assert_equals(new TextDecoder(encoding.name).encoding, encoding.name);
+ assert_equals(new TextEncoder(encoding.name).encoding, encoding.name);
+ }, "UTF encodings are supported for encode and decode");
} else {
- shouldBeEqualToString("new TextDecoder(" + JSON.stringify(encoding.name) + ").encoding", encoding.name);
- shouldThrow("new TextEncoder(" + JSON.stringify(encoding.name) + ").encoding");
+ test(function() {
+ assert_equals(new TextDecoder(encoding.name).encoding, encoding.name);
+ assert_throws({name:'TypeError'}, function() { new TextEncoder(encoding.name); });
+ }, "Non-UTF encodings supported only for decode, not encode");
}
});
});
« no previous file with comments | « LayoutTests/fast/encoding/api/latin-1-expected.txt ('k') | LayoutTests/fast/encoding/api/legacy-encode-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698