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

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

Issue 23182003: Push SetAccessor to Template (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: missed something Created 7 years, 4 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
Index: test/cctest/test-accessors.cc
diff --git a/test/cctest/test-accessors.cc b/test/cctest/test-accessors.cc
index 7d96ea64c2e77b858ce542dd13d50b559ae492e1..89c8d9f8705872d707dc197ff6f95ad53170656b 100644
--- a/test/cctest/test-accessors.cc
+++ b/test/cctest/test-accessors.cc
@@ -50,18 +50,34 @@ static void handle_property(Local<String> name,
info.GetReturnValue().Set(v8_num(900));
}
+static void handle_property_2(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
+ ApiTestFuzzer::Fuzz();
+ info.GetReturnValue().Set(v8_num(902));
+}
+
THREADED_TEST(PropertyHandler) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
- fun_templ->InstanceTemplate()->SetAccessor(v8_str("foo"), handle_property);
+ fun_templ->InstanceTemplate()->
+ SetNativeDataProperty(v8_str("instance_foo"), handle_property);
+ fun_templ->SetNativeDataProperty(v8_str("object_foo"), handle_property_2);
Local<Function> fun = fun_templ->GetFunction();
env->Global()->Set(v8_str("Fun"), fun);
- Local<Script> getter = v8_compile("var obj = new Fun(); obj.foo;");
+ Local<Script> getter;
+ Local<Script> setter;
+ // check function instance accessors
+ getter = v8_compile("var obj = new Fun(); obj.instance_foo;");
CHECK_EQ(900, getter->Run()->Int32Value());
- Local<Script> setter = v8_compile("obj.foo = 901;");
+ setter = v8_compile("obj.instance_foo = 901;");
CHECK_EQ(901, setter->Run()->Int32Value());
+ // check function static accessors
+ getter = v8_compile("Fun.object_foo;");
+ CHECK_EQ(902, getter->Run()->Int32Value());
+ setter = v8_compile("Fun.object_foo = 903;");
+ CHECK_EQ(903, setter->Run()->Int32Value());
}

Powered by Google App Engine
This is Rietveld 408576698