OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/css/CSSFontFaceSource.h" | 5 #include "core/css/CSSFontFaceSource.h" |
6 | 6 |
7 #include "platform/fonts/FontCacheKey.h" | 7 #include "platform/fonts/FontCacheKey.h" |
8 #include "platform/fonts/FontDescription.h" | 8 #include "platform/fonts/FontDescription.h" |
9 #include "platform/fonts/FontPlatformData.h" | 9 #include "platform/fonts/FontPlatformData.h" |
10 #include "platform/fonts/SimpleFontData.h" | 10 #include "platform/fonts/SimpleFontData.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 fontDescription.setSizeAdjust(size); | 37 fontDescription.setSizeAdjust(size); |
38 fontDescription.setAdjustedSize(size); | 38 fontDescription.setAdjustedSize(size); |
39 return fontDescription.cacheKey(FontFaceCreationParams()).hash(); | 39 return fontDescription.cacheKey(FontFaceCreationParams()).hash(); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 TEST(CSSFontFaceSourceTest, HashCollision) { | 43 TEST(CSSFontFaceSourceTest, HashCollision) { |
44 DummyFontFaceSource fontFaceSource; | 44 DummyFontFaceSource fontFaceSource; |
45 // Even if the hash value collide, fontface cache should return different | 45 // Even if the hash value collide, fontface cache should return different |
46 // value for different fonts. | 46 // value for different fonts. |
47 EXPECT_EQ(simulateHashCalculation(2821), simulateHashCalculation(3346)); | 47 EXPECT_EQ(simulateHashCalculation(8775), simulateHashCalculation(418)); |
48 EXPECT_NE(fontFaceSource.getFontDataForSize(2821), | 48 EXPECT_NE(fontFaceSource.getFontDataForSize(8775), |
49 fontFaceSource.getFontDataForSize(3346)); | 49 fontFaceSource.getFontDataForSize(418)); |
50 } | 50 } |
51 | 51 |
52 } // namespace blink | 52 } // namespace blink |
OLD | NEW |