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

Side by Side Diff: content/test/dwrite_font_fake_sender_win.h

Issue 1846433005: Implement direct write fallback proxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a missing SUCCEEDED call Created 4 years, 8 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 | « content/content_tests.gypi ('k') | content/test/dwrite_font_fake_sender_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 #ifndef CONTENT_TEST_DWRITE_FONT_FAKE_SENDER_WIN_H_ 5 #ifndef CONTENT_TEST_DWRITE_FONT_FAKE_SENDER_WIN_H_
6 #define CONTENT_TEST_DWRITE_FONT_FAKE_SENDER_WIN_H_ 6 #define CONTENT_TEST_DWRITE_FONT_FAKE_SENDER_WIN_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <wrl.h> 10 #include <wrl.h>
11 11
12 #include <memory> 12 #include <memory>
13 #include <utility> 13 #include <utility>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/strings/string16.h" 18 #include "base/strings/string16.h"
19 #include "ipc/ipc_message.h" 19 #include "ipc/ipc_message.h"
20 #include "ipc/ipc_sender.h" 20 #include "ipc/ipc_sender.h"
21 21
22 struct DWriteFontStyle;
23 struct MapCharactersResult;
24
22 namespace content { 25 namespace content {
23 26
24 class FakeFontCollection; 27 class FakeFontCollection;
25 28
26 // Creates a new FakeFontCollection, seeded with some basic data, and returns a 29 // Creates a new FakeFontCollection, seeded with some basic data, and returns a
27 // Sender that can be used to interact with the collection. 30 // Sender that can be used to interact with the collection.
28 IPC::Sender* CreateFakeCollectionSender(); 31 IPC::Sender* CreateFakeCollectionSender();
29 32
30 // Helper class for describing a font object. Use FakeFontCollection instead. 33 // Helper class for describing a font object. Use FakeFontCollection instead.
31 class FakeFont { 34 class FakeFont {
32 public: 35 public:
33 explicit FakeFont(const base::string16& name); 36 explicit FakeFont(const base::string16& name);
34 37
35 FakeFont(const FakeFont& other); 38 FakeFont(const FakeFont& other);
36 39
37 ~FakeFont(); 40 ~FakeFont();
38 41
39 FakeFont& AddFilePath(const base::string16& file_path) { 42 FakeFont& AddFilePath(const base::string16& file_path) {
40 file_paths_.push_back(file_path); 43 file_paths_.push_back(file_path);
41 return *this; 44 return *this;
42 } 45 }
43 46
44 FakeFont& AddFamilyName(const base::string16& locale, 47 FakeFont& AddFamilyName(const base::string16& locale,
45 const base::string16& family_name) { 48 const base::string16& family_name) {
46 family_names_.emplace_back(locale, family_name); 49 family_names_.emplace_back(locale, family_name);
47 return *this; 50 return *this;
48 } 51 }
49 52
53 const base::string16& font_name() { return font_name_; }
54
50 private: 55 private:
51 friend FakeFontCollection; 56 friend FakeFontCollection;
52 base::string16 font_name_; 57 base::string16 font_name_;
53 std::vector<base::string16> file_paths_; 58 std::vector<base::string16> file_paths_;
54 std::vector<std::pair<base::string16, base::string16>> family_names_; 59 std::vector<std::pair<base::string16, base::string16>> family_names_;
55 60
56 DISALLOW_ASSIGN(FakeFont); 61 DISALLOW_ASSIGN(FakeFont);
57 }; 62 };
58 63
59 // Implements a font collection that supports interaction through sending IPC 64 // Implements a font collection that supports interaction through sending IPC
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 void OnFindFamily(const base::string16& family_name, uint32_t* index); 112 void OnFindFamily(const base::string16& family_name, uint32_t* index);
108 113
109 void OnGetFamilyCount(uint32_t* count); 114 void OnGetFamilyCount(uint32_t* count);
110 115
111 void OnGetFamilyNames( 116 void OnGetFamilyNames(
112 uint32_t family_index, 117 uint32_t family_index,
113 std::vector<std::pair<base::string16, base::string16>>* family_names); 118 std::vector<std::pair<base::string16, base::string16>>* family_names);
114 void OnGetFontFiles(uint32_t family_index, 119 void OnGetFontFiles(uint32_t family_index,
115 std::vector<base::string16>* file_paths_); 120 std::vector<base::string16>* file_paths_);
116 121
122 void OnMapCharacters(const base::string16& text,
123 const DWriteFontStyle& font_style,
124 const base::string16& locale_name,
125 uint32_t reading_direction,
126 const base::string16& base_family_name,
127 MapCharactersResult* result);
128
117 private: 129 private:
118 scoped_refptr<FakeFontCollection> collection_; 130 scoped_refptr<FakeFontCollection> collection_;
119 std::unique_ptr<IPC::Message> reply_; 131 std::unique_ptr<IPC::Message> reply_;
120 132
121 DISALLOW_COPY_AND_ASSIGN(ReplySender); 133 DISALLOW_COPY_AND_ASSIGN(ReplySender);
122 }; 134 };
123 135
124 // This class can be used by the "renderer" to send messages to the "browser" 136 // This class can be used by the "renderer" to send messages to the "browser"
125 class FakeSender : public IPC::Sender { 137 class FakeSender : public IPC::Sender {
126 public: 138 public:
(...skipping 14 matching lines...) Expand all
141 153
142 void OnGetFamilyCount(uint32_t* count); 154 void OnGetFamilyCount(uint32_t* count);
143 155
144 void OnGetFamilyNames( 156 void OnGetFamilyNames(
145 uint32_t family_index, 157 uint32_t family_index,
146 std::vector<std::pair<base::string16, base::string16>>* family_names); 158 std::vector<std::pair<base::string16, base::string16>>* family_names);
147 159
148 void OnGetFontFiles(uint32_t family_index, 160 void OnGetFontFiles(uint32_t family_index,
149 std::vector<base::string16>* file_paths); 161 std::vector<base::string16>* file_paths);
150 162
163 void OnMapCharacters(const base::string16& text,
164 const DWriteFontStyle& font_style,
165 const base::string16& locale_name,
166 uint32_t reading_direction,
167 const base::string16& base_family_name,
168 MapCharactersResult* result);
169
151 std::unique_ptr<ReplySender> GetReplySender(); 170 std::unique_ptr<ReplySender> GetReplySender();
152 171
153 private: 172 private:
154 friend class base::RefCounted<FakeFontCollection>; 173 friend class base::RefCounted<FakeFontCollection>;
155 ~FakeFontCollection(); 174 ~FakeFontCollection();
156 175
157 std::vector<FakeFont> fonts_; 176 std::vector<FakeFont> fonts_;
158 std::vector<std::unique_ptr<IPC::Message>> messages_; 177 std::vector<std::unique_ptr<IPC::Message>> messages_;
159 178
160 DISALLOW_COPY_AND_ASSIGN(FakeFontCollection); 179 DISALLOW_COPY_AND_ASSIGN(FakeFontCollection);
161 }; 180 };
162 181
163 } // namespace content 182 } // namespace content
164 183
165 #endif // CONTENT_TEST_DWRITE_FONT_FAKE_SENDER_WIN_H_ 184 #endif // CONTENT_TEST_DWRITE_FONT_FAKE_SENDER_WIN_H_
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | content/test/dwrite_font_fake_sender_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698