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 6682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6693 float y = scrolling_layer->TotalScrollOffset().y(); | 6693 float y = scrolling_layer->TotalScrollOffset().y(); |
6694 EXPECT_TRUE(y > 1 && y < 49); | 6694 EXPECT_TRUE(y > 1 && y < 49); |
6695 | 6695 |
6696 host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(200)); | 6696 host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(200)); |
6697 host_impl_->UpdateAnimationState(true); | 6697 host_impl_->UpdateAnimationState(true); |
6698 | 6698 |
6699 EXPECT_EQ(gfx::Vector2dF(0, 50), scrolling_layer->TotalScrollOffset()); | 6699 EXPECT_EQ(gfx::Vector2dF(0, 50), scrolling_layer->TotalScrollOffset()); |
6700 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); | 6700 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); |
6701 } | 6701 } |
6702 | 6702 |
| 6703 TEST_F(LayerTreeHostImplTest, GetPictureLayerImplPairs) { |
| 6704 host_impl_->CreatePendingTree(); |
| 6705 host_impl_->ActivateSyncTree(); |
| 6706 host_impl_->CreatePendingTree(); |
| 6707 |
| 6708 LayerTreeImpl* active_tree = host_impl_->active_tree(); |
| 6709 LayerTreeImpl* pending_tree = host_impl_->pending_tree(); |
| 6710 EXPECT_NE(active_tree, pending_tree); |
| 6711 |
| 6712 scoped_ptr<FakePictureLayerImpl> active_layer = |
| 6713 FakePictureLayerImpl::Create(active_tree, 10); |
| 6714 scoped_ptr<FakePictureLayerImpl> pending_layer = |
| 6715 FakePictureLayerImpl::Create(pending_tree, 10); |
| 6716 |
| 6717 std::vector<PictureLayerImpl::Pair> layer_pairs; |
| 6718 host_impl_->GetPictureLayerImplPairs(&layer_pairs); |
| 6719 |
| 6720 EXPECT_EQ(2u, layer_pairs.size()); |
| 6721 if (layer_pairs[0].active) { |
| 6722 EXPECT_EQ(active_layer.get(), layer_pairs[0].active); |
| 6723 EXPECT_EQ(NULL, layer_pairs[0].pending); |
| 6724 } else { |
| 6725 EXPECT_EQ(pending_layer.get(), layer_pairs[0].pending); |
| 6726 EXPECT_EQ(NULL, layer_pairs[0].active); |
| 6727 } |
| 6728 |
| 6729 if (layer_pairs[1].active) { |
| 6730 EXPECT_EQ(active_layer.get(), layer_pairs[1].active); |
| 6731 EXPECT_EQ(NULL, layer_pairs[1].pending); |
| 6732 } else { |
| 6733 EXPECT_EQ(pending_layer.get(), layer_pairs[1].pending); |
| 6734 EXPECT_EQ(NULL, layer_pairs[1].active); |
| 6735 } |
| 6736 |
| 6737 active_layer->set_twin_layer(pending_layer.get()); |
| 6738 pending_layer->set_twin_layer(active_layer.get()); |
| 6739 |
| 6740 layer_pairs.clear(); |
| 6741 host_impl_->GetPictureLayerImplPairs(&layer_pairs); |
| 6742 EXPECT_EQ(1u, layer_pairs.size()); |
| 6743 |
| 6744 EXPECT_EQ(active_layer.get(), layer_pairs[0].active); |
| 6745 EXPECT_EQ(pending_layer.get(), layer_pairs[0].pending); |
| 6746 } |
| 6747 |
6703 } // namespace | 6748 } // namespace |
6704 } // namespace cc | 6749 } // namespace cc |
OLD | NEW |