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

Side by Side Diff: gpu/command_buffer/service/program_manager_unittest.cc

Issue 6721010: Fix bug in shader and program managers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/program_manager.h" 5 #include "gpu/command_buffer/service/program_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 ASSERT_TRUE(info1 != NULL); 79 ASSERT_TRUE(info1 != NULL);
80 EXPECT_CALL(*gl_, DeleteProgram(kService1Id)) 80 EXPECT_CALL(*gl_, DeleteProgram(kService1Id))
81 .Times(1) 81 .Times(1)
82 .RetiresOnSaturation(); 82 .RetiresOnSaturation();
83 manager_.Destroy(true); 83 manager_.Destroy(true);
84 // Check the resources were released. 84 // Check the resources were released.
85 info1 = manager_.GetProgramInfo(kClient1Id); 85 info1 = manager_.GetProgramInfo(kClient1Id);
86 ASSERT_TRUE(info1 == NULL); 86 ASSERT_TRUE(info1 == NULL);
87 } 87 }
88 88
89 TEST_F(ProgramManagerTest, DeleteBug) {
90 ShaderManager shader_manager;
91 const GLuint kClient1Id = 1;
92 const GLuint kClient2Id = 2;
93 const GLuint kService1Id = 11;
94 const GLuint kService2Id = 12;
95 // Check we can create program.
96 manager_.CreateProgramInfo(kClient1Id, kService1Id);
97 manager_.CreateProgramInfo(kClient2Id, kService2Id);
98 // Check program got created.
99 ProgramManager::ProgramInfo::Ref info1(manager_.GetProgramInfo(kClient1Id));
100 ProgramManager::ProgramInfo::Ref info2(manager_.GetProgramInfo(kClient2Id));
101 ASSERT_TRUE(info1.get() != NULL);
102 ASSERT_TRUE(info2.get() != NULL);
103 manager_.UseProgram(info1);
104 manager_.MarkAsDeleted(&shader_manager, info1);
105 manager_.MarkAsDeleted(&shader_manager, info2);
106 EXPECT_TRUE(manager_.IsOwned(info1));
107 EXPECT_FALSE(manager_.IsOwned(info2));
108 }
109
89 TEST_F(ProgramManagerTest, ProgramInfo) { 110 TEST_F(ProgramManagerTest, ProgramInfo) {
90 const GLuint kClient1Id = 1; 111 const GLuint kClient1Id = 1;
91 const GLuint kService1Id = 11; 112 const GLuint kService1Id = 11;
92 // Check we can create program. 113 // Check we can create program.
93 manager_.CreateProgramInfo(kClient1Id, kService1Id); 114 manager_.CreateProgramInfo(kClient1Id, kService1Id);
94 // Check program got created. 115 // Check program got created.
95 ProgramManager::ProgramInfo* info1 = manager_.GetProgramInfo(kClient1Id); 116 ProgramManager::ProgramInfo* info1 = manager_.GetProgramInfo(kClient1Id);
96 ASSERT_TRUE(info1 != NULL); 117 ASSERT_TRUE(info1 != NULL);
97 EXPECT_EQ(kService1Id, info1->service_id()); 118 EXPECT_EQ(kService1Id, info1->service_id());
98 EXPECT_FALSE(info1->InUse()); 119 EXPECT_FALSE(info1->InUse());
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 EXPECT_TRUE(info2 == NULL); 741 EXPECT_TRUE(info2 == NULL);
721 EXPECT_FALSE(vshader->InUse()); 742 EXPECT_FALSE(vshader->InUse());
722 EXPECT_FALSE(fshader->InUse()); 743 EXPECT_FALSE(fshader->InUse());
723 shader_manager.Destroy(false); 744 shader_manager.Destroy(false);
724 } 745 }
725 746
726 } // namespace gles2 747 } // namespace gles2
727 } // namespace gpu 748 } // namespace gpu
728 749
729 750
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/program_manager.cc ('k') | gpu/command_buffer/service/shader_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698