26template <
typename T,
typename U>
29template <
typename Ret,
typename... Args>
44struct function_traits;
46template <
typename C,
typename Ret,
typename... Args>
47struct function_traits<Ret (C::*)(Args...)> {
48 using return_type = Ret;
51template <
typename Func,
typename... Args>
52auto CallMockMethod(Func func, Args&&...
args) {
54 if (mock_gles->GetImpl()) {
55 return (mock_gles->GetImpl()->*func)(std::forward<Args>(
args)...);
58 return typename function_traits<Func>::return_type();
65 return reinterpret_cast<const unsigned char*
>(
kMockVendor);
67 return reinterpret_cast<const unsigned char*
>(
g_version);
68 case GL_SHADING_LANGUAGE_VERSION:
69 return reinterpret_cast<const unsigned char*
>(
72 return reinterpret_cast<const unsigned char*
>(
"");
77 decltype(glGetString)>::value);
82 return reinterpret_cast<const unsigned char*
>(
g_extensions[index]);
84 return reinterpret_cast<const unsigned char*
>(
"");
89 decltype(glGetStringi)>::value);
93 case GL_NUM_EXTENSIONS: {
96 case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
99 case GL_MAX_LABEL_LENGTH_KHR:
102 case GL_MAX_TEXTURE_SIZE:
112 decltype(glGetIntegerv)>::value);
119 decltype(glGetError)>::value);
124 decltype(glPopDebugGroupKHR)>::value);
132 decltype(glPushDebugGroupKHR)>::value);
139 decltype(glGenQueriesEXT)>::value);
146 decltype(glBeginQueryEXT)>::value);
153 decltype(glEndQueryEXT)>::value);
160 decltype(glGetQueryObjectuivEXT)>::value);
167 decltype(glGetQueryObjectui64vEXT)>::value);
178 decltype(glDeleteQueriesEXT)>::value);
184 decltype(glUniform1fv)>::value);
191 decltype(glGenTextures)>::value);
198 decltype(glGenTextures)>::value);
203 const GLchar* label) {
208 decltype(glObjectLabelKHR)>::value);
215 decltype(glIsTexture)>::value);
222 decltype(glCheckFramebufferStatus)>::value);
229 decltype(glGenFramebuffers)>::value);
236 decltype(glBindFramebuffer)>::value);
250 GLsizei numAttachments,
251 const GLenum* attachments) {
253 numAttachments, attachments);
257 decltype(glDiscardFramebufferEXT)>::value);
261 std::unique_ptr<MockGLESImpl> impl,
262 const std::optional<std::vector<const char*>>& extensions) {
264 <<
"MockGLES is already being used by another test.";
267 auto mock_gles = std::shared_ptr<MockGLES>(
new MockGLES());
268 mock_gles->impl_ = std::move(impl);
274 const std::optional<std::vector<const char*>>& extensions,
275 const char* version_string,
279 <<
"MockGLES is already being used by another test.";
282 auto mock_gles = std::shared_ptr<MockGLES>(
new MockGLES(std::move(resolver)));
288 if (strcmp(
name,
"glPopDebugGroupKHR") == 0) {
290 }
else if (strcmp(
name,
"glPushDebugGroupKHR") == 0) {
292 }
else if (strcmp(
name,
"glGetString") == 0) {
294 }
else if (strcmp(
name,
"glGetStringi") == 0) {
296 }
else if (strcmp(
name,
"glGetIntegerv") == 0) {
298 }
else if (strcmp(
name,
"glGetError") == 0) {
300 }
else if (strcmp(
name,
"glGenQueriesEXT") == 0) {
302 }
else if (strcmp(
name,
"glBeginQueryEXT") == 0) {
304 }
else if (strcmp(
name,
"glEndQueryEXT") == 0) {
306 }
else if (strcmp(
name,
"glDeleteQueriesEXT") == 0) {
308 }
else if (strcmp(
name,
"glDeleteTextures") == 0) {
310 }
else if (strcmp(
name,
"glGetQueryObjectui64vEXT") == 0) {
312 }
else if (strcmp(
name,
"glGetQueryObjectuivEXT") == 0) {
314 }
else if (strcmp(
name,
"glUniform1fv") == 0) {
316 }
else if (strcmp(
name,
"glGenTextures") == 0) {
318 }
else if (strcmp(
name,
"glObjectLabelKHR") == 0) {
320 }
else if (strcmp(
name,
"glGenBuffers") == 0) {
322 }
else if (strcmp(
name,
"glIsTexture") == 0) {
324 }
else if (strcmp(
name,
"glCheckFramebufferStatus") == 0) {
326 }
else if (strcmp(
name,
"glReadPixels") == 0) {
328 }
else if (strcmp(
name,
"glGenFramebuffers") == 0) {
330 }
else if (strcmp(
name,
"glBindFramebuffer") == 0) {
332 }
else if (strcmp(
name,
"glDiscardFramebufferEXT") == 0) {
335 return reinterpret_cast<void*
>(&
doNothing);
340 : proc_table_(
std::move(resolver)) {}
342MockGLES::~MockGLES() {
std::function< void *(const char *function_name)> Resolver
virtual void GenFramebuffers(GLsizei n, GLuint *framebuffers)
virtual void GenBuffers(GLsizei n, GLuint *buffers)
virtual void GetQueryObjectui64vEXT(GLuint id, GLenum target, GLuint64 *result)
virtual void GetQueryObjectuivEXT(GLuint id, GLenum target, GLuint *result)
virtual void DeleteQueriesEXT(GLsizei size, const GLuint *queries)
virtual void ObjectLabelKHR(GLenum identifier, GLuint name, GLsizei length, const GLchar *label)
virtual void EndQueryEXT(GLuint id)
virtual void DiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments)
virtual void DeleteTextures(GLsizei size, const GLuint *queries)
virtual void GenQueriesEXT(GLsizei n, GLuint *ids)
virtual void BeginQueryEXT(GLenum target, GLuint id)
virtual void BindFramebuffer(GLenum target, GLuint framebuffer)
virtual void GetIntegerv(GLenum name, GLint *attachments)
virtual GLboolean IsTexture(GLuint texture)
virtual void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels)
virtual void Uniform1fv(GLint location, GLsizei count, const GLfloat *value)
virtual void GenTextures(GLsizei n, GLuint *textures)
virtual GLenum CheckFramebufferStatus(GLenum target)
Provides a mocked version of the |ProcTableGLES| class.
static std::shared_ptr< MockGLES > Init(std::unique_ptr< MockGLESImpl > impl, const std::optional< std::vector< const char * > > &extensions=std::nullopt)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
G_BEGIN_DECLS GBytes * message
uint32_t uint32_t * format
#define FML_CHECK(condition)
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
DEF_SWITCHES_START aot vmservice shared library name
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
void mockDeleteQueriesEXT(GLsizei size, const GLuint *queries)
void mockGetQueryObjectuivEXT(GLuint id, GLenum target, GLuint *result)
static std::mutex g_test_lock
void mockDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments)
const auto kMockShadingLanguageVersion
void mockPopDebugGroupKHR()
const unsigned char * mockGetStringi(GLenum name, GLuint index)
void mockGetIntegerv(GLenum name, int *value)
static std::vector< const char * > g_extensions
void mockGetQueryObjectui64vEXT(GLuint id, GLenum target, GLuint64 *result)
GLboolean mockIsTexture(GLuint texture)
void mockReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *data)
static std::weak_ptr< MockGLES > g_mock_gles
void mockDeleteTextures(GLsizei size, const GLuint *queries)
GLenum mockCheckFramebufferStatus(GLenum target)
void mockUniform1fv(GLint location, GLsizei count, const GLfloat *value)
void mockObjectLabelKHR(GLenum identifier, GLuint name, GLsizei length, const GLchar *label)
static const char * g_version
const ProcTableGLES::Resolver kMockResolverGLES
void mockPushDebugGroupKHR(GLenum source, GLuint id, GLsizei length, const GLchar *message)
void mockBindFramebuffer(GLenum target, GLuint framebuffer)
void mockEndQueryEXT(GLuint id)
void mockGenBuffers(GLsizei n, GLuint *buffers)
void mockGenFramebuffers(GLsizei n, GLuint *ids)
void mockGenQueriesEXT(GLsizei n, GLuint *ids)
const unsigned char * mockGetString(GLenum name)
void mockBeginQueryEXT(GLenum target, GLuint id)
void mockGenTextures(GLsizei n, GLuint *textures)