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

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: Rebase and resolve comments 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
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 // arbitrarily set the animation scale for transform_layer and see if it is
688 // refreshed when pushing layer trees
ajuma 2016/06/30 21:57:37 Style nit: Please write comments as sentences (cap
689 host_impl->active_tree()->property_trees()->SetAnimationScalesForTesting(
690 transform_layer->transform_tree_index(), 10.f, 10.f);
691 EXPECT_EQ(
692 CombinedAnimationScale(10.f, 10.f),
693 host_impl->active_tree()->property_trees()->GetAnimationScales(
694 transform_layer->transform_tree_index(), host_impl->active_tree()));
695
696 host_impl->CreatePendingTree();
697 host_->CommitAndCreatePendingTree();
698 host_impl->ActivateSyncTree();
699 EXPECT_EQ(
700 CombinedAnimationScale(0.f, 0.f),
701 host_impl->active_tree()->property_trees()->GetAnimationScales(
702 transform_layer->transform_tree_index(), host_impl->active_tree()));
703 }
704
660 } // namespace 705 } // namespace
661 } // namespace cc 706 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_common_unittest.cc ('K') | « cc/trees/property_tree_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698