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

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

Issue 1920583002: NOT FOR LANDING: Hack up CSSParser for speed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missing consts. Created 4 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 unified diff | Download patch
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 void testTokens(const String& string, const CSSParserToken& token1, const CSSPar serToken& token2 = CSSParserToken(EOFToken), const CSSParserToken& token3 = CSSP arserToken(EOFToken)) 59 void testTokens(const String& string, const CSSParserToken& token1, const CSSPar serToken& token2 = CSSParserToken(EOFToken), const CSSParserToken& token3 = CSSP arserToken(EOFToken))
60 { 60 {
61 Vector<CSSParserToken> expectedTokens; 61 Vector<CSSParserToken> expectedTokens;
62 expectedTokens.append(token1); 62 expectedTokens.append(token1);
63 if (token2.type() != EOFToken) { 63 if (token2.type() != EOFToken) {
64 expectedTokens.append(token2); 64 expectedTokens.append(token2);
65 if (token3.type() != EOFToken) 65 if (token3.type() != EOFToken)
66 expectedTokens.append(token3); 66 expectedTokens.append(token3);
67 } 67 }
68 68
69 CSSParserTokenRange expected(expectedTokens); 69 CSSParserTokenRange expected(expectedTokens.begin(), expectedTokens.end());
70 70
71 CSSTokenizer::Scope actualScope(string); 71 CSSTokenizer::Scope actualScope(string);
72 CSSParserTokenRange actual = actualScope.tokenRange(); 72 CSSParserTokenRange actual = actualScope.tokenRange();
73 73
74 // Just check that serialization doesn't hit any asserts 74 // Just check that serialization doesn't hit any asserts
75 actual.serialize(); 75 actual.serialize();
76 76
77 while (!expected.atEnd() || !actual.atEnd()) 77 while (!expected.atEnd() || !actual.atEnd())
78 compareTokens(expected.consume(), actual.consume()); 78 compareTokens(expected.consume(), actual.consume());
79 } 79 }
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 blockWatcher.handleToken(range.consume()); 493 blockWatcher.handleToken(range.consume());
494 level = blockWatcher.blockLevel(); 494 level = blockWatcher.blockLevel();
495 maxLevel = std::max(level, maxLevel); 495 maxLevel = std::max(level, maxLevel);
496 } 496 }
497 ASSERT_EQ(testCases[i].maxLevel, maxLevel); 497 ASSERT_EQ(testCases[i].maxLevel, maxLevel);
498 ASSERT_EQ(testCases[i].finalLevel, level); 498 ASSERT_EQ(testCases[i].finalLevel, level);
499 } 499 }
500 } 500 }
501 501
502 } // namespace blink 502 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698