Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Side by Side Diff: cc/trees/tree_synchronizer_unittest.cc

Issue 2105673003: cc: Compute animation scale on demand (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit changes Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/property_tree_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 scroll_offset_map.erase(transient_scroll_layer->id()); 650 scroll_offset_map.erase(transient_scroll_layer->id());
651 scroll_offset_map[scroll_layer->id()]->SetCurrent(gfx::ScrollOffset(20, 30)); 651 scroll_offset_map[scroll_layer->id()]->SetCurrent(gfx::ScrollOffset(20, 30));
652 scroll_offset_map[scroll_layer->id()]->PullDeltaForMainThread(); 652 scroll_offset_map[scroll_layer->id()]->PullDeltaForMainThread();
653 scroll_offset_map[scroll_layer->id()]->SetCurrent(gfx::ScrollOffset(40, 50)); 653 scroll_offset_map[scroll_layer->id()]->SetCurrent(gfx::ScrollOffset(40, 50));
654 scroll_offset_map[scroll_layer->id()]->PushFromMainThread( 654 scroll_offset_map[scroll_layer->id()]->PushFromMainThread(
655 gfx::ScrollOffset(100, 100)); 655 gfx::ScrollOffset(100, 100));
656 scroll_offset_map[scroll_layer->id()]->PushPendingToActive(); 656 scroll_offset_map[scroll_layer->id()]->PushPendingToActive();
657 EXPECT_TRUE(is_equal(scroll_offset_map, scroll_tree.scroll_offset_map())); 657 EXPECT_TRUE(is_equal(scroll_offset_map, scroll_tree.scroll_offset_map()));
658 } 658 }
659 659
660 TEST_F(TreeSynchronizerTest, RefreshPropertyTreesCachedData) {
661 host_->InitializeSingleThreaded(&client_, base::ThreadTaskRunnerHandle::Get(),
662 nullptr);
663 LayerTreeSettings settings;
664 FakeLayerTreeHostImplClient client;
665 FakeImplTaskRunnerProvider task_runner_provider;
666 FakeRenderingStatsInstrumentation stats_instrumentation;
667 TestSharedBitmapManager shared_bitmap_manager;
668 TestTaskGraphRunner task_graph_runner;
669 FakeLayerTreeHostImpl* host_impl = host_->host_impl();
670 host_impl->CreatePendingTree();
671
672 scoped_refptr<Layer> layer_tree_root = Layer::Create();
673 scoped_refptr<Layer> transform_layer = Layer::Create();
674
675 gfx::Transform scale_transform;
676 scale_transform.Scale3d(2.f, 2.f, 2.f);
677 // Force adding a transform node for the layer.
678 transform_layer->SetTransform(scale_transform);
679
680 layer_tree_root->AddChild(transform_layer);
681
682 host_->SetRootLayer(layer_tree_root);
683 host_->BuildPropertyTreesForTesting();
684 host_->CommitAndCreatePendingTree();
685 host_impl->ActivateSyncTree();
686
687 // This arbitrarily set the animation scale for transform_layer and see if it
688 // is
689 // refreshed when pushing layer trees.
690 host_impl->active_tree()->property_trees()->SetAnimationScalesForTesting(
691 transform_layer->transform_tree_index(), 10.f, 10.f);
692 EXPECT_EQ(
693 CombinedAnimationScale(10.f, 10.f),
694 host_impl->active_tree()->property_trees()->GetAnimationScales(
695 transform_layer->transform_tree_index(), host_impl->active_tree()));
696
697 host_impl->CreatePendingTree();
698 host_->CommitAndCreatePendingTree();
699 host_impl->ActivateSyncTree();
700 EXPECT_EQ(
701 CombinedAnimationScale(0.f, 0.f),
702 host_impl->active_tree()->property_trees()->GetAnimationScales(
703 transform_layer->transform_tree_index(), host_impl->active_tree()));
704 }
705
660 } // namespace 706 } // namespace
661 } // namespace cc 707 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/property_tree_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698