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 27 matching lines...) Expand all Loading... |
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(MediaQueryParserTest, 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}, |
| 49 {" ", "", true}, |
48 {"screen", 0, true}, | 50 {"screen", 0, true}, |
49 {"screen and (color)", 0, true}, | 51 {"screen and (color)", 0, true}, |
50 {"all and (min-width:500px)", "(min-width: 500px)", true}, | 52 {"all and (min-width:500px)", "(min-width: 500px)", true}, |
51 {"all and (min-width:/*bla*/500px)", "(min-width: 500px)", true}, | 53 {"all and (min-width:/*bla*/500px)", "(min-width: 500px)", true}, |
52 {"(min-width:500px)", "(min-width: 500px)", true}, | 54 {"(min-width:500px)", "(min-width: 500px)", true}, |
53 {"screen and (color), projection and (color)", 0, true}, | 55 {"screen and (color), projection and (color)", 0, true}, |
54 {"not screen and (color)", 0, true}, | 56 {"not screen and (color)", 0, true}, |
55 {"only screen and (color)", 0, true}, | 57 {"only screen and (color)", 0, true}, |
56 {"screen and (color), projection and (color)", 0, true}, | 58 {"screen and (color), projection and (color)", 0, true}, |
57 {"aural and (device-aspect-ratio: 16/9)", 0, true}, | 59 {"aural and (device-aspect-ratio: 16/9)", 0, true}, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 162 |
161 for (unsigned i = 0; testCases[i].input; ++i) { | 163 for (unsigned i = 0; testCases[i].input; ++i) { |
162 RefPtrWillBeRawPtr<MediaQuerySet> oldParserQuerySet = MediaQuerySet::cre
ate(testCases[i].input); | 164 RefPtrWillBeRawPtr<MediaQuerySet> oldParserQuerySet = MediaQuerySet::cre
ate(testCases[i].input); |
163 RefPtrWillBeRawPtr<MediaQuerySet> threadSafeQuerySet = MediaQuerySet::cr
eateOffMainThread(testCases[i].input); | 165 RefPtrWillBeRawPtr<MediaQuerySet> threadSafeQuerySet = MediaQuerySet::cr
eateOffMainThread(testCases[i].input); |
164 testMediaQuery(testCases[i], *oldParserQuerySet, true); | 166 testMediaQuery(testCases[i], *oldParserQuerySet, true); |
165 testMediaQuery(testCases[i], *threadSafeQuerySet, false); | 167 testMediaQuery(testCases[i], *threadSafeQuerySet, false); |
166 } | 168 } |
167 } | 169 } |
168 | 170 |
169 } // namespace | 171 } // namespace |
OLD | NEW |