| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file implements mock GL Interface for unit testing. The interface | 5 // This file implements mock GL Interface for unit testing. The interface |
| 6 // corresponds to the set of functionally distinct GL functions defined in | 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. | 7 // generate_bindings.py, which may originate from either desktop GL or GLES. |
| 8 | 8 |
| 9 #ifndef UI_GL_GL_MOCK_H_ | 9 #ifndef UI_GL_GL_MOCK_H_ |
| 10 #define UI_GL_GL_MOCK_H_ | 10 #define UI_GL_GL_MOCK_H_ |
| 11 | 11 |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 13 #include "ui/gl/gl_bindings.h" | 13 #include "ui/gl/gl_bindings.h" |
| 14 | 14 |
| 15 namespace gl { | 15 namespace gl { |
| 16 | 16 |
| 17 using GLFunctionPointerType = void (*)(); |
| 18 |
| 17 class MockGLInterface { | 19 class MockGLInterface { |
| 18 public: | 20 public: |
| 19 MockGLInterface(); | 21 MockGLInterface(); |
| 20 virtual ~MockGLInterface(); | 22 virtual ~MockGLInterface(); |
| 21 | 23 |
| 22 // Set the functions called from the mock GL implementation for the purposes | 24 // Set the functions called from the mock GL implementation for the purposes |
| 23 // of testing. | 25 // of testing. |
| 24 static void SetGLInterface(MockGLInterface* gl_interface); | 26 static void SetGLInterface(MockGLInterface* gl_interface); |
| 25 | 27 |
| 26 // Find an entry point to the mock GL implementation. | 28 // Find an entry point to the mock GL implementation. |
| 27 static void* GL_BINDING_CALL GetGLProcAddress(const char* name); | 29 static GLFunctionPointerType GL_BINDING_CALL |
| 30 GetGLProcAddress(const char* name); |
| 28 | 31 |
| 29 // Include the auto-generated parts of this class. We split this because | 32 // 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 | 33 // 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 // this file instead of having to edit some template or the code generator. |
| 32 | 35 |
| 33 // Member functions | 36 // Member functions |
| 34 #include "gl_mock_autogen_gl.h" | 37 #include "gl_mock_autogen_gl.h" |
| 35 | 38 |
| 36 // TODO(zmo): crbug.com/456340 | 39 // TODO(zmo): crbug.com/456340 |
| 37 // Functions that cannot be mocked because they have more than 10 args. | 40 // Functions that cannot be mocked because they have more than 10 args. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 #include "gl_bindings_autogen_mock.h" | 120 #include "gl_bindings_autogen_mock.h" |
| 118 | 121 |
| 119 static void GL_BINDING_CALL Mock_glTexSubImage3DNoData( | 122 static void GL_BINDING_CALL Mock_glTexSubImage3DNoData( |
| 120 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, | 123 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, |
| 121 GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type); | 124 GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type); |
| 122 }; | 125 }; |
| 123 | 126 |
| 124 } // namespace gl | 127 } // namespace gl |
| 125 | 128 |
| 126 #endif // UI_GL_GL_MOCK_H_ | 129 #endif // UI_GL_GL_MOCK_H_ |
| OLD | NEW |