Enable a lot of extensions to increase fuzzer coverage
Pretend the underlying context (stub) supports most of the extensions we care
about, to make sure we exercise the code paths that are enabled by those.
Ideally we would test with arbitrary combinations of those, but this is a good
first step to increase coverage.
BUG=None
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Review-Url: https://codereview.chromium.org/2299413003
Cr-Commit-Position: refs/heads/master@{#416369}
diff --git a/ui/gl/gl_stub_api.cc b/ui/gl/gl_stub_api.cc
index e4b634a..7d071cf 100644
--- a/ui/gl/gl_stub_api.cc
+++ b/ui/gl/gl_stub_api.cc
@@ -15,6 +15,11 @@
} // anonymous namespace
+GLStubApi::GLStubApi()
+ : version_("OpenGL ES 3.0"), extensions_("GL_EXT_framebuffer_object") {}
+
+GLStubApi::~GLStubApi() = default;
+
GLenum GLStubApi::glCheckFramebufferStatusEXTFn(GLenum target) {
return GL_FRAMEBUFFER_COMPLETE;
}
@@ -114,6 +119,7 @@
*params = 8;
break;
case GL_MAX_TEXTURE_SIZE:
+ case GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB:
*params = 2048;
break;
case GL_MAX_CUBE_MAP_TEXTURE_SIZE:
@@ -205,9 +211,9 @@
default:
return reinterpret_cast<const GLubyte*>("");
case GL_VERSION:
- return reinterpret_cast<const GLubyte*>("OpenGL ES 3.0");
+ return reinterpret_cast<const GLubyte*>(version_.c_str());
case GL_EXTENSIONS:
- return reinterpret_cast<const GLubyte*>("GL_EXT_framebuffer_object");
+ return reinterpret_cast<const GLubyte*>(extensions_.c_str());
}
}
diff --git a/ui/gl/gl_stub_api.h b/ui/gl/gl_stub_api.h
index e654ffb..99681163 100644
--- a/ui/gl/gl_stub_api.h
+++ b/ui/gl/gl_stub_api.h
@@ -5,6 +5,8 @@
#ifndef UI_GL_GL_STUB_API_H_
#define UI_GL_GL_STUB_API_H_
+#include <string>
+
#include "ui/gl/gl_export.h"
#include "ui/gl/gl_stub_api_base.h"
@@ -12,6 +14,15 @@
class GL_EXPORT GLStubApi: public GLStubApiBase {
public:
+ GLStubApi();
+ ~GLStubApi() override;
+
+ void set_version(std::string version) { version_ = std::move(version); }
+
+ void set_extensions(std::string extensions) {
+ extensions_ = std::move(extensions);
+ }
+
GLenum glCheckFramebufferStatusEXTFn(GLenum target) override;
GLuint glCreateProgramFn(void) override;
GLuint glCreateShaderFn(GLenum type) override;
@@ -54,6 +65,12 @@
GLenum glWaitSyncFn(GLsync sync,
GLbitfield flags,
GLuint64 timeout) override;
+
+ private:
+ std::string version_;
+ std::string extensions_;
+
+ DISALLOW_COPY_AND_ASSIGN(GLStubApi);
};
} // namespace gl