Enable gaia services for enterprise autotests.
[chromium-blink-merge.git] / cc / test / fake_picture_layer_tiling_client.cc
blob68ff5182d586cd5756cc106c7f520e30915f5fb3
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 #include "cc/test/fake_picture_layer_tiling_client.h"
7 #include <limits>
9 #include "cc/test/fake_picture_pile_impl.h"
10 #include "cc/test/fake_tile_manager.h"
12 namespace cc {
14 FakePictureLayerTilingClient::FakePictureLayerTilingClient()
15 : tile_manager_(new FakeTileManager(&tile_manager_client_)),
16 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()),
17 twin_tiling_(NULL),
18 recycled_twin_tiling_(NULL),
19 allow_create_tile_(true),
20 max_tiles_for_interest_area_(10000),
21 skewport_target_time_in_seconds_(1.0f),
22 skewport_extrapolation_limit_in_content_pixels_(2000) {
25 FakePictureLayerTilingClient::FakePictureLayerTilingClient(
26 ResourceProvider* resource_provider)
27 : resource_pool_(
28 ResourcePool::Create(resource_provider, GL_TEXTURE_2D, RGBA_8888)),
29 tile_manager_(
30 new FakeTileManager(&tile_manager_client_, resource_pool_.get())),
31 pile_(FakePicturePileImpl::CreateInfiniteFilledPile()),
32 twin_tiling_(NULL),
33 recycled_twin_tiling_(NULL),
34 allow_create_tile_(true),
35 max_tiles_for_interest_area_(10000),
36 skewport_target_time_in_seconds_(1.0f) {
39 FakePictureLayerTilingClient::~FakePictureLayerTilingClient() {
42 scoped_refptr<Tile> FakePictureLayerTilingClient::CreateTile(
43 PictureLayerTiling*,
44 const gfx::Rect& rect) {
45 if (!allow_create_tile_)
46 return scoped_refptr<Tile>();
47 return tile_manager_->CreateTile(pile_.get(), tile_size_, rect, 1, 0, 0, 0);
50 PicturePileImpl* FakePictureLayerTilingClient::GetPile() {
51 return pile_.get();
54 void FakePictureLayerTilingClient::SetTileSize(const gfx::Size& tile_size) {
55 tile_size_ = tile_size;
58 gfx::Size FakePictureLayerTilingClient::CalculateTileSize(
59 const gfx::Size& /* content_bounds */) const {
60 return tile_size_;
63 size_t FakePictureLayerTilingClient::GetMaxTilesForInterestArea() const {
64 return max_tiles_for_interest_area_;
67 float FakePictureLayerTilingClient::GetSkewportTargetTimeInSeconds() const {
68 return skewport_target_time_in_seconds_;
71 int FakePictureLayerTilingClient::GetSkewportExtrapolationLimitInContentPixels()
72 const {
73 return skewport_extrapolation_limit_in_content_pixels_;
76 const Region* FakePictureLayerTilingClient::GetInvalidation() {
77 return &invalidation_;
80 const PictureLayerTiling* FakePictureLayerTilingClient::GetTwinTiling(
81 const PictureLayerTiling* tiling) const {
82 return twin_tiling_;
85 PictureLayerTiling* FakePictureLayerTilingClient::GetRecycledTwinTiling(
86 const PictureLayerTiling* tiling) {
87 return recycled_twin_tiling_;
90 WhichTree FakePictureLayerTilingClient::GetTree() const {
91 return tree_;
94 } // namespace cc