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

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

Issue 14308014: Clean up of GLES2 Command Decoder by moving some of the error state into a separate class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix merge error. Created 7 years, 8 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
OLDNEW
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/error_state_mock.h"
5 #include "gpu/command_buffer/service/framebuffer_manager.h" 6 #include "gpu/command_buffer/service/framebuffer_manager.h"
6 #include "gpu/command_buffer/service/feature_info.h" 7 #include "gpu/command_buffer/service/feature_info.h"
7 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h"
8 #include "gpu/command_buffer/service/renderbuffer_manager.h" 8 #include "gpu/command_buffer/service/renderbuffer_manager.h"
9 #include "gpu/command_buffer/service/test_helper.h" 9 #include "gpu/command_buffer/service/test_helper.h"
10 #include "gpu/command_buffer/service/texture_manager.h" 10 #include "gpu/command_buffer/service/texture_manager.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/gl/gl_mock.h" 12 #include "ui/gl/gl_mock.h"
13 13
14 using ::testing::Return; 14 using ::testing::Return;
15 15
16 namespace gpu { 16 namespace gpu {
17 namespace gles2 { 17 namespace gles2 {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 manager_.Destroy(false); 125 manager_.Destroy(false);
126 texture_manager_.Destroy(false); 126 texture_manager_.Destroy(false);
127 renderbuffer_manager_.Destroy(false); 127 renderbuffer_manager_.Destroy(false);
128 } 128 }
129 129
130 protected: 130 protected:
131 virtual void SetUp() { 131 virtual void SetUp() {
132 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); 132 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>());
133 ::gfx::GLInterface::SetGLInterface(gl_.get()); 133 ::gfx::GLInterface::SetGLInterface(gl_.get());
134 manager_.CreateFramebuffer(kClient1Id, kService1Id); 134 manager_.CreateFramebuffer(kClient1Id, kService1Id);
135 decoder_.reset(new ::testing::StrictMock<gles2::MockGLES2Decoder>()); 135 error_state_.reset(new ::testing::StrictMock<gles2::MockErrorState>());
136 framebuffer_ = manager_.GetFramebuffer(kClient1Id); 136 framebuffer_ = manager_.GetFramebuffer(kClient1Id);
137 ASSERT_TRUE(framebuffer_ != NULL); 137 ASSERT_TRUE(framebuffer_ != NULL);
138 } 138 }
139 139
140 virtual void TearDown() { 140 virtual void TearDown() {
141 ::gfx::GLInterface::SetGLInterface(NULL); 141 ::gfx::GLInterface::SetGLInterface(NULL);
142 gl_.reset(); 142 gl_.reset();
143 } 143 }
144 144
145 // Use StrictMock to make 100% sure we know how GL will be called. 145 // Use StrictMock to make 100% sure we know how GL will be called.
146 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; 146 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_;
147 FramebufferManager manager_; 147 FramebufferManager manager_;
148 Framebuffer* framebuffer_; 148 Framebuffer* framebuffer_;
149 TextureManager texture_manager_; 149 TextureManager texture_manager_;
150 RenderbufferManager renderbuffer_manager_; 150 RenderbufferManager renderbuffer_manager_;
151 scoped_ptr<MockGLES2Decoder> decoder_; 151 scoped_ptr<MockErrorState> error_state_;
152 }; 152 };
153 153
154 // GCC requires these declarations, but MSVC requires they not be present 154 // GCC requires these declarations, but MSVC requires they not be present
155 #ifndef COMPILER_MSVC 155 #ifndef COMPILER_MSVC
156 const GLuint FramebufferInfoTest::kClient1Id; 156 const GLuint FramebufferInfoTest::kClient1Id;
157 const GLuint FramebufferInfoTest::kService1Id; 157 const GLuint FramebufferInfoTest::kService1Id;
158 const GLint FramebufferInfoTest::kMaxTextureSize; 158 const GLint FramebufferInfoTest::kMaxTextureSize;
159 const GLint FramebufferInfoTest::kMaxCubemapSize; 159 const GLint FramebufferInfoTest::kMaxCubemapSize;
160 const GLint FramebufferInfoTest::kMaxRenderbufferSize; 160 const GLint FramebufferInfoTest::kMaxRenderbufferSize;
161 #endif 161 #endif
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 // Check a second call for the same type does not call anything. 725 // Check a second call for the same type does not call anything.
726 if (!framebuffer_->AllowFramebufferComboCompleteMapForTesting()) { 726 if (!framebuffer_->AllowFramebufferComboCompleteMapForTesting()) {
727 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) 727 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER))
728 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) 728 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
729 .RetiresOnSaturation(); 729 .RetiresOnSaturation();
730 } 730 }
731 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER); 731 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER);
732 732
733 // Check changing the format calls CheckFramebuffferStatus. 733 // Check changing the format calls CheckFramebuffferStatus.
734 TestHelper::SetTexParameterWithExpectations( 734 TestHelper::SetTexParameterWithExpectations(
735 gl_.get(), decoder_.get(), &texture_manager_, 735 gl_.get(), error_state_.get(), &texture_manager_,
736 texture2, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE, GL_NO_ERROR); 736 texture2, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE, GL_NO_ERROR);
737 737
738 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) 738 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER))
739 .WillOnce(Return(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT)) 739 .WillOnce(Return(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT))
740 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) 740 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
741 .RetiresOnSaturation(); 741 .RetiresOnSaturation();
742 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER); 742 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER);
743 743
744 // Check since it did not return FRAMEBUFFER_COMPLETE that it calls 744 // Check since it did not return FRAMEBUFFER_COMPLETE that it calls
745 // CheckFramebufferStatus 745 // CheckFramebufferStatus
746 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER); 746 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER);
747 747
748 // Check putting it back does not call CheckFramebufferStatus. 748 // Check putting it back does not call CheckFramebufferStatus.
749 if (!framebuffer_->AllowFramebufferComboCompleteMapForTesting()) { 749 if (!framebuffer_->AllowFramebufferComboCompleteMapForTesting()) {
750 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) 750 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER))
751 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) 751 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
752 .RetiresOnSaturation(); 752 .RetiresOnSaturation();
753 } 753 }
754 TestHelper::SetTexParameterWithExpectations( 754 TestHelper::SetTexParameterWithExpectations(
755 gl_.get(), decoder_.get(), &texture_manager_, 755 gl_.get(), error_state_.get(), &texture_manager_,
756 texture2, GL_TEXTURE_WRAP_S, GL_REPEAT, GL_NO_ERROR); 756 texture2, GL_TEXTURE_WRAP_S, GL_REPEAT, GL_NO_ERROR);
757 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER); 757 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER);
758 758
759 // Check Unbinding does not call CheckFramebufferStatus 759 // Check Unbinding does not call CheckFramebufferStatus
760 framebuffer_->UnbindRenderbuffer(GL_RENDERBUFFER, renderbuffer1); 760 framebuffer_->UnbindRenderbuffer(GL_RENDERBUFFER, renderbuffer1);
761 if (!framebuffer_->AllowFramebufferComboCompleteMapForTesting()) { 761 if (!framebuffer_->AllowFramebufferComboCompleteMapForTesting()) {
762 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) 762 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER))
763 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) 763 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
764 .RetiresOnSaturation(); 764 .RetiresOnSaturation();
765 } 765 }
766 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER); 766 framebuffer_->GetStatus(&texture_manager_, GL_READ_FRAMEBUFFER);
767 } 767 }
768 768
769 } // namespace gles2 769 } // namespace gles2
770 } // namespace gpu 770 } // namespace gpu
771 771
772 772
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/error_state_mock.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698