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/tree_synchronizer.h" | 5 #include "cc/trees/tree_synchronizer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/format_macros.h" | 13 #include "base/format_macros.h" |
14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
16 #include "cc/layers/layer.h" | 16 #include "cc/layers/layer.h" |
17 #include "cc/layers/layer_impl.h" | 17 #include "cc/layers/layer_impl.h" |
18 #include "cc/test/animation_test_common.h" | 18 #include "cc/test/animation_test_common.h" |
19 #include "cc/test/fake_impl_task_runner_provider.h" | 19 #include "cc/test/fake_impl_task_runner_provider.h" |
20 #include "cc/test/fake_layer_tree_host.h" | 20 #include "cc/test/fake_layer_tree_host.h" |
21 #include "cc/test/fake_rendering_stats_instrumentation.h" | 21 #include "cc/test/fake_rendering_stats_instrumentation.h" |
22 #include "cc/test/stub_layer_tree_host_single_thread_client.h" | 22 #include "cc/test/stub_layer_tree_host_single_thread_client.h" |
23 #include "cc/test/test_shared_bitmap_manager.h" | |
24 #include "cc/test/test_task_graph_runner.h" | 23 #include "cc/test/test_task_graph_runner.h" |
25 #include "cc/trees/effect_node.h" | 24 #include "cc/trees/effect_node.h" |
26 #include "cc/trees/layer_tree_host_common.h" | 25 #include "cc/trees/layer_tree_host_common.h" |
27 #include "cc/trees/single_thread_proxy.h" | 26 #include "cc/trees/single_thread_proxy.h" |
28 #include "cc/trees/task_runner_provider.h" | 27 #include "cc/trees/task_runner_provider.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
30 | 29 |
31 namespace cc { | 30 namespace cc { |
32 namespace { | 31 namespace { |
33 | 32 |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 host_->active_tree()); | 475 host_->active_tree()); |
477 | 476 |
478 host_->active_tree()->DetachLayers(); | 477 host_->active_tree()->DetachLayers(); |
479 } | 478 } |
480 | 479 |
481 TEST_F(TreeSynchronizerTest, SynchronizeCurrentlyScrollingNode) { | 480 TEST_F(TreeSynchronizerTest, SynchronizeCurrentlyScrollingNode) { |
482 LayerTreeSettings settings; | 481 LayerTreeSettings settings; |
483 FakeLayerTreeHostImplClient client; | 482 FakeLayerTreeHostImplClient client; |
484 FakeImplTaskRunnerProvider task_runner_provider; | 483 FakeImplTaskRunnerProvider task_runner_provider; |
485 FakeRenderingStatsInstrumentation stats_instrumentation; | 484 FakeRenderingStatsInstrumentation stats_instrumentation; |
486 TestSharedBitmapManager shared_bitmap_manager; | |
487 TestTaskGraphRunner task_graph_runner; | 485 TestTaskGraphRunner task_graph_runner; |
488 FakeLayerTreeHostImpl* host_impl = host_->host_impl(); | 486 FakeLayerTreeHostImpl* host_impl = host_->host_impl(); |
489 host_impl->CreatePendingTree(); | 487 host_impl->CreatePendingTree(); |
490 | 488 |
491 scoped_refptr<Layer> layer_tree_root = Layer::Create(); | 489 scoped_refptr<Layer> layer_tree_root = Layer::Create(); |
492 scoped_refptr<Layer> scroll_clip_layer = Layer::Create(); | 490 scoped_refptr<Layer> scroll_clip_layer = Layer::Create(); |
493 scoped_refptr<Layer> scroll_layer = Layer::Create(); | 491 scoped_refptr<Layer> scroll_layer = Layer::Create(); |
494 scoped_refptr<Layer> transient_scroll_clip_layer = Layer::Create(); | 492 scoped_refptr<Layer> transient_scroll_clip_layer = Layer::Create(); |
495 scoped_refptr<Layer> transient_scroll_layer = Layer::Create(); | 493 scoped_refptr<Layer> transient_scroll_layer = Layer::Create(); |
496 | 494 |
(...skipping 27 matching lines...) Expand all Loading... |
524 host_impl->active_tree()->CurrentlyScrollingLayer()->id()); | 522 host_impl->active_tree()->CurrentlyScrollingLayer()->id()); |
525 } | 523 } |
526 | 524 |
527 TEST_F(TreeSynchronizerTest, SynchronizeScrollTreeScrollOffsetMap) { | 525 TEST_F(TreeSynchronizerTest, SynchronizeScrollTreeScrollOffsetMap) { |
528 host_->InitializeSingleThreaded(&single_thread_client_, | 526 host_->InitializeSingleThreaded(&single_thread_client_, |
529 base::ThreadTaskRunnerHandle::Get()); | 527 base::ThreadTaskRunnerHandle::Get()); |
530 LayerTreeSettings settings; | 528 LayerTreeSettings settings; |
531 FakeLayerTreeHostImplClient client; | 529 FakeLayerTreeHostImplClient client; |
532 FakeImplTaskRunnerProvider task_runner_provider; | 530 FakeImplTaskRunnerProvider task_runner_provider; |
533 FakeRenderingStatsInstrumentation stats_instrumentation; | 531 FakeRenderingStatsInstrumentation stats_instrumentation; |
534 TestSharedBitmapManager shared_bitmap_manager; | |
535 TestTaskGraphRunner task_graph_runner; | 532 TestTaskGraphRunner task_graph_runner; |
536 FakeLayerTreeHostImpl* host_impl = host_->host_impl(); | 533 FakeLayerTreeHostImpl* host_impl = host_->host_impl(); |
537 host_impl->CreatePendingTree(); | 534 host_impl->CreatePendingTree(); |
538 | 535 |
539 scoped_refptr<Layer> layer_tree_root = Layer::Create(); | 536 scoped_refptr<Layer> layer_tree_root = Layer::Create(); |
540 scoped_refptr<Layer> scroll_clip_layer = Layer::Create(); | 537 scoped_refptr<Layer> scroll_clip_layer = Layer::Create(); |
541 scoped_refptr<Layer> scroll_layer = Layer::Create(); | 538 scoped_refptr<Layer> scroll_layer = Layer::Create(); |
542 scoped_refptr<Layer> transient_scroll_clip_layer = Layer::Create(); | 539 scoped_refptr<Layer> transient_scroll_clip_layer = Layer::Create(); |
543 scoped_refptr<Layer> transient_scroll_layer = Layer::Create(); | 540 scoped_refptr<Layer> transient_scroll_layer = Layer::Create(); |
544 | 541 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 EXPECT_TRUE(is_equal(scroll_offset_map, scroll_tree.scroll_offset_map())); | 617 EXPECT_TRUE(is_equal(scroll_offset_map, scroll_tree.scroll_offset_map())); |
621 } | 618 } |
622 | 619 |
623 TEST_F(TreeSynchronizerTest, RefreshPropertyTreesCachedData) { | 620 TEST_F(TreeSynchronizerTest, RefreshPropertyTreesCachedData) { |
624 host_->InitializeSingleThreaded(&single_thread_client_, | 621 host_->InitializeSingleThreaded(&single_thread_client_, |
625 base::ThreadTaskRunnerHandle::Get()); | 622 base::ThreadTaskRunnerHandle::Get()); |
626 LayerTreeSettings settings; | 623 LayerTreeSettings settings; |
627 FakeLayerTreeHostImplClient client; | 624 FakeLayerTreeHostImplClient client; |
628 FakeImplTaskRunnerProvider task_runner_provider; | 625 FakeImplTaskRunnerProvider task_runner_provider; |
629 FakeRenderingStatsInstrumentation stats_instrumentation; | 626 FakeRenderingStatsInstrumentation stats_instrumentation; |
630 TestSharedBitmapManager shared_bitmap_manager; | |
631 TestTaskGraphRunner task_graph_runner; | 627 TestTaskGraphRunner task_graph_runner; |
632 FakeLayerTreeHostImpl* host_impl = host_->host_impl(); | 628 FakeLayerTreeHostImpl* host_impl = host_->host_impl(); |
633 host_impl->CreatePendingTree(); | 629 host_impl->CreatePendingTree(); |
634 | 630 |
635 scoped_refptr<Layer> layer_tree_root = Layer::Create(); | 631 scoped_refptr<Layer> layer_tree_root = Layer::Create(); |
636 scoped_refptr<Layer> transform_layer = Layer::Create(); | 632 scoped_refptr<Layer> transform_layer = Layer::Create(); |
637 | 633 |
638 gfx::Transform scale_transform; | 634 gfx::Transform scale_transform; |
639 scale_transform.Scale3d(2.f, 2.f, 2.f); | 635 scale_transform.Scale3d(2.f, 2.f, 2.f); |
640 // Force adding a transform node for the layer. | 636 // Force adding a transform node for the layer. |
(...skipping 20 matching lines...) Expand all Loading... |
661 host_->CommitAndCreatePendingTree(); | 657 host_->CommitAndCreatePendingTree(); |
662 host_impl->ActivateSyncTree(); | 658 host_impl->ActivateSyncTree(); |
663 EXPECT_EQ( | 659 EXPECT_EQ( |
664 CombinedAnimationScale(0.f, 0.f), | 660 CombinedAnimationScale(0.f, 0.f), |
665 host_impl->active_tree()->property_trees()->GetAnimationScales( | 661 host_impl->active_tree()->property_trees()->GetAnimationScales( |
666 transform_layer->transform_tree_index(), host_impl->active_tree())); | 662 transform_layer->transform_tree_index(), host_impl->active_tree())); |
667 } | 663 } |
668 | 664 |
669 } // namespace | 665 } // namespace |
670 } // namespace cc | 666 } // namespace cc |
OLD | NEW |