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

Unified Diff: Source/core/css/parser/MediaQueryTokenizerTest.cpp

Issue 203343004: Fixed an assert related to MediaQuerytokenizer code points table (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: A better test 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/parser/MediaQueryTokenizer.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/parser/MediaQueryTokenizerTest.cpp
diff --git a/Source/core/css/parser/MediaQueryTokenizerTest.cpp b/Source/core/css/parser/MediaQueryTokenizerTest.cpp
index 1138de99d588e8eaf21d6f7619b6a65d80fe3d51..2adbbf31d266a92a2915b0dea95e9ae6533f8500 100644
--- a/Source/core/css/parser/MediaQueryTokenizerTest.cpp
+++ b/Source/core/css/parser/MediaQueryTokenizerTest.cpp
@@ -24,4 +24,46 @@ TEST(MediaQueryTokenizerTest, Basic)
}
}
+void testToken(UChar c, MediaQueryTokenType tokenType)
+{
+ Vector<MediaQueryToken> tokens;
+ StringBuilder input;
+ input.append(c);
+ MediaQueryTokenizer::tokenize(input.toString(), tokens);
+ ASSERT_EQ(tokens[0].type(), tokenType);
+}
+
+TEST(MediaQueryTokenizerCodepointsTest, Basic)
+{
+ for (UChar c = 0; c <= 1000; ++c) {
+ if (isASCIIDigit(c))
+ testToken(c, NumberToken);
+ else if (isASCIIAlpha(c))
+ testToken(c, IdentToken);
+ else if (c == '_')
+ testToken(c, IdentToken);
+ else if (c == '\r' || c == ' ' || c == '\n' || c == '\t' || c == '\f')
+ testToken(c, WhitespaceToken);
+ else if (c == '(')
+ testToken(c, LeftParenthesisToken);
+ else if (c == ')')
+ testToken(c, RightParenthesisToken);
+ else if (c == '.' || c == '+' || c == '-' || c == '/' || c == '\\')
+ testToken(c, DelimiterToken);
+ else if (c == ',')
+ testToken(c, CommaToken);
+ else if (c == ':')
+ testToken(c, ColonToken);
+ else if (c == ';')
+ testToken(c, SemicolonToken);
+ else if (!c)
+ testToken(c, EOFToken);
+ else if (c > SCHAR_MAX)
+ testToken(c, IdentToken);
+ else
+ testToken(c, DelimiterToken);
+ }
+ testToken(USHRT_MAX, IdentToken);
+}
+
} // namespace
« no previous file with comments | « Source/core/css/parser/MediaQueryTokenizer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698