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 7777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7788 host_impl_->UpdateAnimationState(true); | 7788 host_impl_->UpdateAnimationState(true); |
7789 | 7789 |
7790 EXPECT_VECTOR_EQ(gfx::ScrollOffset(0, 100), | 7790 EXPECT_VECTOR_EQ(gfx::ScrollOffset(0, 100), |
7791 scrolling_layer->TotalScrollOffset()); | 7791 scrolling_layer->TotalScrollOffset()); |
7792 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); | 7792 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); |
7793 } | 7793 } |
7794 | 7794 |
7795 TEST_F(LayerTreeHostImplTest, GetPictureLayerImplPairs) { | 7795 TEST_F(LayerTreeHostImplTest, GetPictureLayerImplPairs) { |
7796 host_impl_->CreatePendingTree(); | 7796 host_impl_->CreatePendingTree(); |
7797 host_impl_->pending_tree()->SetRootLayer( | 7797 host_impl_->pending_tree()->SetRootLayer( |
7798 PictureLayerImpl::Create(host_impl_->pending_tree(), 10)); | 7798 PictureLayerImpl::Create(host_impl_->pending_tree(), 10, false)); |
7799 | 7799 |
7800 LayerTreeImpl* pending_tree = host_impl_->pending_tree(); | 7800 LayerTreeImpl* pending_tree = host_impl_->pending_tree(); |
7801 LayerImpl* pending_layer = pending_tree->root_layer(); | 7801 LayerImpl* pending_layer = pending_tree->root_layer(); |
7802 | 7802 |
7803 std::vector<PictureLayerImpl::Pair> layer_pairs; | 7803 std::vector<PictureLayerImpl::Pair> layer_pairs; |
7804 host_impl_->GetPictureLayerImplPairs(&layer_pairs, true); | 7804 host_impl_->GetPictureLayerImplPairs(&layer_pairs, true); |
7805 EXPECT_EQ(1u, layer_pairs.size()); | 7805 EXPECT_EQ(1u, layer_pairs.size()); |
7806 EXPECT_EQ(pending_layer, layer_pairs[0].pending); | 7806 EXPECT_EQ(pending_layer, layer_pairs[0].pending); |
7807 EXPECT_EQ(nullptr, layer_pairs[0].active); | 7807 EXPECT_EQ(nullptr, layer_pairs[0].active); |
7808 | 7808 |
(...skipping 20 matching lines...) Expand all Loading... |
7829 layer_pairs.clear(); | 7829 layer_pairs.clear(); |
7830 host_impl_->GetPictureLayerImplPairs(&layer_pairs, true); | 7830 host_impl_->GetPictureLayerImplPairs(&layer_pairs, true); |
7831 EXPECT_EQ(1u, layer_pairs.size()); | 7831 EXPECT_EQ(1u, layer_pairs.size()); |
7832 EXPECT_EQ(active_layer, layer_pairs[0].active); | 7832 EXPECT_EQ(active_layer, layer_pairs[0].active); |
7833 EXPECT_EQ(nullptr, layer_pairs[0].pending); | 7833 EXPECT_EQ(nullptr, layer_pairs[0].pending); |
7834 | 7834 |
7835 // Create another layer in the pending tree that's not in the active tree. We | 7835 // Create another layer in the pending tree that's not in the active tree. We |
7836 // should get two pairs. | 7836 // should get two pairs. |
7837 host_impl_->CreatePendingTree(); | 7837 host_impl_->CreatePendingTree(); |
7838 host_impl_->pending_tree()->root_layer()->AddChild( | 7838 host_impl_->pending_tree()->root_layer()->AddChild( |
7839 PictureLayerImpl::Create(host_impl_->pending_tree(), 11)); | 7839 PictureLayerImpl::Create(host_impl_->pending_tree(), 11, false)); |
7840 | 7840 |
7841 LayerImpl* new_pending_layer = pending_tree->root_layer()->children()[0]; | 7841 LayerImpl* new_pending_layer = pending_tree->root_layer()->children()[0]; |
7842 | 7842 |
7843 layer_pairs.clear(); | 7843 layer_pairs.clear(); |
7844 host_impl_->GetPictureLayerImplPairs(&layer_pairs, true); | 7844 host_impl_->GetPictureLayerImplPairs(&layer_pairs, true); |
7845 EXPECT_EQ(2u, layer_pairs.size()); | 7845 EXPECT_EQ(2u, layer_pairs.size()); |
7846 | 7846 |
7847 // The pair ordering is flaky, so make it consistent. | 7847 // The pair ordering is flaky, so make it consistent. |
7848 if (layer_pairs[0].active != active_layer) | 7848 if (layer_pairs[0].active != active_layer) |
7849 std::swap(layer_pairs[0], layer_pairs[1]); | 7849 std::swap(layer_pairs[0], layer_pairs[1]); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7955 // surface. | 7955 // surface. |
7956 EXPECT_EQ(0, num_lost_surfaces_); | 7956 EXPECT_EQ(0, num_lost_surfaces_); |
7957 host_impl_->DidLoseOutputSurface(); | 7957 host_impl_->DidLoseOutputSurface(); |
7958 EXPECT_EQ(1, num_lost_surfaces_); | 7958 EXPECT_EQ(1, num_lost_surfaces_); |
7959 host_impl_->DidLoseOutputSurface(); | 7959 host_impl_->DidLoseOutputSurface(); |
7960 EXPECT_LE(1, num_lost_surfaces_); | 7960 EXPECT_LE(1, num_lost_surfaces_); |
7961 } | 7961 } |
7962 | 7962 |
7963 } // namespace | 7963 } // namespace |
7964 } // namespace cc | 7964 } // namespace cc |
OLD | NEW |