1 // Copyright 2018 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 5 #ifndef FXJS_CFX_V8_UNITTEST_H_ 6 #define FXJS_CFX_V8_UNITTEST_H_ 7 8 #include <memory> 9 10 #include "testing/gtest/include/gtest/gtest.h" 11 12 class CFX_V8; 13 class CFX_V8ArrayBufferAllocator; 14 15 namespace v8 { 16 class Isolate; 17 } // namespace v8 18 19 class FXV8UnitTest : public ::testing::Test { 20 public: 21 struct V8IsolateDeleter { 22 void operator()(v8::Isolate* ptr) const; 23 }; 24 25 FXV8UnitTest(); 26 ~FXV8UnitTest() override; 27 28 void SetUp() override; 29 isolate()30 v8::Isolate* isolate() const { return isolate_.get(); } cfx_v8()31 CFX_V8* cfx_v8() const { return cfx_v8_.get(); } 32 33 protected: 34 std::unique_ptr<CFX_V8ArrayBufferAllocator> array_buffer_allocator_; 35 std::unique_ptr<v8::Isolate, V8IsolateDeleter> isolate_; 36 std::unique_ptr<CFX_V8> cfx_v8_; 37 }; 38 39 #endif // FXJS_CFX_V8_UNITTEST_H_ 40