| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_SCROLLBAR_LAYER_H_ | 5 #ifndef CC_TEST_FAKE_SCROLLBAR_LAYER_H_ |
| 6 #define CC_TEST_FAKE_SCROLLBAR_LAYER_H_ | 6 #define CC_TEST_FAKE_SCROLLBAR_LAYER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "cc/layers/scrollbar_layer.h" | 9 #include "cc/layers/scrollbar_layer.h" |
| 10 | 10 |
| 11 namespace base { template<typename T> class AutoReset; } | 11 namespace base { template<typename T> class AutoReset; } |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 | 14 |
| 15 class FakeScrollbarLayer : public ScrollbarLayer { | 15 class FakeScrollbarLayer : public ScrollbarLayer { |
| 16 public: | 16 public: |
| 17 static scoped_refptr<FakeScrollbarLayer> Create(bool paint_during_update, | 17 static scoped_refptr<FakeScrollbarLayer> Create(bool paint_during_update, |
| 18 bool has_thumb, | 18 bool has_thumb, |
| 19 int scrolling_layer_id) { | 19 int scrolling_layer_id) { |
| 20 return make_scoped_refptr(new FakeScrollbarLayer( | 20 return make_scoped_refptr(new FakeScrollbarLayer( |
| 21 paint_during_update, has_thumb, scrolling_layer_id)); | 21 paint_during_update, has_thumb, scrolling_layer_id)); |
| 22 } | 22 } |
| 23 | 23 |
| 24 int update_count() const { return update_count_; } | 24 int update_count() const { return update_count_; } |
| 25 void reset_update_count() { update_count_ = 0; } | 25 void reset_update_count() { update_count_ = 0; } |
| 26 size_t last_update_full_upload_size() const { | |
| 27 return last_update_full_upload_size_; | |
| 28 } | |
| 29 size_t last_update_partial_upload_size() const { | |
| 30 return last_update_partial_upload_size_; | |
| 31 } | |
| 32 | 26 |
| 33 virtual bool Update(ResourceUpdateQueue* queue, | 27 virtual bool Update(ResourceUpdateQueue* queue, |
| 34 const OcclusionTracker* occlusion) OVERRIDE; | 28 const OcclusionTracker* occlusion) OVERRIDE; |
| 35 | 29 |
| 36 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; | 30 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; |
| 37 | 31 |
| 38 scoped_ptr<base::AutoReset<bool> > IgnoreSetNeedsCommit(); | 32 scoped_ptr<base::AutoReset<bool> > IgnoreSetNeedsCommit(); |
| 39 | 33 |
| 40 size_t push_properties_count() const { return push_properties_count_; } | 34 size_t push_properties_count() const { return push_properties_count_; } |
| 41 void reset_push_properties_count() { push_properties_count_ = 0; } | 35 void reset_push_properties_count() { push_properties_count_ = 0; } |
| 42 | 36 |
| 37 // For unit tests |
| 38 UIResourceId track_resource_id() { |
| 39 return ScrollbarLayer::track_resource_id(); |
| 40 } |
| 41 UIResourceId thumb_resource_id() { |
| 42 return ScrollbarLayer::thumb_resource_id(); |
| 43 } |
| 44 |
| 43 private: | 45 private: |
| 44 FakeScrollbarLayer(bool paint_during_update, | 46 FakeScrollbarLayer(bool paint_during_update, |
| 45 bool has_thumb, | 47 bool has_thumb, |
| 46 int scrolling_layer_id); | 48 int scrolling_layer_id); |
| 47 virtual ~FakeScrollbarLayer(); | 49 virtual ~FakeScrollbarLayer(); |
| 48 | 50 |
| 49 int update_count_; | 51 int update_count_; |
| 50 size_t push_properties_count_; | 52 size_t push_properties_count_; |
| 51 size_t last_update_full_upload_size_; | |
| 52 size_t last_update_partial_upload_size_; | |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 } // namespace cc | 55 } // namespace cc |
| 56 | 56 |
| 57 #endif // CC_TEST_FAKE_SCROLLBAR_LAYER_H_ | 57 #endif // CC_TEST_FAKE_SCROLLBAR_LAYER_H_ |
| OLD | NEW |