| 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.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 LayerTreeHostTestCommit() {} | 677 LayerTreeHostTestCommit() {} |
| 678 | 678 |
| 679 virtual void BeginTest() OVERRIDE { | 679 virtual void BeginTest() OVERRIDE { |
| 680 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); | 680 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); |
| 681 layer_tree_host()->set_background_color(SK_ColorGRAY); | 681 layer_tree_host()->set_background_color(SK_ColorGRAY); |
| 682 | 682 |
| 683 PostSetNeedsCommitToMainThread(); | 683 PostSetNeedsCommitToMainThread(); |
| 684 } | 684 } |
| 685 | 685 |
| 686 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 686 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 687 EXPECT_EQ(gfx::Size(20, 20), impl->device_viewport_size()); | 687 EXPECT_EQ(gfx::Size(20, 20), impl->DrawViewportSize()); |
| 688 EXPECT_EQ(SK_ColorGRAY, impl->active_tree()->background_color()); | 688 EXPECT_EQ(SK_ColorGRAY, impl->active_tree()->background_color()); |
| 689 | 689 |
| 690 EndTest(); | 690 EndTest(); |
| 691 } | 691 } |
| 692 | 692 |
| 693 virtual void AfterTest() OVERRIDE {} | 693 virtual void AfterTest() OVERRIDE {} |
| 694 }; | 694 }; |
| 695 | 695 |
| 696 MULTI_THREAD_TEST_F(LayerTreeHostTestCommit); | 696 MULTI_THREAD_TEST_F(LayerTreeHostTestCommit); |
| 697 | 697 |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 1029 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 1030 // Should only do one commit. | 1030 // Should only do one commit. |
| 1031 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); | 1031 EXPECT_EQ(0, impl->active_tree()->source_frame_number()); |
| 1032 // Device scale factor should come over to impl. | 1032 // Device scale factor should come over to impl. |
| 1033 EXPECT_NEAR(impl->device_scale_factor(), 1.5f, 0.00001f); | 1033 EXPECT_NEAR(impl->device_scale_factor(), 1.5f, 0.00001f); |
| 1034 | 1034 |
| 1035 // Both layers are on impl. | 1035 // Both layers are on impl. |
| 1036 ASSERT_EQ(1u, impl->active_tree()->root_layer()->children().size()); | 1036 ASSERT_EQ(1u, impl->active_tree()->root_layer()->children().size()); |
| 1037 | 1037 |
| 1038 // Device viewport is scaled. | 1038 // Device viewport is scaled. |
| 1039 EXPECT_EQ(gfx::Size(60, 60), impl->device_viewport_size()); | 1039 EXPECT_EQ(gfx::Size(60, 60), impl->DrawViewportSize()); |
| 1040 | 1040 |
| 1041 LayerImpl* root = impl->active_tree()->root_layer(); | 1041 LayerImpl* root = impl->active_tree()->root_layer(); |
| 1042 LayerImpl* child = impl->active_tree()->root_layer()->children()[0]; | 1042 LayerImpl* child = impl->active_tree()->root_layer()->children()[0]; |
| 1043 | 1043 |
| 1044 // Positions remain in layout pixels. | 1044 // Positions remain in layout pixels. |
| 1045 EXPECT_EQ(gfx::Point(0, 0), root->position()); | 1045 EXPECT_EQ(gfx::Point(0, 0), root->position()); |
| 1046 EXPECT_EQ(gfx::Point(2, 2), child->position()); | 1046 EXPECT_EQ(gfx::Point(2, 2), child->position()); |
| 1047 | 1047 |
| 1048 // Compute all the layer transforms for the frame. | 1048 // Compute all the layer transforms for the frame. |
| 1049 LayerTreeHostImpl::FrameData frame_data; | 1049 LayerTreeHostImpl::FrameData frame_data; |
| (...skipping 3410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4460 int num_will_begin_frames_; | 4460 int num_will_begin_frames_; |
| 4461 int num_impl_commits_; | 4461 int num_impl_commits_; |
| 4462 }; | 4462 }; |
| 4463 | 4463 |
| 4464 // Commits can only be aborted when using the thread proxy. | 4464 // Commits can only be aborted when using the thread proxy. |
| 4465 MULTI_THREAD_TEST_F(LayerTreeHostTestAbortEvictedTextures); | 4465 MULTI_THREAD_TEST_F(LayerTreeHostTestAbortEvictedTextures); |
| 4466 | 4466 |
| 4467 } // namespace | 4467 } // namespace |
| 4468 | 4468 |
| 4469 } // namespace cc | 4469 } // namespace cc |
| OLD | NEW |