Home | History | Annotate | Download | only in test
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CC_TEST_FAKE_SCROLLBAR_LAYER_H_
      6 #define CC_TEST_FAKE_SCROLLBAR_LAYER_H_
      7 
      8 #include "base/memory/scoped_ptr.h"
      9 #include "cc/layers/scrollbar_layer.h"
     10 
     11 namespace base { template<typename T> class AutoReset; }
     12 
     13 namespace cc {
     14 
     15 class FakeScrollbarLayer : public ScrollbarLayer {
     16  public:
     17   static scoped_refptr<FakeScrollbarLayer> Create(bool paint_during_update,
     18                                                   bool has_thumb,
     19                                                   int scrolling_layer_id) {
     20     return make_scoped_refptr(new FakeScrollbarLayer(
     21         paint_during_update, has_thumb, scrolling_layer_id));
     22   }
     23 
     24   int update_count() const { return update_count_; }
     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 
     33   virtual bool Update(ResourceUpdateQueue* queue,
     34                       const OcclusionTracker* occlusion) OVERRIDE;
     35 
     36   virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
     37 
     38   scoped_ptr<base::AutoReset<bool> > IgnoreSetNeedsCommit();
     39 
     40   size_t push_properties_count() const { return push_properties_count_; }
     41   void reset_push_properties_count() { push_properties_count_ = 0; }
     42 
     43  private:
     44   FakeScrollbarLayer(bool paint_during_update,
     45                      bool has_thumb,
     46                      int scrolling_layer_id);
     47   virtual ~FakeScrollbarLayer();
     48 
     49   int update_count_;
     50   size_t push_properties_count_;
     51   size_t last_update_full_upload_size_;
     52   size_t last_update_partial_upload_size_;
     53 };
     54 
     55 }  // namespace cc
     56 
     57 #endif  // CC_TEST_FAKE_SCROLLBAR_LAYER_H_
     58