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

Side by Side Diff: Source/core/css/MediaQuerySetTest.cpp

Issue 482753002: Use StringBuilder::appendLiteral() / StringBuilder::append(char) when possible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/css/MediaQueryExp.cpp ('k') | Source/core/css/StylePropertySerializer.cpp » ('j') | 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/MediaQuery.h" 6 #include "core/css/MediaQuery.h"
7 7
8 #include "core/css/MediaList.h" 8 #include "core/css/MediaList.h"
9 #include "wtf/PassOwnPtr.h" 9 #include "wtf/PassOwnPtr.h"
10 #include "wtf/text/StringBuilder.h" 10 #include "wtf/text/StringBuilder.h"
(...skipping 11 matching lines...) Expand all
22 static void testMediaQuery(TestCase test, MediaQuerySet& querySet, bool oldParse r) 22 static void testMediaQuery(TestCase test, MediaQuerySet& querySet, bool oldParse r)
23 { 23 {
24 StringBuilder output; 24 StringBuilder output;
25 size_t j = 0; 25 size_t j = 0;
26 while (j < querySet.queryVector().size()) { 26 while (j < querySet.queryVector().size()) {
27 String queryText = querySet.queryVector()[j]->cssText(); 27 String queryText = querySet.queryVector()[j]->cssText();
28 output.append(queryText); 28 output.append(queryText);
29 ++j; 29 ++j;
30 if (j >= querySet.queryVector().size()) 30 if (j >= querySet.queryVector().size())
31 break; 31 break;
32 output.append(", "); 32 output.appendLiteral(", ");
33 } 33 }
34 if (!oldParser || test.shouldWorkOnOldParser) { 34 if (!oldParser || test.shouldWorkOnOldParser) {
35 if (test.output) 35 if (test.output)
36 ASSERT_STREQ(test.output, output.toString().ascii().data()); 36 ASSERT_STREQ(test.output, output.toString().ascii().data());
37 else 37 else
38 ASSERT_STREQ(test.input, output.toString().ascii().data()); 38 ASSERT_STREQ(test.input, output.toString().ascii().data());
39 } 39 }
40 } 40 }
41 41
42 TEST(MediaQuerySetTest, Basic) 42 TEST(MediaQuerySetTest, Basic)
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 for (unsigned i = 0; testCases[i].input; ++i) { 165 for (unsigned i = 0; testCases[i].input; ++i) {
166 RefPtrWillBeRawPtr<MediaQuerySet> oldParserQuerySet = MediaQuerySet::cre ate(testCases[i].input); 166 RefPtrWillBeRawPtr<MediaQuerySet> oldParserQuerySet = MediaQuerySet::cre ate(testCases[i].input);
167 RefPtrWillBeRawPtr<MediaQuerySet> threadSafeQuerySet = MediaQuerySet::cr eateOffMainThread(testCases[i].input); 167 RefPtrWillBeRawPtr<MediaQuerySet> threadSafeQuerySet = MediaQuerySet::cr eateOffMainThread(testCases[i].input);
168 testMediaQuery(testCases[i], *oldParserQuerySet, true); 168 testMediaQuery(testCases[i], *oldParserQuerySet, true);
169 testMediaQuery(testCases[i], *threadSafeQuerySet, false); 169 testMediaQuery(testCases[i], *threadSafeQuerySet, false);
170 } 170 }
171 } 171 }
172 172
173 } // namespace 173 } // namespace
OLDNEW
« no previous file with comments | « Source/core/css/MediaQueryExp.cpp ('k') | Source/core/css/StylePropertySerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698