| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/layers/layer_utils.h" | 5 #include "cc/layers/layer_utils.h" |
| 6 | 6 |
| 7 #include "cc/animation/transform_operations.h" | 7 #include "cc/animation/transform_operations.h" |
| 8 #include "cc/layers/layer_impl.h" | 8 #include "cc/layers/layer_impl.h" |
| 9 #include "cc/test/animation_test_common.h" | 9 #include "cc/test/animation_test_common.h" |
| 10 #include "cc/test/fake_impl_task_runner_provider.h" | 10 #include "cc/test/fake_impl_task_runner_provider.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 return std::sqrt(width * width + height * height); | 22 return std::sqrt(width * width + height * height); |
| 23 } | 23 } |
| 24 | 24 |
| 25 class LayerUtilsGetAnimationBoundsTest : public testing::Test { | 25 class LayerUtilsGetAnimationBoundsTest : public testing::Test { |
| 26 public: | 26 public: |
| 27 LayerUtilsGetAnimationBoundsTest() | 27 LayerUtilsGetAnimationBoundsTest() |
| 28 : host_impl_(&task_runner_provider_, | 28 : host_impl_(&task_runner_provider_, |
| 29 &shared_bitmap_manager_, | 29 &shared_bitmap_manager_, |
| 30 &task_graph_runner_), | 30 &task_graph_runner_), |
| 31 root_(CreateThreeNodeTree(&host_impl_)), | 31 root_(CreateThreeNodeTree(&host_impl_)), |
| 32 parent_(root_->children()[0]), | 32 parent_(root_->children()[0].get()), |
| 33 child_(parent_->children()[0]) {} | 33 child_(parent_->children()[0].get()) {} |
| 34 | 34 |
| 35 LayerImpl* root() { return root_.get(); } | 35 LayerImpl* root() { return root_.get(); } |
| 36 LayerImpl* parent() { return parent_; } | 36 LayerImpl* parent() { return parent_; } |
| 37 LayerImpl* child() { return child_; } | 37 LayerImpl* child() { return child_; } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 static scoped_ptr<LayerImpl> CreateThreeNodeTree( | 40 static scoped_ptr<LayerImpl> CreateThreeNodeTree( |
| 41 LayerTreeHostImpl* host_impl) { | 41 LayerTreeHostImpl* host_impl) { |
| 42 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl->active_tree(), 1); | 42 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl->active_tree(), 1); |
| 43 root->AddChild(LayerImpl::Create(host_impl->active_tree(), 2)); | 43 root->AddChild(LayerImpl::Create(host_impl->active_tree(), 2)); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 child()->SetPosition(gfx::PointF(150.f, 50.f)); | 262 child()->SetPosition(gfx::PointF(150.f, 50.f)); |
| 263 child()->SetBounds(bounds); | 263 child()->SetBounds(bounds); |
| 264 | 264 |
| 265 gfx::BoxF box; | 265 gfx::BoxF box; |
| 266 bool success = LayerUtils::GetAnimationBounds(*child(), &box); | 266 bool success = LayerUtils::GetAnimationBounds(*child(), &box); |
| 267 EXPECT_FALSE(success); | 267 EXPECT_FALSE(success); |
| 268 } | 268 } |
| 269 | 269 |
| 270 } // namespace | 270 } // namespace |
| 271 } // namespace cc | 271 } // namespace cc |
| OLD | NEW |