| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/css/parser/CSSTokenizer.h" | 5 #include "core/css/parser/CSSTokenizer.h" |
| 6 | 6 |
| 7 #include "core/css/parser/CSSParserTokenRange.h" | 7 #include "core/css/parser/CSSParserTokenRange.h" |
| 8 #include "core/css/parser/MediaQueryBlockWatcher.h" | 8 #include "core/css/parser/MediaQueryBlockWatcher.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "wtf/allocator/Partitions.h" | 10 #include "wtf/allocator/Partitions.h" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 273 |
| 274 TEST(CSSTokenizerTest, FunctionToken) { | 274 TEST(CSSTokenizerTest, FunctionToken) { |
| 275 TEST_TOKENS("scale(2)", function("scale"), | 275 TEST_TOKENS("scale(2)", function("scale"), |
| 276 number(IntegerValueType, 2, NoSign), rightParenthesis()); | 276 number(IntegerValueType, 2, NoSign), rightParenthesis()); |
| 277 TEST_TOKENS("foo-bar\\ baz(", function("foo-bar baz")); | 277 TEST_TOKENS("foo-bar\\ baz(", function("foo-bar baz")); |
| 278 TEST_TOKENS("fun\\(ction(", function("fun(ction")); | 278 TEST_TOKENS("fun\\(ction(", function("fun(ction")); |
| 279 TEST_TOKENS("-foo(", function("-foo")); | 279 TEST_TOKENS("-foo(", function("-foo")); |
| 280 TEST_TOKENS("url(\"foo.gif\"", function("url"), string("foo.gif")); | 280 TEST_TOKENS("url(\"foo.gif\"", function("url"), string("foo.gif")); |
| 281 TEST_TOKENS("foo( \'bar.gif\'", function("foo"), whitespace(), | 281 TEST_TOKENS("foo( \'bar.gif\'", function("foo"), whitespace(), |
| 282 string("bar.gif")); | 282 string("bar.gif")); |
| 283 // To simplify implementation we drop the whitespace in function(url),whitespa
ce,string() | 283 // To simplify implementation we drop the whitespace in |
| 284 // function(url),whitespace,string() |
| 284 TEST_TOKENS("url( \'bar.gif\'", function("url"), string("bar.gif")); | 285 TEST_TOKENS("url( \'bar.gif\'", function("url"), string("bar.gif")); |
| 285 } | 286 } |
| 286 | 287 |
| 287 TEST(CSSTokenizerTest, AtKeywordToken) { | 288 TEST(CSSTokenizerTest, AtKeywordToken) { |
| 288 TEST_TOKENS("@at-keyword", atKeyword("at-keyword")); | 289 TEST_TOKENS("@at-keyword", atKeyword("at-keyword")); |
| 289 TEST_TOKENS("@testing123", atKeyword("testing123")); | 290 TEST_TOKENS("@testing123", atKeyword("testing123")); |
| 290 TEST_TOKENS("@hello!", atKeyword("hello"), delim('!')); | 291 TEST_TOKENS("@hello!", atKeyword("hello"), delim('!')); |
| 291 TEST_TOKENS("@-text", atKeyword("-text")); | 292 TEST_TOKENS("@-text", atKeyword("-text")); |
| 292 TEST_TOKENS("@--abc", atKeyword("--abc")); | 293 TEST_TOKENS("@--abc", atKeyword("--abc")); |
| 293 TEST_TOKENS("@--", atKeyword("--")); | 294 TEST_TOKENS("@--", atKeyword("--")); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 blockWatcher.handleToken(range.consume()); | 505 blockWatcher.handleToken(range.consume()); |
| 505 level = blockWatcher.blockLevel(); | 506 level = blockWatcher.blockLevel(); |
| 506 maxLevel = std::max(level, maxLevel); | 507 maxLevel = std::max(level, maxLevel); |
| 507 } | 508 } |
| 508 ASSERT_EQ(testCases[i].maxLevel, maxLevel); | 509 ASSERT_EQ(testCases[i].maxLevel, maxLevel); |
| 509 ASSERT_EQ(testCases[i].finalLevel, level); | 510 ASSERT_EQ(testCases[i].finalLevel, level); |
| 510 } | 511 } |
| 511 } | 512 } |
| 512 | 513 |
| 513 } // namespace blink | 514 } // namespace blink |
| OLD | NEW |