| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/layers/painted_scrollbar_layer.h" | 5 #include "cc/layers/painted_scrollbar_layer.h" |
| 6 | 6 |
| 7 #include "cc/animation/animation_host.h" | 7 #include "cc/animation/animation_host.h" |
| 8 #include "cc/test/fake_layer_tree_host.h" | 8 #include "cc/test/fake_layer_tree_host.h" |
| 9 #include "cc/test/fake_layer_tree_host_client.h" | 9 #include "cc/test/fake_layer_tree_host_client.h" |
| 10 #include "cc/test/fake_scrollbar.h" | 10 #include "cc/test/fake_scrollbar.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 TEST(PaintedScrollbarLayerTest, NeedsPaint) { | 30 TEST(PaintedScrollbarLayerTest, NeedsPaint) { |
| 31 FakeLayerTreeHostClient fake_client_; | 31 FakeLayerTreeHostClient fake_client_; |
| 32 TestTaskGraphRunner task_graph_runner_; | 32 TestTaskGraphRunner task_graph_runner_; |
| 33 | 33 |
| 34 auto animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); | 34 auto animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); |
| 35 auto layer_tree_host = FakeLayerTreeHost::Create( | 35 auto layer_tree_host = FakeLayerTreeHost::Create( |
| 36 &fake_client_, &task_graph_runner_, animation_host.get()); | 36 &fake_client_, &task_graph_runner_, animation_host.get()); |
| 37 | 37 |
| 38 MockScrollbar* scrollbar = new MockScrollbar(); | 38 MockScrollbar* scrollbar = new MockScrollbar(); |
| 39 scoped_refptr<PaintedScrollbarLayer> scrollbar_layer = | 39 scoped_refptr<PaintedScrollbarLayer> scrollbar_layer = |
| 40 PaintedScrollbarLayer::Create(std::unique_ptr<Scrollbar>(scrollbar), 1); | 40 PaintedScrollbarLayer::Create(std::unique_ptr<Scrollbar>(scrollbar)); |
| 41 | 41 |
| 42 scrollbar_layer->SetIsDrawable(true); | 42 scrollbar_layer->SetIsDrawable(true); |
| 43 scrollbar_layer->SetBounds(gfx::Size(100, 100)); | 43 scrollbar_layer->SetBounds(gfx::Size(100, 100)); |
| 44 | 44 |
| 45 layer_tree_host->SetRootLayer(scrollbar_layer); | 45 layer_tree_host->SetRootLayer(scrollbar_layer); |
| 46 EXPECT_EQ(scrollbar_layer->GetLayerTreeHostForTesting(), | 46 EXPECT_EQ(scrollbar_layer->GetLayerTreeHostForTesting(), |
| 47 layer_tree_host.get()); | 47 layer_tree_host.get()); |
| 48 scrollbar_layer->SavePaintProperties(); | 48 scrollbar_layer->SavePaintProperties(); |
| 49 | 49 |
| 50 // Request no paint, but expect them to be painted because they have not | 50 // Request no paint, but expect them to be painted because they have not |
| (...skipping 23 matching lines...) Expand all Loading... |
| 74 EXPECT_CALL(*scrollbar, PaintPart(_, THUMB, _)).Times(0); | 74 EXPECT_CALL(*scrollbar, PaintPart(_, THUMB, _)).Times(0); |
| 75 EXPECT_CALL(*scrollbar, PaintPart(_, TRACK, _)).Times(1); | 75 EXPECT_CALL(*scrollbar, PaintPart(_, TRACK, _)).Times(1); |
| 76 scrollbar->set_needs_paint_thumb(false); | 76 scrollbar->set_needs_paint_thumb(false); |
| 77 scrollbar->set_needs_paint_track(true); | 77 scrollbar->set_needs_paint_track(true); |
| 78 scrollbar_layer->Update(); | 78 scrollbar_layer->Update(); |
| 79 Mock::VerifyAndClearExpectations(scrollbar); | 79 Mock::VerifyAndClearExpectations(scrollbar); |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace | 82 } // namespace |
| 83 } // namespace cc | 83 } // namespace cc |
| OLD | NEW |