| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/css/parser/CSSTokenizer.h" | 6 #include "core/css/parser/CSSTokenizer.h" |
| 7 | 7 |
| 8 #include "core/css/parser/CSSParserTokenRange.h" | 8 #include "core/css/parser/CSSParserTokenRange.h" |
| 9 #include "core/css/parser/MediaQueryBlockWatcher.h" | 9 #include "core/css/parser/MediaQueryBlockWatcher.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "wtf/Partitions.h" | 11 #include "wtf/Partitions.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 // This let's us see the line numbers of failing tests | 15 // This let's us see the line numbers of failing tests |
| 16 #define TEST_TOKENS(string, ...) { \ | 16 #define TEST_TOKENS(string, ...) { \ |
| 17 String s = string; \ | 17 String s = string; \ |
| 18 SCOPED_TRACE(s.ascii().data()); \ | 18 SCOPED_TRACE(s.ascii().data()); \ |
| 19 testTokens(string, __VA_ARGS__); \ | 19 testTokens(string, __VA_ARGS__); \ |
| 20 } | 20 } |
| 21 | 21 |
| 22 void compareTokens(const CSSParserToken& expected, const CSSParserToken& actual) | 22 void compareTokens(const CSSParserToken& expected, const CSSParserToken& actual) |
| 23 { | 23 { |
| 24 EXPECT_EQ(expected, actual); |
| 24 ASSERT_EQ(expected.type(), actual.type()); | 25 ASSERT_EQ(expected.type(), actual.type()); |
| 25 switch (expected.type()) { | 26 switch (expected.type()) { |
| 26 case DelimiterToken: | 27 case DelimiterToken: |
| 27 ASSERT_EQ(expected.delimiter(), actual.delimiter()); | 28 ASSERT_EQ(expected.delimiter(), actual.delimiter()); |
| 28 break; | 29 break; |
| 29 case IdentToken: | 30 case IdentToken: |
| 30 case FunctionToken: | 31 case FunctionToken: |
| 31 case StringToken: | 32 case StringToken: |
| 32 case UrlToken: | 33 case UrlToken: |
| 33 ASSERT_EQ(String(expected.value()), String(actual.value())); | 34 ASSERT_EQ(String(expected.value()), String(actual.value())); |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 blockWatcher.handleToken(range.consume()); | 495 blockWatcher.handleToken(range.consume()); |
| 495 level = blockWatcher.blockLevel(); | 496 level = blockWatcher.blockLevel(); |
| 496 maxLevel = std::max(level, maxLevel); | 497 maxLevel = std::max(level, maxLevel); |
| 497 } | 498 } |
| 498 ASSERT_EQ(testCases[i].maxLevel, maxLevel); | 499 ASSERT_EQ(testCases[i].maxLevel, maxLevel); |
| 499 ASSERT_EQ(testCases[i].finalLevel, level); | 500 ASSERT_EQ(testCases[i].finalLevel, level); |
| 500 } | 501 } |
| 501 } | 502 } |
| 502 | 503 |
| 503 } // namespace | 504 } // namespace |
| OLD | NEW |