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

Unified Diff: test/unittests/api/remote-object-unittest.cc

Issue 2698683003: Make FunctionTemplate::HasInstance checks work with remote contexts. (Closed)
Patch Set: Handle parent templates Created 3 years, 10 months 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
« src/api.cc ('K') | « src/api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/api/remote-object-unittest.cc
diff --git a/test/unittests/api/remote-object-unittest.cc b/test/unittests/api/remote-object-unittest.cc
index dc45d086ab86989221fff922e2f9885749387f78..4830ee53e5eb261429e8e8784f523516b56d2bd9 100644
--- a/test/unittests/api/remote-object-unittest.cc
+++ b/test/unittests/api/remote-object-unittest.cc
@@ -59,4 +59,23 @@ TEST_F(RemoteObjectTest, CreationContextOfRemoteObject) {
EXPECT_TRUE(remote_object->CreationContext().IsEmpty());
}
+TEST_F(RemoteObjectTest, RemoteContextHasInstance) {
+ v8::Local<v8::FunctionTemplate> parent_template =
+ v8::FunctionTemplate::New(isolate(), Constructor);
+
+ v8::Local<v8::FunctionTemplate> constructor_template =
+ v8::FunctionTemplate::New(isolate(), Constructor);
+ constructor_template->InstanceTemplate()->SetAccessCheckCallbackAndHandler(
+ AccessCheck, v8::NamedPropertyHandlerConfiguration(NamedGetter),
+ v8::IndexedPropertyHandlerConfiguration());
+ constructor_template->Inherit(parent_template);
+
+ v8::Local<v8::Object> remote_context =
+ v8::Context::NewRemoteContext(isolate(),
+ constructor_template->InstanceTemplate())
+ .ToLocalChecked();
+ EXPECT_TRUE(parent_template->HasInstance(remote_context));
+ EXPECT_TRUE(constructor_template->HasInstance(remote_context));
+}
+
} // namespace v8
« src/api.cc ('K') | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698