From 2785fb46249df5229e057917e54fe161bb0e3517 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 3 Mar 2015 09:49:29 -0800 Subject: Fix pdfium_embeddertests on XFA. Required to avoid a DCHECK() due to recent changes in V8 initialization. This mirrors the changes introduced at b045ed21 to pdfium_test.cpp in pdfium_embeddertest.cpp R=jam@chromium.org Review URL: https://codereview.chromium.org/969243002 --- BUILD.gn | 7 ++++++- pdfium.gyp | 5 ++++- testing/embedder_test.cpp | 5 +++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 7fb5963f67..830e7d1309 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1586,9 +1586,14 @@ test("pdfium_embeddertests") { deps = [ "//testing/gmock", "//testing/gtest", + "//v8:v8_libplatform", ":pdfium" ] - include_dirs = [ "." ] + include_dirs = [ + ".", + "//v8", + "//v8/include", + ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ ":pdfium_config", "//build/config/compiler:no_chromium_code" ] } diff --git a/pdfium.gyp b/pdfium.gyp index daf261a422..b6e68aa377 100644 --- a/pdfium.gyp +++ b/pdfium.gyp @@ -934,10 +934,13 @@ 'dependencies': [ '<(DEPTH)/testing/gmock.gyp:gmock', '<(DEPTH)/testing/gtest.gyp:gtest', + '<(DEPTH)/v8/tools/gyp/v8.gyp:v8_libplatform', 'pdfium', ], 'include_dirs': [ - '<(DEPTH)' + '<(DEPTH)', + '<(DEPTH)/v8', + '<(DEPTH)/v8/include', ], 'sources': [ 'fpdfsdk/src/fpdf_dataavail_embeddertest.cpp', diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp index ffe51192af..cf0bdf892c 100644 --- a/testing/embedder_test.cpp +++ b/testing/embedder_test.cpp @@ -19,6 +19,7 @@ #include "../core/include/fxcrt/fx_system.h" #include "testing/gmock/include/gmock/gmock.h" #include "v8/include/v8.h" +#include "v8/include/libplatform/libplatform.h" #ifdef _WIN32 #define snprintf _snprintf @@ -193,6 +194,9 @@ EmbedderTest::~EmbedderTest() { void EmbedderTest::SetUp() { v8::V8::InitializeICU(); + v8::Platform* platform = v8::platform::CreateDefaultPlatform(); + v8::V8::InitializePlatform(platform); + v8::V8::Initialize(); #ifdef V8_USE_EXTERNAL_STARTUP_DATA ASSERT_TRUE(GetExternalData(g_exe_path_, "natives_blob.bin", &natives_)); @@ -226,6 +230,7 @@ void EmbedderTest::TearDown() { if (file_contents_) { free(file_contents_); } + v8::V8::ShutdownPlatform(); } bool EmbedderTest::OpenDocument(const std::string& filename) { -- cgit v1.2.3