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

Unified Diff: LayoutTests/fast/encoding/api/ascii-supersets.html

Issue 15901002: Implement Encoding API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebaseline webexposed global constructor tests Created 7 years, 5 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
new file mode 100644
index 0000000000000000000000000000000000000000..c9f6f2e6337b582729de2506cc7795bad6177095
--- /dev/null
+++ b/LayoutTests/fast/encoding/api/ascii-supersets.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/shared.js"></script>
+<script>
+
+description("Supersets of ASCII decode ASCII correctly");
+
+encodings = legacy_encodings.slice();
+encodings.unshift('utf-8');
+
+// 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 ]
+};
+
+encodings.forEach(function (encoding) {
+ string = '';
+ decoded = null;
+ bytes = [];
+ for (var i = 0; i < 128; ++i) {
+ if (encoding in escape_codes && escape_codes[encoding].indexOf(i) !== -1)
+ continue;
+ string += String.fromCharCode(i);
+ bytes.push(i);
+ }
+ evalAndLog("decoder = new TextDecoder('"+encoding+"')");
+ evalAndLog("decoded = decoder.decode(new Uint8Array(bytes))");
+ // encodeURIComponent ensures output is printable
+ shouldBe("encodeURIComponent(string)", "encodeURIComponent(decoded)");
+});
+
+
+</script>
+<script src="../../js/resources/js-test-post.js"></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