Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: third_party/WebKit/Source/platform/testing/FontTestHelpers.cpp

Issue 2717123003: RemoteFontFaceSource should keep FontCustomPlatformData over FontResource revalidation (Closed)
Patch Set: test description Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/PassRefPtr.h" 12 #include "wtf/PassRefPtr.h"
13 #include "wtf/RefPtr.h" 13 #include "wtf/RefPtr.h"
14 #include <memory>
15 14
16 namespace blink { 15 namespace blink {
17 namespace testing { 16 namespace testing {
18 17
19 namespace { 18 namespace {
20 19
21 class TestFontSelector : public FontSelector { 20 class TestFontSelector : public FontSelector {
22 public: 21 public:
23 static TestFontSelector* create(const String& path) { 22 static TestFontSelector* create(const String& path) {
24 RefPtr<SharedBuffer> fontBuffer = testing::readFromFile(path); 23 RefPtr<SharedBuffer> fontBuffer = testing::readFromFile(path);
(...skipping 16 matching lines...) Expand all
41 const AtomicString& familyName, 40 const AtomicString& familyName,
42 const String& text) override {} 41 const String& text) override {}
43 void willUseRange(const FontDescription&, 42 void willUseRange(const FontDescription&,
44 const AtomicString& familyName, 43 const AtomicString& familyName,
45 const FontDataForRangeSet&) override{}; 44 const FontDataForRangeSet&) override{};
46 45
47 unsigned version() const override { return 0; } 46 unsigned version() const override { return 0; }
48 void fontCacheInvalidated() override {} 47 void fontCacheInvalidated() override {}
49 48
50 private: 49 private:
51 TestFontSelector(std::unique_ptr<FontCustomPlatformData> customPlatformData) 50 TestFontSelector(PassRefPtr<FontCustomPlatformData> customPlatformData)
52 : m_customPlatformData(std::move(customPlatformData)) {} 51 : m_customPlatformData(customPlatformData) {}
53 52
54 std::unique_ptr<FontCustomPlatformData> m_customPlatformData; 53 RefPtr<FontCustomPlatformData> m_customPlatformData;
55 }; 54 };
56 55
57 } // namespace 56 } // namespace
58 57
59 Font createTestFont(const AtomicString& familyName, 58 Font createTestFont(const AtomicString& familyName,
60 const String& fontPath, 59 const String& fontPath,
61 float size) { 60 float size) {
62 FontFamily family; 61 FontFamily family;
63 family.setFamily(familyName); 62 family.setFamily(familyName);
64 63
65 FontDescription fontDescription; 64 FontDescription fontDescription;
66 fontDescription.setFamily(family); 65 fontDescription.setFamily(family);
67 fontDescription.setSpecifiedSize(size); 66 fontDescription.setSpecifiedSize(size);
68 fontDescription.setComputedSize(size); 67 fontDescription.setComputedSize(size);
69 68
70 Font font(fontDescription); 69 Font font(fontDescription);
71 font.update(TestFontSelector::create(fontPath)); 70 font.update(TestFontSelector::create(fontPath));
72 return font; 71 return font;
73 } 72 }
74 73
75 } // namespace testing 74 } // namespace testing
76 } // namespace blink 75 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698