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

Unified Diff: test/mjsunit/harmony/typedarrays.js

Issue 1186733002: Add %TypedArray% to proto chain (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: changes from arv's review Created 5 years, 6 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/mjsunit/harmony/sharedarraybuffer.js ('k') | test/mjsunit/harmony/typedarrays-of.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/typedarrays.js
diff --git a/test/mjsunit/harmony/typedarrays.js b/test/mjsunit/harmony/typedarrays.js
index ef7955ce928bfd80deff04bea4ef71f2ad8395cc..9b2cde6e7faeae30f38ba22dcab4f9281fc9923f 100644
--- a/test/mjsunit/harmony/typedarrays.js
+++ b/test/mjsunit/harmony/typedarrays.js
@@ -121,6 +121,14 @@ TestArrayBufferSlice();
// Typed arrays
+function getPropertyDescriptor(object, field, expectedDepth) {
+ for (var depth = 0; depth < expectedDepth; depth++) {
+ assertFalse(Object.hasOwnProperty(object, field));
+ object = object.__proto__;
+ }
+ return Object.getOwnPropertyDescriptor(object, field);
+}
+
function TestTypedArray(constr, elementSize, typicalElement) {
assertSame(elementSize, constr.BYTES_PER_ELEMENT);
@@ -269,8 +277,7 @@ function TestTypedArray(constr, elementSize, typicalElement) {
var a = new constr(ab, 64*elementSize, 128);
assertEquals("[object " + constr.name + "]",
Object.prototype.toString.call(a));
- var desc = Object.getOwnPropertyDescriptor(
- constr.prototype, Symbol.toStringTag);
+ var desc = getPropertyDescriptor(constr.prototype, Symbol.toStringTag, 1);
assertTrue(desc.configurable);
assertFalse(desc.enumerable);
assertFalse(!!desc.writable);
@@ -417,17 +424,13 @@ var typedArrayConstructors = [
function TestPropertyTypeChecks(constructor) {
function CheckProperty(name) {
- var d = Object.getOwnPropertyDescriptor(constructor.prototype, name);
+ var d = getPropertyDescriptor(constructor.prototype, name, 1);
var o = {};
assertThrows(function() {d.get.call(o);}, TypeError);
for (var i = 0; i < typedArrayConstructors.length; i++) {
var ctor = typedArrayConstructors[i];
var a = new ctor(10);
- if (ctor === constructor) {
- d.get.call(a); // shouldn't throw
- } else {
- assertThrows(function() {d.get.call(a);}, TypeError);
- }
+ d.get.call(a); // shouldn't throw, even from a different type
}
}
« no previous file with comments | « test/mjsunit/harmony/sharedarraybuffer.js ('k') | test/mjsunit/harmony/typedarrays-of.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698