Bug 1330529 - Part 1: Fix PDFium gtest by using absolute path to PDFium DLL. r=jimm

This gtest assumed the current working directory ($OBJDIR/_tests/gtest/) was in the DLL LoadLibrary path. That is no longer true with this bug's patches, so the gtest must specify the absolute path to the PDFium DLL to load it.

MozReview-Commit-ID: 5TXj6A9Tb9w

--HG--
extra : rebase_source : b097ae0c3430767e9ff16632ee96fd8739a902bf
extra : histedit_source : 1f13fa04c29039f8aeae05028d0a20ede5ee794b
This commit is contained in:
Chris Peterson 2018-02-11 11:58:21 -08:00
parent 5aa9b78a4d
commit 203d98bd72

View File

@ -124,12 +124,19 @@ public:
protected: protected:
virtual bool CreatePDFiumEngineIfNeed() override { virtual bool CreatePDFiumEngineIfNeed() override {
if (!mPDFiumEngine) { if (!mPDFiumEngine) {
#ifdef _WIN64 #ifdef _WIN64
nsAutoCString externalDll("pdfium_ref_x64.dll"); #define PDFIUM_FILENAME "pdfium_ref_x64.dll"
#else #else
nsAutoCString externalDll("pdfium_ref_x86.dll"); #define PDFIUM_FILENAME "pdfium_ref_x86.dll"
#endif #endif
nsAutoString pdfiumPath;
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(GetFilePathViaSpecialDirectory(
NS_OS_CURRENT_WORKING_DIR,
PDFIUM_FILENAME,
pdfiumPath)));
const NS_ConvertUTF16toUTF8 externalDll(pdfiumPath);
mPDFiumEngine = PDFiumEngineShim::GetInstanceOrNull(externalDll); mPDFiumEngine = PDFiumEngineShim::GetInstanceOrNull(externalDll);
MOZ_RELEASE_ASSERT(mPDFiumEngine);
} }
return !!mPDFiumEngine; return !!mPDFiumEngine;
@ -201,4 +208,4 @@ TEST(TestEMFConversion, TestInsufficientWidthAndHeight)
} }
} // namespace widget } // namespace widget
} // namespace mozilla } // namespace mozilla