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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSTokenizerTest.cpp

Issue 2329463004: ABANDONED CL: Changes needed to make things compile after running rewrite_to_chrome_style tool. (Closed)
Patch Set: More fixes - things build fine at this point. Created 3 years, 8 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/core/css/parser/CSSTokenizerTest.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSTokenizerTest.cpp b/third_party/WebKit/Source/core/css/parser/CSSTokenizerTest.cpp
index 95688c0c29e4086a413f5fc1464eaad6b26a364a..7f46a4609bd88c53d146756233f900e1f5cb4882 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSTokenizerTest.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSTokenizerTest.cpp
@@ -137,58 +137,58 @@ static CSSParserToken percentage(NumericValueType type, double value) {
return name; \
}
-DEFINE_TOKEN(whitespace, (WhitespaceToken))
-DEFINE_TOKEN(colon, (ColonToken));
-DEFINE_TOKEN(semicolon, (SemicolonToken));
-DEFINE_TOKEN(comma, (CommaToken));
-DEFINE_TOKEN(includeMatch, (IncludeMatchToken));
-DEFINE_TOKEN(dashMatch, (DashMatchToken));
-DEFINE_TOKEN(prefixMatch, (PrefixMatchToken));
-DEFINE_TOKEN(suffixMatch, (SuffixMatchToken));
-DEFINE_TOKEN(substringMatch, (SubstringMatchToken));
-DEFINE_TOKEN(column, (ColumnToken));
-DEFINE_TOKEN(cdo, (CDOToken));
-DEFINE_TOKEN(cdc, (CDCToken));
-DEFINE_TOKEN(leftParenthesis, (LeftParenthesisToken));
-DEFINE_TOKEN(rightParenthesis, (RightParenthesisToken));
-DEFINE_TOKEN(leftBracket, (LeftBracketToken));
-DEFINE_TOKEN(rightBracket, (RightBracketToken));
-DEFINE_TOKEN(leftBrace, (LeftBraceToken));
-DEFINE_TOKEN(rightBrace, (RightBraceToken));
-DEFINE_TOKEN(badString, (BadStringToken));
-DEFINE_TOKEN(badUrl, (BadUrlToken));
-
-String fromUChar32(UChar32 c) {
+DEFINE_TOKEN(Whitespace, (kWhitespaceToken))
+DEFINE_TOKEN(Colon, (kColonToken));
+DEFINE_TOKEN(Semicolon, (kSemicolonToken));
+DEFINE_TOKEN(Comma, (kCommaToken));
+DEFINE_TOKEN(IncludeMatch, (kIncludeMatchToken));
+DEFINE_TOKEN(DashMatch, (kDashMatchToken));
+DEFINE_TOKEN(PrefixMatch, (kPrefixMatchToken));
+DEFINE_TOKEN(SuffixMatch, (kSuffixMatchToken));
+DEFINE_TOKEN(SubstringMatch, (kSubstringMatchToken));
+DEFINE_TOKEN(Column, (kColumnToken));
+DEFINE_TOKEN(Cdo, (kCDOToken));
+DEFINE_TOKEN(Cdc, (kCDCToken));
+DEFINE_TOKEN(LeftParenthesis, (kLeftParenthesisToken));
+DEFINE_TOKEN(RightParenthesis, (kRightParenthesisToken));
+DEFINE_TOKEN(LeftBracket, (kLeftBracketToken));
+DEFINE_TOKEN(RightBracket, (kRightBracketToken));
+DEFINE_TOKEN(LeftBrace, (kLeftBraceToken));
+DEFINE_TOKEN(RightBrace, (kRightBraceToken));
+DEFINE_TOKEN(BadString, (kBadStringToken));
+DEFINE_TOKEN(BadUrl, (kBadUrlToken));
+
+String FromUChar32(UChar32 c) {
StringBuilder input;
input.append(c);
return input.toString();
}
TEST(CSSTokenizerTest, SingleCharacterTokens) {
- TEST_TOKENS("(", leftParenthesis());
- TEST_TOKENS(")", rightParenthesis());
- TEST_TOKENS("[", leftBracket());
- TEST_TOKENS("]", rightBracket());
- TEST_TOKENS(",", comma());
- TEST_TOKENS(":", colon());
- TEST_TOKENS(";", semicolon());
- TEST_TOKENS(")[", rightParenthesis(), leftBracket());
- TEST_TOKENS("[)", leftBracket(), rightParenthesis());
- TEST_TOKENS("{}", leftBrace(), rightBrace());
- TEST_TOKENS(",,", comma(), comma());
+ TEST_TOKENS("(", LeftParenthesis());
+ TEST_TOKENS(")", RightParenthesis());
+ TEST_TOKENS("[", LeftBracket());
+ TEST_TOKENS("]", RightBracket());
+ TEST_TOKENS(",", Comma());
+ TEST_TOKENS(":", Colon());
+ TEST_TOKENS(";", Semicolon());
+ TEST_TOKENS(")[", RightParenthesis(), LeftBracket());
+ TEST_TOKENS("[)", LeftBracket(), RightParenthesis());
+ TEST_TOKENS("{}", LeftBrace(), RightBrace());
+ TEST_TOKENS(",,", Comma(), Comma());
}
TEST(CSSTokenizerTest, MultipleCharacterTokens) {
- TEST_TOKENS("~=", includeMatch());
- TEST_TOKENS("|=", dashMatch());
- TEST_TOKENS("^=", prefixMatch());
- TEST_TOKENS("$=", suffixMatch());
- TEST_TOKENS("*=", substringMatch());
- TEST_TOKENS("||", column());
- TEST_TOKENS("|||", column(), delim('|'));
- TEST_TOKENS("<!--", cdo());
- TEST_TOKENS("<!---", cdo(), delim('-'));
- TEST_TOKENS("-->", cdc());
+ TEST_TOKENS("~=", IncludeMatch());
+ TEST_TOKENS("|=", DashMatch());
+ TEST_TOKENS("^=", PrefixMatch());
+ TEST_TOKENS("$=", SuffixMatch());
+ TEST_TOKENS("*=", SubstringMatch());
+ TEST_TOKENS("||", Column());
+ TEST_TOKENS("|||", Column(), Delim('|'));
+ TEST_TOKENS("<!--", Cdo());
+ TEST_TOKENS("<!---", Cdo(), Delim('-'));
+ TEST_TOKENS("-->", Cdc());
}
TEST(CSSTokenizerTest, DelimiterToken) {
@@ -272,14 +272,14 @@ TEST(CSSTokenizerTest, IdentToken) {
}
TEST(CSSTokenizerTest, FunctionToken) {
- TEST_TOKENS("scale(2)", function("scale"),
- number(IntegerValueType, 2, NoSign), rightParenthesis());
- TEST_TOKENS("foo-bar\\ baz(", function("foo-bar baz"));
- TEST_TOKENS("fun\\(ction(", function("fun(ction"));
- TEST_TOKENS("-foo(", function("-foo"));
- TEST_TOKENS("url(\"foo.gif\"", function("url"), string("foo.gif"));
- TEST_TOKENS("foo( \'bar.gif\'", function("foo"), whitespace(),
- string("bar.gif"));
+ TEST_TOKENS("scale(2)", Function("scale"),
+ Number(kIntegerValueType, 2, kNoSign), RightParenthesis());
+ TEST_TOKENS("foo-bar\\ baz(", Function("foo-bar baz"));
+ TEST_TOKENS("fun\\(ction(", Function("fun(ction"));
+ TEST_TOKENS("-foo(", Function("-foo"));
+ TEST_TOKENS("url(\"foo.gif\"", Function("url"), GetString("foo.gif"));
+ TEST_TOKENS("foo( \'bar.gif\'", Function("foo"), Whitespace(),
+ GetString("bar.gif"));
// To simplify implementation we drop the whitespace in
// function(url),whitespace,string()
TEST_TOKENS("url( \'bar.gif\'", function("url"), string("bar.gif"));
@@ -306,44 +306,44 @@ TEST(CSSTokenizerTest, UrlToken) {
TEST_TOKENS("urL(https://example.com/cats.png)",
url("https://example.com/cats.png"));
TEST_TOKENS("uRl(what-a.crazy^URL~this\\ is!)",
- url("what-a.crazy^URL~this is!"));
- TEST_TOKENS("uRL(123#test)", url("123#test"));
- TEST_TOKENS("Url(escapes\\ \\\"\\'\\)\\()", url("escapes \"')("));
- TEST_TOKENS("UrL( whitespace )", url("whitespace"));
- TEST_TOKENS("URl( whitespace-eof ", url("whitespace-eof"));
- TEST_TOKENS("URL(eof", url("eof"));
- TEST_TOKENS("url(not/*a*/comment)", url("not/*a*/comment"));
- TEST_TOKENS("urL()", url(""));
- TEST_TOKENS("uRl(white space),", badUrl(), comma());
- TEST_TOKENS("Url(b(ad),", badUrl(), comma());
- TEST_TOKENS("uRl(ba'd):", badUrl(), colon());
- TEST_TOKENS("urL(b\"ad):", badUrl(), colon());
- TEST_TOKENS("uRl(b\"ad):", badUrl(), colon());
- TEST_TOKENS("Url(b\\\rad):", badUrl(), colon());
- TEST_TOKENS("url(b\\\nad):", badUrl(), colon());
- TEST_TOKENS("url(/*'bad')*/", badUrl(), delim('*'), delim('/'));
- TEST_TOKENS("url(ba'd\\\\))", badUrl(), rightParenthesis());
+ Url("what-a.crazy^URL~this is!"));
+ TEST_TOKENS("uRL(123#test)", Url("123#test"));
+ TEST_TOKENS("Url(escapes\\ \\\"\\'\\)\\()", Url("escapes \"')("));
+ TEST_TOKENS("UrL( whitespace )", Url("whitespace"));
+ TEST_TOKENS("URl( whitespace-eof ", Url("whitespace-eof"));
+ TEST_TOKENS("URL(eof", Url("eof"));
+ TEST_TOKENS("url(not/*a*/comment)", Url("not/*a*/comment"));
+ TEST_TOKENS("urL()", Url(""));
+ TEST_TOKENS("uRl(white space),", BadUrl(), Comma());
+ TEST_TOKENS("Url(b(ad),", BadUrl(), Comma());
+ TEST_TOKENS("uRl(ba'd):", BadUrl(), Colon());
+ TEST_TOKENS("urL(b\"ad):", BadUrl(), Colon());
+ TEST_TOKENS("uRl(b\"ad):", BadUrl(), Colon());
+ TEST_TOKENS("Url(b\\\rad):", BadUrl(), Colon());
+ TEST_TOKENS("url(b\\\nad):", BadUrl(), Colon());
+ TEST_TOKENS("url(/*'bad')*/", BadUrl(), Delim('*'), Delim('/'));
+ TEST_TOKENS("url(ba'd\\\\))", BadUrl(), RightParenthesis());
}
TEST(CSSTokenizerTest, StringToken) {
- TEST_TOKENS("'text'", string("text"));
- TEST_TOKENS("\"text\"", string("text"));
- TEST_TOKENS("'testing, 123!'", string("testing, 123!"));
- TEST_TOKENS("'es\\'ca\\\"pe'", string("es'ca\"pe"));
- TEST_TOKENS("'\"quotes\"'", string("\"quotes\""));
- TEST_TOKENS("\"'quotes'\"", string("'quotes'"));
- TEST_TOKENS("\"mismatch'", string("mismatch'"));
- TEST_TOKENS("'text\5\t\13'", string("text\5\t\13"));
- TEST_TOKENS("\"end on eof", string("end on eof"));
- TEST_TOKENS("'esca\\\nped'", string("escaped"));
- TEST_TOKENS("\"esc\\\faped\"", string("escaped"));
- TEST_TOKENS("'new\\\rline'", string("newline"));
- TEST_TOKENS("\"new\\\r\nline\"", string("newline"));
- TEST_TOKENS("'bad\nstring", badString(), whitespace(), ident("string"));
- TEST_TOKENS("'bad\rstring", badString(), whitespace(), ident("string"));
- TEST_TOKENS("'bad\r\nstring", badString(), whitespace(), ident("string"));
- TEST_TOKENS("'bad\fstring", badString(), whitespace(), ident("string"));
- TEST_TOKENS(String("'\0'", 3), string(fromUChar32(0xFFFD)));
+ TEST_TOKENS("'text'", GetString("text"));
+ TEST_TOKENS("\"text\"", GetString("text"));
+ TEST_TOKENS("'testing, 123!'", GetString("testing, 123!"));
+ TEST_TOKENS("'es\\'ca\\\"pe'", GetString("es'ca\"pe"));
+ TEST_TOKENS("'\"quotes\"'", GetString("\"quotes\""));
+ TEST_TOKENS("\"'quotes'\"", GetString("'quotes'"));
+ TEST_TOKENS("\"mismatch'", GetString("mismatch'"));
+ TEST_TOKENS("'text\5\t\13'", GetString("text\5\t\13"));
+ TEST_TOKENS("\"end on eof", GetString("end on eof"));
+ TEST_TOKENS("'esca\\\nped'", GetString("escaped"));
+ TEST_TOKENS("\"esc\\\faped\"", GetString("escaped"));
+ TEST_TOKENS("'new\\\rline'", GetString("newline"));
+ TEST_TOKENS("\"new\\\r\nline\"", GetString("newline"));
+ TEST_TOKENS("'bad\nstring", BadString(), Whitespace(), Ident("string"));
+ TEST_TOKENS("'bad\rstring", BadString(), Whitespace(), Ident("string"));
+ TEST_TOKENS("'bad\r\nstring", BadString(), Whitespace(), Ident("string"));
+ TEST_TOKENS("'bad\fstring", BadString(), Whitespace(), Ident("string"));
+ TEST_TOKENS(String("'\0'", 3), GetString(FromUChar32(0xFFFD)));
TEST_TOKENS(String("'hel\0lo'", 8),
string("hel" + fromUChar32(0xFFFD) + "lo"));
TEST_TOKENS(String("'h\\65l\0lo'", 10),
@@ -449,13 +449,13 @@ TEST(CSSTokenizerTest, UnicodeRangeToken) {
}
TEST(CSSTokenizerTest, CommentToken) {
- TEST_TOKENS("/*comment*/a", ident("a"));
- TEST_TOKENS("/**\\2f**//", delim('/'));
- TEST_TOKENS("/**y*a*y**/ ", whitespace());
- TEST_TOKENS(",/* \n :) \n */)", comma(), rightParenthesis());
- TEST_TOKENS(":/*/*/", colon());
- TEST_TOKENS("/**/*", delim('*'));
- TEST_TOKENS(";/******", semicolon());
+ TEST_TOKENS("/*comment*/a", Ident("a"));
+ TEST_TOKENS("/**\\2f**//", Delim('/'));
+ TEST_TOKENS("/**y*a*y**/ ", Whitespace());
+ TEST_TOKENS(",/* \n :) \n */)", Comma(), RightParenthesis());
+ TEST_TOKENS(":/*/*/", Colon());
+ TEST_TOKENS("/**/*", Delim('*'));
+ TEST_TOKENS(";/******", Semicolon());
}
typedef struct {
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSTokenizer.cpp ('k') | third_party/WebKit/Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698