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_EXTERNAL_ENGINE_EMBEDDER_TEST_H_ 6 #define TESTING_EXTERNAL_ENGINE_EMBEDDER_TEST_H_ 7 8 #include <memory> 9 10 #include "testing/js_embedder_test.h" 11 #include "v8/include/v8-context.h" 12 #include "v8/include/v8-local-handle.h" 13 14 class CFXJS_Engine; 15 16 // Test class that allows creating a FXJS javascript engine without 17 // first having to load a document and instantiate a form filler 18 // against it. Generally, most tests will want to do the latter. 19 class ExternalEngineEmbedderTest : public JSEmbedderTest { 20 public: 21 ExternalEngineEmbedderTest(); 22 ~ExternalEngineEmbedderTest() override; 23 24 // EmbedderTest: 25 void SetUp() override; 26 void TearDown() override; 27 engine()28 CFXJS_Engine* engine() const { return m_Engine.get(); } 29 v8::Local<v8::Context> GetV8Context(); 30 31 private: 32 std::unique_ptr<CFXJS_Engine> m_Engine; 33 }; 34 35 #endif // TESTING_EXTERNAL_ENGINE_EMBEDDER_TEST_H_ 36