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

Unified Diff: cc/layers/scrollbar_layer_unittest.cc

Issue 2014533005: cc : Reland Add IsInIdtoIndexMap to property tres (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/trees/property_tree.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/scrollbar_layer_unittest.cc
diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc
index 22114c8b297e714db75c1e5a206148c5ed3cb2fd..26285915af061de4dfd150c8fe17225798162063 100644
--- a/cc/layers/scrollbar_layer_unittest.cc
+++ b/cc/layers/scrollbar_layer_unittest.cc
@@ -99,6 +99,9 @@ class ScrollbarLayerTest : public testing::Test {
ScrollbarLayerTest() : fake_client_(FakeLayerTreeHostClient::DIRECT_3D) {
layer_tree_settings_.single_thread_proxy_scheduler = false;
layer_tree_settings_.use_zero_copy = true;
+ layer_tree_settings_.scrollbar_animator = LayerTreeSettings::LINEAR_FADE;
+ layer_tree_settings_.scrollbar_fade_delay_ms = 20;
+ layer_tree_settings_.scrollbar_fade_duration_ms = 20;
scrollbar_layer_id_ = -1;
@@ -550,6 +553,50 @@ TEST_F(ScrollbarLayerTest, ScrollbarLayerOpacity) {
EXPECT_EQ(node->data.opacity, 1.f);
}
+TEST_F(ScrollbarLayerTest, ScrollbarLayerPushProperties) {
+ // Pushing changed bounds of scroll layer can lead to calling
+ // OnOpacityAnimated on scrollbar layer which means OnOpacityAnimated should
+ // be independent of scrollbar layer's properties as scrollbar layer can push
+ // its properties after scroll layer.
+ const int kThumbThickness = 3;
+ const int kTrackStart = 0;
+ std::unique_ptr<Scrollbar> scrollbar(new FakeScrollbar(false, true, true));
+
+ scoped_refptr<Layer> layer_tree_root = Layer::Create();
+ scoped_refptr<Layer> scroll_layer = Layer::Create();
+ scroll_layer->SetScrollClipLayerId(layer_tree_root->id());
+ scoped_refptr<Layer> child1 = Layer::Create();
+ scoped_refptr<Layer> scrollbar_layer;
+ const bool kIsLeftSideVerticalScrollbar = false;
+ scrollbar_layer = SolidColorScrollbarLayer::Create(
+ scrollbar->Orientation(), kThumbThickness, kTrackStart,
+ kIsLeftSideVerticalScrollbar, child1->id());
+ scroll_layer->SetScrollClipLayerId(layer_tree_root->id());
+ scrollbar_layer->ToScrollbarLayer()->SetScrollLayer(scroll_layer->id());
+ scroll_layer->AddChild(child1);
+ scroll_layer->InsertChild(scrollbar_layer, 1);
+ layer_tree_root->AddChild(scroll_layer);
+ layer_tree_host_->SetRootLayer(layer_tree_root);
+
+ layer_tree_root->SetBounds(gfx::Size(2, 2));
+ scroll_layer->SetBounds(gfx::Size(10, 10));
+ layer_tree_host_->UpdateLayers();
+ layer_tree_host_->CommitAndCreateLayerImplTree();
+ LayerTreeHostImpl* host_impl = layer_tree_host_->host_impl();
+ EXPECT_TRUE(host_impl->ScrollbarAnimationControllerForId(scroll_layer->id()));
+
+ scroll_layer->SetBounds(gfx::Size(20, 20));
+ scroll_layer->SetForceRenderSurfaceForTesting(true);
+ layer_tree_host_->UpdateLayers();
+ host_impl->CreatePendingTree();
+ layer_tree_host_->CommitAndCreatePendingTree();
+ host_impl->ActivateSyncTree();
+ EffectNode* node =
+ host_impl->active_tree()->property_trees()->effect_tree.Node(
+ scrollbar_layer->effect_tree_index());
+ EXPECT_EQ(node->data.opacity, 1.f);
+}
+
class ScrollbarLayerSolidColorThumbTest : public testing::Test {
public:
ScrollbarLayerSolidColorThumbTest() {
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/trees/property_tree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698