xref: /aosp_15_r20/external/pdfium/testing/fxv8_unittest.cpp (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2020 The PDFium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "testing/fxv8_unittest.h"
6 
7 #include <memory>
8 
9 #include "fxjs/cfx_v8_array_buffer_allocator.h"
10 #include "v8/include/v8-isolate.h"
11 
operator ()(v8::Isolate * ptr) const12 void FXV8UnitTest::V8IsolateDeleter::operator()(v8::Isolate* ptr) const {
13   ptr->Dispose();
14 }
15 
16 FXV8UnitTest::FXV8UnitTest() = default;
17 
18 FXV8UnitTest::~FXV8UnitTest() = default;
19 
SetUp()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 }
27