| 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" |
| 11 #include "cc/test/test_task_graph_runner.h" | 11 #include "cc/test/test_task_graph_runner.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 13 | 13 |
| 14 using ::testing::Mock; | 14 using ::testing::Mock; |
| 15 using ::testing::_; | 15 using ::testing::_; |
| 16 | 16 |
| 17 namespace cc { | 17 namespace cc { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 class MockScrollbar : public FakeScrollbar { | 21 class MockScrollbar : public FakeScrollbar { |
| 22 public: | 22 public: |
| 23 MockScrollbar() : FakeScrollbar(true, true, true) {} | 23 MockScrollbar() : FakeScrollbar(true, true, true) {} |
| 24 MOCK_METHOD3(PaintPart, | 24 MOCK_METHOD3(PaintPart, |
| 25 void(SkCanvas* canvas, | 25 void(CdlCanvas* canvas, |
| 26 ScrollbarPart part, | 26 ScrollbarPart part, |
| 27 const gfx::Rect& content_rect)); | 27 const gfx::Rect& content_rect)); |
| 28 }; | 28 }; |
| 29 | 29 |
| 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( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |