OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 15293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15304 // Accessors | 15304 // Accessors |
15305 CHECK_EQ(0, force_set_set_count); | 15305 CHECK_EQ(0, force_set_set_count); |
15306 CHECK_EQ(0, force_set_get_count); | 15306 CHECK_EQ(0, force_set_get_count); |
15307 CHECK_EQ(3, global->Get(access_property)->Int32Value()); | 15307 CHECK_EQ(3, global->Get(access_property)->Int32Value()); |
15308 // CHECK_EQ the property shouldn't override it, just call the setter | 15308 // CHECK_EQ the property shouldn't override it, just call the setter |
15309 // which in this case does nothing. | 15309 // which in this case does nothing. |
15310 global->Set(access_property, v8::Int32::New(isolate, 7)); | 15310 global->Set(access_property, v8::Int32::New(isolate, 7)); |
15311 CHECK_EQ(3, global->Get(access_property)->Int32Value()); | 15311 CHECK_EQ(3, global->Get(access_property)->Int32Value()); |
15312 CHECK_EQ(1, force_set_set_count); | 15312 CHECK_EQ(1, force_set_set_count); |
15313 CHECK_EQ(2, force_set_get_count); | 15313 CHECK_EQ(2, force_set_get_count); |
15314 // Forcing the property to be set should override the accessor without | 15314 // Forcing the property to be set should call the accessor |
15315 // calling it | |
15316 global->ForceSet(access_property, v8::Int32::New(isolate, 8)); | 15315 global->ForceSet(access_property, v8::Int32::New(isolate, 8)); |
15317 CHECK_EQ(8, global->Get(access_property)->Int32Value()); | 15316 CHECK_EQ(3, global->Get(access_property)->Int32Value()); |
15318 CHECK_EQ(1, force_set_set_count); | 15317 CHECK_EQ(2, force_set_set_count); |
15319 CHECK_EQ(2, force_set_get_count); | 15318 CHECK_EQ(3, force_set_get_count); |
15320 } | 15319 } |
15321 | 15320 |
15322 | 15321 |
15323 TEST(ForceSetWithInterceptor) { | 15322 TEST(ForceSetWithInterceptor) { |
15324 force_set_get_count = 0; | 15323 force_set_get_count = 0; |
15325 force_set_set_count = 0; | 15324 force_set_set_count = 0; |
15326 pass_on_get = false; | 15325 pass_on_get = false; |
15327 | 15326 |
15328 v8::Isolate* isolate = CcTest::isolate(); | 15327 v8::Isolate* isolate = CcTest::isolate(); |
15329 v8::HandleScope scope(isolate); | 15328 v8::HandleScope scope(isolate); |
(...skipping 7424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22754 call_eval_context = v8::Context::New(isolate); | 22753 call_eval_context = v8::Context::New(isolate); |
22755 v8::Context::Scope scope(call_eval_context); | 22754 v8::Context::Scope scope(call_eval_context); |
22756 call_eval_bound_function = | 22755 call_eval_bound_function = |
22757 Local<Function>::Cast(CompileRun("eval.bind(this, '1')")); | 22756 Local<Function>::Cast(CompileRun("eval.bind(this, '1')")); |
22758 } | 22757 } |
22759 env->Global()->Set(v8_str("CallEval"), | 22758 env->Global()->Set(v8_str("CallEval"), |
22760 v8::FunctionTemplate::New(isolate, CallEval)->GetFunction()); | 22759 v8::FunctionTemplate::New(isolate, CallEval)->GetFunction()); |
22761 Local<Value> result = CompileRun("CallEval();"); | 22760 Local<Value> result = CompileRun("CallEval();"); |
22762 CHECK_EQ(result, v8::Integer::New(isolate, 1)); | 22761 CHECK_EQ(result, v8::Integer::New(isolate, 1)); |
22763 } | 22762 } |
OLD | NEW |