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/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 Loading... |
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 Loading... |
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 |
OLD | NEW |