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

Unified Diff: LayoutTests/fast/encoding/api/fatal-flag.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
Index: LayoutTests/fast/encoding/api/fatal-flag.html
diff --git a/LayoutTests/fast/encoding/api/fatal-flag.html b/LayoutTests/fast/encoding/api/fatal-flag.html
new file mode 100644
index 0000000000000000000000000000000000000000..6d5497038dc09c6bc4f71bb404f8b7ea2b08582f
--- /dev/null
+++ b/LayoutTests/fast/encoding/api/fatal-flag.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script>
+
+description("Test the Encoding API's 'fatal' flag");
+
+var bad = [
+ { encoding: 'utf-8', input: "[0xC0]" }, // ends early
+ { encoding: 'utf-8', input: "[0xC0, 0x00]" }, // invalid trail
+ { encoding: 'utf-8', input: "[0xC0, 0xC0]" }, // invalid trail
+ { encoding: 'utf-8', input: "[0xE0]" }, // ends early
+ { encoding: 'utf-8', input: "[0xE0, 0x00]" }, // invalid trail
+ { encoding: 'utf-8', input: "[0xE0, 0xC0]" }, // invalid trail
+ { encoding: 'utf-8', input: "[0xE0, 0x80, 0x00]" }, // invalid trail
+ { encoding: 'utf-8', input: "[0xE0, 0x80, 0xC0]" }, // invalid trail
+ { encoding: 'utf-8', input: "[0xFC, 0x80, 0x80, 0x80, 0x80, 0x80]" }, // > 0x10FFFF
+ { encoding: 'utf-16', input: "[0x00]" }, // truncated code unit
+ { encoding: 'utf-16', input: "[0x00, 0xd8]" }, // surrogate half
+ { encoding: 'utf-16', input: "[0x00, 0xd8, 0x00, 0x00]" }, // surrogate half
+ { encoding: 'utf-16', input: "[0x00, 0xdc, 0x00, 0x00]" }, // trail surrogate
+ { encoding: 'utf-16', input: "[0x00, 0xdc, 0x00, 0xd8]" } // swapped surrogates
+ // FIXME: Legacy encoding cases
+];
+
+bad.forEach(function(t) {
+ shouldThrow("new TextDecoder('" + t.encoding + "', {fatal: true}).decode(new Uint8Array(" + t.input + "))");
+});
+
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
« no previous file with comments | « LayoutTests/fast/encoding/api/end-of-file-expected.txt ('k') | LayoutTests/fast/encoding/api/fatal-flag-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698