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

Side by Side Diff: Source/core/css/parser/SizesCalcParserTest.cpp

Issue 962093002: CSS Tokenizer: Add an on-stack tokenizer scope (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « Source/core/css/parser/SizesAttributeParser.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 #include "core/css/parser/SizesCalcParser.h" 6 #include "core/css/parser/SizesCalcParser.h"
7 7
8 #include "core/MediaTypeNames.h" 8 #include "core/MediaTypeNames.h"
9 #include "core/css/CSSPrimitiveValue.h" 9 #include "core/css/CSSPrimitiveValue.h"
10 #include "core/css/MediaValuesCached.h" 10 #include "core/css/MediaValuesCached.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 data.monochromeBitsPerComponent = 0; 110 data.monochromeBitsPerComponent = 0;
111 data.primaryPointerType = PointerTypeFine; 111 data.primaryPointerType = PointerTypeFine;
112 data.defaultFontSize = 16; 112 data.defaultFontSize = 16;
113 data.threeDEnabled = true; 113 data.threeDEnabled = true;
114 data.mediaType = MediaTypeNames::screen; 114 data.mediaType = MediaTypeNames::screen;
115 data.strictMode = true; 115 data.strictMode = true;
116 data.displayMode = WebDisplayModeBrowser; 116 data.displayMode = WebDisplayModeBrowser;
117 RefPtr<MediaValues> mediaValues = MediaValuesCached::create(data); 117 RefPtr<MediaValues> mediaValues = MediaValuesCached::create(data);
118 118
119 for (unsigned i = 0; testCases[i].input; ++i) { 119 for (unsigned i = 0; testCases[i].input; ++i) {
120 Vector<CSSParserToken> tokens; 120 SizesCalcParser calcParser(CSSTokenizer::Scope(testCases[i].input).token Range(), mediaValues);
121 CSSTokenizer::tokenize(testCases[i].input, tokens);
122 SizesCalcParser calcParser(CSSParserTokenRange(tokens), mediaValues);
123 ASSERT_EQ(testCases[i].valid, calcParser.isValid()); 121 ASSERT_EQ(testCases[i].valid, calcParser.isValid());
124 if (calcParser.isValid()) 122 if (calcParser.isValid())
125 ASSERT_EQ(testCases[i].output, calcParser.result()); 123 ASSERT_EQ(testCases[i].output, calcParser.result());
126 } 124 }
127 125
128 for (unsigned i = 0; testCases[i].input; ++i) { 126 for (unsigned i = 0; testCases[i].input; ++i) {
129 if (testCases[i].dontRunInCSSCalc) 127 if (testCases[i].dontRunInCSSCalc)
130 continue; 128 continue;
131 verifyCSSCalc(testCases[i].input, testCases[i].output, testCases[i].vali d, data.defaultFontSize, data.viewportWidth, data.viewportHeight); 129 verifyCSSCalc(testCases[i].input, testCases[i].output, testCases[i].vali d, data.defaultFontSize, data.viewportWidth, data.viewportHeight);
132 } 130 }
133 } 131 }
134 132
135 } // namespace 133 } // namespace
OLDNEW
« no previous file with comments | « Source/core/css/parser/SizesAttributeParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698