Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Side by Side Diff: Source/core/css/MediaQuerySetTest.cpp

Issue 171383002: A thread-safe Media Query Parser (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Moar rebase Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 {"screen and (max-width: 0)", 0}, 87 {"screen and (max-width: 0)", 0},
88 {"screen and (max-width: 1deg)", "not all"}, 88 {"screen and (max-width: 1deg)", "not all"},
89 {"handheld and (min-width: 20em), \nscreen and (min-width: 20em)", "hand held and (min-width: 20em), screen and (min-width: 20em)"}, 89 {"handheld and (min-width: 20em), \nscreen and (min-width: 20em)", "hand held and (min-width: 20em), screen and (min-width: 20em)"},
90 {"print and (min-resolution: 300dpi)", 0}, 90 {"print and (min-resolution: 300dpi)", 0},
91 {"print and (min-resolution: 118dpcm)", 0}, 91 {"print and (min-resolution: 118dpcm)", 0},
92 {"(resolution: 0.83333333333333333333dppx)", "(resolution: 0.83333333333 33334dppx)"}, 92 {"(resolution: 0.83333333333333333333dppx)", "(resolution: 0.83333333333 33334dppx)"},
93 {"(resolution: 2.4dppx)", 0}, 93 {"(resolution: 2.4dppx)", 0},
94 {"all and(color)", "not all"}, 94 {"all and(color)", "not all"},
95 {"all and (", "not all"}, 95 {"all and (", "not all"},
96 {"test;,all", "not all, all"}, 96 {"test;,all", "not all, all"},
97 // {"(color:20example)", "not all"}, // BisonCSSParser fails to parse th at MQ, producing an infinitesimal float. 97 {"(color:20example)", "not all"},
98 {"not braille", 0}, 98 {"not braille", 0},
99 {",screen", "not all, screen"}, 99 {",screen", "not all, screen"},
100 {",all", "not all, all"}, 100 {",all", "not all, all"},
101 {",,all,,", "not all, not all, all, not all, not all"}, 101 {",,all,,", "not all, not all, all, not all, not all"},
102 {",,all,, ", "not all, not all, all, not all, not all"}, 102 {",,all,, ", "not all, not all, all, not all, not all"},
103 {",screen,,&invalid,,", "not all, screen, not all, not all, not all, not all"}, 103 {",screen,,&invalid,,", "not all, screen, not all, not all, not all, not all"},
104 {",screen,,(invalid,),,", "not all, screen, not all, not all, not all, n ot all"}, 104 {",screen,,(invalid,),,", "not all, screen, not all, not all, not all, n ot all"},
105 {",(all,),,", "not all, not all, not all, not all"}, 105 {",(all,),,", "not all, not all, not all, not all"},
106 {",", "not all, not all"}, 106 {",", "not all, not all"},
107 // {" ", ""}, // BisonCSSParser fails to parse that MQ, producing "not all, not all". 107 {" ", ""},
108 {"(color", "(color)"}, 108 {"(color", "(color)"},
109 {"(min-color: 2", "(min-color: 2)"}, 109 {"(min-color: 2", "(min-color: 2)"},
110 {"(orientation: portrait)", 0}, 110 {"(orientation: portrait)", 0},
111 {"tv and (scan: progressive)", 0}, 111 {"tv and (scan: progressive)", 0},
112 {"(pointer: coarse)", 0}, 112 {"(pointer: coarse)", 0},
113 {"(min-orientation:portrait)", "not all"}, 113 {"(min-orientation:portrait)", "not all"},
114 {"all and (orientation:portrait)", "(orientation: portrait)"}, 114 {"all and (orientation:portrait)", "(orientation: portrait)"},
115 {"all and (orientation:landscape)", "(orientation: landscape)"}, 115 {"all and (orientation:landscape)", "(orientation: landscape)"},
116 {"NOT braille, tv AND (max-width: 200px) and (min-WIDTH: 100px) and (ori entation: landscape), (color)", 116 {"NOT braille, tv AND (max-width: 200px) and (min-WIDTH: 100px) and (ori entation: landscape), (color)",
117 "not braille, tv and (max-width: 200px) and (min-width: 100px) and ( orientation: landscape), (color)"}, 117 "not braille, tv and (max-width: 200px) and (min-width: 100px) and ( orientation: landscape), (color)"},
(...skipping 16 matching lines...) Expand all
134 ASSERT(output.length() < outputCharArrayLen); 134 ASSERT(output.length() < outputCharArrayLen);
135 getCharArray(output.toString(), outputCharArray); 135 getCharArray(output.toString(), outputCharArray);
136 if (testCases[i].output) 136 if (testCases[i].output)
137 ASSERT_STREQ(testCases[i].output, outputCharArray); 137 ASSERT_STREQ(testCases[i].output, outputCharArray);
138 else 138 else
139 ASSERT_STREQ(testCases[i].input, outputCharArray); 139 ASSERT_STREQ(testCases[i].input, outputCharArray);
140 } 140 }
141 } 141 }
142 142
143 } // namespace 143 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698