| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 2281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2292 static_cast<DidDrawCheckLayer*>(root->children()[0]); | 2292 static_cast<DidDrawCheckLayer*>(root->children()[0]); |
| 2293 // Ensure visible_layer_rect for layer is empty. | 2293 // Ensure visible_layer_rect for layer is empty. |
| 2294 layer->SetPosition(gfx::PointF(100.f, 100.f)); | 2294 layer->SetPosition(gfx::PointF(100.f, 100.f)); |
| 2295 layer->SetBounds(gfx::Size(10, 10)); | 2295 layer->SetBounds(gfx::Size(10, 10)); |
| 2296 | 2296 |
| 2297 LayerTreeHostImpl::FrameData frame; | 2297 LayerTreeHostImpl::FrameData frame; |
| 2298 | 2298 |
| 2299 EXPECT_FALSE(layer->will_draw_called()); | 2299 EXPECT_FALSE(layer->will_draw_called()); |
| 2300 EXPECT_FALSE(layer->did_draw_called()); | 2300 EXPECT_FALSE(layer->did_draw_called()); |
| 2301 | 2301 |
| 2302 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | |
| 2303 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 2302 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 2304 host_impl_->DrawLayers(&frame); | 2303 host_impl_->DrawLayers(&frame); |
| 2305 host_impl_->DidDrawAllLayers(frame); | 2304 host_impl_->DidDrawAllLayers(frame); |
| 2306 | 2305 |
| 2307 EXPECT_FALSE(layer->will_draw_called()); | 2306 EXPECT_FALSE(layer->will_draw_called()); |
| 2308 EXPECT_FALSE(layer->did_draw_called()); | 2307 EXPECT_FALSE(layer->did_draw_called()); |
| 2309 | 2308 |
| 2310 EXPECT_TRUE(layer->visible_layer_rect().IsEmpty()); | 2309 EXPECT_TRUE(layer->visible_layer_rect().IsEmpty()); |
| 2311 | 2310 |
| 2312 // Ensure visible_layer_rect for layer is not empty | 2311 // Ensure visible_layer_rect for layer is not empty |
| (...skipping 3268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5581 } | 5580 } |
| 5582 Mock::VerifyAndClearExpectations(&mock_context); | 5581 Mock::VerifyAndClearExpectations(&mock_context); |
| 5583 | 5582 |
| 5584 // Without partial swap, but a layer does clip its subtree, one scissor is | 5583 // Without partial swap, but a layer does clip its subtree, one scissor is |
| 5585 // set. | 5584 // set. |
| 5586 host_impl_->active_tree()->root_layer()->SetMasksToBounds(true); | 5585 host_impl_->active_tree()->root_layer()->SetMasksToBounds(true); |
| 5587 harness.MustDrawSolidQuad(); | 5586 harness.MustDrawSolidQuad(); |
| 5588 harness.MustSetScissor(0, 0, 10, 10); | 5587 harness.MustSetScissor(0, 0, 10, 10); |
| 5589 { | 5588 { |
| 5590 LayerTreeHostImpl::FrameData frame; | 5589 LayerTreeHostImpl::FrameData frame; |
| 5591 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | |
| 5592 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 5590 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
| 5593 host_impl_->DrawLayers(&frame); | 5591 host_impl_->DrawLayers(&frame); |
| 5594 host_impl_->DidDrawAllLayers(frame); | 5592 host_impl_->DidDrawAllLayers(frame); |
| 5595 } | 5593 } |
| 5596 Mock::VerifyAndClearExpectations(&mock_context); | 5594 Mock::VerifyAndClearExpectations(&mock_context); |
| 5597 } | 5595 } |
| 5598 | 5596 |
| 5599 TEST_F(LayerTreeHostImplTest, PartialSwap) { | 5597 TEST_F(LayerTreeHostImplTest, PartialSwap) { |
| 5600 scoped_ptr<MockContext> context_owned(new MockContext); | 5598 scoped_ptr<MockContext> context_owned(new MockContext); |
| 5601 MockContext* mock_context = context_owned.get(); | 5599 MockContext* mock_context = context_owned.get(); |
| (...skipping 2478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8080 // Hold an unowned pointer to the output surface to use for mock expectations. | 8078 // Hold an unowned pointer to the output surface to use for mock expectations. |
| 8081 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); | 8079 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); |
| 8082 | 8080 |
| 8083 CreateHostImpl(DefaultSettings(), output_surface.Pass()); | 8081 CreateHostImpl(DefaultSettings(), output_surface.Pass()); |
| 8084 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); | 8082 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); |
| 8085 host_impl_->BeginCommit(); | 8083 host_impl_->BeginCommit(); |
| 8086 } | 8084 } |
| 8087 | 8085 |
| 8088 } // namespace | 8086 } // namespace |
| 8089 } // namespace cc | 8087 } // namespace cc |
| OLD | NEW |