Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: test/mjsunit/harmony/object-observe.js

Issue 11280105: Object.observe: Unblacklist some tests involving indexed properties (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 assertCalled: function() { 49 assertCalled: function() {
50 assertEquals(1, this.callbackCount); 50 assertEquals(1, this.callbackCount);
51 }, 51 },
52 assertRecordCount: function(count) { 52 assertRecordCount: function(count) {
53 this.assertCalled(); 53 this.assertCalled();
54 assertEquals(count, this.records.length); 54 assertEquals(count, this.records.length);
55 }, 55 },
56 assertCallbackRecords: function(recs) { 56 assertCallbackRecords: function(recs) {
57 this.assertRecordCount(recs.length); 57 this.assertRecordCount(recs.length);
58 for (var i = 0; i < recs.length; i++) { 58 for (var i = 0; i < recs.length; i++) {
59 if ('name' in recs[i])
60 recs[i].name = String(recs[i].name);
59 print(i, JSON.stringify(this.records[i]), JSON.stringify(recs[i])); 61 print(i, JSON.stringify(this.records[i]), JSON.stringify(recs[i]));
60 assertSame(this.records[i].object, recs[i].object); 62 assertSame(this.records[i].object, recs[i].object);
61 assertEquals('string', typeof recs[i].type); 63 assertEquals('string', typeof recs[i].type);
62 assertPropertiesEqual(this.records[i], recs[i]); 64 assertPropertiesEqual(this.records[i], recs[i]);
63 } 65 }
64 } 66 }
65 }; 67 };
66 68
67 observer.callback = function(r) { 69 observer.callback = function(r) {
68 assertEquals(undefined, this); 70 assertEquals(undefined, this);
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 new Set, new Map, new WeakMap, 490 new Set, new Map, new WeakMap,
489 new ArrayBuffer(10), new Int32Array(5), 491 new ArrayBuffer(10), new Int32Array(5),
490 createProxy(Proxy.create, null), 492 createProxy(Proxy.create, null),
491 createProxy(Proxy.createFunction, function(){}), 493 createProxy(Proxy.createFunction, function(){}),
492 ]; 494 ];
493 var properties = ["a", "1", 1, "length", "prototype"]; 495 var properties = ["a", "1", 1, "length", "prototype"];
494 496
495 // Cases that yield non-standard results. 497 // Cases that yield non-standard results.
496 // TODO(observe): ...or don't work yet. 498 // TODO(observe): ...or don't work yet.
497 function blacklisted(obj, prop) { 499 function blacklisted(obj, prop) {
498 return (obj instanceof Array && prop == 1) || 500 return (obj instanceof Int32Array && prop == 1) ||
499 (obj instanceof Int32Array && prop == 1) ||
500 (obj instanceof Int32Array && prop === "length") || 501 (obj instanceof Int32Array && prop === "length") ||
501 // TODO(observe): oldValue when deleting/reconfiguring indexed accessor 502 (obj instanceof ArrayBuffer && prop == 1) ||
502 prop == 1 ||
503 // TODO(observe): oldValue when reconfiguring array length 503 // TODO(observe): oldValue when reconfiguring array length
504 (obj instanceof Array && prop === "length") || 504 (obj instanceof Array && prop === "length") ||
505 // TODO(observe): prototype property on functions 505 // TODO(observe): prototype property on functions
506 (obj instanceof Function && prop === "prototype") || 506 (obj instanceof Function && prop === "prototype") ||
507 // TODO(observe): global object 507 // TODO(observe): global object
508 obj === this; 508 obj === this;
509 } 509 }
510 510
511 for (var i in objects) for (var j in properties) { 511 for (var i in objects) for (var j in properties) {
512 var obj = objects[i]; 512 var obj = objects[i];
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 Object.observe(dummy, observer.callback); 769 Object.observe(dummy, observer.callback);
770 Object.unobserve(dummy, observer.callback); 770 Object.unobserve(dummy, observer.callback);
771 var array = [0]; 771 var array = [0];
772 Object.observe(array, observer.callback); 772 Object.observe(array, observer.callback);
773 array.splice(0, 1); 773 array.splice(0, 1);
774 Object.deliverChangeRecords(observer.callback); 774 Object.deliverChangeRecords(observer.callback);
775 observer.assertCallbackRecords([ 775 observer.assertCallbackRecords([
776 { object: array, name: '0', type: 'deleted', oldValue: 0 }, 776 { object: array, name: '0', type: 'deleted', oldValue: 0 },
777 { object: array, name: 'length', type: 'updated', oldValue: 1}, 777 { object: array, name: 'length', type: 'updated', oldValue: 1},
778 ]); 778 ]);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698