| OLD | NEW |
| 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/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" |
| 11 #include "gpu/command_buffer/service/test_helper.h" | 11 #include "gpu/command_buffer/service/test_helper.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 using ::testing::Pointee; | 14 using ::testing::Pointee; |
| 15 using ::testing::Return; | 15 using ::testing::Return; |
| 16 using ::testing::_; | 16 using ::testing::_; |
| 17 | 17 |
| 18 namespace gpu { | 18 namespace gpu { |
| 19 namespace gles2 { | 19 namespace gles2 { |
| 20 | 20 |
| 21 class TextureManagerTest : public testing::Test { | 21 class TextureManagerTest : public testing::Test { |
| 22 public: | 22 public: |
| 23 static const GLint kMaxTextureSize = 16; | 23 static const GLint kMaxTextureSize = 16; |
| 24 static const GLint kMaxCubeMapTextureSize = 8; | 24 static const GLint kMaxCubeMapTextureSize = 8; |
| 25 static const GLint kMaxExternalTextureSize = 16; | 25 static const GLint kMaxExternalTextureSize = 16; |
| 26 static const GLint kMax2dLevels = 5; | 26 static const GLint kMax2dLevels = 5; |
| 27 static const GLint kMaxCubeMapLevels = 4; | 27 static const GLint kMaxCubeMapLevels = 4; |
| 28 static const GLint kMaxExternalLevels = 1; | 28 static const GLint kMaxExternalLevels = 1; |
| 29 | 29 |
| 30 static const GLuint kServiceBlackTexture2dId = 701; | |
| 31 static const GLuint kServiceBlackTextureCubemapId = 702; | |
| 32 static const GLuint kServiceDefaultTexture2dId = 703; | |
| 33 static const GLuint kServiceDefaultTextureCubemapId = 704; | |
| 34 | |
| 35 | |
| 36 TextureManagerTest() | 30 TextureManagerTest() |
| 37 : manager_(kMaxTextureSize, kMaxCubeMapTextureSize) { | 31 : manager_(kMaxTextureSize, kMaxCubeMapTextureSize) { |
| 38 } | 32 } |
| 39 | 33 |
| 40 ~TextureManagerTest() { | 34 ~TextureManagerTest() { |
| 41 manager_.Destroy(false); | 35 manager_.Destroy(false); |
| 42 } | 36 } |
| 43 | 37 |
| 44 protected: | 38 protected: |
| 45 virtual void SetUp() { | 39 virtual void SetUp() { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 62 }; | 56 }; |
| 63 | 57 |
| 64 // GCC requires these declarations, but MSVC requires they not be present | 58 // GCC requires these declarations, but MSVC requires they not be present |
| 65 #ifndef COMPILER_MSVC | 59 #ifndef COMPILER_MSVC |
| 66 const GLint TextureManagerTest::kMaxTextureSize; | 60 const GLint TextureManagerTest::kMaxTextureSize; |
| 67 const GLint TextureManagerTest::kMaxCubeMapTextureSize; | 61 const GLint TextureManagerTest::kMaxCubeMapTextureSize; |
| 68 const GLint TextureManagerTest::kMaxExternalTextureSize; | 62 const GLint TextureManagerTest::kMaxExternalTextureSize; |
| 69 const GLint TextureManagerTest::kMax2dLevels; | 63 const GLint TextureManagerTest::kMax2dLevels; |
| 70 const GLint TextureManagerTest::kMaxCubeMapLevels; | 64 const GLint TextureManagerTest::kMaxCubeMapLevels; |
| 71 const GLint TextureManagerTest::kMaxExternalLevels; | 65 const GLint TextureManagerTest::kMaxExternalLevels; |
| 72 const GLuint TextureManagerTest::kServiceBlackTexture2dId; | |
| 73 const GLuint TextureManagerTest::kServiceBlackTextureCubemapId; | |
| 74 const GLuint TextureManagerTest::kServiceDefaultTexture2dId; | |
| 75 const GLuint TextureManagerTest::kServiceDefaultTextureCubemapId; | |
| 76 #endif | 66 #endif |
| 77 | 67 |
| 78 TEST_F(TextureManagerTest, Basic) { | 68 TEST_F(TextureManagerTest, Basic) { |
| 79 const GLuint kClient1Id = 1; | 69 const GLuint kClient1Id = 1; |
| 80 const GLuint kService1Id = 11; | 70 const GLuint kService1Id = 11; |
| 81 const GLuint kClient2Id = 2; | 71 const GLuint kClient2Id = 2; |
| 82 EXPECT_FALSE(manager_.HaveUnrenderableTextures()); | 72 EXPECT_FALSE(manager_.HaveUnrenderableTextures()); |
| 83 EXPECT_FALSE(manager_.HaveUnsafeTextures()); | 73 EXPECT_FALSE(manager_.HaveUnsafeTextures()); |
| 84 EXPECT_FALSE(manager_.HaveUnclearedMips()); | 74 EXPECT_FALSE(manager_.HaveUnclearedMips()); |
| 85 // Check we can create texture. | 75 // Check we can create texture. |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 EXPECT_TRUE(info_->SafeToRenderFrom()); | 871 EXPECT_TRUE(info_->SafeToRenderFrom()); |
| 882 EXPECT_FALSE(manager_.HaveUnsafeTextures()); | 872 EXPECT_FALSE(manager_.HaveUnsafeTextures()); |
| 883 EXPECT_FALSE(manager_.HaveUnclearedMips()); | 873 EXPECT_FALSE(manager_.HaveUnclearedMips()); |
| 884 EXPECT_EQ(0, info_->num_uncleared_mips()); | 874 EXPECT_EQ(0, info_->num_uncleared_mips()); |
| 885 } | 875 } |
| 886 | 876 |
| 887 } // namespace gles2 | 877 } // namespace gles2 |
| 888 } // namespace gpu | 878 } // namespace gpu |
| 889 | 879 |
| 890 | 880 |
| OLD | NEW |