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

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

Issue 6670074: GPU process - parent GL context does not delete the textures it shares with c... (Closed) Base URL: svn://chrome-svn/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
« no previous file with comments | « gpu/command_buffer/service/texture_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/scoped_ptr.h" 7 #include "base/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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 .RetiresOnSaturation(); 107 .RetiresOnSaturation();
108 EXPECT_CALL(*gl_, DeleteTextures(4, _)) 108 EXPECT_CALL(*gl_, DeleteTextures(4, _))
109 .Times(1) 109 .Times(1)
110 .RetiresOnSaturation(); 110 .RetiresOnSaturation();
111 manager_.Destroy(true); 111 manager_.Destroy(true);
112 // Check that resources got freed. 112 // Check that resources got freed.
113 info1 = manager_.GetTextureInfo(kClient1Id); 113 info1 = manager_.GetTextureInfo(kClient1Id);
114 ASSERT_TRUE(info1 == NULL); 114 ASSERT_TRUE(info1 == NULL);
115 } 115 }
116 116
117 TEST_F(TextureManagerTest, DestroyUnowned) {
118 const GLuint kClient1Id = 1;
119 const GLuint kService1Id = 11;
120 EXPECT_FALSE(manager_.HaveUnrenderableTextures());
121 // Check we can create texture.
122 TextureManager::TextureInfo* created_info =
123 manager_.CreateTextureInfo(&feature_info_, kClient1Id, kService1Id);
124 created_info->SetNotOwned();
125
126 // Check texture got created.
127 TextureManager::TextureInfo* info1 = manager_.GetTextureInfo(kClient1Id);
128 ASSERT_TRUE(info1 != NULL);
129 EXPECT_CALL(*gl_, DeleteTextures(4, _))
130 .Times(1)
131 .RetiresOnSaturation();
132
133 // Check that it is not freed if it is not owned.
134 manager_.Destroy(true);
135 info1 = manager_.GetTextureInfo(kClient1Id);
136 ASSERT_TRUE(info1 == NULL);
137 }
138
117 TEST_F(TextureManagerTest, MaxValues) { 139 TEST_F(TextureManagerTest, MaxValues) {
118 // Check we get the right values for the max sizes. 140 // Check we get the right values for the max sizes.
119 EXPECT_EQ(kMax2dLevels, manager_.MaxLevelsForTarget(GL_TEXTURE_2D)); 141 EXPECT_EQ(kMax2dLevels, manager_.MaxLevelsForTarget(GL_TEXTURE_2D));
120 EXPECT_EQ(kMaxCubeMapLevels, 142 EXPECT_EQ(kMaxCubeMapLevels,
121 manager_.MaxLevelsForTarget(GL_TEXTURE_CUBE_MAP)); 143 manager_.MaxLevelsForTarget(GL_TEXTURE_CUBE_MAP));
122 EXPECT_EQ(kMaxTextureSize, manager_.MaxSizeForTarget(GL_TEXTURE_2D)); 144 EXPECT_EQ(kMaxTextureSize, manager_.MaxSizeForTarget(GL_TEXTURE_2D));
123 EXPECT_EQ(kMaxCubeMapTextureSize, 145 EXPECT_EQ(kMaxCubeMapTextureSize,
124 manager_.MaxSizeForTarget(GL_TEXTURE_CUBE_MAP)); 146 manager_.MaxSizeForTarget(GL_TEXTURE_CUBE_MAP));
125 } 147 }
126 148
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 manager.SetLevelInfo(&feature_info, info, 612 manager.SetLevelInfo(&feature_info, info,
591 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_HALF_FLOAT_OES); 613 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_HALF_FLOAT_OES);
592 EXPECT_TRUE(info->texture_complete()); 614 EXPECT_TRUE(info->texture_complete());
593 manager.Destroy(false); 615 manager.Destroy(false);
594 } 616 }
595 617
596 } // namespace gles2 618 } // namespace gles2
597 } // namespace gpu 619 } // namespace gpu
598 620
599 621
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698