summaryrefslogtreecommitdiff
path: root/fxjs/cfx_v8_unittest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs/cfx_v8_unittest.cpp')
-rw-r--r--fxjs/cfx_v8_unittest.cpp40
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());