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 13248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13259 // Accessors | 13259 // Accessors |
13260 CHECK_EQ(0, force_set_set_count); | 13260 CHECK_EQ(0, force_set_set_count); |
13261 CHECK_EQ(0, force_set_get_count); | 13261 CHECK_EQ(0, force_set_get_count); |
13262 CHECK_EQ(3, global->Get(access_property)->Int32Value()); | 13262 CHECK_EQ(3, global->Get(access_property)->Int32Value()); |
13263 // CHECK_EQ the property shouldn't override it, just call the setter | 13263 // CHECK_EQ the property shouldn't override it, just call the setter |
13264 // which in this case does nothing. | 13264 // which in this case does nothing. |
13265 global->Set(access_property, v8::Int32::New(isolate, 7)); | 13265 global->Set(access_property, v8::Int32::New(isolate, 7)); |
13266 CHECK_EQ(3, global->Get(access_property)->Int32Value()); | 13266 CHECK_EQ(3, global->Get(access_property)->Int32Value()); |
13267 CHECK_EQ(1, force_set_set_count); | 13267 CHECK_EQ(1, force_set_set_count); |
13268 CHECK_EQ(2, force_set_get_count); | 13268 CHECK_EQ(2, force_set_get_count); |
13269 // ForceSet does not remove the accessors, but rather calls the setter. | 13269 // ForceSet doesn't call the accessors for now. |
| 13270 // TODO(verwaest): Update once blink doesn't rely on ForceSet to delete api |
| 13271 // accessors. |
13270 global->ForceSet(access_property, v8::Int32::New(isolate, 8)); | 13272 global->ForceSet(access_property, v8::Int32::New(isolate, 8)); |
13271 CHECK_EQ(3, global->Get(access_property)->Int32Value()); | 13273 CHECK_EQ(8, global->Get(access_property)->Int32Value()); |
13272 CHECK_EQ(2, force_set_set_count); | 13274 CHECK_EQ(1, force_set_set_count); |
13273 CHECK_EQ(3, force_set_get_count); | 13275 CHECK_EQ(2, force_set_get_count); |
13274 } | 13276 } |
13275 | 13277 |
13276 | 13278 |
13277 TEST(ForceSetWithInterceptor) { | 13279 TEST(ForceSetWithInterceptor) { |
13278 force_set_get_count = 0; | 13280 force_set_get_count = 0; |
13279 force_set_set_count = 0; | 13281 force_set_set_count = 0; |
13280 pass_on_get = false; | 13282 pass_on_get = false; |
13281 | 13283 |
13282 v8::Isolate* isolate = CcTest::isolate(); | 13284 v8::Isolate* isolate = CcTest::isolate(); |
13283 v8::HandleScope scope(isolate); | 13285 v8::HandleScope scope(isolate); |
(...skipping 8241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21525 CHECK_EQ(2U, set->Size()); | 21527 CHECK_EQ(2U, set->Size()); |
21526 | 21528 |
21527 v8::Local<v8::Array> keys = set->AsArray(); | 21529 v8::Local<v8::Array> keys = set->AsArray(); |
21528 CHECK_EQ(2U, keys->Length()); | 21530 CHECK_EQ(2U, keys->Length()); |
21529 CHECK_EQ(1, keys->Get(0).As<v8::Int32>()->Value()); | 21531 CHECK_EQ(1, keys->Get(0).As<v8::Int32>()->Value()); |
21530 CHECK_EQ(2, keys->Get(1).As<v8::Int32>()->Value()); | 21532 CHECK_EQ(2, keys->Get(1).As<v8::Int32>()->Value()); |
21531 | 21533 |
21532 set = v8::Set::FromArray(env.local(), keys).ToLocalChecked(); | 21534 set = v8::Set::FromArray(env.local(), keys).ToLocalChecked(); |
21533 CHECK_EQ(2U, set->Size()); | 21535 CHECK_EQ(2U, set->Size()); |
21534 } | 21536 } |
OLD | NEW |