Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: gpu/command_buffer/service/buffer_manager_unittest.cc

Issue 2880013: Free the resources used by a context group. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/buffer_manager.cc ('k') | gpu/command_buffer/service/context_group.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/buffer_manager_unittest.cc
===================================================================
--- gpu/command_buffer/service/buffer_manager_unittest.cc (revision 51426)
+++ gpu/command_buffer/service/buffer_manager_unittest.cc (working copy)
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "gpu/command_buffer/service/buffer_manager.h"
+#include "app/gfx/gl/gl_mock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace gpu {
@@ -12,18 +13,27 @@
public:
BufferManagerTest() {
}
+ ~BufferManagerTest() {
+ 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();
}
GLenum GetTarget(const BufferManager::BufferInfo* info) const {
return info->target();
}
+ // Use StrictMock to make 100% sure we know how GL will be called.
+ scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_;
BufferManager manager_;
};
@@ -58,6 +68,24 @@
EXPECT_TRUE(manager_.GetBufferInfo(kClientBuffer1Id) == NULL);
}
+TEST_F(BufferManagerTest, Destroy) {
+ const GLuint kClient1Id = 1;
+ const GLuint kService1Id = 11;
+ // Check we can create buffer.
+ manager_.CreateBufferInfo(kClient1Id, kService1Id);
+ // Check buffer got created.
+ BufferManager::BufferInfo* info1 =
+ manager_.GetBufferInfo(kClient1Id);
+ ASSERT_TRUE(info1 != NULL);
+ EXPECT_CALL(*gl_, DeleteBuffersARB(1, ::testing::Pointee(kService1Id)))
+ .Times(1)
+ .RetiresOnSaturation();
+ manager_.Destroy(true);
+ // Check the resources were released.
+ info1 = manager_.GetBufferInfo(kClient1Id);
+ ASSERT_TRUE(info1 == NULL);
+}
+
TEST_F(BufferManagerTest, SetRange) {
const GLuint kClientBufferId = 1;
const GLuint kServiceBufferId = 11;
« no previous file with comments | « gpu/command_buffer/service/buffer_manager.cc ('k') | gpu/command_buffer/service/context_group.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698