| 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 "wtf/PassOwnPtr.h" | 8 #include "wtf/PassOwnPtr.h" |
| 9 #include <gtest/gtest.h> | 9 #include <gtest/gtest.h> |
| 10 | 10 |
| 11 namespace WebCore { | 11 namespace WebCore { |
| 12 | 12 |
| 13 typedef struct { | 13 typedef struct { |
| 14 const char* input; | 14 const char* input; |
| 15 const char* output; | 15 const char* output; |
| 16 } TestCase; | 16 } TestCase; |
| 17 | 17 |
| 18 TEST(MediaQueryTokenizerTest, Basic) | 18 TEST(MediaQueryTokenizerTest, Basic) |
| 19 { | 19 { |
| 20 TestCase testCases[] = { | 20 TestCase testCases[] = { |
| 21 { "(max-width: 50px)", "(max-width: 50px)" }, | 21 { "(max-width: 50px)", "(max-width: 50px)" }, |
| 22 { "(max-width: 50\\70\\78)", "(max-width: 50px)" }, |
| 22 { "(max-width: /* comment */50px)", "(max-width: 50px)" }, | 23 { "(max-width: /* comment */50px)", "(max-width: 50px)" }, |
| 23 { "(max-width: /** *commen*t */60px)", "(max-width: 60px)" }, | 24 { "(max-width: /** *commen*t */60px)", "(max-width: 60px)" }, |
| 24 { "(max-width: /** *commen*t **/70px)", "(max-width: 70px)" }, | 25 { "(max-width: /** *commen*t **/70px)", "(max-width: 70px)" }, |
| 25 { "(max-width: /** *commen*t **//**/80px)", "(max-width: 80px)" }, | 26 { "(max-width: /** *commen*t **//**/80px)", "(max-width: 80px)" }, |
| 26 { "(max-width: /*/ **/90px)", "(max-width: 90px)" }, | 27 { "(max-width: /*/ **/90px)", "(max-width: 90px)" }, |
| 27 { "(max-width: /*/ **/*100px)", "(max-width: *100px)" }, | 28 { "(max-width: /*/ **/*100px)", "(max-width: *100px)" }, |
| 28 { "(max-width: 110px/*)", "(max-width: 110px" }, | 29 { "(max-width: 110px/*)", "(max-width: 110px" }, |
| 29 { "(max-width: 120px)/*", "(max-width: 120px)" }, | 30 { "(max-width: 120px)/*", "(max-width: 120px)" }, |
| 30 { "(max-width: 130px)/**", "(max-width: 130px)" }, | 31 { "(max-width: 130px)/**", "(max-width: 130px)" }, |
| 31 { "(max-width: /***/140px)/**/", "(max-width: 140px)" }, | 32 { "(max-width: /***/140px)/**/", "(max-width: 140px)" }, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 testToken(c, EOFToken); | 87 testToken(c, EOFToken); |
| 87 else if (c > SCHAR_MAX) | 88 else if (c > SCHAR_MAX) |
| 88 testToken(c, IdentToken); | 89 testToken(c, IdentToken); |
| 89 else | 90 else |
| 90 testToken(c, DelimiterToken); | 91 testToken(c, DelimiterToken); |
| 91 } | 92 } |
| 92 testToken(USHRT_MAX, IdentToken); | 93 testToken(USHRT_MAX, IdentToken); |
| 93 } | 94 } |
| 94 | 95 |
| 95 } // namespace | 96 } // namespace |
| OLD | NEW |