summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/js_embedder_test.cpp11
-rw-r--r--testing/js_embedder_test.h4
2 files changed, 8 insertions, 7 deletions
diff --git a/testing/js_embedder_test.cpp b/testing/js_embedder_test.cpp
index 1b21fe04db..f7aa7e38f7 100644
--- a/testing/js_embedder_test.cpp
+++ b/testing/js_embedder_test.cpp
@@ -21,13 +21,14 @@ void JSEmbedderTest::SetUp() {
v8::Isolate::Scope isolate_scope(m_pIsolate);
v8::HandleScope handle_scope(m_pIsolate);
FXJS_PerIsolateData::SetUp(m_pIsolate);
- FXJS_InitializeEngine(m_pIsolate, nullptr, &m_pPersistentContext,
- &m_StaticObjects);
+ m_Engine.reset(new CFXJS_Engine);
+ m_Engine->SetIsolate(m_pIsolate);
+ m_Engine->InitializeEngine();
}
void JSEmbedderTest::TearDown() {
- FXJS_ReleaseEngine(m_pIsolate, &m_pPersistentContext, &m_StaticObjects);
- m_pPersistentContext.Reset();
+ m_Engine->ReleaseEngine();
+ m_Engine.reset();
EmbedderTest::TearDown();
m_pIsolate->Dispose();
m_pIsolate = nullptr;
@@ -38,5 +39,5 @@ v8::Isolate* JSEmbedderTest::isolate() {
}
v8::Local<v8::Context> JSEmbedderTest::GetV8Context() {
- return m_pPersistentContext.Get(m_pIsolate);
+ return m_Engine->GetPersistentContext();
}
diff --git a/testing/js_embedder_test.h b/testing/js_embedder_test.h
index b2bd5a87b1..f0beb1eb29 100644
--- a/testing/js_embedder_test.h
+++ b/testing/js_embedder_test.h
@@ -21,12 +21,12 @@ class JSEmbedderTest : public EmbedderTest {
v8::Isolate* isolate();
v8::Local<v8::Context> GetV8Context();
+ CFXJS_Engine* engine() { return m_Engine.get(); }
private:
std::unique_ptr<FXJS_ArrayBufferAllocator> m_pArrayBufferAllocator;
v8::Isolate* m_pIsolate;
- v8::Global<v8::Context> m_pPersistentContext;
- std::vector<v8::Global<v8::Object>*> m_StaticObjects;
+ std::unique_ptr<CFXJS_Engine> m_Engine;
};
#endif // TESTING_JS_EMBEDDER_TEST_H_