Home | History | Annotate | Download | only in tests
      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 #include <GLES2/gl2.h>
      6 #include <GLES2/gl2ext.h>
      7 #include <GLES2/gl2extchromium.h>
      8 
      9 #include "gpu/command_buffer/tests/gl_manager.h"
     10 #include "gpu/command_buffer/tests/gl_test_utils.h"
     11 #include "testing/gmock/include/gmock/gmock.h"
     12 #include "testing/gtest/include/gtest/gtest.h"
     13 
     14 namespace gpu {
     15 
     16 class GLChromiumFramebufferMultisampleTest : public testing::Test {
     17  protected:
     18   virtual void SetUp() {
     19     gl_.Initialize(GLManager::Options());
     20   }
     21 
     22   virtual void TearDown() {
     23     gl_.Destroy();
     24   }
     25 
     26   GLManager gl_;
     27 };
     28 
     29 // Test that GL is at least minimally working.
     30 TEST_F(GLChromiumFramebufferMultisampleTest, CachedBindingsTest) {
     31   if (!GLTestHelper::HasExtension("GL_CHROMIUM_framebuffer_multisample")) {
     32     return;
     33   }
     34 
     35   GLuint fbo = 0;
     36   glGenFramebuffers(1, &fbo);
     37   glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
     38   glBindFramebuffer(GL_FRAMEBUFFER, 0);
     39 
     40   // If the caching is bad the second call to glBindFramebuffer will do nothing.
     41   // which means the draw buffer is bad and will not return
     42   // GL_FRAMEBUFFER_COMPLETE and rendering will generate an error.
     43   EXPECT_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE),
     44             glCheckFramebufferStatus(GL_FRAMEBUFFER));
     45 
     46   glClear(GL_COLOR_BUFFER_BIT);
     47   GLTestHelper::CheckGLError("no errors", __LINE__);
     48 }
     49 
     50 }  // namespace gpu
     51 
     52