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 {"(m\\61x-width: 300px)", "(max-width: 300px)"}, | |
101 {"(max-width: 400\\70\\78)", "(max-width: 400px)"}, | |
102 {"(max-width: 500\\0070\\0078)", "(max-width: 500px)"}, | |
103 {"(max-width: 600\\000070\\000078)", "(max-width: 600px)"}, | |
100 {"[(), (max-width: 900px)", "not all"}, | 104 {"[(), (max-width: 900px)", "not all"}, |
101 {"[{}, (max-width: 900px)", "not all"}, | 105 {"[{}, (max-width: 900px)", "not all"}, |
102 {"[{]}], (max-width: 900px)", "not all, (max-width: 900px)"}, | 106 {"[{]}], (max-width: 900px)", "not all, (max-width: 900px)"}, |
103 {"[{[]{}{{{}}}}], (max-width: 900px)", "not all, (max-width: 900px)"}, | 107 {"[{[]{}{{{}}}}], (max-width: 900px)", "not all, (max-width: 900px)"}, |
104 {"[{[}], (max-width: 900px)", "not all"}, | 108 {"[{[}], (max-width: 900px)", "not all"}, |
105 {"[({)}], (max-width: 900px)", "not all"}, | 109 {"[({)}], (max-width: 900px)", "not all"}, |
106 {0, 0} // Do not remove the terminator line. | 110 {0, 0} // Do not remove the terminator line. |
107 }; | 111 }; |
108 | 112 |
109 for (unsigned i = 0; testCases[i].input; ++i) { | 113 for (unsigned i = 0; testCases[i].input; ++i) { |
110 RefPtrWillBeRawPtr<MediaQuerySet> querySet = MediaQuerySet::create(testC ases[i].input); | 114 RefPtrWillBeRawPtr<MediaQuerySet> querySet = MediaQuerySet::createOffMai nThread(testCases[i].input); |
eseidel
2014/04/01 22:03:06
Seems like we should test both parsers, no? Run t
| |
111 StringBuilder output; | 115 StringBuilder output; |
112 size_t j = 0; | 116 size_t j = 0; |
113 while (j < querySet->queryVector().size()) { | 117 while (j < querySet->queryVector().size()) { |
114 String queryText = querySet->queryVector()[j]->cssText(); | 118 String queryText = querySet->queryVector()[j]->cssText(); |
115 output.append(queryText); | 119 output.append(queryText); |
116 ++j; | 120 ++j; |
117 if (j >= querySet->queryVector().size()) | 121 if (j >= querySet->queryVector().size()) |
118 break; | 122 break; |
119 output.append(", "); | 123 output.append(", "); |
120 } | 124 } |
121 if (testCases[i].output) | 125 if (testCases[i].output) |
122 ASSERT_STREQ(testCases[i].output, output.toString().ascii().data()); | 126 ASSERT_STREQ(testCases[i].output, output.toString().ascii().data()); |
123 else | 127 else |
124 ASSERT_STREQ(testCases[i].input, output.toString().ascii().data()); | 128 ASSERT_STREQ(testCases[i].input, output.toString().ascii().data()); |
125 } | 129 } |
126 } | 130 } |
127 | 131 |
128 } // namespace | 132 } // namespace |
OLD | NEW |