summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/service/renderbuffer_manager_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gpu/command_buffer/service/renderbuffer_manager_unittest.cc')
-rw-r--r--gpu/command_buffer/service/renderbuffer_manager_unittest.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/gpu/command_buffer/service/renderbuffer_manager_unittest.cc b/gpu/command_buffer/service/renderbuffer_manager_unittest.cc
index 0cedaea..05c51ce 100644
--- a/gpu/command_buffer/service/renderbuffer_manager_unittest.cc
+++ b/gpu/command_buffer/service/renderbuffer_manager_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "gpu/command_buffer/service/renderbuffer_manager.h"
+#include "app/gfx/gl/gl_mock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace gpu {
@@ -12,14 +13,23 @@ class RenderbufferManagerTest : public testing::Test {
public:
RenderbufferManagerTest() {
}
+ ~RenderbufferManagerTest() {
+ manager_.Destroy(false);
+ }
protected:
virtual void SetUp() {
+ gl_.reset(new ::testing::StrictMock<gfx::MockGLInterface>());
+ ::gfx::GLInterface::SetGLInterface(gl_.get());
}
virtual void TearDown() {
+ ::gfx::GLInterface::SetGLInterface(NULL);
+ gl_.reset();
}
+ // Use StrictMock to make 100% sure we know how GL will be called.
+ scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_;
RenderbufferManager manager_;
};
@@ -50,6 +60,23 @@ TEST_F(RenderbufferManagerTest, Basic) {
EXPECT_TRUE(manager_.GetRenderbufferInfo(kClient1Id) == NULL);
}
+TEST_F(RenderbufferManagerTest, Destroy) {
+ const GLuint kClient1Id = 1;
+ const GLuint kService1Id = 11;
+ // Check we can create renderbuffer.
+ manager_.CreateRenderbufferInfo(kClient1Id, kService1Id);
+ // Check renderbuffer got created.
+ RenderbufferManager::RenderbufferInfo* info1 =
+ manager_.GetRenderbufferInfo(kClient1Id);
+ ASSERT_TRUE(info1 != NULL);
+ EXPECT_CALL(*gl_, DeleteRenderbuffersEXT(1, ::testing::Pointee(kService1Id)))
+ .Times(1)
+ .RetiresOnSaturation();
+ manager_.Destroy(true);
+ info1 = manager_.GetRenderbufferInfo(kClient1Id);
+ ASSERT_TRUE(info1 == NULL);
+}
+
} // namespace gles2
} // namespace gpu