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

Side by Side Diff: content/child/dwrite_font_proxy/font_fallback_win_unittest.cc

Issue 2182213004: Use ChildThreadImpl::thread_safe_sender in font proxy if available (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unittests Created 4 years, 4 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
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 "content/child/dwrite_font_proxy/font_fallback_win.h" 5 #include "content/child/dwrite_font_proxy/font_fallback_win.h"
6 6
7 #include <dwrite.h> 7 #include <dwrite.h>
8 #include <shlobj.h> 8 #include <shlobj.h>
9 #include <wrl.h> 9 #include <wrl.h>
10 10
(...skipping 26 matching lines...) Expand all
37 CSIDL_FONTS, FALSE /* fCreate*/); 37 CSIDL_FONTS, FALSE /* fCreate*/);
38 base::string16 segoe_path; 38 base::string16 segoe_path;
39 segoe_path.append(font_path.data()).append(L"\\seguisym.ttf"); 39 segoe_path.append(font_path.data()).append(L"\\seguisym.ttf");
40 40
41 fake_collection_ = new FakeFontCollection(); 41 fake_collection_ = new FakeFontCollection();
42 fake_collection_->AddFont(L"Segoe UI Symbol") 42 fake_collection_->AddFont(L"Segoe UI Symbol")
43 .AddFamilyName(L"en-us", L"Segoe UI Symbol") 43 .AddFamilyName(L"en-us", L"Segoe UI Symbol")
44 .AddFilePath(segoe_path); 44 .AddFilePath(segoe_path);
45 45
46 mswr::MakeAndInitialize<DWriteFontCollectionProxy>( 46 mswr::MakeAndInitialize<DWriteFontCollectionProxy>(
47 &collection_, factory_.Get(), fake_collection_->GetSender()); 47 &collection_, factory_.Get(),
48 base::Bind(&FakeFontCollection::GetSender, fake_collection_));
48 } 49 }
49 50
50 void CreateDWriteFactory(IUnknown** factory) { 51 void CreateDWriteFactory(IUnknown** factory) {
51 using DWriteCreateFactoryProc = decltype(DWriteCreateFactory)*; 52 using DWriteCreateFactoryProc = decltype(DWriteCreateFactory)*;
52 HMODULE dwrite_dll = LoadLibraryW(L"dwrite.dll"); 53 HMODULE dwrite_dll = LoadLibraryW(L"dwrite.dll");
53 if (!dwrite_dll) 54 if (!dwrite_dll)
54 return; 55 return;
55 56
56 DWriteCreateFactoryProc dwrite_create_factory_proc = 57 DWriteCreateFactoryProc dwrite_create_factory_proc =
57 reinterpret_cast<DWriteCreateFactoryProc>( 58 reinterpret_cast<DWriteCreateFactoryProc>(
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, 198 DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL,
198 DWRITE_FONT_STRETCH_NORMAL, &mapped_length, &font, 199 DWRITE_FONT_STRETCH_NORMAL, &mapped_length, &font,
199 &scale); 200 &scale);
200 201
201 EXPECT_EQ(1u, fake_collection_->MessageCount()); 202 EXPECT_EQ(1u, fake_collection_->MessageCount());
202 EXPECT_EQ(2u, mapped_length); 203 EXPECT_EQ(2u, mapped_length);
203 } 204 }
204 205
205 } // namespace 206 } // namespace
206 } // namespace content 207 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698