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.
5 #ifndef CC_TEST_FAKE_PICTURE_LAYER_H_
6 #define CC_TEST_FAKE_PICTURE_LAYER_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "cc/layers/picture_layer.h"
11 #include "cc/resources/recording_source.h"
14 class FakePictureLayer
: public PictureLayer
{
16 static scoped_refptr
<FakePictureLayer
> Create(ContentLayerClient
* client
) {
17 return make_scoped_refptr(new FakePictureLayer(client
));
20 static scoped_refptr
<FakePictureLayer
> CreateWithRecordingSource(
21 ContentLayerClient
* client
,
22 scoped_ptr
<RecordingSource
> source
) {
23 return make_scoped_refptr(new FakePictureLayer(client
, source
.Pass()));
26 scoped_ptr
<LayerImpl
> CreateLayerImpl(LayerTreeImpl
* tree_impl
) override
;
28 size_t update_count() const { return update_count_
; }
29 void reset_update_count() { update_count_
= 0; }
31 size_t push_properties_count() const { return push_properties_count_
; }
32 void reset_push_properties_count() { push_properties_count_
= 0; }
34 void set_always_update_resources(bool always_update_resources
) {
35 always_update_resources_
= always_update_resources
;
38 void disable_lcd_text() { disable_lcd_text_
= true; }
40 bool Update(ResourceUpdateQueue
* queue
,
41 const OcclusionTracker
<Layer
>* occlusion
) override
;
43 void PushPropertiesTo(LayerImpl
* layer
) override
;
45 void OnOutputSurfaceCreated() override
;
46 size_t output_surface_created_count() const {
47 return output_surface_created_count_
;
51 explicit FakePictureLayer(ContentLayerClient
* client
);
52 FakePictureLayer(ContentLayerClient
* client
,
53 scoped_ptr
<RecordingSource
> source
);
54 ~FakePictureLayer() override
;
57 size_t push_properties_count_
;
58 size_t output_surface_created_count_
;
59 bool always_update_resources_
;
60 bool disable_lcd_text_
;
65 #endif // CC_TEST_FAKE_PICTURE_LAYER_H_