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