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

Side by Side Diff: LayoutTests/fast/canvas/webgl/array-unit-tests.html

Issue 7523024: Merge 91803 - Float32Array(ArrayBuffer, index, length) constructor working incorrectly. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 4 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 | « no previous file | LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <link rel="stylesheet" href="../../js/resources/js-test-style.css"/> 3 <link rel="stylesheet" href="../../js/resources/js-test-style.css"/>
4 <script src="../../js/resources/js-test-pre.js"></script> 4 <script src="../../js/resources/js-test-pre.js"></script>
5 <script src="resources/webgl-test.js"></script> 5 <script src="resources/webgl-test.js"></script>
6 </head> 6 </head>
7 <body> 7 <body>
8 <div id="description"></div> 8 <div id="description"></div>
9 <div id="console"></div> 9 <div id="console"></div>
10 10
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 testFailed(errorText); 473 testFailed(errorText);
474 } catch (e) { 474 } catch (e) {
475 testPassed(text + " threw an exception"); 475 testPassed(text + " threw an exception");
476 } 476 }
477 } 477 }
478 478
479 function testConstructionWithOutOfRangeValues(type, name) { 479 function testConstructionWithOutOfRangeValues(type, name) {
480 shouldThrowIndexSizeErr(function() { 480 shouldThrowIndexSizeErr(function() {
481 var buffer = new ArrayBuffer(4); 481 var buffer = new ArrayBuffer(4);
482 var array = new type(buffer, 4, 0x3FFFFFFF); 482 var array = new type(buffer, 4, 0x3FFFFFFF);
483 }, "Construction of " + name + " with out-of-range values"); 483 }, "Construction of " + name + " with out-of-range number of elements");
484 shouldThrowIndexSizeErr(function() {
485 var buffer = new ArrayBuffer(4);
486 var array = new type(buffer, 8);
487 }, "Construction of " + name + " with out-of-range offset");
484 } 488 }
485 489
486 function testConstructionWithNegativeOutOfRangeValues(type, name) { 490 function testConstructionWithNegativeOutOfRangeValues(type, name) {
487 try { 491 try {
488 var buffer = new ArrayBuffer(-1); 492 var buffer = new ArrayBuffer(-1);
489 testFailed("Construction of ArrayBuffer with negative size should throw exception"); 493 testFailed("Construction of ArrayBuffer with negative size should throw exception");
490 } catch (e) { 494 } catch (e) {
491 testPassed("Construction of ArrayBuffer with negative size threw excepti on"); 495 testPassed("Construction of ArrayBuffer with negative size threw excepti on");
492 } 496 }
493 try { 497 try {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 var buf = new ArrayBuffer(bufByteLength); 542 var buf = new ArrayBuffer(bufByteLength);
539 var array1 = new type(buf); 543 var array1 = new type(buf);
540 var array2 = new type(bufByteLength / elementSizeInBytes); 544 var array2 = new type(bufByteLength / elementSizeInBytes);
541 if (array1.length == array2.length) { 545 if (array1.length == array2.length) {
542 testPassed("Array lengths matched with explicit and implicit creation of ArrayBuffer"); 546 testPassed("Array lengths matched with explicit and implicit creation of ArrayBuffer");
543 } else { 547 } else {
544 testFailed("Array lengths DID NOT MATCH with explicit and implicit creat ion of ArrayBuffer"); 548 testFailed("Array lengths DID NOT MATCH with explicit and implicit creat ion of ArrayBuffer");
545 } 549 }
546 } 550 }
547 551
552 function testConstructionWithSubPortionOfArrayBuffer(type, name, elementSizeInBy tes) {
553 if (elementSizeInBytes > 1) {
554 // Test construction with a valid sub-portion of an array buffer
555 // (whose size is not an integral multiple of the element size).
556 var size = 4 * elementSizeInBytes + (elementSizeInBytes / 2);
557 var buf = new ArrayBuffer(size);
558 try {
559 var array = new type(buf, 0, 2);
560 testPassed("new " + name + "(new ArrayBuffer(" + size + "), 0, 2) su cceeded");
561 } catch (e) {
562 testFailed("new " + name + "(new ArrayBuffer(" + size + "), 0, 2) fa iled: " + e);
563 }
564 }
565 }
566
548 // These need to be global for shouldBe to see them 567 // These need to be global for shouldBe to see them
549 var array; 568 var array;
550 var typeSize; 569 var typeSize;
551 570
552 function testSubarrayWithOutOfRangeValues(type, name, sz) { 571 function testSubarrayWithOutOfRangeValues(type, name, sz) {
553 debug("Testing subarray of " + name); 572 debug("Testing subarray of " + name);
554 try { 573 try {
555 var buffer = new ArrayBuffer(32); 574 var buffer = new ArrayBuffer(32);
556 array = new type(buffer); 575 array = new type(buffer);
557 typeSize = sz; 576 typeSize = sz;
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 name, 861 name,
843 testCase.testValues, 862 testCase.testValues,
844 testCase.expectedValues); 863 testCase.expectedValues);
845 testConstructionWithNullBuffer(type, name); 864 testConstructionWithNullBuffer(type, name);
846 testConstructionWithOutOfRangeValues(type, name); 865 testConstructionWithOutOfRangeValues(type, name);
847 testConstructionWithNegativeOutOfRangeValues(type, name); 866 testConstructionWithNegativeOutOfRangeValues(type, name);
848 testConstructionWithUnalignedOffset(type, name, testCase.elementSizeInBytes) ; 867 testConstructionWithUnalignedOffset(type, name, testCase.elementSizeInBytes) ;
849 testConstructionWithUnalignedLength(type, name, testCase.elementSizeInBytes) ; 868 testConstructionWithUnalignedLength(type, name, testCase.elementSizeInBytes) ;
850 testConstructionOfHugeArray(type, name, testCase.elementSizeInBytes); 869 testConstructionOfHugeArray(type, name, testCase.elementSizeInBytes);
851 testConstructionWithBothArrayBufferAndLength(type, name, testCase.elementSiz eInBytes); 870 testConstructionWithBothArrayBufferAndLength(type, name, testCase.elementSiz eInBytes);
871 testConstructionWithSubPortionOfArrayBuffer(type, name, testCase.elementSize InBytes);
852 testSubarrayWithOutOfRangeValues(type, name, testCase.elementSizeInBytes); 872 testSubarrayWithOutOfRangeValues(type, name, testCase.elementSizeInBytes);
853 testSubarrayWithDefaultValues(type, name, testCase.elementSizeInBytes); 873 testSubarrayWithDefaultValues(type, name, testCase.elementSizeInBytes);
854 testSettingFromArrayWithOutOfRangeOffset(type, name); 874 testSettingFromArrayWithOutOfRangeOffset(type, name);
855 testSettingFromFakeArrayWithOutOfRangeLength(type, name); 875 testSettingFromFakeArrayWithOutOfRangeLength(type, name);
856 testSettingFromTypedArrayWithOutOfRangeOffset(type, name); 876 testSettingFromTypedArrayWithOutOfRangeOffset(type, name);
857 negativeTestGetAndSetMethods(type, name); 877 negativeTestGetAndSetMethods(type, name);
858 testNaNConversion(type, name); 878 testNaNConversion(type, name);
859 } 879 }
860 880
861 printSummary(); 881 printSummary();
862 } 882 }
863 883
864 runTests(); 884 runTests();
865 successfullyParsed = true; 885 successfullyParsed = true;
866 886
867 </script> 887 </script>
868 <script src="../../js/resources/js-test-post.js"></script> 888 <script src="../../js/resources/js-test-post.js"></script>
869 889
870 </body> 890 </body>
871 </html> 891 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/canvas/webgl/array-unit-tests-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698