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/test/fake_layer_tree_host.h" | 7 #include "cc/test/fake_layer_tree_host.h" |
8 #include "cc/test/fake_layer_tree_host_client.h" | 8 #include "cc/test/fake_layer_tree_host_client.h" |
9 #include "cc/test/fake_scrollbar.h" | 9 #include "cc/test/fake_scrollbar.h" |
10 #include "cc/test/test_task_graph_runner.h" | 10 #include "cc/test/test_task_graph_runner.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_); | 35 FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_); |
36 | 36 |
37 MockScrollbar* scrollbar = new MockScrollbar(); | 37 MockScrollbar* scrollbar = new MockScrollbar(); |
38 scoped_refptr<PaintedScrollbarLayer> scrollbar_layer = | 38 scoped_refptr<PaintedScrollbarLayer> scrollbar_layer = |
39 PaintedScrollbarLayer::Create(std::unique_ptr<Scrollbar>(scrollbar), 1); | 39 PaintedScrollbarLayer::Create(std::unique_ptr<Scrollbar>(scrollbar), 1); |
40 | 40 |
41 scrollbar_layer->SetIsDrawable(true); | 41 scrollbar_layer->SetIsDrawable(true); |
42 scrollbar_layer->SetBounds(gfx::Size(100, 100)); | 42 scrollbar_layer->SetBounds(gfx::Size(100, 100)); |
43 | 43 |
44 layer_tree_host_->SetRootLayer(scrollbar_layer); | 44 layer_tree_host_->SetRootLayer(scrollbar_layer); |
45 EXPECT_EQ(scrollbar_layer->layer_tree_host(), layer_tree_host_.get()); | 45 EXPECT_EQ(scrollbar_layer->GetLayerTreeHostForTesting(), |
| 46 layer_tree_host_.get()); |
46 scrollbar_layer->SavePaintProperties(); | 47 scrollbar_layer->SavePaintProperties(); |
47 | 48 |
48 // Request no paint, but expect them to be painted because they have not | 49 // Request no paint, but expect them to be painted because they have not |
49 // yet been initialized. | 50 // yet been initialized. |
50 scrollbar->set_needs_paint_thumb(false); | 51 scrollbar->set_needs_paint_thumb(false); |
51 scrollbar->set_needs_paint_track(false); | 52 scrollbar->set_needs_paint_track(false); |
52 EXPECT_CALL(*scrollbar, PaintPart(_, THUMB, _)).Times(1); | 53 EXPECT_CALL(*scrollbar, PaintPart(_, THUMB, _)).Times(1); |
53 EXPECT_CALL(*scrollbar, PaintPart(_, TRACK, _)).Times(1); | 54 EXPECT_CALL(*scrollbar, PaintPart(_, TRACK, _)).Times(1); |
54 scrollbar_layer->Update(); | 55 scrollbar_layer->Update(); |
55 Mock::VerifyAndClearExpectations(scrollbar); | 56 Mock::VerifyAndClearExpectations(scrollbar); |
(...skipping 16 matching lines...) Expand all Loading... |
72 EXPECT_CALL(*scrollbar, PaintPart(_, THUMB, _)).Times(0); | 73 EXPECT_CALL(*scrollbar, PaintPart(_, THUMB, _)).Times(0); |
73 EXPECT_CALL(*scrollbar, PaintPart(_, TRACK, _)).Times(1); | 74 EXPECT_CALL(*scrollbar, PaintPart(_, TRACK, _)).Times(1); |
74 scrollbar->set_needs_paint_thumb(false); | 75 scrollbar->set_needs_paint_thumb(false); |
75 scrollbar->set_needs_paint_track(true); | 76 scrollbar->set_needs_paint_track(true); |
76 scrollbar_layer->Update(); | 77 scrollbar_layer->Update(); |
77 Mock::VerifyAndClearExpectations(scrollbar); | 78 Mock::VerifyAndClearExpectations(scrollbar); |
78 } | 79 } |
79 | 80 |
80 } // namespace | 81 } // namespace |
81 } // namespace cc | 82 } // namespace cc |
OLD | NEW |