| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_buffer/common/gl_mock.h" | 8 #include "gpu/command_buffer/common/gl_mock.h" |
| 9 #include "gpu/command_buffer/service/feature_info.h" | 9 #include "gpu/command_buffer/service/feature_info.h" |
| 10 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" | 10 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 manager_.SetLevelInfo(info, | 965 manager_.SetLevelInfo(info, |
| 966 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, false); | 966 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, false); |
| 967 EXPECT_TRUE(manager_.CanRender(info)); | 967 EXPECT_TRUE(manager_.CanRender(info)); |
| 968 EXPECT_FALSE(manager_.HaveUnrenderableTextures()); | 968 EXPECT_FALSE(manager_.HaveUnrenderableTextures()); |
| 969 EXPECT_CALL(*gl_, DeleteTextures(1, ::testing::Pointee(kService2Id))) | 969 EXPECT_CALL(*gl_, DeleteTextures(1, ::testing::Pointee(kService2Id))) |
| 970 .Times(1) | 970 .Times(1) |
| 971 .RetiresOnSaturation(); | 971 .RetiresOnSaturation(); |
| 972 info = NULL; | 972 info = NULL; |
| 973 } | 973 } |
| 974 | 974 |
| 975 TEST_F(TextureInfoTest, GetLevelImage) { |
| 976 manager_.SetInfoTarget(info_, GL_TEXTURE_2D); |
| 977 manager_.SetLevelInfo(info_, |
| 978 GL_TEXTURE_2D, 1, GL_RGBA, 2, 2, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, true); |
| 979 EXPECT_TRUE(info_->GetLevelImage(GL_TEXTURE_2D, 1) == NULL); |
| 980 // Set image. |
| 981 manager_.SetLevelImage(info_, |
| 982 GL_TEXTURE_2D, 1, gfx::GLImage::CreatePixmapGLImage(NULL)); |
| 983 EXPECT_FALSE(info_->GetLevelImage(GL_TEXTURE_2D, 1) == NULL); |
| 984 // Remove it. |
| 985 manager_.SetLevelImage(info_, GL_TEXTURE_2D, 1, NULL); |
| 986 EXPECT_TRUE(info_->GetLevelImage(GL_TEXTURE_2D, 1) == NULL); |
| 987 manager_.SetLevelImage(info_, |
| 988 GL_TEXTURE_2D, 1, gfx::GLImage::CreatePixmapGLImage(NULL)); |
| 989 // Image should be reset when SetLevelInfo is called. |
| 990 manager_.SetLevelInfo(info_, |
| 991 GL_TEXTURE_2D, 1, GL_RGBA, 2, 2, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, true); |
| 992 EXPECT_TRUE(info_->GetLevelImage(GL_TEXTURE_2D, 1) == NULL); |
| 993 } |
| 994 |
| 975 } // namespace gles2 | 995 } // namespace gles2 |
| 976 } // namespace gpu | 996 } // namespace gpu |
| 977 | 997 |
| 978 | 998 |
| OLD | NEW |