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 // Forcing the property to be set should override the accessor without | |
13270 // calling it | |
13271 global->ForceSet(access_property, v8::Int32::New(isolate, 8)); | 13269 global->ForceSet(access_property, v8::Int32::New(isolate, 8)); |
Igor Sheludko
2015/06/11 13:44:25
I think it makes sense to add the above comment he
Toon Verwaest
2015/06/11 14:26:50
Done.
| |
13272 CHECK_EQ(8, global->Get(access_property)->Int32Value()); | 13270 CHECK_EQ(3, global->Get(access_property)->Int32Value()); |
13273 CHECK_EQ(1, force_set_set_count); | 13271 CHECK_EQ(2, force_set_set_count); |
13274 CHECK_EQ(2, force_set_get_count); | 13272 CHECK_EQ(3, force_set_get_count); |
13275 } | 13273 } |
13276 | 13274 |
13277 | 13275 |
13278 TEST(ForceSetWithInterceptor) { | 13276 TEST(ForceSetWithInterceptor) { |
13279 force_set_get_count = 0; | 13277 force_set_get_count = 0; |
13280 force_set_set_count = 0; | 13278 force_set_set_count = 0; |
13281 pass_on_get = false; | 13279 pass_on_get = false; |
13282 | 13280 |
13283 v8::Isolate* isolate = CcTest::isolate(); | 13281 v8::Isolate* isolate = CcTest::isolate(); |
13284 v8::HandleScope scope(isolate); | 13282 v8::HandleScope scope(isolate); |
(...skipping 8227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
21512 CHECK_EQ(2U, set->Size()); | 21510 CHECK_EQ(2U, set->Size()); |
21513 | 21511 |
21514 v8::Local<v8::Array> keys = set->AsArray(); | 21512 v8::Local<v8::Array> keys = set->AsArray(); |
21515 CHECK_EQ(2U, keys->Length()); | 21513 CHECK_EQ(2U, keys->Length()); |
21516 CHECK_EQ(1, keys->Get(0).As<v8::Int32>()->Value()); | 21514 CHECK_EQ(1, keys->Get(0).As<v8::Int32>()->Value()); |
21517 CHECK_EQ(2, keys->Get(1).As<v8::Int32>()->Value()); | 21515 CHECK_EQ(2, keys->Get(1).As<v8::Int32>()->Value()); |
21518 | 21516 |
21519 set = v8::Set::FromArray(env.local(), keys).ToLocalChecked(); | 21517 set = v8::Set::FromArray(env.local(), keys).ToLocalChecked(); |
21520 CHECK_EQ(2U, set->Size()); | 21518 CHECK_EQ(2U, set->Size()); |
21521 } | 21519 } |
OLD | NEW |