Allow enabling GL_EXT_texture_filter_anisotropic.

BUG=angleproject:1721

Change-Id: I7cbc734915cde7d09165a3fcfe9a6bc0d7149aff
Reviewed-on: https://chromium-review.googlesource.com/445959
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
diff --git a/src/tests/gl_tests/WebGLCompatibilityTest.cpp b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
index 844cdb8..d99c51d 100644
--- a/src/tests/gl_tests/WebGLCompatibilityTest.cpp
+++ b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
@@ -149,6 +149,45 @@
     }
 }
 
+// Test enabling the GL_EXT_texture_filter_anisotropic extension
+TEST_P(WebGLCompatibilityTest, EnableExtensionTextureFilterAnisotropic)
+{
+    EXPECT_FALSE(extensionEnabled("GL_EXT_texture_filter_anisotropic"));
+
+    GLfloat maxAnisotropy = 0.0f;
+    glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropy);
+    EXPECT_GL_ERROR(GL_INVALID_ENUM);
+
+    GLTexture texture;
+    glBindTexture(GL_TEXTURE_2D, texture.get());
+    ASSERT_GL_NO_ERROR();
+
+    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0f);
+    EXPECT_GL_ERROR(GL_INVALID_ENUM);
+
+    GLfloat currentAnisotropy = 0.0f;
+    glGetTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, &currentAnisotropy);
+    EXPECT_GL_ERROR(GL_INVALID_ENUM);
+
+    if (extensionRequestable("GL_EXT_texture_filter_anisotropic"))
+    {
+        glRequestExtensionANGLE("GL_EXT_texture_filter_anisotropic");
+        EXPECT_GL_NO_ERROR();
+        EXPECT_TRUE(extensionEnabled("GL_EXT_texture_filter_anisotropic"));
+
+        glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropy);
+        ASSERT_GL_NO_ERROR();
+        EXPECT_GE(maxAnisotropy, 2.0f);
+
+        glGetTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, &currentAnisotropy);
+        ASSERT_GL_NO_ERROR();
+        EXPECT_EQ(1.0f, currentAnisotropy);
+
+        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 2.0f);
+        ASSERT_GL_NO_ERROR();
+    }
+}
+
 // Verify that shaders are of a compatible spec when the extension is enabled.
 TEST_P(WebGLCompatibilityTest, ExtensionCompilerSpec)
 {