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 #ifndef TESTING_FXV8_UNITTEST_H_ 6 #define TESTING_FXV8_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(); } 31 32 protected: 33 std::unique_ptr<CFX_V8ArrayBufferAllocator> array_buffer_allocator_; 34 std::unique_ptr<v8::Isolate, V8IsolateDeleter> isolate_; 35 }; 36 37 #endif // TESTING_FXV8_UNITTEST_H_ 38