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

Unified Diff: third_party/WebKit/Source/platform/text/TextEncodingDetectorTest.cpp

Issue 2697213002: Do not guess UTF8 encoding (Closed)
Patch Set: webkit layout htmls Created 3 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
« no previous file with comments | « third_party/WebKit/Source/platform/text/TextEncodingDetector.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/text/TextEncodingDetectorTest.cpp
diff --git a/third_party/WebKit/Source/platform/text/TextEncodingDetectorTest.cpp b/third_party/WebKit/Source/platform/text/TextEncodingDetectorTest.cpp
index 1900b172b876617ce573f891f67f90b49bb727b3..c8c8a0b40b40e51c6bd0525255efd935c67b625f 100644
--- a/third_party/WebKit/Source/platform/text/TextEncodingDetectorTest.cpp
+++ b/third_party/WebKit/Source/platform/text/TextEncodingDetectorTest.cpp
@@ -73,4 +73,14 @@ TEST(TextEncodingDetectorTest, LanguageHintHelpsEUCJP) {
<< "With language hint 'ja', it's detected as EUC-JP";
}
+TEST(TextEncodingDetectorTest, UTF8DetectionShouldFail) {
+ std::string utf8Bytes =
+ "tnegirjji gosa gii beare s\xC3\xA1htt\xC3\xA1 \xC4\x8D\xC3"
+ "\xA1llit artihkkaliid. Maid don s\xC3\xA1ht\xC3\xA1t dievasmah";
+ WTF::TextEncoding encoding;
+ bool result = detectTextEncoding(utf8Bytes.c_str(), utf8Bytes.length(),
+ nullptr, nullptr, nullptr, &encoding);
+ EXPECT_FALSE(result);
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/text/TextEncodingDetector.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698