blob: 031981df8ea6937ff097cda77c59cd1f78a9518b [file] [log] [blame]
kumarashishg826308d2023-06-23 13:21:22 +00001// 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/external_engine_embedder_test.h"
6
7#include <memory>
8
9#include "fxjs/cfxjs_engine.h"
10#include "testing/v8_test_environment.h"
11#include "v8/include/v8-context.h"
12#include "v8/include/v8-isolate.h"
13#include "v8/include/v8-local-handle.h"
14
15ExternalEngineEmbedderTest::ExternalEngineEmbedderTest() = default;
16
17ExternalEngineEmbedderTest::~ExternalEngineEmbedderTest() = default;
18
19void ExternalEngineEmbedderTest::SetUp() {
20 EmbedderTest::SetUp();
21
22 v8::Isolate::Scope isolate_scope(isolate());
23 v8::HandleScope handle_scope(isolate());
24 FXJS_PerIsolateData::SetUp(isolate());
25 m_Engine = std::make_unique<CFXJS_Engine>(isolate());
26 m_Engine->InitializeEngine();
27}
28
29void ExternalEngineEmbedderTest::TearDown() {
30 m_Engine->ReleaseEngine();
31 m_Engine.reset();
32 JSEmbedderTest::TearDown();
33}
34
35v8::Local<v8::Context> ExternalEngineEmbedderTest::GetV8Context() {
36 return m_Engine->GetV8Context();
37}