Delete chrome.mediaGalleriesPrivate because the functionality unique to it has since...
[chromium-blink-merge.git] / cc / test / fake_picture_pile.h
blob4a7b65b86b343a4620721620c489f46789c13565
1 // Copyright 2014 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_PILE_H_
6 #define CC_TEST_FAKE_PICTURE_PILE_H_
8 #include "cc/resources/picture_pile.h"
10 namespace base {
11 class WaitableEvent;
14 namespace cc {
16 class FakePicturePile : public PicturePile {
17 public:
18 using PictureInfo = PicturePile::PictureInfo;
19 using PictureMapKey = PicturePile::PictureMapKey;
20 using PictureMap = PicturePile::PictureMap;
22 FakePicturePile() : playback_allowed_event_(nullptr) {}
23 ~FakePicturePile() override {}
25 // PicturePile overrides.
26 scoped_refptr<RasterSource> CreateRasterSource() const override;
28 using PicturePile::buffer_pixels;
29 using PicturePile::CanRasterSlowTileCheck;
30 using PicturePile::Clear;
31 using PicturePile::SetMinContentsScale;
32 using PicturePile::SetTileGridSize;
34 PictureMap& picture_map() { return picture_map_; }
35 const gfx::Rect& recorded_viewport() const { return recorded_viewport_; }
37 bool CanRasterLayerRect(gfx::Rect layer_rect) {
38 layer_rect.Intersect(gfx::Rect(tiling_.tiling_size()));
39 if (recorded_viewport_.Contains(layer_rect))
40 return true;
41 return CanRasterSlowTileCheck(layer_rect);
44 bool HasRecordings() const { return has_any_recordings_; }
46 void SetRecordedViewport(const gfx::Rect& viewport) {
47 recorded_viewport_ = viewport;
50 void SetHasAnyRecordings(bool has_recordings) {
51 has_any_recordings_ = has_recordings;
54 void SetPlaybackAllowedEvent(base::WaitableEvent* event) {
55 playback_allowed_event_ = event;
58 TilingData& tiling() { return tiling_; }
60 bool is_solid_color() const { return is_solid_color_; }
61 SkColor solid_color() const { return solid_color_; }
63 void SetPixelRecordDistance(int d) { pixel_record_distance_ = d; }
65 private:
66 base::WaitableEvent* playback_allowed_event_;
69 } // namespace cc
71 #endif // CC_TEST_FAKE_PICTURE_PILE_H_