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

Unified Diff: gpu/command_buffer/service/program_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/program_manager.cc ('k') | gpu/command_buffer/service/renderbuffer_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/program_manager_unittest.cc
===================================================================
--- gpu/command_buffer/service/program_manager_unittest.cc (revision 51426)
+++ gpu/command_buffer/service/program_manager_unittest.cc (working copy)
@@ -26,14 +26,23 @@
class ProgramManagerTest : public testing::Test {
public:
ProgramManagerTest() { }
+ ~ProgramManagerTest() {
+ 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_;
ProgramManager manager_;
};
@@ -61,12 +70,34 @@
EXPECT_TRUE(manager_.GetProgramInfo(kClient1Id) == NULL);
}
+TEST_F(ProgramManagerTest, Destroy) {
+ const GLuint kClient1Id = 1;
+ const GLuint kService1Id = 11;
+ // Check we can create program.
+ manager_.CreateProgramInfo(kClient1Id, kService1Id);
+ // Check program got created.
+ ProgramManager::ProgramInfo* info1 =
+ manager_.GetProgramInfo(kClient1Id);
+ ASSERT_TRUE(info1 != NULL);
+ EXPECT_CALL(*gl_, DeleteProgram(kService1Id))
+ .Times(1)
+ .RetiresOnSaturation();
+ manager_.Destroy(true);
+ // Check the resources were released.
+ info1 = manager_.GetProgramInfo(kClient1Id);
+ ASSERT_TRUE(info1 == NULL);
+}
+
class ProgramManagerWithShaderTest : public testing::Test {
public:
ProgramManagerWithShaderTest()
: program_info_(NULL) {
}
+ ~ProgramManagerWithShaderTest() {
+ manager_.Destroy(false);
+ }
+
static const GLint kNumVertexAttribs = 16;
static const GLuint kClientProgramId = 123;
@@ -410,6 +441,7 @@
EXPECT_FALSE(program_info->CanLink());
fshader->SetStatus(true, "");
EXPECT_TRUE(program_info->CanLink());
+ shader_manager.Destroy(false);
}
TEST_F(ProgramManagerWithShaderTest, GetUniformLocation) {
« no previous file with comments | « gpu/command_buffer/service/program_manager.cc ('k') | gpu/command_buffer/service/renderbuffer_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698