| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ | 5 #ifndef CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ |
| 6 #define CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ | 6 #define CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "cc/layers/painted_scrollbar_layer.h" | 9 #include "cc/layers/painted_scrollbar_layer.h" |
| 10 #include "cc/test/fake_scrollbar.h" | 10 #include "cc/test/fake_scrollbar.h" |
| 11 | 11 |
| 12 namespace base { template<typename T> class AutoReset; } | 12 namespace base { template<typename T> class AutoReset; } |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 class FakePaintedScrollbarLayer : public PaintedScrollbarLayer { | 16 class FakePaintedScrollbarLayer : public PaintedScrollbarLayer { |
| 17 public: | 17 public: |
| 18 static scoped_refptr<FakePaintedScrollbarLayer> | 18 static scoped_refptr<FakePaintedScrollbarLayer> Create( |
| 19 Create(bool paint_during_update, bool has_thumb, int scrolling_layer_id); | 19 const LayerSettings& settings, |
| 20 bool paint_during_update, |
| 21 bool has_thumb, |
| 22 int scrolling_layer_id); |
| 20 int update_count() const { return update_count_; } | 23 int update_count() const { return update_count_; } |
| 21 void reset_update_count() { update_count_ = 0; } | 24 void reset_update_count() { update_count_ = 0; } |
| 22 | 25 |
| 23 bool Update(ResourceUpdateQueue* queue, | 26 bool Update(ResourceUpdateQueue* queue, |
| 24 const OcclusionTracker<Layer>* occlusion) override; | 27 const OcclusionTracker<Layer>* occlusion) override; |
| 25 | 28 |
| 26 void PushPropertiesTo(LayerImpl* layer) override; | 29 void PushPropertiesTo(LayerImpl* layer) override; |
| 27 | 30 |
| 28 scoped_ptr<base::AutoReset<bool>> IgnoreSetNeedsCommit(); | 31 scoped_ptr<base::AutoReset<bool>> IgnoreSetNeedsCommit(); |
| 29 | 32 |
| 30 size_t push_properties_count() const { return push_properties_count_; } | 33 size_t push_properties_count() const { return push_properties_count_; } |
| 31 void reset_push_properties_count() { push_properties_count_ = 0; } | 34 void reset_push_properties_count() { push_properties_count_ = 0; } |
| 32 | 35 |
| 33 // For unit tests | 36 // For unit tests |
| 34 UIResourceId track_resource_id() { | 37 UIResourceId track_resource_id() { |
| 35 return PaintedScrollbarLayer::track_resource_id(); | 38 return PaintedScrollbarLayer::track_resource_id(); |
| 36 } | 39 } |
| 37 UIResourceId thumb_resource_id() { | 40 UIResourceId thumb_resource_id() { |
| 38 return PaintedScrollbarLayer::thumb_resource_id(); | 41 return PaintedScrollbarLayer::thumb_resource_id(); |
| 39 } | 42 } |
| 40 FakeScrollbar* fake_scrollbar() { | 43 FakeScrollbar* fake_scrollbar() { |
| 41 return fake_scrollbar_; | 44 return fake_scrollbar_; |
| 42 } | 45 } |
| 43 using PaintedScrollbarLayer::UpdateInternalContentScale; | 46 using PaintedScrollbarLayer::UpdateInternalContentScale; |
| 44 using PaintedScrollbarLayer::UpdateThumbAndTrackGeometry; | 47 using PaintedScrollbarLayer::UpdateThumbAndTrackGeometry; |
| 45 | 48 |
| 46 private: | 49 private: |
| 47 FakePaintedScrollbarLayer(FakeScrollbar* fake_scrollbar, | 50 FakePaintedScrollbarLayer(const LayerSettings& settings, |
| 51 FakeScrollbar* fake_scrollbar, |
| 48 int scrolling_layer_id); | 52 int scrolling_layer_id); |
| 49 ~FakePaintedScrollbarLayer() override; | 53 ~FakePaintedScrollbarLayer() override; |
| 50 | 54 |
| 51 int update_count_; | 55 int update_count_; |
| 52 size_t push_properties_count_; | 56 size_t push_properties_count_; |
| 53 FakeScrollbar* fake_scrollbar_; | 57 FakeScrollbar* fake_scrollbar_; |
| 54 }; | 58 }; |
| 55 | 59 |
| 56 } // namespace cc | 60 } // namespace cc |
| 57 | 61 |
| 58 #endif // CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ | 62 #endif // CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ |
| OLD | NEW |