1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file implements mock GL Interface for unit testing. The interface
6 // corresponds to the set of functionally distinct GL functions defined in
7 // generate_bindings.py, which may originate from either desktop GL or GLES.
9 #ifndef UI_GL_GL_MOCK_H_
10 #define UI_GL_GL_MOCK_H_
12 #include "testing/gmock/include/gmock/gmock.h"
13 #include "ui/gl/gl_bindings.h"
17 class MockGLInterface
{
20 virtual ~MockGLInterface();
22 // Set the functions called from the mock GL implementation for the purposes
24 static void SetGLInterface(MockGLInterface
* gl_interface
);
26 // Find an entry point to the mock GL implementation.
27 static void* GL_BINDING_CALL
GetGLProcAddress(const char* name
);
29 // Include the auto-generated parts of this class. We split this because
30 // it means we can easily edit the non-auto generated parts right here in
31 // this file instead of having to edit some template or the code generator.
34 #include "gl_mock_autogen_gl.h"
36 // TODO(zmo): crbug.com/456340
37 // Functions that cannot be mocked because they have more than 10 args.
38 void CompressedTexSubImage3D(
39 GLenum
/*target*/, GLint
/*level*/, GLint
/*xoffset*/, GLint
/*yoffset*/,
40 GLint
/*zoffset*/, GLsizei
/*width*/, GLsizei
/*height*/,
41 GLsizei
/*depth*/, GLenum
/*format*/, GLsizei
/*imageSize*/,
42 const void* /*data*/) {
46 GLenum
/*target*/, GLint
/*level*/, GLint
/*xoffset*/, GLint
/*yoffset*/,
47 GLint
/*zoffset*/, GLsizei
/*width*/, GLsizei
/*height*/,
48 GLsizei
/*depth*/, GLenum
/*format*/, GLenum
/*type*/,
49 const void* /*pixels*/) {
54 static MockGLInterface
* interface_
;
56 // Static mock functions that invoke the member functions of interface_.
57 #include "gl_bindings_autogen_mock.h"
62 #endif // UI_GL_GL_MOCK_H_