Split off fxv8_unittest.h from cfx_v8_unittest.h
Makes filename match class name. Makes cfx_v8_unittest.cpp more
similar to cfxjs_eninge_unittest.cpp. Allows simpler use of the
FXV8UnitTest component down the road.
Change-Id: I04cb3ff6e996655442ac232ecb4eb0dd80a17192
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/71830
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fxjs/fxv8_unittest.cpp b/fxjs/fxv8_unittest.cpp
new file mode 100644
index 0000000..509178a
--- /dev/null
+++ b/fxjs/fxv8_unittest.cpp
@@ -0,0 +1,24 @@
+// Copyright 2020 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "fxjs/fxv8_unittest.h"
+
+#include "fxjs/cfx_v8.h"
+#include "v8/include/v8.h"
+
+void FXV8UnitTest::V8IsolateDeleter::operator()(v8::Isolate* ptr) const {
+ ptr->Dispose();
+}
+
+FXV8UnitTest::FXV8UnitTest() = default;
+
+FXV8UnitTest::~FXV8UnitTest() = default;
+
+void FXV8UnitTest::SetUp() {
+ array_buffer_allocator_ = std::make_unique<CFX_V8ArrayBufferAllocator>();
+
+ v8::Isolate::CreateParams params;
+ params.array_buffer_allocator = array_buffer_allocator_.get();
+ isolate_.reset(v8::Isolate::New(params));
+}