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

Unified Diff: test/mjsunit/harmony/object-observe.js

Issue 23890030: Rollback trunk to 3.21.15. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-unique.cc ('k') | test/mjsunit/lithium/SeqStringSetChar.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/object-observe.js
diff --git a/test/mjsunit/harmony/object-observe.js b/test/mjsunit/harmony/object-observe.js
index f982a66bc428227d2aaf3fb2ae24dc30fc0bcfaf..75f0ff8bb818402adf439516e31b347722a4dbfd 100644
--- a/test/mjsunit/harmony/object-observe.js
+++ b/test/mjsunit/harmony/object-observe.js
@@ -110,16 +110,14 @@ Object.defineProperty(changeRecordWithAccessor, 'name', {
// Object.observe
-assertThrows(function() { Object.observe("non-object", observer.callback); },
- TypeError);
+assertThrows(function() { Object.observe("non-object", observer.callback); }, TypeError);
assertThrows(function() { Object.observe(obj, nonFunction); }, TypeError);
assertThrows(function() { Object.observe(obj, frozenFunction); }, TypeError);
-assertEquals(obj, Object.observe(obj, observer.callback, [1]));
-assertEquals(obj, Object.observe(obj, observer.callback, [true]));
-assertEquals(obj, Object.observe(obj, observer.callback, ['foo', null]));
-assertEquals(obj, Object.observe(obj, observer.callback, [undefined]));
-assertEquals(obj, Object.observe(obj, observer.callback,
- ['foo', 'bar', 'baz']));
+assertThrows(function() { Object.observe(obj, function() {}, 1); }, TypeError);
+assertThrows(function() { Object.observe(obj, function() {}, [undefined]); }, TypeError);
+assertThrows(function() { Object.observe(obj, function() {}, [1]); }, TypeError);
+assertThrows(function() { Object.observe(obj, function() {}, ['foo', null]); }, TypeError);
+assertEquals(obj, Object.observe(obj, observer.callback, ['foo', 'bar', 'baz']));
assertEquals(obj, Object.observe(obj, observer.callback, []));
assertEquals(obj, Object.observe(obj, observer.callback, undefined));
assertEquals(obj, Object.observe(obj, observer.callback));
@@ -204,25 +202,6 @@ observer.assertCallbackRecords([
{ object: obj, name: 'bar', type: 'deleted', expando2: 'str' }
]);
-// Non-string accept values are coerced to strings
-reset();
-Object.observe(obj, observer.callback, [true, 1, null, undefined]);
-notifier = Object.getNotifier(obj);
-notifier.notify({ type: 'true' });
-notifier.notify({ type: 'false' });
-notifier.notify({ type: '1' });
-notifier.notify({ type: '-1' });
-notifier.notify({ type: 'null' });
-notifier.notify({ type: 'nill' });
-notifier.notify({ type: 'undefined' });
-notifier.notify({ type: 'defined' });
-Object.deliverChangeRecords(observer.callback);
-observer.assertCallbackRecords([
- { object: obj, type: 'true' },
- { object: obj, type: '1' },
- { object: obj, type: 'null' },
- { object: obj, type: 'undefined' }
-]);
// No delivery takes place if no records are pending
reset();
@@ -328,7 +307,7 @@ observer.assertCallbackRecords([
// Accept
reset();
-Object.observe(obj, observer.callback, ['somethingElse']);
+Object.observe(obj, observer.callback, []);
Object.getNotifier(obj).notify({
type: 'new'
});
@@ -1254,75 +1233,6 @@ observer.assertCallbackRecords([
{ object: array, name: '0', type: 'updated', oldValue: 2 },
]);
-// Splice emitted after Array mutation methods
-function MockArray(initial, observer) {
- for (var i = 0; i < initial.length; i++)
- this[i] = initial[i];
-
- this.length_ = initial.length;
- this.observer = observer;
-}
-MockArray.prototype = {
- set length(length) {
- Object.getNotifier(this).notify({ type: 'lengthChange' });
- this.length_ = length;
- Object.observe(this, this.observer.callback, ['splice']);
- },
- get length() {
- return this.length_;
- }
-}
-
-reset();
-var array = new MockArray([], observer);
-Object.observe(array, observer.callback, ['lengthChange']);
-Array.prototype.push.call(array, 1);
-Object.deliverChangeRecords(observer.callback);
-observer.assertCallbackRecords([
- { object: array, type: 'lengthChange' },
- { object: array, type: 'splice', index: 0, removed: [], addedCount: 1 },
-]);
-
-reset();
-var array = new MockArray([1], observer);
-Object.observe(array, observer.callback, ['lengthChange']);
-Array.prototype.pop.call(array);
-Object.deliverChangeRecords(observer.callback);
-observer.assertCallbackRecords([
- { object: array, type: 'lengthChange' },
- { object: array, type: 'splice', index: 0, removed: [1], addedCount: 0 },
-]);
-
-reset();
-var array = new MockArray([1], observer);
-Object.observe(array, observer.callback, ['lengthChange']);
-Array.prototype.shift.call(array);
-Object.deliverChangeRecords(observer.callback);
-observer.assertCallbackRecords([
- { object: array, type: 'lengthChange' },
- { object: array, type: 'splice', index: 0, removed: [1], addedCount: 0 },
-]);
-
-reset();
-var array = new MockArray([], observer);
-Object.observe(array, observer.callback, ['lengthChange']);
-Array.prototype.unshift.call(array, 1);
-Object.deliverChangeRecords(observer.callback);
-observer.assertCallbackRecords([
- { object: array, type: 'lengthChange' },
- { object: array, type: 'splice', index: 0, removed: [], addedCount: 1 },
-]);
-
-reset();
-var array = new MockArray([0, 1, 2], observer);
-Object.observe(array, observer.callback, ['lengthChange']);
-Array.prototype.splice.call(array, 1, 1);
-Object.deliverChangeRecords(observer.callback);
-observer.assertCallbackRecords([
- { object: array, type: 'lengthChange' },
- { object: array, type: 'splice', index: 1, removed: [1], addedCount: 0 },
-]);
-
//
// === PLAIN OBJECTS ===
//
« no previous file with comments | « test/cctest/test-unique.cc ('k') | test/mjsunit/lithium/SeqStringSetChar.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698