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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 {"(color", "(color)"}, | 90 {"(color", "(color)"}, |
91 {"(min-color: 2", "(min-color: 2)"}, | 91 {"(min-color: 2", "(min-color: 2)"}, |
92 {"(orientation: portrait)", 0}, | 92 {"(orientation: portrait)", 0}, |
93 {"tv and (scan: progressive)", 0}, | 93 {"tv and (scan: progressive)", 0}, |
94 {"(pointer: coarse)", 0}, | 94 {"(pointer: coarse)", 0}, |
95 {"(min-orientation:portrait)", "not all"}, | 95 {"(min-orientation:portrait)", "not all"}, |
96 {"all and (orientation:portrait)", "(orientation: portrait)"}, | 96 {"all and (orientation:portrait)", "(orientation: portrait)"}, |
97 {"all and (orientation:landscape)", "(orientation: landscape)"}, | 97 {"all and (orientation:landscape)", "(orientation: landscape)"}, |
98 {"NOT braille, tv AND (max-width: 200px) and (min-WIDTH: 100px) and (ori
entation: landscape), (color)", | 98 {"NOT braille, tv AND (max-width: 200px) and (min-WIDTH: 100px) and (ori
entation: landscape), (color)", |
99 "not braille, tv and (max-width: 200px) and (min-width: 100px) and (
orientation: landscape), (color)"}, | 99 "not braille, tv and (max-width: 200px) and (min-width: 100px) and (
orientation: landscape), (color)"}, |
| 100 {"(max-width: 700px), (max-width: 700px)", "(max-width: 700px), (max-wid
th: 700px)"}, |
| 101 {"(max-width: 800px()), (max-width: 800px)", "not all, (max-width: 800px
)"}, |
| 102 {"(max-width: 900px(()), (max-width: 900px)", "not all"}, |
| 103 {"(max-width: 600px(())))), (max-width: 600px)", "not all, (max-width: 6
00px)"}, |
| 104 {"(max-width: 500px(((((((((())))), (max-width: 500px)", "not all"}, |
| 105 {"(max-width: 800px[]), (max-width: 800px)", "not all, (max-width: 800px
)"}, |
| 106 {"(max-width: 900px[[]), (max-width: 900px)", "not all"}, |
| 107 {"(max-width: 600px[[]]]]), (max-width: 600px)", "not all, (max-width: 6
00px)"}, |
| 108 {"(max-width: 500px[[[[[[[[[[]]]]), (max-width: 500px)", "not all"}, |
| 109 {"(max-width: 800px{}), (max-width: 800px)", "not all, (max-width: 800px
)"}, |
| 110 {"(max-width: 900px{{}), (max-width: 900px)", "not all"}, |
| 111 {"(max-width: 600px{{}}}}), (max-width: 600px)", "not all, (max-width: 6
00px)"}, |
| 112 {"(max-width: 500px{{{{{{{{{{}}}}), (max-width: 500px)", "not all"}, |
100 {"[(), (max-width: 900px)", "not all"}, | 113 {"[(), (max-width: 900px)", "not all"}, |
101 {"[{}, (max-width: 900px)", "not all"}, | 114 {"[{}, (max-width: 900px)", "not all"}, |
102 {"[{]}], (max-width: 900px)", "not all, (max-width: 900px)"}, | 115 {"[{]}], (max-width: 900px)", "not all, (max-width: 900px)"}, |
103 {"[{[]{}{{{}}}}], (max-width: 900px)", "not all, (max-width: 900px)"}, | 116 {"[{[]{}{{{}}}}], (max-width: 900px)", "not all, (max-width: 900px)"}, |
104 {"[{[}], (max-width: 900px)", "not all"}, | 117 {"[{[}], (max-width: 900px)", "not all"}, |
105 {"[({)}], (max-width: 900px)", "not all"}, | 118 {"[({)}], (max-width: 900px)", "not all"}, |
| 119 {"[]((), (max-width: 900px)", "not all"}, |
| 120 {"[](()), (max-width: 900px)", "not all, (max-width: 900px)"}, |
| 121 {"all an[isdfs bla())()]icalc(i)(()), (max-width: 900px)", "not all, (ma
x-width: 900px)"}, |
| 122 {"all an[isdfs bla())(]icalc(i)(()), (max-width: 900px)", "not all"}, |
| 123 {"all an[isdfs bla())(]icalc(i)(())), (max-width: 900px)", "not all"}, |
| 124 {"all an[isdfs bla())(]icalc(i)(()))], (max-width: 900px)", "not all, (m
ax-width: 900px)"}, |
106 {0, 0} // Do not remove the terminator line. | 125 {0, 0} // Do not remove the terminator line. |
107 }; | 126 }; |
108 | 127 |
109 for (unsigned i = 0; testCases[i].input; ++i) { | 128 for (unsigned i = 0; testCases[i].input; ++i) { |
110 RefPtrWillBeRawPtr<MediaQuerySet> querySet = MediaQuerySet::create(testC
ases[i].input); | 129 RefPtrWillBeRawPtr<MediaQuerySet> querySet = MediaQuerySet::create(testC
ases[i].input); |
111 StringBuilder output; | 130 StringBuilder output; |
112 size_t j = 0; | 131 size_t j = 0; |
113 while (j < querySet->queryVector().size()) { | 132 while (j < querySet->queryVector().size()) { |
114 String queryText = querySet->queryVector()[j]->cssText(); | 133 String queryText = querySet->queryVector()[j]->cssText(); |
115 output.append(queryText); | 134 output.append(queryText); |
116 ++j; | 135 ++j; |
117 if (j >= querySet->queryVector().size()) | 136 if (j >= querySet->queryVector().size()) |
118 break; | 137 break; |
119 output.append(", "); | 138 output.append(", "); |
120 } | 139 } |
121 if (testCases[i].output) | 140 if (testCases[i].output) |
122 ASSERT_STREQ(testCases[i].output, output.toString().ascii().data()); | 141 ASSERT_STREQ(testCases[i].output, output.toString().ascii().data()); |
123 else | 142 else |
124 ASSERT_STREQ(testCases[i].input, output.toString().ascii().data()); | 143 ASSERT_STREQ(testCases[i].input, output.toString().ascii().data()); |
125 } | 144 } |
126 } | 145 } |
127 | 146 |
128 } // namespace | 147 } // namespace |
OLD | NEW |