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

Unified Diff: LayoutTests/fast/encoding/char-decoding-truncated.html

Issue 23532016: Handle odd data lengths in UTF-16 decoder (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Simplify Created 6 years, 10 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/char-decoding-truncated.html
diff --git a/LayoutTests/fast/encoding/char-decoding-truncated.html b/LayoutTests/fast/encoding/char-decoding-truncated.html
new file mode 100644
index 0000000000000000000000000000000000000000..9e6c05df16cb58bcf522a72720c8c1e9dbbab3b7
--- /dev/null
+++ b/LayoutTests/fast/encoding/char-decoding-truncated.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<script src="../../resources/js-test.js"></script>
+<script src="resources/char-decoding-utils.js"></script>
+<script>
+
+description("Test encoding behavior for truncated sequences");
+
+// UTF-8 codec emits replacement characters
+testDecode('utf-8', '%E2%88%9A', 'U+221A');
+testDecode('utf-8', '%E2%88', 'U+FFFD/U+FFFD');
+testDecode('utf-8', '%E2', 'U+FFFD');
+
+// UTF-16 codec does not emit replacement characters
+testDecode('utf-16', '%69%D8%D6%DE', 'U+D869/U+DED6');
+testDecode('utf-16', '%69%D8%D6', 'U+D869');
+testDecode('utf-16', '%69%D8', 'U+D869');
+testDecode('utf-16', '%69', '');
+testDecode('utf-16be', '%D8%69%DE%D6', 'U+D869/U+DED6');
+testDecode('utf-16be', '%D8%69%DE', 'U+D869');
+testDecode('utf-16be', '%D8%69', 'U+D869');
+testDecode('utf-16be', '%D8', '');
+
+// Other codecs emit replacement characters
+testDecode('gb2312', '%A3%A0', 'U+3000');
+testDecode('gb2312', '%A3', 'U+FFFD');
+testDecode('shift_jis', '%82%d0', 'U+3072');
+testDecode('shift_jis', '%82', 'U+001A');
+testDecode('windows-949', '%A2%E6', 'U+20AC');
+testDecode('windows-949', '%A2', 'U+FFFD');
+
+</script>
« no previous file with comments | « LayoutTests/fast/encoding/api/fatal-flag-expected.txt ('k') | LayoutTests/fast/encoding/char-decoding-truncated-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698