WebGL validation for depthRange.

Generate INVALID_OPERATION for depthRange(zNear, zFar) if zNear > zFar.
Add corresponding test.

BUG=angleproject:1816

Change-Id: I28b5876a74c9765c0eef1e0f6e5e96d0380586d0
Reviewed-on: https://chromium-review.googlesource.com/441207
Commit-Queue: Frank Henigman <fjhenigman@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/tests/gl_tests/WebGLCompatibilityTest.cpp b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
index af9ac8b..87293cf 100644
--- a/src/tests/gl_tests/WebGLCompatibilityTest.cpp
+++ b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
@@ -423,6 +423,19 @@
     ASSERT_GL_NO_ERROR();
 }
 
+// Test depth range with 'near' more or less than 'far.'
+TEST_P(WebGLCompatibilityTest, DepthRange)
+{
+    glDepthRangef(0, 1);
+    ASSERT_GL_NO_ERROR();
+
+    glDepthRangef(.5, .5);
+    ASSERT_GL_NO_ERROR();
+
+    glDepthRangef(1, 0);
+    EXPECT_GL_ERROR(GL_INVALID_OPERATION);
+}
+
 // Test the checks for OOB reads in the vertex buffers, instanced version
 TEST_P(WebGL2CompatibilityTest, DrawArraysBufferOutOfBoundsInstanced)
 {