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

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

Issue 7529015: Allow the renderer process to map textures from one context into another. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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) 2011 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/texture_manager.h" 5 #include "gpu/command_buffer/service/texture_manager.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "gpu/GLES2/gles2_command_buffer.h" 8 #include "gpu/GLES2/gles2_command_buffer.h"
9 #include "gpu/command_buffer/common/gl_mock.h" 9 #include "gpu/command_buffer/common/gl_mock.h"
10 #include "gpu/command_buffer/service/feature_info.h" 10 #include "gpu/command_buffer/service/feature_info.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 .RetiresOnSaturation(); 146 .RetiresOnSaturation();
147 EXPECT_CALL(*gl_, DeleteTextures(4, _)) 147 EXPECT_CALL(*gl_, DeleteTextures(4, _))
148 .Times(1) 148 .Times(1)
149 .RetiresOnSaturation(); 149 .RetiresOnSaturation();
150 manager_.Destroy(true); 150 manager_.Destroy(true);
151 // Check that resources got freed. 151 // Check that resources got freed.
152 info1 = manager_.GetTextureInfo(kClient1Id); 152 info1 = manager_.GetTextureInfo(kClient1Id);
153 ASSERT_TRUE(info1 == NULL); 153 ASSERT_TRUE(info1 == NULL);
154 } 154 }
155 155
156 TEST_F(TextureManagerTest, DestroyUnowned) {
157 const GLuint kClient1Id = 1;
158 const GLuint kService1Id = 11;
159 EXPECT_FALSE(manager_.HaveUnrenderableTextures());
160 // Check we can create texture.
161 TextureManager::TextureInfo* created_info =
162 manager_.CreateTextureInfo(&feature_info_, kClient1Id, kService1Id);
163 created_info->SetNotOwned();
164
165 // Check texture got created.
166 TextureManager::TextureInfo* info1 = manager_.GetTextureInfo(kClient1Id);
167 ASSERT_TRUE(info1 != NULL);
168 EXPECT_CALL(*gl_, DeleteTextures(4, _))
169 .Times(1)
170 .RetiresOnSaturation();
171
172 // Check that it is not freed if it is not owned.
173 manager_.Destroy(true);
174 info1 = manager_.GetTextureInfo(kClient1Id);
175 ASSERT_TRUE(info1 == NULL);
176 }
177
178 TEST_F(TextureManagerTest, MaxValues) { 156 TEST_F(TextureManagerTest, MaxValues) {
179 // Check we get the right values for the max sizes. 157 // Check we get the right values for the max sizes.
180 EXPECT_EQ(kMax2dLevels, manager_.MaxLevelsForTarget(GL_TEXTURE_2D)); 158 EXPECT_EQ(kMax2dLevels, manager_.MaxLevelsForTarget(GL_TEXTURE_2D));
181 EXPECT_EQ(kMaxCubeMapLevels, 159 EXPECT_EQ(kMaxCubeMapLevels,
182 manager_.MaxLevelsForTarget(GL_TEXTURE_CUBE_MAP)); 160 manager_.MaxLevelsForTarget(GL_TEXTURE_CUBE_MAP));
183 EXPECT_EQ(kMaxCubeMapLevels, 161 EXPECT_EQ(kMaxCubeMapLevels,
184 manager_.MaxLevelsForTarget(GL_TEXTURE_CUBE_MAP_POSITIVE_X)); 162 manager_.MaxLevelsForTarget(GL_TEXTURE_CUBE_MAP_POSITIVE_X));
185 EXPECT_EQ(kMaxCubeMapLevels, 163 EXPECT_EQ(kMaxCubeMapLevels,
186 manager_.MaxLevelsForTarget(GL_TEXTURE_CUBE_MAP_NEGATIVE_X)); 164 manager_.MaxLevelsForTarget(GL_TEXTURE_CUBE_MAP_NEGATIVE_X));
187 EXPECT_EQ(kMaxCubeMapLevels, 165 EXPECT_EQ(kMaxCubeMapLevels,
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 manager.SetInfoTarget(info, GL_TEXTURE_EXTERNAL_OES); 672 manager.SetInfoTarget(info, GL_TEXTURE_EXTERNAL_OES);
695 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), info->target()); 673 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), info->target());
696 EXPECT_FALSE(info->CanGenerateMipmaps(&feature_info)); 674 EXPECT_FALSE(info->CanGenerateMipmaps(&feature_info));
697 manager.Destroy(false); 675 manager.Destroy(false);
698 } 676 }
699 677
700 } // namespace gles2 678 } // namespace gles2
701 } // namespace gpu 679 } // namespace gpu
702 680
703 681
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698