Home | History | Annotate | Download | only in gl
      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.
      4 
      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.
      8 
      9 #ifndef UI_GL_GL_MOCK_H_
     10 #define UI_GL_GL_MOCK_H_
     11 
     12 #include "testing/gmock/include/gmock/gmock.h"
     13 #include "ui/gl/gl_bindings.h"
     14 
     15 namespace gfx {
     16 
     17 class MockGLInterface {
     18  public:
     19   MockGLInterface();
     20   virtual ~MockGLInterface();
     21 
     22   // Set the functions called from the mock GL implementation for the purposes
     23   // of testing.
     24   static void SetGLInterface(MockGLInterface* gl_interface);
     25 
     26   // Find an entry point to the mock GL implementation.
     27   static void* GL_BINDING_CALL GetGLProcAddress(const char* name);
     28 
     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.
     32 
     33   // Member functions
     34   #include "gl_mock_autogen_gl.h"
     35 
     36  private:
     37   static MockGLInterface* interface_;
     38 
     39   // Static mock functions that invoke the member functions of interface_.
     40   #include "gl_bindings_autogen_mock.h"
     41 };
     42 
     43 }  // namespace gfx
     44 
     45 #endif  // UI_GL_GL_MOCK_H_
     46