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

Side by Side Diff: test/mjsunit/es6/typedarray.js

Issue 1554523002: Revert of Use ES2015-style TypedArray prototype chain (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « test/mjsunit/es6/typed-array-iterator.js ('k') | test/mjsunit/es6/typedarray-of.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 var aNoParam = new constr(); 263 var aNoParam = new constr();
264 assertSame(elementSize, aNoParam.BYTES_PER_ELEMENT); 264 assertSame(elementSize, aNoParam.BYTES_PER_ELEMENT);
265 assertSame(0, aNoParam.length); 265 assertSame(0, aNoParam.length);
266 assertSame(0, aNoParam.byteLength); 266 assertSame(0, aNoParam.byteLength);
267 assertSame(0, aNoParam.byteOffset); 267 assertSame(0, aNoParam.byteOffset);
268 268
269 var a = new constr(ab, 64*elementSize, 128); 269 var a = new constr(ab, 64*elementSize, 128);
270 assertEquals("[object " + constr.name + "]", 270 assertEquals("[object " + constr.name + "]",
271 Object.prototype.toString.call(a)); 271 Object.prototype.toString.call(a));
272 var desc = Object.getOwnPropertyDescriptor( 272 var desc = Object.getOwnPropertyDescriptor(
273 constr.prototype.__proto__, Symbol.toStringTag); 273 constr.prototype, Symbol.toStringTag);
274 assertTrue(desc.configurable); 274 assertTrue(desc.configurable);
275 assertFalse(desc.enumerable); 275 assertFalse(desc.enumerable);
276 assertFalse(!!desc.writable); 276 assertFalse(!!desc.writable);
277 assertFalse(!!desc.set); 277 assertFalse(!!desc.set);
278 assertEquals("function", typeof desc.get); 278 assertEquals("function", typeof desc.get);
279 279
280 // Test that the constructor can be called with an iterable 280 // Test that the constructor can be called with an iterable
281 function* gen() { for (var i = 0; i < 10; i++) yield i; } 281 function* gen() { for (var i = 0; i < 10; i++) yield i; }
282 var genArr = new constr(gen()); 282 var genArr = new constr(gen());
283 assertEquals(10, genArr.length); 283 assertEquals(10, genArr.length);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 Int16Array, 411 Int16Array,
412 Uint32Array, 412 Uint32Array,
413 Int32Array, 413 Int32Array,
414 Uint8ClampedArray, 414 Uint8ClampedArray,
415 Float32Array, 415 Float32Array,
416 Float64Array]; 416 Float64Array];
417 417
418 function TestPropertyTypeChecks(constructor) { 418 function TestPropertyTypeChecks(constructor) {
419 function CheckProperty(name) { 419 function CheckProperty(name) {
420 assertThrows(function() { 'use strict'; new constructor(10)[name] = 0; }) 420 assertThrows(function() { 'use strict'; new constructor(10)[name] = 0; })
421 var d = Object.getOwnPropertyDescriptor(constructor.prototype.__proto__, nam e); 421 var d = Object.getOwnPropertyDescriptor(constructor.prototype, name);
422 var o = {}; 422 var o = {};
423 assertThrows(function() {d.get.call(o);}, TypeError); 423 assertThrows(function() {d.get.call(o);}, TypeError);
424 for (var i = 0; i < typedArrayConstructors.length; i++) { 424 for (var i = 0; i < typedArrayConstructors.length; i++) {
425 var ctor = typedArrayConstructors[i]; 425 var ctor = typedArrayConstructors[i];
426 var a = new ctor(10); 426 var a = new ctor(10);
427 d.get.call(a); // shouldn't throw 427 if (ctor === constructor) {
428 d.get.call(a); // shouldn't throw
429 } else {
430 assertThrows(function() {d.get.call(a);}, TypeError);
431 }
428 } 432 }
429 } 433 }
430 434
431 CheckProperty("buffer"); 435 CheckProperty("buffer");
432 CheckProperty("byteOffset"); 436 CheckProperty("byteOffset");
433 CheckProperty("byteLength"); 437 CheckProperty("byteLength");
434 CheckProperty("length"); 438 CheckProperty("length");
435 } 439 }
436 440
437 for(i = 0; i < typedArrayConstructors.length; i++) { 441 for(i = 0; i < typedArrayConstructors.length; i++) {
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 759
756 function TestNonConfigurableProperties(constructor) { 760 function TestNonConfigurableProperties(constructor) {
757 var arr = new constructor([100]) 761 var arr = new constructor([100])
758 assertFalse(Object.getOwnPropertyDescriptor(arr,"0").configurable) 762 assertFalse(Object.getOwnPropertyDescriptor(arr,"0").configurable)
759 assertFalse(delete arr[0]) 763 assertFalse(delete arr[0])
760 } 764 }
761 765
762 for(i = 0; i < typedArrayConstructors.length; i++) { 766 for(i = 0; i < typedArrayConstructors.length; i++) {
763 TestNonConfigurableProperties(typedArrayConstructors[i]); 767 TestNonConfigurableProperties(typedArrayConstructors[i]);
764 } 768 }
OLDNEW
« no previous file with comments | « test/mjsunit/es6/typed-array-iterator.js ('k') | test/mjsunit/es6/typedarray-of.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698