Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: test/cctest/test-serialize.cc

Issue 2571743002: [serializer] API to re-use global proxy in v8::Context::FromSnapshot. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/snapshot/snapshot-common.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-serialize.cc
diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc
index c15e892d62b466ae6f094cdd0aed27e723a312bc..041d5bbe9df13eeb4badb86778f323b8d66ecc20 100644
--- a/test/cctest/test-serialize.cc
+++ b/test/cctest/test-serialize.cc
@@ -2443,15 +2443,37 @@ TEST(SnapshotCreatorIncludeGlobalProxy) {
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context =
v8::Context::FromSnapshot(isolate, 0).ToLocalChecked();
- v8::Context::Scope context_scope(context);
- ExpectInt32("f()", 42);
- ExpectInt32("g()", 12);
- ExpectInt32("h()", 13);
- ExpectInt32("i()", 24);
- ExpectInt32("j()", 25);
- ExpectInt32("o.p", 8);
- ExpectInt32("x", 2016);
- ExpectInt32("y", 2017);
+ {
+ v8::Context::Scope context_scope(context);
+ ExpectInt32("f()", 42);
+ ExpectInt32("g()", 12);
+ ExpectInt32("h()", 13);
+ ExpectInt32("i()", 24);
+ ExpectInt32("j()", 25);
+ ExpectInt32("o.p", 8);
+ ExpectInt32("x", 2016);
+ }
+
+ v8::Local<v8::Object> global = context->Global();
+ context->DetachGlobal();
+
+ // New context, but reuse global proxy.
+ v8::ExtensionConfiguration* no_extensions = nullptr;
+ v8::Local<v8::Context> context2 =
+ v8::Context::FromSnapshot(isolate, 0, no_extensions, global)
+ .ToLocalChecked();
+ {
+ v8::Context::Scope context_scope(context2);
+ ExpectInt32("f()", 42);
+ ExpectInt32("g()", 12);
+ ExpectInt32("h()", 13);
+ ExpectInt32("i()", 24);
+ ExpectInt32("j()", 25);
+ ExpectInt32("o.p", 8);
+ ExpectInt32("x", 2016);
+ }
+
+ CHECK(context2->Global()->Equals(context2, global).FromJust());
}
}
isolate->Dispose();
« no previous file with comments | « src/snapshot/snapshot-common.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698