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

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

Side-by-side diff isn't available for this file because of its large size.
Issue 2531653002: [api] Support sharing prototypes between FunctionTemplates (Closed)
Patch Set: fixing test 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:
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 48d0c156e7fb76b3e03ffda22c0bb7ac27c3f52d..aa8396a2be182c5f78a7b8cc41ffa51218ecb3c8 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -26159,3 +26159,29 @@ TEST(InternalFieldsOnDataView) {
array->GetAlignedPointerFromInternalField(i));
}
}
+
+TEST(SetPrototypeTemplate) {
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ v8::HandleScope scope(isolate);
+
+ Local<FunctionTemplate> HTMLElementTemplate = FunctionTemplate::New(isolate);
+ Local<FunctionTemplate> HTMLImageElementTemplate =
+ FunctionTemplate::New(isolate);
+ HTMLImageElementTemplate->Inherit(HTMLElementTemplate);
+
+ Local<FunctionTemplate> ImageTemplate = FunctionTemplate::New(isolate);
+ ImageTemplate->SetPrototypeProviderTemplate(HTMLImageElementTemplate);
+
+ Local<Function> HTMLImageElement =
+ HTMLImageElementTemplate->GetFunction(env.local()).ToLocalChecked();
+ Local<Function> Image =
+ ImageTemplate->GetFunction(env.local()).ToLocalChecked();
+
+ CHECK(env->Global()
+ ->Set(env.local(), v8_str("HTMLImageElement"), HTMLImageElement)
+ .FromJust());
+ CHECK(env->Global()->Set(env.local(), v8_str("Image"), Image).FromJust());
+
+ ExpectTrue("Image.prototype === HTMLImageElement.prototype");
+}
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698