| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <meta charset="utf-8"> | 4 <meta charset="utf-8"> |
| 5 <link rel="stylesheet" href="../../resources/js-test-style.css"/> | 5 <link rel="stylesheet" href="../../resources/js-test-style.css"/> |
| 6 <script src="../../js/resources/js-test-pre.js"></script> | 6 <script src="../../js/resources/js-test-pre.js"></script> |
| 7 <script src="resources/webgl-test.js"></script> | 7 <script src="resources/webgl-test.js"></script> |
| 8 <script src="resources/typed-array-test-cases.js"></script> | 8 <script src="resources/typed-array-test-cases.js"></script> |
| 9 </head> | 9 </head> |
| 10 <body> | 10 <body> |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 function testInheritanceHierarchy() { | 117 function testInheritanceHierarchy() { |
| 118 debug('test inheritance hierarchy of typed array views'); | 118 debug('test inheritance hierarchy of typed array views'); |
| 119 | 119 |
| 120 try { | 120 try { |
| 121 var foo = ArrayBufferView; | 121 var foo = ArrayBufferView; |
| 122 testFailed('ArrayBufferView has [NoInterfaceObject] extended attribute and s
hould not be defined'); | 122 testFailed('ArrayBufferView has [NoInterfaceObject] extended attribute and s
hould not be defined'); |
| 123 } catch (e) { | 123 } catch (e) { |
| 124 testPassed('ArrayBufferView has [NoInterfaceObject] extended attribute and w
as (correctly) not defined'); | 124 testPassed('ArrayBufferView has [NoInterfaceObject] extended attribute and w
as (correctly) not defined'); |
| 125 } | 125 } |
| 126 | 126 » |
| 127 // There is currently only one kind of view that inherits from another | 127 // There is currently only one kind of view that inherits from another» |
| 128 shouldBe('new Uint8ClampedArray(1) instanceof Uint8Array', 'true'); | 128 // Uint8ClampedArray inherited from Uint8Array in earlier versions |
| 129 // of the typed array specification. Since this is no longer the |
| 130 // case, assert the new behavior. |
| 131 shouldBe('new Uint8ClampedArray(1) instanceof Uint8Array', 'false'); |
| 129 } | 132 } |
| 130 | 133 |
| 131 // | 134 // |
| 132 // Tests for unsigned array variants | 135 // Tests for unsigned array variants |
| 133 // | 136 // |
| 134 | 137 |
| 135 function testSetAndGet10To1(type, name) { | 138 function testSetAndGet10To1(type, name) { |
| 136 running('test ' + name + ' SetAndGet10To1'); | 139 running('test ' + name + ' SetAndGet10To1'); |
| 137 try { | 140 try { |
| 138 var array = new type(10); | 141 var array = new type(10); |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 | 644 |
| 642 function testConstructionWithUnalignedLength(type, name, elementSizeInBytes) { | 645 function testConstructionWithUnalignedLength(type, name, elementSizeInBytes) { |
| 643 if (elementSizeInBytes > 1) { | 646 if (elementSizeInBytes > 1) { |
| 644 shouldThrowIndexSizeErr(function() { | 647 shouldThrowIndexSizeErr(function() { |
| 645 var buffer = new ArrayBuffer(elementSizeInBytes + 1); | 648 var buffer = new ArrayBuffer(elementSizeInBytes + 1); |
| 646 var array = new type(buffer, 0); | 649 var array = new type(buffer, 0); |
| 647 }, "Construction of " + name + " with unaligned length"); | 650 }, "Construction of " + name + " with unaligned length"); |
| 648 } | 651 } |
| 649 } | 652 } |
| 650 | 653 |
| 651 function testConstructionOfHugeArray(type, name, sz) { | |
| 652 if (sz == 1) | |
| 653 return; | |
| 654 try { | |
| 655 // Construction of huge arrays must fail because byteLength is | |
| 656 // an unsigned long | |
| 657 array = new type(3000000000); | |
| 658 testFailed("Construction of huge " + name + " should throw exception"); | |
| 659 } catch (e) { | |
| 660 testPassed("Construction of huge " + name + " threw exception"); | |
| 661 } | |
| 662 } | |
| 663 | |
| 664 function testConstructionWithBothArrayBufferAndLength(type, name, elementSizeInB
ytes) { | 654 function testConstructionWithBothArrayBufferAndLength(type, name, elementSizeInB
ytes) { |
| 665 var bufByteLength = 1000 * elementSizeInBytes; | 655 var bufByteLength = 1000 * elementSizeInBytes; |
| 666 var buf = new ArrayBuffer(bufByteLength); | 656 var buf = new ArrayBuffer(bufByteLength); |
| 667 var array1 = new type(buf); | 657 var array1 = new type(buf); |
| 668 var array2 = new type(bufByteLength / elementSizeInBytes); | 658 var array2 = new type(bufByteLength / elementSizeInBytes); |
| 669 if (array1.length == array2.length) { | 659 if (array1.length == array2.length) { |
| 670 testPassed("Array lengths matched with explicit and implicit creation of
ArrayBuffer"); | 660 testPassed("Array lengths matched with explicit and implicit creation of
ArrayBuffer"); |
| 671 } else { | 661 } else { |
| 672 testFailed("Array lengths DID NOT MATCH with explicit and implicit creat
ion of ArrayBuffer"); | 662 testFailed("Array lengths DID NOT MATCH with explicit and implicit creat
ion of ArrayBuffer"); |
| 673 } | 663 } |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 testConstructionBoundaryConditions(type, | 986 testConstructionBoundaryConditions(type, |
| 997 name, | 987 name, |
| 998 testCase.testValues, | 988 testCase.testValues, |
| 999 testCase.expectedValues); | 989 testCase.expectedValues); |
| 1000 testConstructionWithNullBuffer(type, name); | 990 testConstructionWithNullBuffer(type, name); |
| 1001 testConstructionWithExceptionThrowingObject(type, name); | 991 testConstructionWithExceptionThrowingObject(type, name); |
| 1002 testConstructionWithOutOfRangeValues(type, name); | 992 testConstructionWithOutOfRangeValues(type, name); |
| 1003 testConstructionWithNegativeOutOfRangeValues(type, name); | 993 testConstructionWithNegativeOutOfRangeValues(type, name); |
| 1004 testConstructionWithUnalignedOffset(type, name, testCase.elementSizeInBytes)
; | 994 testConstructionWithUnalignedOffset(type, name, testCase.elementSizeInBytes)
; |
| 1005 testConstructionWithUnalignedLength(type, name, testCase.elementSizeInBytes)
; | 995 testConstructionWithUnalignedLength(type, name, testCase.elementSizeInBytes)
; |
| 1006 testConstructionOfHugeArray(type, name, testCase.elementSizeInBytes); | |
| 1007 testConstructionWithBothArrayBufferAndLength(type, name, testCase.elementSiz
eInBytes); | 996 testConstructionWithBothArrayBufferAndLength(type, name, testCase.elementSiz
eInBytes); |
| 1008 testConstructionWithSubPortionOfArrayBuffer(type, name, testCase.elementSize
InBytes); | 997 testConstructionWithSubPortionOfArrayBuffer(type, name, testCase.elementSize
InBytes); |
| 1009 testSubarrayWithOutOfRangeValues(type, name, testCase.elementSizeInBytes); | 998 testSubarrayWithOutOfRangeValues(type, name, testCase.elementSizeInBytes); |
| 1010 testSubarrayWithDefaultValues(type, name, testCase.elementSizeInBytes); | 999 testSubarrayWithDefaultValues(type, name, testCase.elementSizeInBytes); |
| 1011 testSettingFromArrayWithOutOfRangeOffset(type, name); | 1000 testSettingFromArrayWithOutOfRangeOffset(type, name); |
| 1012 testSettingFromTypedArrayWithOutOfRangeOffset(type, name); | 1001 testSettingFromTypedArrayWithOutOfRangeOffset(type, name); |
| 1013 testSettingFromArrayWithNegativeOffset(type, name); | 1002 testSettingFromArrayWithNegativeOffset(type, name); |
| 1014 testSettingFromTypedArrayWithNegativeOffset(type, name); | 1003 testSettingFromTypedArrayWithNegativeOffset(type, name); |
| 1015 testSettingFromArrayWithMinusZeroOffset(type, name); | 1004 testSettingFromArrayWithMinusZeroOffset(type, name); |
| 1016 testSettingFromTypedArrayWithMinusZeroOffset(type, name); | 1005 testSettingFromTypedArrayWithMinusZeroOffset(type, name); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1027 } | 1016 } |
| 1028 | 1017 |
| 1029 runTests(); | 1018 runTests(); |
| 1030 var successfullyParsed = true; | 1019 var successfullyParsed = true; |
| 1031 | 1020 |
| 1032 </script> | 1021 </script> |
| 1033 <script src="../../js/resources/js-test-post.js"></script> | 1022 <script src="../../js/resources/js-test-post.js"></script> |
| 1034 | 1023 |
| 1035 </body> | 1024 </body> |
| 1036 </html> | 1025 </html> |
| OLD | NEW |