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 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 manager_.SetLevelInfo(info, | 992 manager_.SetLevelInfo(info, |
993 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, false); | 993 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, false); |
994 EXPECT_TRUE(manager_.CanRender(info)); | 994 EXPECT_TRUE(manager_.CanRender(info)); |
995 EXPECT_FALSE(manager_.HaveUnrenderableTextures()); | 995 EXPECT_FALSE(manager_.HaveUnrenderableTextures()); |
996 EXPECT_CALL(*gl_, DeleteTextures(1, ::testing::Pointee(kService2Id))) | 996 EXPECT_CALL(*gl_, DeleteTextures(1, ::testing::Pointee(kService2Id))) |
997 .Times(1) | 997 .Times(1) |
998 .RetiresOnSaturation(); | 998 .RetiresOnSaturation(); |
999 info = NULL; | 999 info = NULL; |
1000 } | 1000 } |
1001 | 1001 |
| 1002 TEST_F(TextureInfoTest, GetLevelImage) { |
| 1003 manager_.SetInfoTarget(info_, GL_TEXTURE_2D); |
| 1004 manager_.SetLevelInfo(info_, |
| 1005 GL_TEXTURE_2D, 1, GL_RGBA, 2, 2, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, true); |
| 1006 EXPECT_TRUE(info_->GetLevelImage(GL_TEXTURE_2D, 1) == NULL); |
| 1007 // Set image. |
| 1008 manager_.SetLevelImage(info_, |
| 1009 GL_TEXTURE_2D, 1, gfx::GLImage::CreateGLImage(0)); |
| 1010 EXPECT_FALSE(info_->GetLevelImage(GL_TEXTURE_2D, 1) == NULL); |
| 1011 // Remove it. |
| 1012 manager_.SetLevelImage(info_, GL_TEXTURE_2D, 1, NULL); |
| 1013 EXPECT_TRUE(info_->GetLevelImage(GL_TEXTURE_2D, 1) == NULL); |
| 1014 manager_.SetLevelImage(info_, |
| 1015 GL_TEXTURE_2D, 1, gfx::GLImage::CreateGLImage(0)); |
| 1016 // Image should be reset when SetLevelInfo is called. |
| 1017 manager_.SetLevelInfo(info_, |
| 1018 GL_TEXTURE_2D, 1, GL_RGBA, 2, 2, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, true); |
| 1019 EXPECT_TRUE(info_->GetLevelImage(GL_TEXTURE_2D, 1) == NULL); |
| 1020 } |
| 1021 |
1002 } // namespace gles2 | 1022 } // namespace gles2 |
1003 } // namespace gpu | 1023 } // namespace gpu |
1004 | 1024 |
1005 | 1025 |
OLD | NEW |