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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 if (!expectations[i].old_value.IsEmpty()) { | 246 if (!expectations[i].old_value.IsEmpty()) { |
247 CHECK(expectations[i].old_value->Equals( | 247 CHECK(expectations[i].old_value->Equals( |
248 recordObj->Get(String::NewFromUtf8(isolate, "oldValue")))); | 248 recordObj->Get(String::NewFromUtf8(isolate, "oldValue")))); |
249 } | 249 } |
250 } | 250 } |
251 } | 251 } |
252 } | 252 } |
253 | 253 |
254 #define EXPECT_RECORDS(records, expectations) \ | 254 #define EXPECT_RECORDS(records, expectations) \ |
255 ExpectRecords(CcTest::isolate(), records, expectations, \ | 255 ExpectRecords(CcTest::isolate(), records, expectations, \ |
256 ARRAY_SIZE(expectations)) | 256 arraysize(expectations)) |
257 | 257 |
258 TEST(APITestBasicMutation) { | 258 TEST(APITestBasicMutation) { |
259 v8::Isolate* v8_isolate = CcTest::isolate(); | 259 v8::Isolate* v8_isolate = CcTest::isolate(); |
260 HandleScope scope(v8_isolate); | 260 HandleScope scope(v8_isolate); |
261 LocalContext context(v8_isolate); | 261 LocalContext context(v8_isolate); |
262 Handle<Object> obj = Handle<Object>::Cast(CompileRun( | 262 Handle<Object> obj = Handle<Object>::Cast(CompileRun( |
263 "var records = [];" | 263 "var records = [];" |
264 "var obj = {};" | 264 "var obj = {};" |
265 "function observer(r) { [].push.apply(records, r); };" | 265 "function observer(r) { [].push.apply(records, r); };" |
266 "Object.observe(obj, observer);" | 266 "Object.observe(obj, observer);" |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 notifier); | 702 notifier); |
703 CompileRun("var obj2 = {};" | 703 CompileRun("var obj2 = {};" |
704 "var notifier2 = Object.getNotifier(obj2);" | 704 "var notifier2 = Object.getNotifier(obj2);" |
705 "notifier2.performChange.call(" | 705 "notifier2.performChange.call(" |
706 "notifier, 'foo', function(){})"); | 706 "notifier, 'foo', function(){})"); |
707 } | 707 } |
708 | 708 |
709 CcTest::isolate()->ContextDisposedNotification(); | 709 CcTest::isolate()->ContextDisposedNotification(); |
710 CheckSurvivingGlobalObjectsCount(1); | 710 CheckSurvivingGlobalObjectsCount(1); |
711 } | 711 } |
OLD | NEW |