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

Side by Side 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, 7 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../../resources/js-test.js"></script> 2 <title>Encoding API: Legacy encodings</title>
3 <script src="../../../resources/testharness.js"></script>
4 <script src="../../../resources/testharnessreport.js"></script>
3 <script src="resources/shared.js"></script> 5 <script src="resources/shared.js"></script>
4 <script> 6 <script>
5 7
6 description("Non-UTF encodings supported only for decode, not encode");
7
8 encodings_table.forEach(function(section) { 8 encodings_table.forEach(function(section) {
9 section.encodings.forEach(function(encoding) { 9 section.encodings.forEach(function(encoding) {
10 if (encoding.name === "replacement") 10 if (encoding.name === "replacement")
11 return; 11 return;
12
12 if (utf_encodings.indexOf(encoding.name) !== -1) { 13 if (utf_encodings.indexOf(encoding.name) !== -1) {
13 shouldBeEqualToString("new TextDecoder(" + JSON.stringify(encoding.n ame) + ").encoding", encoding.name); 14 test(function() {
14 shouldBeEqualToString("new TextEncoder(" + JSON.stringify(encoding.n ame) + ").encoding", encoding.name); 15 assert_equals(new TextDecoder(encoding.name).encoding, encoding. name);
16 assert_equals(new TextEncoder(encoding.name).encoding, encoding. name);
17 }, "UTF encodings are supported for encode and decode");
15 } else { 18 } else {
16 shouldBeEqualToString("new TextDecoder(" + JSON.stringify(encoding.n ame) + ").encoding", encoding.name); 19 test(function() {
17 shouldThrow("new TextEncoder(" + JSON.stringify(encoding.name) + "). encoding"); 20 assert_equals(new TextDecoder(encoding.name).encoding, encoding. name);
21 assert_throws({name:'TypeError'}, function() { new TextEncoder(e ncoding.name); });
22 }, "Non-UTF encodings supported only for decode, not encode");
18 } 23 }
19 }); 24 });
20 }); 25 });
21 26
22 </script> 27 </script>
OLDNEW
« 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