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 "platform/testing/FontTestHelpers.h" | 5 #include "platform/testing/FontTestHelpers.h" |
6 | 6 |
7 #include "platform/fonts/Font.h" | 7 #include "platform/fonts/Font.h" |
8 #include "platform/fonts/FontCustomPlatformData.h" | 8 #include "platform/fonts/FontCustomPlatformData.h" |
9 #include "platform/fonts/FontDescription.h" | 9 #include "platform/fonts/FontDescription.h" |
10 #include "platform/fonts/FontSelector.h" | 10 #include "platform/fonts/FontSelector.h" |
11 #include "platform/testing/UnitTestHelpers.h" | 11 #include "platform/testing/UnitTestHelpers.h" |
12 #include "wtf/OwnPtr.h" | 12 #include "wtf/OwnPtr.h" |
13 #include "wtf/PassRefPtr.h" | 13 #include "wtf/PassRefPtr.h" |
14 #include "wtf/RefPtr.h" | 14 #include "wtf/RefPtr.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 namespace testing { | 17 namespace testing { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 class TestFontSelector : public FontSelector { | 21 class TestFontSelector : public FontSelector { |
22 public: | 22 public: |
23 static RawPtr<TestFontSelector> create(const String& path) | 23 static TestFontSelector* create(const String& path) |
24 { | 24 { |
25 RefPtr<SharedBuffer> fontBuffer = testing::readFromFile(path); | 25 RefPtr<SharedBuffer> fontBuffer = testing::readFromFile(path); |
26 String otsParseMessage; | 26 String otsParseMessage; |
27 return new TestFontSelector(FontCustomPlatformData::create( | 27 return new TestFontSelector(FontCustomPlatformData::create( |
28 fontBuffer.get(), otsParseMessage)); | 28 fontBuffer.get(), otsParseMessage)); |
29 } | 29 } |
30 | 30 |
31 ~TestFontSelector() override { } | 31 ~TestFontSelector() override { } |
32 | 32 |
33 PassRefPtr<FontData> getFontData(const FontDescription& fontDescription, | 33 PassRefPtr<FontData> getFontData(const FontDescription& fontDescription, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 fontDescription.setSpecifiedSize(size); | 70 fontDescription.setSpecifiedSize(size); |
71 fontDescription.setComputedSize(size); | 71 fontDescription.setComputedSize(size); |
72 | 72 |
73 Font font(fontDescription); | 73 Font font(fontDescription); |
74 font.update(TestFontSelector::create(fontPath)); | 74 font.update(TestFontSelector::create(fontPath)); |
75 return font; | 75 return font; |
76 } | 76 } |
77 | 77 |
78 } // namespace testing | 78 } // namespace testing |
79 } // namespace blink | 79 } // namespace blink |
OLD | NEW |