Check EXT_sparse_texture in get_internalformativ tests.

Check extension GL_EXT_sparse_texture before assuming that
GL_TEXTURE_2D is invalid target.

Bug: 20005726
Change-Id: I200ddea79c42e1734cae6b4bea4f358bda863112
diff --git a/modules/gles31/functional/es31fNegativeStateApiTests.cpp b/modules/gles31/functional/es31fNegativeStateApiTests.cpp
index cedbe0b..761259f 100644
--- a/modules/gles31/functional/es31fNegativeStateApiTests.cpp
+++ b/modules/gles31/functional/es31fNegativeStateApiTests.cpp
@@ -987,8 +987,13 @@
 	ctx.expectError				(GL_INVALID_ENUM);
 	ctx.glGetInternalformativ	(GL_FRAMEBUFFER, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 16, &params[0]);
 	ctx.expectError				(GL_INVALID_ENUM);
-	ctx.glGetInternalformativ	(GL_TEXTURE_2D, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 16, &params[0]);
-	ctx.expectError				(GL_INVALID_ENUM);
+
+	if (!ctx.getContextInfo().isExtensionSupported("GL_EXT_sparse_texture"))
+	{
+		ctx.glGetInternalformativ	(GL_TEXTURE_2D, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 16, &params[0]);
+		ctx.expectError				(GL_INVALID_ENUM);
+	}
+
 	ctx.endSection();
 }