summaryrefslogtreecommitdiff
path: root/testing/unit_test_main.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-09-26 12:02:16 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-26 17:30:44 +0000
commit81f02f4c8347890ce66d6ec48781589d10098689 (patch)
tree6e085c69e5a5addf964014fb63b42d1d8c7a36fa /testing/unit_test_main.cpp
parent15dffdf6bd8d595193cfb072974a8efeb8052a91 (diff)
downloadpdfium-81f02f4c8347890ce66d6ec48781589d10098689.tar.xz
Move font source into CFGAS_FontMgr
This CL moves the font source into the font manager so it doesn't need to be stored by each caller (and removes the platform dependant code). The |EnumFonts| method is exposed on the CFGAS_FontMgr so the caller can clear the manager if the enumeration fails. Change-Id: Iecce3d2e09ff01152b7bb79a34fe2b728320da9c Reviewed-on: https://pdfium-review.googlesource.com/14816 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'testing/unit_test_main.cpp')
-rw-r--r--testing/unit_test_main.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/testing/unit_test_main.cpp b/testing/unit_test_main.cpp
index 1b1dcb0e32..ffc95216cc 100644
--- a/testing/unit_test_main.cpp
+++ b/testing/unit_test_main.cpp
@@ -26,26 +26,17 @@ class Environment : public testing::Environment {
CFX_GEModule::Get()->GetFontMgr()->SetSystemFontInfo(
IFX_SystemFontInfo::CreateDefault(nullptr));
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
- font_mgr_ = CFGAS_FontMgr::Create(FX_GetDefFontEnumerator());
-#else
- font_source_ = pdfium::MakeUnique<CFX_FontSourceEnum_File>();
- font_mgr_ = CFGAS_FontMgr::Create(font_source_.get());
-#endif
+ font_mgr_ = pdfium::MakeUnique<CFGAS_FontMgr>();
+ if (!font_mgr_->EnumFonts())
+ font_mgr_ = nullptr;
}
void TearDown() override {
font_mgr_.reset();
-#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
- font_source_.reset();
-#endif
}
CFGAS_FontMgr* FontManager() const { return font_mgr_.get(); }
private:
-#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
- std::unique_ptr<CFX_FontSourceEnum_File> font_source_;
-#endif
std::unique_ptr<CFGAS_FontMgr> font_mgr_;
};