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

Unified Diff: third_party/WebKit/Source/web/tests/PageSerializerTest.cpp

Issue 1424503006: Page Serializer: Specify encoding for serialized CSS files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nfc-css
Patch Set: Created 5 years, 2 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: third_party/WebKit/Source/web/tests/PageSerializerTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/PageSerializerTest.cpp b/third_party/WebKit/Source/web/tests/PageSerializerTest.cpp
index c882e0eb00fb0eb2485d1a122cc6bf9f4b05982a..640764486a589b77117ae708b35a4f9d6da5686e 100644
--- a/third_party/WebKit/Source/web/tests/PageSerializerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/PageSerializerTest.cpp
@@ -339,6 +339,12 @@ TEST_F(PageSerializerTest, CSS)
EXPECT_TRUE(isSerialized("ul-dot.png", "image/png"));
EXPECT_TRUE(isSerialized("ol-dot.png", "image/png"));
+ // Ensure encodings are specified.
+ EXPECT_TRUE(getSerializedData("link_styles.css", "text/css").startsWith("@charset \"windows-1252\";"));
yosin_UTC9 2015/10/28 00:14:57 Does this work systems uses non-US locale? I'm not
jsbell 2015/10/28 18:16:55 Pretty sure it does; most of the Web is defined as
yosin_UTC9 2015/10/30 01:57:01 Since value of @charset for no @charset case isn't
+ EXPECT_TRUE(getSerializedData("import_styles.css", "text/css").startsWith("@charset \"windows-1252\";"));
+ EXPECT_TRUE(getSerializedData("import_style_from_link.css", "text/css").startsWith("@charset \"windows-1252\";"));
+ EXPECT_TRUE(getSerializedData("encoding.css", "text/css").startsWith("@charset \"euc-kr\";"));
+
// Ensure that stylesheet contents are not NFC-normalized before encoding.
EXPECT_TRUE(getSerializedData("encoding.css", "text/css").contains("\xE4\xC5\xD1\xE2"));
EXPECT_FALSE(getSerializedData("encoding.css", "text/css").contains("\xE4\xC5\xE4\xC5"));

Powered by Google App Engine
This is Rietveld 408576698