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/html/parser/HTMLSrcsetParser.h" | 6 #include "core/html/parser/HTMLSrcsetParser.h" |
7 | 7 |
8 #include <gtest/gtest.h> | 8 #include <gtest/gtest.h> |
9 #include <limits.h> | 9 #include <limits.h> |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 {1.0, 400, "", "400.gif 400w, 6000.gif 6000w", "400.gif", 1.0, 400}, | 81 {1.0, 400, "", "400.gif 400w, 6000.gif 6000w", "400.gif", 1.0, 400}, |
82 {1.0, 400, "", "400.gif 400pw, 6000.gif 6000w", "6000.gif", 15.0, 6000}, | 82 {1.0, 400, "", "400.gif 400pw, 6000.gif 6000w", "6000.gif", 15.0, 6000}, |
83 {1.0, 400, "fallback.gif", "400.gif 400pw", "fallback.gif", 1.0, -1}, | 83 {1.0, 400, "fallback.gif", "400.gif 400pw", "fallback.gif", 1.0, -1}, |
84 {1.0, 400, "fallback.gif", "400.gif +400w", "fallback.gif", 1.0, -1}, | 84 {1.0, 400, "fallback.gif", "400.gif +400w", "fallback.gif", 1.0, -1}, |
85 {1.0, 400, "", "400.gif 400w 400h, 6000.gif 6000w", "400.gif", 1.0, 400}
, | 85 {1.0, 400, "", "400.gif 400w 400h, 6000.gif 6000w", "400.gif", 1.0, 400}
, |
86 {4.0, 400, "", "400.gif 400w, 6000.gif 6000w", "6000.gif", 15.0, 6000}, | 86 {4.0, 400, "", "400.gif 400w, 6000.gif 6000w", "6000.gif", 15.0, 6000}, |
87 {3.8, 400, "", "400.gif 400w, 6000.gif 6000w", "400.gif", 1.0, 400}, | 87 {3.8, 400, "", "400.gif 400w, 6000.gif 6000w", "400.gif", 1.0, 400}, |
88 {0.9, 800, "src.gif", "400.gif 400w", "400.gif", 0.5, 400}, | 88 {0.9, 800, "src.gif", "400.gif 400w", "400.gif", 0.5, 400}, |
89 {0.9, 800, "src.gif", "1x.gif 1x, 400.gif 400w", "1x.gif", 1.0, -1}, | 89 {0.9, 800, "src.gif", "1x.gif 1x, 400.gif 400w", "1x.gif", 1.0, -1}, |
90 {0.9, 800, "src.gif", "1x.gif 0.6x, 400.gif 400w", "1x.gif", 0.6, -1}, | 90 {0.9, 800, "src.gif", "1x.gif 0.6x, 400.gif 400w", "1x.gif", 0.6, -1}, |
| 91 {0.9, 800, "src.gif", "1x.gif 1x, 400.gif 720w", "400.gif", 0.9, 720}, |
| 92 {0.9, 800, "src.gif", "1x.gif 1x, 400.gif 719w", "1x.gif", 1.0, -1}, |
91 {2.0, 800, "src.gif", "400.gif 400w", "400.gif", 0.5, 400}, | 93 {2.0, 800, "src.gif", "400.gif 400w", "400.gif", 0.5, 400}, |
92 {1.0, 400, "src.gif", "800.gif 800w", "800.gif", 2.0, 800}, | 94 {1.0, 400, "src.gif", "800.gif 800w", "800.gif", 2.0, 800}, |
93 {1.0, 400, "src.gif", "0.gif 0w, 800.gif 800w", "800.gif", 2.0, 800}, | 95 {1.0, 400, "src.gif", "0.gif 0w, 800.gif 800w", "800.gif", 2.0, 800}, |
94 {1.0, 400, "src.gif", "0.gif 0w, 2x.gif 2x", "src.gif", 1.0, -1}, | 96 {1.0, 400, "src.gif", "0.gif 0w, 2x.gif 2x", "src.gif", 1.0, -1}, |
95 {1.0, 400, "src.gif", "800.gif 2x, 1600.gif 1600w", "800.gif", 2.0, -1}, | 97 {1.0, 400, "src.gif", "800.gif 2x, 1600.gif 1600w", "800.gif", 2.0, -1}, |
96 {1.0, 400, "", "400.gif 400w, 2x.gif 2x", "400.gif", 1.0, 400}, | 98 {1.0, 400, "", "400.gif 400w, 2x.gif 2x", "400.gif", 1.0, 400}, |
97 {2.0, 400, "", "400.gif 400w, 2x.gif 2x", "2x.gif", 2.0, -1}, | 99 {2.0, 400, "", "400.gif 400w, 2x.gif 2x", "2x.gif", 2.0, -1}, |
98 {1.0, 0, "", "400.gif 400w, 6000.gif 6000w", "400.gif", std::numeric_lim
its<float>::infinity(), 400}, | 100 {1.0, 0, "", "400.gif 400w, 6000.gif 6000w", "400.gif", std::numeric_lim
its<float>::infinity(), 400}, |
99 {2.0, -1, "", ", 1x.gif 1x, 2x.gif 2x", "2x.gif", 2.0, -1}, | 101 {2.0, -1, "", ", 1x.gif 1x, 2x.gif 2x", "2x.gif", 2.0, -1}, |
100 {1.0, -1, "", ",1x.gif 1x, 2x.gif 2x", "1x.gif", 1.0, -1}, | 102 {1.0, -1, "", ",1x.gif 1x, 2x.gif 2x", "1x.gif", 1.0, -1}, |
(...skipping 16 matching lines...) Expand all Loading... |
117 for (unsigned i = 0; testCases[i].srcInput; ++i) { | 119 for (unsigned i = 0; testCases[i].srcInput; ++i) { |
118 TestCase test = testCases[i]; | 120 TestCase test = testCases[i]; |
119 ImageCandidate candidate = bestFitSourceForImageAttributes(test.deviceSc
aleFactor, test.effectiveSize, test.srcInput, test.srcsetInput); | 121 ImageCandidate candidate = bestFitSourceForImageAttributes(test.deviceSc
aleFactor, test.effectiveSize, test.srcInput, test.srcsetInput); |
120 ASSERT_EQ(test.outputDensity, candidate.density()); | 122 ASSERT_EQ(test.outputDensity, candidate.density()); |
121 ASSERT_EQ(test.outputResourceWidth, candidate.resourceWidth()); | 123 ASSERT_EQ(test.outputResourceWidth, candidate.resourceWidth()); |
122 ASSERT_STREQ(test.outputURL, candidate.toString().ascii().data()); | 124 ASSERT_STREQ(test.outputURL, candidate.toString().ascii().data()); |
123 } | 125 } |
124 } | 126 } |
125 | 127 |
126 } // namespace | 128 } // namespace |
OLD | NEW |