summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fxjs/fxjs_v8_embeddertest.cpp31
1 files changed, 26 insertions, 5 deletions
diff --git a/fxjs/fxjs_v8_embeddertest.cpp b/fxjs/fxjs_v8_embeddertest.cpp
index d975264d1d..21e6460b8c 100644
--- a/fxjs/fxjs_v8_embeddertest.cpp
+++ b/fxjs/fxjs_v8_embeddertest.cpp
@@ -51,28 +51,49 @@ TEST_F(FXJSV8EmbedderTest, MultipleEngines) {
CFXJS_Engine engine2(isolate());
engine2.InitializeEngine();
+ v8::Local<v8::Context> context1 = engine1.NewLocalContext();
+ v8::Local<v8::Context> context2 = engine2.NewLocalContext();
+
v8::Context::Scope context_scope(GetV8Context());
ExecuteInCurrentContext(WideString(kScript0));
CheckAssignmentInCurrentContext(kExpected0);
{
- v8::Local<v8::Context> context1 = engine1.NewLocalContext();
v8::Context::Scope context_scope1(context1);
ExecuteInCurrentContext(WideString(kScript1));
CheckAssignmentInCurrentContext(kExpected1);
}
+ {
+ v8::Context::Scope context_scope2(context2);
+ ExecuteInCurrentContext(WideString(kScript2));
+ CheckAssignmentInCurrentContext(kExpected2);
+ }
- engine1.ReleaseEngine();
+ CheckAssignmentInCurrentContext(kExpected0);
{
- v8::Local<v8::Context> context2 = engine2.NewLocalContext();
+ v8::Context::Scope context_scope1(context1);
+ CheckAssignmentInCurrentContext(kExpected1);
+ {
+ v8::Context::Scope context_scope2(context2);
+ CheckAssignmentInCurrentContext(kExpected2);
+ }
+ CheckAssignmentInCurrentContext(kExpected1);
+ }
+ {
v8::Context::Scope context_scope2(context2);
- ExecuteInCurrentContext(WideString(kScript2));
+ CheckAssignmentInCurrentContext(kExpected2);
+ {
+ v8::Context::Scope context_scope1(context1);
+ CheckAssignmentInCurrentContext(kExpected1);
+ }
CheckAssignmentInCurrentContext(kExpected2);
}
- engine2.ReleaseEngine();
CheckAssignmentInCurrentContext(kExpected0);
+
+ engine1.ReleaseEngine();
+ engine2.ReleaseEngine();
}
TEST_F(FXJSV8EmbedderTest, EmptyLocal) {