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/MediaTypeNames.h" |
8 #include "core/css/MediaValuesCached.h" | 9 #include "core/css/MediaValuesCached.h" |
9 | 10 |
10 #include <gtest/gtest.h> | 11 #include <gtest/gtest.h> |
11 | 12 |
12 namespace WebCore { | 13 namespace WebCore { |
13 | 14 |
14 typedef struct { | 15 typedef struct { |
15 const char* input; | 16 const char* input; |
16 const int output; | 17 const int output; |
17 } TestCase; | 18 } TestCase; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 data.viewportWidth = 500; | 61 data.viewportWidth = 500; |
61 data.viewportHeight = 500; | 62 data.viewportHeight = 500; |
62 data.deviceWidth = 500; | 63 data.deviceWidth = 500; |
63 data.deviceHeight = 500; | 64 data.deviceHeight = 500; |
64 data.devicePixelRatio = 2.0; | 65 data.devicePixelRatio = 2.0; |
65 data.colorBitsPerComponent = 24; | 66 data.colorBitsPerComponent = 24; |
66 data.monochromeBitsPerComponent = 0; | 67 data.monochromeBitsPerComponent = 0; |
67 data.pointer = MediaValues::MousePointer; | 68 data.pointer = MediaValues::MousePointer; |
68 data.defaultFontSize = 16; | 69 data.defaultFontSize = 16; |
69 data.threeDEnabled = true; | 70 data.threeDEnabled = true; |
70 data.scanMediaType = false; | 71 data.mediaType = MediaTypeNames::screen; |
71 data.screenMediaType = true; | |
72 data.printMediaType = false; | |
73 data.strictMode = true; | 72 data.strictMode = true; |
74 RefPtr<MediaValues> mediaValues = MediaValuesCached::create(data); | 73 RefPtr<MediaValues> mediaValues = MediaValuesCached::create(data); |
75 | 74 |
76 for (unsigned i = 0; testCases[i].input; ++i) { | 75 for (unsigned i = 0; testCases[i].input; ++i) { |
77 int effectiveSize = SizesAttributeParser::findEffectiveSize(testCases[i]
.input, mediaValues); | 76 int effectiveSize = SizesAttributeParser::findEffectiveSize(testCases[i]
.input, mediaValues); |
78 ASSERT_EQ(testCases[i].output, effectiveSize); | 77 ASSERT_EQ(testCases[i].output, effectiveSize); |
79 } | 78 } |
80 } | 79 } |
81 | 80 |
82 } // namespace | 81 } // namespace |
OLD | NEW |