| 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/parser/MediaQueryTokenizer.h" | 6 #include "core/css/parser/MediaQueryTokenizer.h" |
| 7 | 7 |
| 8 #include "core/css/parser/MediaQueryBlockWatcher.h" | 8 #include "core/css/parser/MediaQueryBlockWatcher.h" |
| 9 #include "wtf/PassOwnPtr.h" | 9 #include "wtf/PassOwnPtr.h" |
| 10 #include <gtest/gtest.h> | 10 #include <gtest/gtest.h> |
| 11 | 11 |
| 12 namespace WebCore { | 12 namespace WebCore { |
| 13 | 13 |
| 14 typedef struct { | 14 typedef struct { |
| 15 const char* input; | 15 const char* input; |
| 16 const char* output; | 16 const char* output; |
| 17 } TestCase; | 17 } TestCase; |
| 18 | 18 |
| 19 typedef struct { | 19 typedef struct { |
| 20 const char* input; | 20 const char* input; |
| 21 const unsigned maxLevel; | 21 const unsigned maxLevel; |
| 22 const unsigned finalLevel; | 22 const unsigned finalLevel; |
| 23 } BlockTestCase; | 23 } BlockTestCase; |
| 24 | 24 |
| 25 TEST(MediaQueryTokenizerTest, Basic) | 25 TEST(MediaQueryTokenizerTest, Basic) |
| 26 { | 26 { |
| 27 TestCase testCases[] = { | 27 TestCase testCases[] = { |
| 28 { "(max-width: 50px)", "(max-width: 50px)" }, | 28 { "(max-width: 50px)", "(max-width: 50px)" }, |
| 29 { "(max-width: 1e+2px)", "(max-width: 100px)" }, |
| 30 { "(max-width: 1e2px)", "(max-width: 100px)" }, |
| 31 { "(max-width: 1000e-1px)", "(max-width: 100px)" }, |
| 29 { "(max-width: 50\\70\\78)", "(max-width: 50px)" }, | 32 { "(max-width: 50\\70\\78)", "(max-width: 50px)" }, |
| 30 { "(max-width: /* comment */50px)", "(max-width: 50px)" }, | 33 { "(max-width: /* comment */50px)", "(max-width: 50px)" }, |
| 31 { "(max-width: /** *commen*t */60px)", "(max-width: 60px)" }, | 34 { "(max-width: /** *commen*t */60px)", "(max-width: 60px)" }, |
| 32 { "(max-width: /** *commen*t **/70px)", "(max-width: 70px)" }, | 35 { "(max-width: /** *commen*t **/70px)", "(max-width: 70px)" }, |
| 33 { "(max-width: /** *commen*t **//**/80px)", "(max-width: 80px)" }, | 36 { "(max-width: /** *commen*t **//**/80px)", "(max-width: 80px)" }, |
| 34 { "(max-width: /*/ **/90px)", "(max-width: 90px)" }, | 37 { "(max-width: /*/ **/90px)", "(max-width: 90px)" }, |
| 35 { "(max-width: /*/ **/*100px)", "(max-width: *100px)" }, | 38 { "(max-width: /*/ **/*100px)", "(max-width: *100px)" }, |
| 36 { "(max-width: 110px/*)", "(max-width: 110px" }, | 39 { "(max-width: 110px/*)", "(max-width: 110px" }, |
| 37 { "(max-width: 120px)/*", "(max-width: 120px)" }, | 40 { "(max-width: 120px)/*", "(max-width: 120px)" }, |
| 38 { "(max-width: 130px)/**", "(max-width: 130px)" }, | 41 { "(max-width: 130px)/**", "(max-width: 130px)" }, |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 testToken(c, EOFToken); | 155 testToken(c, EOFToken); |
| 153 else if (c > SCHAR_MAX) | 156 else if (c > SCHAR_MAX) |
| 154 testToken(c, IdentToken); | 157 testToken(c, IdentToken); |
| 155 else | 158 else |
| 156 testToken(c, DelimiterToken); | 159 testToken(c, DelimiterToken); |
| 157 } | 160 } |
| 158 testToken(USHRT_MAX, IdentToken); | 161 testToken(USHRT_MAX, IdentToken); |
| 159 } | 162 } |
| 160 | 163 |
| 161 } // namespace | 164 } // namespace |
| OLD | NEW |