diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-01 22:41:16 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-01 22:41:16 +0000 |
commit | d304cbdeccf3db7330c09cb218096a45a2bdc746 (patch) | |
tree | d0b939398f1fe3f4beb1def5fbede824d1dea94d /gpu/command_buffer/service/renderbuffer_manager_unittest.cc | |
parent | e7f7509f4ab3672f61e6fc5ec6b5ce0b5eefb4a8 (diff) | |
download | chromium_src-d304cbdeccf3db7330c09cb218096a45a2bdc746.zip chromium_src-d304cbdeccf3db7330c09cb218096a45a2bdc746.tar.gz chromium_src-d304cbdeccf3db7330c09cb218096a45a2bdc746.tar.bz2 |
Free the resources used by a context group.
TEST=unit tests
BUG=none
Review URL: http://codereview.chromium.org/2880013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51441 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/service/renderbuffer_manager_unittest.cc')
-rw-r--r-- | gpu/command_buffer/service/renderbuffer_manager_unittest.cc | 27 |
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 |