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

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: rebase, grokdump Created 7 years, 3 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/objects-printer.cc ('k') | test/cctest/test-declarative-accessors.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-accessors.cc
diff --git a/test/cctest/test-accessors.cc b/test/cctest/test-accessors.cc
index 2f7e7f4e7d563b443a2cbb96de6cf500df85f79f..b68b0b0011bfafa3d521dfa99ed1406524d1c897 100644
--- a/test/cctest/test-accessors.cc
+++ b/test/cctest/test-accessors.cc
@@ -49,6 +49,12 @@ 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));
+}
+
static void handle_property(const v8::FunctionCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
@@ -67,16 +73,27 @@ THREADED_TEST(PropertyHandler) {
getter_templ->SetLength(0);
fun_templ->
InstanceTemplate()->SetAccessorProperty(v8_str("bar"), getter_templ);
+ 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());
getter = v8_compile("obj.bar;");
CHECK_EQ(907, getter->Run()->Int32Value());
setter = v8_compile("obj.bar = 908;");
CHECK_EQ(908, 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());
}
« no previous file with comments | « src/objects-printer.cc ('k') | test/cctest/test-declarative-accessors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698