Tom Sepez | 1b6a47d | 2020-07-21 23:32:19 +0000 | [diff] [blame] | 1 | // Copyright 2020 PDFium Authors. All rights reserved. |
| 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 | |
| 7 | #include "fxjs/cfx_v8.h" |
| 8 | #include "v8/include/v8.h" |
| 9 | |
| 10 | void FXV8UnitTest::V8IsolateDeleter::operator()(v8::Isolate* ptr) const { |
| 11 | ptr->Dispose(); |
| 12 | } |
| 13 | |
| 14 | FXV8UnitTest::FXV8UnitTest() = default; |
| 15 | |
| 16 | FXV8UnitTest::~FXV8UnitTest() = default; |
| 17 | |
| 18 | void FXV8UnitTest::SetUp() { |
| 19 | array_buffer_allocator_ = std::make_unique<CFX_V8ArrayBufferAllocator>(); |
| 20 | |
| 21 | v8::Isolate::CreateParams params; |
| 22 | params.array_buffer_allocator = array_buffer_allocator_.get(); |
| 23 | isolate_.reset(v8::Isolate::New(params)); |
| 24 | } |