| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 default: | 55 default: |
| 56 break; | 56 break; |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 void testTokens(const String& string, | 60 void testTokens(const String& string, |
| 61 const CSSParserToken& token1, | 61 const CSSParserToken& token1, |
| 62 const CSSParserToken& token2 = CSSParserToken(EOFToken), | 62 const CSSParserToken& token2 = CSSParserToken(EOFToken), |
| 63 const CSSParserToken& token3 = CSSParserToken(EOFToken)) { | 63 const CSSParserToken& token3 = CSSParserToken(EOFToken)) { |
| 64 Vector<CSSParserToken> expectedTokens; | 64 Vector<CSSParserToken> expectedTokens; |
| 65 expectedTokens.append(token1); | 65 expectedTokens.push_back(token1); |
| 66 if (token2.type() != EOFToken) { | 66 if (token2.type() != EOFToken) { |
| 67 expectedTokens.append(token2); | 67 expectedTokens.push_back(token2); |
| 68 if (token3.type() != EOFToken) | 68 if (token3.type() != EOFToken) |
| 69 expectedTokens.append(token3); | 69 expectedTokens.push_back(token3); |
| 70 } | 70 } |
| 71 | 71 |
| 72 CSSParserTokenRange expected(expectedTokens); | 72 CSSParserTokenRange expected(expectedTokens); |
| 73 | 73 |
| 74 CSSTokenizer tokenizer(string); | 74 CSSTokenizer tokenizer(string); |
| 75 CSSParserTokenRange actual = tokenizer.tokenRange(); | 75 CSSParserTokenRange actual = tokenizer.tokenRange(); |
| 76 | 76 |
| 77 // Just check that serialization doesn't hit any asserts | 77 // Just check that serialization doesn't hit any asserts |
| 78 actual.serialize(); | 78 actual.serialize(); |
| 79 | 79 |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 blockWatcher.handleToken(range.consume()); | 505 blockWatcher.handleToken(range.consume()); |
| 506 level = blockWatcher.blockLevel(); | 506 level = blockWatcher.blockLevel(); |
| 507 maxLevel = std::max(level, maxLevel); | 507 maxLevel = std::max(level, maxLevel); |
| 508 } | 508 } |
| 509 ASSERT_EQ(testCases[i].maxLevel, maxLevel); | 509 ASSERT_EQ(testCases[i].maxLevel, maxLevel); |
| 510 ASSERT_EQ(testCases[i].finalLevel, level); | 510 ASSERT_EQ(testCases[i].finalLevel, level); |
| 511 } | 511 } |
| 512 } | 512 } |
| 513 | 513 |
| 514 } // namespace blink | 514 } // namespace blink |
| OLD | NEW |