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 15320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15331 // Accessors | 15331 // Accessors |
15332 CHECK_EQ(0, force_set_set_count); | 15332 CHECK_EQ(0, force_set_set_count); |
15333 CHECK_EQ(0, force_set_get_count); | 15333 CHECK_EQ(0, force_set_get_count); |
15334 CHECK_EQ(3, global->Get(access_property)->Int32Value()); | 15334 CHECK_EQ(3, global->Get(access_property)->Int32Value()); |
15335 // CHECK_EQ the property shouldn't override it, just call the setter | 15335 // CHECK_EQ the property shouldn't override it, just call the setter |
15336 // which in this case does nothing. | 15336 // which in this case does nothing. |
15337 global->Set(access_property, v8::Int32::New(isolate, 7)); | 15337 global->Set(access_property, v8::Int32::New(isolate, 7)); |
15338 CHECK_EQ(3, global->Get(access_property)->Int32Value()); | 15338 CHECK_EQ(3, global->Get(access_property)->Int32Value()); |
15339 CHECK_EQ(1, force_set_set_count); | 15339 CHECK_EQ(1, force_set_set_count); |
15340 CHECK_EQ(2, force_set_get_count); | 15340 CHECK_EQ(2, force_set_get_count); |
15341 // Forcing the property to be set should call the accessor | 15341 // Forcing the property to be set should override the accessor without |
| 15342 // calling it |
15342 global->ForceSet(access_property, v8::Int32::New(isolate, 8)); | 15343 global->ForceSet(access_property, v8::Int32::New(isolate, 8)); |
15343 CHECK_EQ(3, global->Get(access_property)->Int32Value()); | 15344 CHECK_EQ(8, global->Get(access_property)->Int32Value()); |
15344 CHECK_EQ(2, force_set_set_count); | 15345 CHECK_EQ(1, force_set_set_count); |
15345 CHECK_EQ(3, force_set_get_count); | 15346 CHECK_EQ(2, force_set_get_count); |
15346 } | 15347 } |
15347 | 15348 |
15348 | 15349 |
15349 TEST(ForceSetWithInterceptor) { | 15350 TEST(ForceSetWithInterceptor) { |
15350 force_set_get_count = 0; | 15351 force_set_get_count = 0; |
15351 force_set_set_count = 0; | 15352 force_set_set_count = 0; |
15352 pass_on_get = false; | 15353 pass_on_get = false; |
15353 | 15354 |
15354 v8::Isolate* isolate = CcTest::isolate(); | 15355 v8::Isolate* isolate = CcTest::isolate(); |
15355 v8::HandleScope scope(isolate); | 15356 v8::HandleScope scope(isolate); |
(...skipping 7506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22862 SourceURLHelper("function foo() {}\n" | 22863 SourceURLHelper("function foo() {}\n" |
22863 "//# sourceURL=bar19\".js \n" | 22864 "//# sourceURL=bar19\".js \n" |
22864 "//# sourceMappingURL=bar20\".js \n", | 22865 "//# sourceMappingURL=bar20\".js \n", |
22865 NULL, NULL); | 22866 NULL, NULL); |
22866 | 22867 |
22867 // Not too much whitespace. | 22868 // Not too much whitespace. |
22868 SourceURLHelper("function foo() {}\n" | 22869 SourceURLHelper("function foo() {}\n" |
22869 "//# sourceURL= bar21.js \n" | 22870 "//# sourceURL= bar21.js \n" |
22870 "//# sourceMappingURL= bar22.js \n", "bar21.js", "bar22.js"); | 22871 "//# sourceMappingURL= bar22.js \n", "bar21.js", "bar22.js"); |
22871 } | 22872 } |
OLD | NEW |