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/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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 ~TextureInfoTest() { | 301 ~TextureInfoTest() { |
302 manager_.Destroy(false); | 302 manager_.Destroy(false); |
303 } | 303 } |
304 | 304 |
305 protected: | 305 protected: |
306 virtual void SetUp() { | 306 virtual void SetUp() { |
307 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); | 307 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); |
308 ::gfx::GLInterface::SetGLInterface(gl_.get()); | 308 ::gfx::GLInterface::SetGLInterface(gl_.get()); |
309 manager_.CreateTextureInfo(&feature_info_, kClient1Id, kService1Id); | 309 manager_.CreateTextureInfo(&feature_info_, kClient1Id, kService1Id); |
310 info_ = manager_.GetTextureInfo(kClient1Id); | 310 info_ = manager_.GetTextureInfo(kClient1Id); |
311 ASSERT_TRUE(info_ != NULL); | 311 ASSERT_TRUE(info_.get() != NULL); |
312 } | 312 } |
313 | 313 |
314 virtual void TearDown() { | 314 virtual void TearDown() { |
| 315 info_ = NULL; |
315 ::gfx::GLInterface::SetGLInterface(NULL); | 316 ::gfx::GLInterface::SetGLInterface(NULL); |
316 gl_.reset(); | 317 gl_.reset(); |
317 } | 318 } |
318 | 319 |
319 // Use StrictMock to make 100% sure we know how GL will be called. | 320 // Use StrictMock to make 100% sure we know how GL will be called. |
320 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; | 321 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; |
321 TextureManager manager_; | 322 TextureManager manager_; |
322 TextureManager::TextureInfo* info_; | 323 TextureManager::TextureInfo::Ref info_; |
323 FeatureInfo feature_info_; | 324 FeatureInfo feature_info_; |
324 }; | 325 }; |
325 | 326 |
326 TEST_F(TextureInfoTest, Basic) { | 327 TEST_F(TextureInfoTest, Basic) { |
327 EXPECT_EQ(0u, info_->target()); | 328 EXPECT_EQ(0u, info_->target()); |
328 EXPECT_FALSE(info_->texture_complete()); | 329 EXPECT_FALSE(info_->texture_complete()); |
329 EXPECT_FALSE(info_->cube_complete()); | 330 EXPECT_FALSE(info_->cube_complete()); |
330 EXPECT_FALSE(info_->CanGenerateMipmaps(&feature_info_)); | 331 EXPECT_FALSE(info_->CanGenerateMipmaps(&feature_info_)); |
331 EXPECT_FALSE(info_->npot()); | 332 EXPECT_FALSE(info_->npot()); |
332 EXPECT_FALSE(info_->CanRender(&feature_info_)); | 333 EXPECT_FALSE(info_->CanRender(&feature_info_)); |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 manager.SetInfoTarget(info, GL_TEXTURE_EXTERNAL_OES); | 695 manager.SetInfoTarget(info, GL_TEXTURE_EXTERNAL_OES); |
695 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), info->target()); | 696 EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), info->target()); |
696 EXPECT_FALSE(info->CanGenerateMipmaps(&feature_info)); | 697 EXPECT_FALSE(info->CanGenerateMipmaps(&feature_info)); |
697 manager.Destroy(false); | 698 manager.Destroy(false); |
698 } | 699 } |
699 | 700 |
700 } // namespace gles2 | 701 } // namespace gles2 |
701 } // namespace gpu | 702 } // namespace gpu |
702 | 703 |
703 | 704 |
OLD | NEW |