Chromium Code Reviews| 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..0d4177fbdfc72c820c70d432243fcda30e6f7f3c 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,51 @@ 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(); |
| + LayerImpl* layer_impl_tree_root = |
| + 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_impl_tree_root = 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); |
|
jaydasika
2016/05/26 02:17:06
If we use effect tree index in LayerImpl::OnOpacit
|
| +} |
| + |
| class ScrollbarLayerSolidColorThumbTest : public testing::Test { |
| public: |
| ScrollbarLayerSolidColorThumbTest() { |