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

Unified Diff: LayoutTests/http/tests/htmlimports/encoding.html

Issue 178883002: Set encoding to UTF-8 for HTML Imports if no encoding is specified in the HTTP response (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/http/tests/htmlimports/encoding.html
diff --git a/LayoutTests/http/tests/htmlimports/encoding.html b/LayoutTests/http/tests/htmlimports/encoding.html
new file mode 100644
index 0000000000000000000000000000000000000000..97dd30bb6b1dde8ca89a510f3cb130facb31dff1
--- /dev/null
+++ b/LayoutTests/http/tests/htmlimports/encoding.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<head>
+ <script src="/js-test-resources/js-test.js"></script>
+ <link rel="import" href="resources/no-encoding.cgi">
+ <link rel="import" href="resources/http-encoding.cgi">
+ <link rel="import" href="resources/bogus-encoding.cgi">
+</head>
+<body>
+<script>
+description("Test that UTF-8 decoding is applied appropriately to imports");
+jsTestIsAsync = true;
+window.onload = function() {
+ links = document.querySelectorAll('link[rel=import]');
+ debug("Default encoding should be UTF-8...");
+ shouldBeEqualToString("links[0].import.characterSet", "UTF-8");
+ debug("But a charset in the Content-Type HTTP header should override it...");
+ shouldBeEqualToString("links[1].import.characterSet", "EUC-JP");
+ // FIXME: This is probably the wrong behavior
+ debug("Any non-empty charset takes precedence, which means we sometimes fall back to sniffing...");
+ shouldBeEqualToString("links[2].import.characterSet", "ISO-8859-1");
+ finishJSTest();
+};
+</script>
+</body>

Powered by Google App Engine
This is Rietveld 408576698