K. Moon | 832a694 | 2022-10-31 20:11:31 +0000 | [diff] [blame] | 1 | // Copyright 2020 The PDFium Authors |
Tom Sepez | 1b6a47d | 2020-07-21 23:32:19 +0000 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Tom Sepez | f5397f0 | 2020-07-23 21:22:40 +0000 | [diff] [blame] | 5 | #include "testing/fxv8_unittest.h" |
Tom Sepez | 1b6a47d | 2020-07-21 23:32:19 +0000 | [diff] [blame] | 6 | |
Lei Zhang | 59a1a91 | 2021-06-07 16:55:25 +0000 | [diff] [blame] | 7 | #include <memory> |
| 8 | |
Lei Zhang | 020fbf2 | 2021-09-21 21:58:22 +0000 | [diff] [blame] | 9 | #include "fxjs/cfx_v8_array_buffer_allocator.h" |
Lei Zhang | bfcf156 | 2022-07-07 01:49:26 +0000 | [diff] [blame] | 10 | #include "v8/include/v8-isolate.h" |
Tom Sepez | 1b6a47d | 2020-07-21 23:32:19 +0000 | [diff] [blame] | 11 | |
| 12 | void FXV8UnitTest::V8IsolateDeleter::operator()(v8::Isolate* ptr) const { |
| 13 | ptr->Dispose(); |
| 14 | } |
| 15 | |
| 16 | FXV8UnitTest::FXV8UnitTest() = default; |
| 17 | |
| 18 | FXV8UnitTest::~FXV8UnitTest() = default; |
| 19 | |
| 20 | void 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 | } |