diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-02-12 21:49:04 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-02-12 21:49:04 +0000 |
commit | 3e5fac8169987afe652752ca5c7b9350ffabce0d (patch) | |
tree | be0a898268dc0366af721216db03744f1ec6cb75 /fxjs/cfx_v8_unittest.cpp | |
parent | ad905158b86269686f94ea76d1b700f68ea377d5 (diff) | |
download | pdfium-3e5fac8169987afe652752ca5c7b9350ffabce0d.tar.xz |
Test if GC'd FXJS objects have their C-side counterparts cleaned up.
Small correctness fix in other engine embeddertest.
Change-Id: I6c2721921a659eef1b2f155ea1797722d37209d0
Reviewed-on: https://pdfium-review.googlesource.com/26270
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/cfx_v8_unittest.cpp')
-rw-r--r-- | fxjs/cfx_v8_unittest.cpp | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/fxjs/cfx_v8_unittest.cpp b/fxjs/cfx_v8_unittest.cpp index db7da961e8..879d90462d 100644 --- a/fxjs/cfx_v8_unittest.cpp +++ b/fxjs/cfx_v8_unittest.cpp @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "fxjs/cfx_v8.h" +#include "fxjs/cfx_v8_unittest.h" #include <memory> @@ -10,37 +10,23 @@ #include "testing/test_support.h" #include "third_party/base/ptr_util.h" -namespace { - -struct V8IsolateDeleter { - inline void operator()(v8::Isolate* ptr) const { ptr->Dispose(); } -}; - -} // namespace - -class FXV8UnitTest : public ::testing::Test { - public: - FXV8UnitTest() = default; - ~FXV8UnitTest() override = default; +void FXV8UnitTest::V8IsolateDeleter::operator()(v8::Isolate* ptr) const { + ptr->Dispose(); +} - void SetUp() override { - array_buffer_allocator_ = pdfium::MakeUnique<CFX_V8ArrayBufferAllocator>(); +FXV8UnitTest::FXV8UnitTest() = default; - v8::Isolate::CreateParams params; - params.array_buffer_allocator = array_buffer_allocator_.get(); - isolate_.reset(v8::Isolate::New(params)); +FXV8UnitTest::~FXV8UnitTest() = default; - cfx_v8_ = pdfium::MakeUnique<CFX_V8>(isolate_.get()); - } +void FXV8UnitTest::SetUp() { + array_buffer_allocator_ = pdfium::MakeUnique<CFX_V8ArrayBufferAllocator>(); - v8::Isolate* isolate() const { return isolate_.get(); } - CFX_V8* cfx_v8() const { return cfx_v8_.get(); } + v8::Isolate::CreateParams params; + params.array_buffer_allocator = array_buffer_allocator_.get(); + isolate_.reset(v8::Isolate::New(params)); - protected: - std::unique_ptr<CFX_V8ArrayBufferAllocator> array_buffer_allocator_; - std::unique_ptr<v8::Isolate, V8IsolateDeleter> isolate_; - std::unique_ptr<CFX_V8> cfx_v8_; -}; + cfx_v8_ = pdfium::MakeUnique<CFX_V8>(isolate_.get()); +} TEST_F(FXV8UnitTest, EmptyLocal) { v8::Isolate::Scope isolate_scope(isolate()); |