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

Unified Diff: Source/core/css/CSSParserValuesTest.cpp

Issue 189843005: CSSParserString::equalIgnoringCase should check string length. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed linux_debug failure. Created 6 years, 9 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 | « Source/core/css/CSSParserValues.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSParserValuesTest.cpp
diff --git a/Source/core/css/CSSParserValuesTest.cpp b/Source/core/css/CSSParserValuesTest.cpp
index 6d1ac8b939d45b6a14c94d1e517c484285f6d4e3..41ad43ccc2b812e275c378e243af80ca9036cd92 100644
--- a/Source/core/css/CSSParserValuesTest.cpp
+++ b/Source/core/css/CSSParserValuesTest.cpp
@@ -56,4 +56,32 @@ TEST(CSSParserValuesTest, InitWithEmpty16BitsString)
ASSERT_EQ(0u, cssParserString.length());
}
+TEST(CSSParserValuesTest, EqualIgnoringCase8BitsString)
+{
+ CSSParserString cssParserString;
+ String string8bit("sHaDOw");
+ cssParserString.init(string8bit, 0, string8bit.length());
+
+ ASSERT_TRUE(cssParserString.equalIgnoringCase("shadow"));
+ ASSERT_TRUE(cssParserString.equalIgnoringCase("ShaDow"));
+ ASSERT_FALSE(cssParserString.equalIgnoringCase("shadow-all"));
+ ASSERT_FALSE(cssParserString.equalIgnoringCase("sha"));
+ ASSERT_FALSE(cssParserString.equalIgnoringCase("abCD"));
+}
+
+TEST(CSSParserValuesTest, EqualIgnoringCase16BitsString)
+{
+ String string16bit("sHaDOw");
+ string16bit.ensure16Bit();
+
+ CSSParserString cssParserString;
+ cssParserString.init(string16bit, 0, string16bit.length());
+
+ ASSERT_TRUE(cssParserString.equalIgnoringCase("shadow"));
+ ASSERT_TRUE(cssParserString.equalIgnoringCase("ShaDow"));
+ ASSERT_FALSE(cssParserString.equalIgnoringCase("shadow-all"));
+ ASSERT_FALSE(cssParserString.equalIgnoringCase("sha"));
+ ASSERT_FALSE(cssParserString.equalIgnoringCase("abCD"));
+}
+
} // namespace
« no previous file with comments | « Source/core/css/CSSParserValues.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698