blob: fdd4c0843a6149c8501472cb920149ea0b71e43a [file] [log] [blame]
K. Moon832a6942022-10-31 20:11:31 +00001// Copyright 2020 The PDFium Authors
Tom Sepez1b6a47d2020-07-21 23:32:19 +00002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Tom Sepezf5397f02020-07-23 21:22:40 +00005#include "testing/fxv8_unittest.h"
Tom Sepez1b6a47d2020-07-21 23:32:19 +00006
Lei Zhang59a1a912021-06-07 16:55:25 +00007#include <memory>
8
Lei Zhang020fbf22021-09-21 21:58:22 +00009#include "fxjs/cfx_v8_array_buffer_allocator.h"
Lei Zhangbfcf1562022-07-07 01:49:26 +000010#include "v8/include/v8-isolate.h"
Tom Sepez1b6a47d2020-07-21 23:32:19 +000011
12void FXV8UnitTest::V8IsolateDeleter::operator()(v8::Isolate* ptr) const {
13 ptr->Dispose();
14}
15
16FXV8UnitTest::FXV8UnitTest() = default;
17
18FXV8UnitTest::~FXV8UnitTest() = default;
19
20void FXV8UnitTest::SetUp() {
21 array_buffer_allocator_ = std::make_unique<CFX_V8ArrayBufferAllocator>();
22
23 v8::Isolate::CreateParams params;
24 params.array_buffer_allocator = array_buffer_allocator_.get();
25 isolate_.reset(v8::Isolate::New(params));
26}