| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 3606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3617 | 3617 |
| 3618 // Any un-sanctioned calls to disable() are OK | 3618 // Any un-sanctioned calls to disable() are OK |
| 3619 EXPECT_CALL(*context_, disable(_)) | 3619 EXPECT_CALL(*context_, disable(_)) |
| 3620 .WillRepeatedly(Return()); | 3620 .WillRepeatedly(Return()); |
| 3621 } | 3621 } |
| 3622 | 3622 |
| 3623 void MustDrawSolidQuad() { | 3623 void MustDrawSolidQuad() { |
| 3624 EXPECT_CALL(*context_, drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0)) | 3624 EXPECT_CALL(*context_, drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0)) |
| 3625 .WillOnce(Return()) | 3625 .WillOnce(Return()) |
| 3626 .RetiresOnSaturation(); | 3626 .RetiresOnSaturation(); |
| 3627 | |
| 3628 EXPECT_CALL(*context_, useProgram(_)) | |
| 3629 .WillOnce(Return()) | |
| 3630 .RetiresOnSaturation(); | |
| 3631 } | 3627 } |
| 3632 | 3628 |
| 3633 void MustSetScissor(int x, int y, int width, int height) { | 3629 void MustSetScissor(int x, int y, int width, int height) { |
| 3634 EXPECT_CALL(*context_, enable(GL_SCISSOR_TEST)) | 3630 EXPECT_CALL(*context_, enable(GL_SCISSOR_TEST)) |
| 3635 .WillRepeatedly(Return()); | 3631 .WillRepeatedly(Return()); |
| 3636 | 3632 |
| 3637 EXPECT_CALL(*context_, scissor(x, y, width, height)) | 3633 EXPECT_CALL(*context_, scissor(x, y, width, height)) |
| 3638 .Times(AtLeast(1)) | 3634 .Times(AtLeast(1)) |
| 3639 .WillRepeatedly(Return()); | 3635 .WillRepeatedly(Return()); |
| 3640 } | 3636 } |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3917 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 3913 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
| 3918 mock_context_owned.PassAs<TestWebGraphicsContext3D>())); | 3914 mock_context_owned.PassAs<TestWebGraphicsContext3D>())); |
| 3919 | 3915 |
| 3920 // Run test case | 3916 // Run test case |
| 3921 CreateLayerTreeHost(false, output_surface.Pass()); | 3917 CreateLayerTreeHost(false, output_surface.Pass()); |
| 3922 SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1)); | 3918 SetupRootLayerImpl(LayerImpl::Create(host_impl_->active_tree(), 1)); |
| 3923 host_impl_->active_tree()->set_background_color(SK_ColorWHITE); | 3919 host_impl_->active_tree()->set_background_color(SK_ColorWHITE); |
| 3924 | 3920 |
| 3925 // Verify one quad is drawn when transparent background set is not set. | 3921 // Verify one quad is drawn when transparent background set is not set. |
| 3926 host_impl_->active_tree()->set_has_transparent_background(false); | 3922 host_impl_->active_tree()->set_has_transparent_background(false); |
| 3927 EXPECT_CALL(*mock_context, useProgram(_)) | |
| 3928 .Times(1); | |
| 3929 EXPECT_CALL(*mock_context, drawElements(_, _, _, _)) | 3923 EXPECT_CALL(*mock_context, drawElements(_, _, _, _)) |
| 3930 .Times(1); | 3924 .Times(1); |
| 3931 LayerTreeHostImpl::FrameData frame; | 3925 LayerTreeHostImpl::FrameData frame; |
| 3932 EXPECT_TRUE(host_impl_->PrepareToDraw(&frame, gfx::Rect())); | 3926 EXPECT_TRUE(host_impl_->PrepareToDraw(&frame, gfx::Rect())); |
| 3933 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); | 3927 host_impl_->DrawLayers(&frame, gfx::FrameTime::Now()); |
| 3934 host_impl_->DidDrawAllLayers(frame); | 3928 host_impl_->DidDrawAllLayers(frame); |
| 3935 Mock::VerifyAndClearExpectations(&mock_context); | 3929 Mock::VerifyAndClearExpectations(&mock_context); |
| 3936 | 3930 |
| 3937 // Verify no quads are drawn when transparent background is set. | 3931 // Verify no quads are drawn when transparent background is set. |
| 3938 host_impl_->active_tree()->set_has_transparent_background(true); | 3932 host_impl_->active_tree()->set_has_transparent_background(true); |
| (...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5353 // The root should have scrolled. | 5347 // The root should have scrolled. |
| 5354 ASSERT_EQ(2u, scroll_info->scrolls.size()); | 5348 ASSERT_EQ(2u, scroll_info->scrolls.size()); |
| 5355 ExpectContains(*scroll_info.get(), | 5349 ExpectContains(*scroll_info.get(), |
| 5356 host_impl_->active_tree()->root_layer()->id(), | 5350 host_impl_->active_tree()->root_layer()->id(), |
| 5357 gfx::Vector2d(0, 10)); | 5351 gfx::Vector2d(0, 10)); |
| 5358 } | 5352 } |
| 5359 } | 5353 } |
| 5360 | 5354 |
| 5361 } // namespace | 5355 } // namespace |
| 5362 } // namespace cc | 5356 } // namespace cc |
| OLD | NEW |