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

Unified Diff: content/child/dwrite_font_proxy/dwrite_font_proxy_win_unittest.cc

Issue 2111373002: Reland of Link to DirectWrite directly, instead of calling LoadLibrary (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/child/dwrite_font_proxy/dwrite_font_proxy_win_unittest.cc
diff --git a/content/child/dwrite_font_proxy/dwrite_font_proxy_win_unittest.cc b/content/child/dwrite_font_proxy/dwrite_font_proxy_win_unittest.cc
index 88c02eeb003f64e21ef5408df90af2784824c6c6..ca897b412ac892aaf82b7f10186f6cfddbf6905f 100644
--- a/content/child/dwrite_font_proxy/dwrite_font_proxy_win_unittest.cc
+++ b/content/child/dwrite_font_proxy/dwrite_font_proxy_win_unittest.cc
@@ -24,27 +24,9 @@ namespace content {
namespace {
-void CreateDWriteFactory(IUnknown** factory) {
- using DWriteCreateFactoryProc = decltype(DWriteCreateFactory)*;
- HMODULE dwrite_dll = LoadLibraryW(L"dwrite.dll");
- if (!dwrite_dll)
- return;
-
- DWriteCreateFactoryProc dwrite_create_factory_proc =
- reinterpret_cast<DWriteCreateFactoryProc>(
- GetProcAddress(dwrite_dll, "DWriteCreateFactory"));
- if (!dwrite_create_factory_proc)
- return;
-
- dwrite_create_factory_proc(DWRITE_FACTORY_TYPE_SHARED,
- __uuidof(IDWriteFactory), factory);
-}
-
class DWriteFontProxyUnitTest : public testing::Test {
public:
DWriteFontProxyUnitTest() {
- if (!factory)
- return;
fake_collection_ = new FakeFontCollection();
SetupFonts(fake_collection_.get());
mswr::MakeAndInitialize<DWriteFontCollectionProxy>(
@@ -71,7 +53,8 @@ class DWriteFontProxyUnitTest : public testing::Test {
}
static void SetUpTestCase() {
- CreateDWriteFactory(&factory);
+ DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory),
+ &factory);
std::vector<base::char16> font_path;
font_path.resize(MAX_PATH);
@@ -96,9 +79,6 @@ std::vector<base::string16> DWriteFontProxyUnitTest::arial_font_files;
mswr::ComPtr<IDWriteFactory> DWriteFontProxyUnitTest::factory;
TEST_F(DWriteFontProxyUnitTest, GetFontFamilyCount) {
- if (!factory)
- return;
-
UINT32 family_count = collection_->GetFontFamilyCount();
EXPECT_EQ(3u, family_count);
@@ -114,8 +94,6 @@ TEST_F(DWriteFontProxyUnitTest, GetFontFamilyCount) {
TEST_F(DWriteFontProxyUnitTest, FindFamilyNameShouldFindFamily) {
HRESULT hr;
- if (!factory)
- return;
UINT32 index = UINT_MAX;
BOOL exists = FALSE;
@@ -133,8 +111,6 @@ TEST_F(DWriteFontProxyUnitTest, FindFamilyNameShouldFindFamily) {
TEST_F(DWriteFontProxyUnitTest, FindFamilyNameShouldReturnUINTMAXWhenNotFound) {
HRESULT hr;
- if (!factory)
- return;
UINT32 index = UINT_MAX;
BOOL exists = FALSE;
@@ -150,8 +126,6 @@ TEST_F(DWriteFontProxyUnitTest, FindFamilyNameShouldReturnUINTMAXWhenNotFound) {
TEST_F(DWriteFontProxyUnitTest, FindFamilyNameShouldNotSendDuplicateIPC) {
HRESULT hr;
- if (!factory)
- return;
UINT32 index = UINT_MAX;
BOOL exists = FALSE;
@@ -167,8 +141,6 @@ TEST_F(DWriteFontProxyUnitTest, FindFamilyNameShouldNotSendDuplicateIPC) {
TEST_F(DWriteFontProxyUnitTest, GetFontFamilyShouldCreateFamily) {
HRESULT hr;
- if (!factory)
- return;
UINT32 index = UINT_MAX;
BOOL exists = FALSE;
@@ -214,8 +186,6 @@ void CheckLocale(const base::string16& locale_name,
TEST_F(DWriteFontProxyUnitTest, GetFamilyNames) {
HRESULT hr;
- if (!factory)
- return;
UINT32 index = UINT_MAX;
BOOL exists = FALSE;
@@ -253,8 +223,6 @@ TEST_F(DWriteFontProxyUnitTest, GetFamilyNames) {
TEST_F(DWriteFontProxyUnitTest, GetFontCollection) {
HRESULT hr;
- if (!factory)
- return;
UINT32 index = UINT_MAX;
BOOL exists = FALSE;
@@ -275,8 +243,6 @@ TEST_F(DWriteFontProxyUnitTest, GetFontCollection) {
TEST_F(DWriteFontProxyUnitTest, GetFamilyNamesShouldNotIPCAfterLoadingFamily) {
HRESULT hr;
- if (!factory)
- return;
UINT32 index = UINT_MAX;
BOOL exists = FALSE;
@@ -295,8 +261,6 @@ TEST_F(DWriteFontProxyUnitTest, GetFamilyNamesShouldNotIPCAfterLoadingFamily) {
TEST_F(DWriteFontProxyUnitTest,
GetFontFamilyShouldNotCreateFamilyWhenIndexIsInvalid) {
HRESULT hr;
- if (!factory)
- return;
UINT32 index = UINT_MAX;
BOOL exists = FALSE;
@@ -312,8 +276,6 @@ TEST_F(DWriteFontProxyUnitTest,
TEST_F(DWriteFontProxyUnitTest, LoadingFontFamily) {
HRESULT hr;
- if (!factory)
- return;
UINT32 index = UINT_MAX;
BOOL exists = FALSE;
@@ -348,8 +310,6 @@ TEST_F(DWriteFontProxyUnitTest, LoadingFontFamily) {
TEST_F(DWriteFontProxyUnitTest, GetFontFromFontFaceShouldFindFont) {
HRESULT hr;
- if (!factory)
- return;
UINT32 index = UINT_MAX;
BOOL exists = FALSE;

Powered by Google App Engine
This is Rietveld 408576698