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

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

Issue 1128553002: Add ObjectTemplate::New() taking FunctionTemplate. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add ObjectTemplate::New() taking FunctionTemplate. Created 5 years, 7 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
« no previous file with comments | « 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/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 12f481019b05cfe2d87693b15354ac9f2514d519..2910cfcd959426e724fcd44d2f905c3aec8a74d3 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -1782,17 +1782,22 @@ THREADED_TEST(GlobalPrototype) {
THREADED_TEST(ObjectTemplate) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
- Local<ObjectTemplate> templ1 = ObjectTemplate::New(isolate);
+ Local<v8::FunctionTemplate> fun = v8::FunctionTemplate::New(isolate);
+ v8::Local<v8::String> class_name =
+ v8::String::NewFromUtf8(isolate, "the_class_name");
+ fun->SetClassName(class_name);
+ Local<ObjectTemplate> templ1 = ObjectTemplate::New(isolate, fun);
templ1->Set(isolate, "x", v8_num(10));
templ1->Set(isolate, "y", v8_num(13));
LocalContext env;
Local<v8::Object> instance1 = templ1->NewInstance();
+ CHECK(class_name->StrictEquals(instance1->GetConstructorName()));
env->Global()->Set(v8_str("p"), instance1);
CHECK(v8_compile("(p.x == 10)")->Run()->BooleanValue());
CHECK(v8_compile("(p.y == 13)")->Run()->BooleanValue());
- Local<v8::FunctionTemplate> fun = v8::FunctionTemplate::New(isolate);
- fun->PrototypeTemplate()->Set(isolate, "nirk", v8_num(123));
- Local<ObjectTemplate> templ2 = fun->InstanceTemplate();
+ Local<v8::FunctionTemplate> fun2 = v8::FunctionTemplate::New(isolate);
+ fun2->PrototypeTemplate()->Set(isolate, "nirk", v8_num(123));
+ Local<ObjectTemplate> templ2 = fun2->InstanceTemplate();
templ2->Set(isolate, "a", v8_num(12));
templ2->Set(isolate, "b", templ1);
Local<v8::Object> instance2 = templ2->NewInstance();
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698