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/SizesAttributeParser.h" | 6 #include "core/css/parser/SizesAttributeParser.h" |
7 | 7 |
8 #include "core/css/MediaValuesCached.h" | 8 #include "core/css/MediaValuesCached.h" |
9 | 9 |
10 #include <gtest/gtest.h> | 10 #include <gtest/gtest.h> |
(...skipping 12 matching lines...) Expand all Loading... |
23 // Otherwise, the output string is identical to the first string. | 23 // Otherwise, the output string is identical to the first string. |
24 TestCase testCases[] = { | 24 TestCase testCases[] = { |
25 {"screen", 500}, | 25 {"screen", 500}, |
26 {"(min-width:500px)", 500}, | 26 {"(min-width:500px)", 500}, |
27 {"(min-width:500px) 200px", 200}, | 27 {"(min-width:500px) 200px", 200}, |
28 {"(min-width:500px) 50vw", 250}, | 28 {"(min-width:500px) 50vw", 250}, |
29 {"(min-width:500px) 200px, 400px", 200}, | 29 {"(min-width:500px) 200px, 400px", 200}, |
30 {"400px, (min-width:500px) 200px", 400}, | 30 {"400px, (min-width:500px) 200px", 400}, |
31 {"(min-width:5000px) 200px, 400px", 400}, | 31 {"(min-width:5000px) 200px, 400px", 400}, |
32 {"(blalbadfsdf) 200px, 400px", 400}, | 32 {"(blalbadfsdf) 200px, 400px", 400}, |
33 {"0", 500}, | 33 {"0", 0}, |
34 {"-0", 500}, | 34 {"-0", 0}, |
35 {"1", 500}, | 35 {"1", 500}, |
36 {"300px, 400px", 300}, | 36 {"300px, 400px", 300}, |
37 {"(min-width:5000px) 200px, (min-width:500px) 400px", 400}, | 37 {"(min-width:5000px) 200px, (min-width:500px) 400px", 400}, |
38 {"", 500}, | 38 {"", 500}, |
39 {" ", 500}, | 39 {" ", 500}, |
40 {" /**/ ", 500}, | 40 {" /**/ ", 500}, |
41 {" /**/ 300px", 300}, | 41 {" /**/ 300px", 300}, |
42 {"300px /**/ ", 300}, | 42 {"300px /**/ ", 300}, |
43 {" /**/ (min-width:500px) /**/ 300px", 300}, | 43 {" /**/ (min-width:500px) /**/ 300px", 300}, |
44 {"-100px, 200px", 200}, | 44 {"-100px, 200px", 200}, |
(...skipping 28 matching lines...) Expand all Loading... |
73 data.strictMode = true; | 73 data.strictMode = true; |
74 RefPtr<MediaValues> mediaValues = MediaValuesCached::create(data); | 74 RefPtr<MediaValues> mediaValues = MediaValuesCached::create(data); |
75 | 75 |
76 for (unsigned i = 0; testCases[i].input; ++i) { | 76 for (unsigned i = 0; testCases[i].input; ++i) { |
77 int effectiveSize = SizesAttributeParser::findEffectiveSize(testCases[i]
.input, mediaValues); | 77 int effectiveSize = SizesAttributeParser::findEffectiveSize(testCases[i]
.input, mediaValues); |
78 ASSERT_EQ(testCases[i].output, effectiveSize); | 78 ASSERT_EQ(testCases[i].output, effectiveSize); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 } // namespace | 82 } // namespace |
OLD | NEW |