| 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 21 matching lines...) Expand all Loading... |
| 32 output.append(", "); | 32 output.append(", "); |
| 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(MediaQueryParserTest, Basic) | 42 TEST(MediaQuerySetTest, Basic) |
| 43 { | 43 { |
| 44 // The first string represents the input string. | 44 // The first string represents the input string. |
| 45 // The second string represents the output string, if present. | 45 // The second string represents the output string, if present. |
| 46 // Otherwise, the output string is identical to the first string. | 46 // Otherwise, the output string is identical to the first string. |
| 47 TestCase testCases[] = { | 47 TestCase testCases[] = { |
| 48 {"", 0, true}, | 48 {"", 0, true}, |
| 49 {" ", "", true}, | 49 {" ", "", true}, |
| 50 {"screen", 0, true}, | 50 {"screen", 0, true}, |
| 51 {"screen and (color)", 0, true}, | 51 {"screen and (color)", 0, true}, |
| 52 {"all and (min-width:500px)", "(min-width: 500px)", true}, | 52 {"all and (min-width:500px)", "(min-width: 500px)", true}, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 for (unsigned i = 0; testCases[i].input; ++i) { | 163 for (unsigned i = 0; testCases[i].input; ++i) { |
| 164 RefPtrWillBeRawPtr<MediaQuerySet> oldParserQuerySet = MediaQuerySet::cre
ate(testCases[i].input); | 164 RefPtrWillBeRawPtr<MediaQuerySet> oldParserQuerySet = MediaQuerySet::cre
ate(testCases[i].input); |
| 165 RefPtrWillBeRawPtr<MediaQuerySet> threadSafeQuerySet = MediaQuerySet::cr
eateOffMainThread(testCases[i].input); | 165 RefPtrWillBeRawPtr<MediaQuerySet> threadSafeQuerySet = MediaQuerySet::cr
eateOffMainThread(testCases[i].input); |
| 166 testMediaQuery(testCases[i], *oldParserQuerySet, true); | 166 testMediaQuery(testCases[i], *oldParserQuerySet, true); |
| 167 testMediaQuery(testCases[i], *threadSafeQuerySet, false); | 167 testMediaQuery(testCases[i], *threadSafeQuerySet, false); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 | 170 |
| 171 } // namespace | 171 } // namespace |
| OLD | NEW |