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

Unified Diff: LayoutTests/fast/canvas/webgl/data-view-test.html

Issue 6469012: Merge 77433 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/648/
Patch Set: Created 9 years, 10 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 | « no previous file | LayoutTests/fast/canvas/webgl/data-view-test-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/canvas/webgl/data-view-test.html
===================================================================
--- LayoutTests/fast/canvas/webgl/data-view-test.html (revision 78119)
+++ LayoutTests/fast/canvas/webgl/data-view-test.html (working copy)
@@ -47,7 +47,7 @@
expr += littleEndian ? "true" : "false";
}
expr += ")";
- if (index + getElementSize(func) - 1 < view.byteLength)
+ if (index >= 0 && index + getElementSize(func) - 1 < view.byteLength)
shouldBe(expr, expected);
else
shouldThrow(expr);
@@ -61,7 +61,7 @@
expr += littleEndian ? "true" : "false";
}
expr += ")";
- if (index + getElementSize(func) - 1 < view.byteLength) {
+ if (index >= 0 && index + getElementSize(func) - 1 < view.byteLength) {
shouldBeUndefined(expr);
checkGet(func, index, value, littleEndian);
} else
@@ -192,6 +192,43 @@
testFloat(isTestingGet, "Float64", isTestingGet ? [255, 255, 255, 255, 255, 255, 255, 255] : emptyArray, start, "-NaN");
}
+function runNegativeIndexTests(isTestingGet)
+{
+ createDataView(intArray1, 0, true, 0, 16);
+
+ test(isTestingGet, "Int8", -1, "0");
+ test(isTestingGet, "Int8", -2, "0");
+
+ test(isTestingGet, "Uint8", -1, "0");
+ test(isTestingGet, "Uint8", -2, "0");
+
+ test(isTestingGet, "Int16", -1, "0");
+ test(isTestingGet, "Int16", -2, "0");
+ test(isTestingGet, "Int16", -3, "0");
+
+ test(isTestingGet, "Uint16", -1, "0");
+ test(isTestingGet, "Uint16", -2, "0");
+ test(isTestingGet, "Uint16", -3, "0");
+
+ test(isTestingGet, "Int32", -1, "0");
+ test(isTestingGet, "Int32", -3, "0");
+ test(isTestingGet, "Int32", -5, "0");
+
+ test(isTestingGet, "Uint32", -1, "0");
+ test(isTestingGet, "Uint32", -3, "0");
+ test(isTestingGet, "Uint32", -5, "0");
+
+ createDataView([0, 0, 0, 0, 0, 0, 36, 64], 0, true, 0, 8);
+
+ test(isTestingGet, "Float32", -1, "0");
+ test(isTestingGet, "Float32", -3, "0");
+ test(isTestingGet, "Float32", -5, "0");
+
+ test(isTestingGet, "Float64", -1, "0");
+ test(isTestingGet, "Float64", -5, "0");
+ test(isTestingGet, "Float64", -9, "0");
+}
+
function runConstructorTests()
{
arayBuffer = (new Uint8Array([1, 2])).buffer;
@@ -229,11 +266,15 @@
runFloatTestCases(true, 0);
debug("");
- debug("Test for get methods that might read beyound range");
+ debug("Test for get methods that might read beyond range");
runIntegerTestCases(true, intArray2, 3, 2);
runFloatTestCases(true, 3);
debug("");
+ debug("Test for get methods that read from negative index");
+ runNegativeIndexTests(true);
+
+ debug("");
debug("Test for wrong arguments passed to get methods");
view = new DataView((new Uint8Array([1, 2])).buffer);
shouldThrow("view.getInt8()");
@@ -259,7 +300,11 @@
runFloatTestCases(false, 7);
debug("");
- debug("Test for wrong arguments passed to get methods");
+ debug("Test for set methods that write to negative index");
+ runNegativeIndexTests(false);
+
+ debug("");
+ debug("Test for wrong arguments passed to set methods");
view = new DataView((new Uint8Array([1, 2])).buffer);
shouldThrow("view.setInt8()");
shouldThrow("view.setUint8()");
« no previous file with comments | « no previous file | LayoutTests/fast/canvas/webgl/data-view-test-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698