From 33c7ade187724c767fff74913cda63de182b0ce2 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 1 Feb 2018 02:11:44 +0000 Subject: Test more context overlap in fxjs/fxjs_v8_embeddertest.cpp Change-Id: If9ab65019f12244938116e19f717e2092ccae4ff Reviewed-on: https://pdfium-review.googlesource.com/24931 Commit-Queue: dsinclair Reviewed-by: dsinclair --- fxjs/fxjs_v8_embeddertest.cpp | 31 ++++++++++++++++++++++++++----- 1 file 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 context1 = engine1.NewLocalContext(); + v8::Local context2 = engine2.NewLocalContext(); + v8::Context::Scope context_scope(GetV8Context()); ExecuteInCurrentContext(WideString(kScript0)); CheckAssignmentInCurrentContext(kExpected0); { - v8::Local 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 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) { -- cgit v1.2.3