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 7727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7738 host_impl_->UpdateAnimationState(true); | 7738 host_impl_->UpdateAnimationState(true); |
7739 | 7739 |
7740 EXPECT_VECTOR_EQ(gfx::ScrollOffset(0, 100), | 7740 EXPECT_VECTOR_EQ(gfx::ScrollOffset(0, 100), |
7741 scrolling_layer->TotalScrollOffset()); | 7741 scrolling_layer->TotalScrollOffset()); |
7742 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); | 7742 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); |
7743 } | 7743 } |
7744 | 7744 |
7745 TEST_F(LayerTreeHostImplTest, GetPictureLayerImplPairs) { | 7745 TEST_F(LayerTreeHostImplTest, GetPictureLayerImplPairs) { |
7746 host_impl_->CreatePendingTree(); | 7746 host_impl_->CreatePendingTree(); |
7747 host_impl_->pending_tree()->SetRootLayer( | 7747 host_impl_->pending_tree()->SetRootLayer( |
7748 PictureLayerImpl::Create(host_impl_->pending_tree(), 10)); | 7748 PictureLayerImpl::Create(host_impl_->pending_tree(), 10, false)); |
7749 | 7749 |
7750 LayerTreeImpl* pending_tree = host_impl_->pending_tree(); | 7750 LayerTreeImpl* pending_tree = host_impl_->pending_tree(); |
7751 LayerImpl* pending_layer = pending_tree->root_layer(); | 7751 LayerImpl* pending_layer = pending_tree->root_layer(); |
7752 | 7752 |
7753 std::vector<PictureLayerImpl::Pair> layer_pairs; | 7753 std::vector<PictureLayerImpl::Pair> layer_pairs; |
7754 host_impl_->GetPictureLayerImplPairs(&layer_pairs, true); | 7754 host_impl_->GetPictureLayerImplPairs(&layer_pairs, true); |
7755 EXPECT_EQ(1u, layer_pairs.size()); | 7755 EXPECT_EQ(1u, layer_pairs.size()); |
7756 EXPECT_EQ(pending_layer, layer_pairs[0].pending); | 7756 EXPECT_EQ(pending_layer, layer_pairs[0].pending); |
7757 EXPECT_EQ(nullptr, layer_pairs[0].active); | 7757 EXPECT_EQ(nullptr, layer_pairs[0].active); |
7758 | 7758 |
(...skipping 20 matching lines...) Expand all Loading... |
7779 layer_pairs.clear(); | 7779 layer_pairs.clear(); |
7780 host_impl_->GetPictureLayerImplPairs(&layer_pairs, true); | 7780 host_impl_->GetPictureLayerImplPairs(&layer_pairs, true); |
7781 EXPECT_EQ(1u, layer_pairs.size()); | 7781 EXPECT_EQ(1u, layer_pairs.size()); |
7782 EXPECT_EQ(active_layer, layer_pairs[0].active); | 7782 EXPECT_EQ(active_layer, layer_pairs[0].active); |
7783 EXPECT_EQ(nullptr, layer_pairs[0].pending); | 7783 EXPECT_EQ(nullptr, layer_pairs[0].pending); |
7784 | 7784 |
7785 // Create another layer in the pending tree that's not in the active tree. We | 7785 // Create another layer in the pending tree that's not in the active tree. We |
7786 // should get two pairs. | 7786 // should get two pairs. |
7787 host_impl_->CreatePendingTree(); | 7787 host_impl_->CreatePendingTree(); |
7788 host_impl_->pending_tree()->root_layer()->AddChild( | 7788 host_impl_->pending_tree()->root_layer()->AddChild( |
7789 PictureLayerImpl::Create(host_impl_->pending_tree(), 11)); | 7789 PictureLayerImpl::Create(host_impl_->pending_tree(), 11, false)); |
7790 | 7790 |
7791 LayerImpl* new_pending_layer = pending_tree->root_layer()->children()[0]; | 7791 LayerImpl* new_pending_layer = pending_tree->root_layer()->children()[0]; |
7792 | 7792 |
7793 layer_pairs.clear(); | 7793 layer_pairs.clear(); |
7794 host_impl_->GetPictureLayerImplPairs(&layer_pairs, true); | 7794 host_impl_->GetPictureLayerImplPairs(&layer_pairs, true); |
7795 EXPECT_EQ(2u, layer_pairs.size()); | 7795 EXPECT_EQ(2u, layer_pairs.size()); |
7796 | 7796 |
7797 // The pair ordering is flaky, so make it consistent. | 7797 // The pair ordering is flaky, so make it consistent. |
7798 if (layer_pairs[0].active != active_layer) | 7798 if (layer_pairs[0].active != active_layer) |
7799 std::swap(layer_pairs[0], layer_pairs[1]); | 7799 std::swap(layer_pairs[0], layer_pairs[1]); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7905 // surface. | 7905 // surface. |
7906 EXPECT_EQ(0, num_lost_surfaces_); | 7906 EXPECT_EQ(0, num_lost_surfaces_); |
7907 host_impl_->DidLoseOutputSurface(); | 7907 host_impl_->DidLoseOutputSurface(); |
7908 EXPECT_EQ(1, num_lost_surfaces_); | 7908 EXPECT_EQ(1, num_lost_surfaces_); |
7909 host_impl_->DidLoseOutputSurface(); | 7909 host_impl_->DidLoseOutputSurface(); |
7910 EXPECT_LE(1, num_lost_surfaces_); | 7910 EXPECT_LE(1, num_lost_surfaces_); |
7911 } | 7911 } |
7912 | 7912 |
7913 } // namespace | 7913 } // namespace |
7914 } // namespace cc | 7914 } // namespace cc |
OLD | NEW |