1 // Copyright 2015 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 TESTING_JS_EMBEDDER_TEST_H_ 6 #define TESTING_JS_EMBEDDER_TEST_H_ 7 8 #include <memory> 9 10 #include "fxjs/cfx_v8.h" 11 #include "testing/embedder_test.h" 12 #include "v8/include/v8.h" 13 14 class CFXJS_Engine; 15 class CFX_V8ArrayBufferAllocator; 16 17 class JSEmbedderTest : public EmbedderTest { 18 public: 19 JSEmbedderTest(); 20 ~JSEmbedderTest() override; 21 22 void SetUp() override; 23 void TearDown() override; 24 isolate()25 v8::Isolate* isolate() const { return m_pIsolate.get(); } engine()26 CFXJS_Engine* engine() const { return m_Engine.get(); } 27 v8::Local<v8::Context> GetV8Context(); 28 29 private: 30 std::unique_ptr<CFX_V8ArrayBufferAllocator> m_pArrayBufferAllocator; 31 std::unique_ptr<v8::Isolate, CFX_V8IsolateDeleter> m_pIsolate; 32 std::unique_ptr<CFXJS_Engine> m_Engine; 33 }; 34 35 #endif // TESTING_JS_EMBEDDER_TEST_H_ 36