WebGLCompatibility: Add test for "negative" offset in DrawElements

BUG=angleproject:1523
BUG=chromium:668223

Change-Id: I2d21c15b53fa204b3cb2b0be849cfe91ca63046b
Reviewed-on: https://chromium-review.googlesource.com/435884
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/tests/gl_tests/WebGLCompatibilityTest.cpp b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
index cfbf594..600697d 100644
--- a/src/tests/gl_tests/WebGLCompatibilityTest.cpp
+++ b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
@@ -445,6 +445,16 @@
     // Test any offset if valid if count is zero
     glDrawElements(GL_POINTS, 0, GL_UNSIGNED_BYTE, zeroOffset + 42);
     ASSERT_GL_NO_ERROR();
+
+    // Test touching the first index is valid
+    glDrawElements(GL_POINTS, 4, GL_UNSIGNED_BYTE, zeroOffset + 4);
+    ASSERT_GL_NO_ERROR();
+
+    // Test touching the first - 1 index is invalid
+    // The error ha been specified to be INVALID_VALUE instead of INVALID_OPERATION because it was
+    // the historic behavior of WebGL implementations
+    glDrawElements(GL_POINTS, 4, GL_UNSIGNED_BYTE, zeroOffset - 1);
+    EXPECT_GL_ERROR(GL_INVALID_VALUE);
 }
 
 // Test depth range with 'near' more or less than 'far.'