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

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

Issue 5256004: Expose an API method for getting JSObject constructor name (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 1 month 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/profile-generator.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
===================================================================
--- test/cctest/test-api.cc (revision 5888)
+++ test/cctest/test-api.cc (working copy)
@@ -7819,6 +7819,31 @@
}
+THREADED_TEST(ObjectGetConstructorName) {
+ v8::HandleScope scope;
+ LocalContext context;
+ v8_compile("function Parent() {};"
+ "function Child() {};"
+ "Child.prototype = new Parent();"
+ "var outer = { inner: function() { } };"
+ "var p = new Parent();"
+ "var c = new Child();"
+ "var x = new outer.inner();")->Run();
+
+ Local<v8::Value> p = context->Global()->Get(v8_str("p"));
+ CHECK(p->IsObject() && p->ToObject()->GetConstructorName()->Equals(
+ v8_str("Parent")));
+
+ Local<v8::Value> c = context->Global()->Get(v8_str("c"));
+ CHECK(c->IsObject() && c->ToObject()->GetConstructorName()->Equals(
+ v8_str("Child")));
+
+ Local<v8::Value> x = context->Global()->Get(v8_str("x"));
+ CHECK(x->IsObject() && x->ToObject()->GetConstructorName()->Equals(
+ v8_str("outer.inner")));
+}
+
+
bool ApiTestFuzzer::fuzzing_ = false;
i::Semaphore* ApiTestFuzzer::all_tests_done_=
i::OS::CreateSemaphore(0);
« no previous file with comments | « src/profile-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698