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 #include "cc/test/fake_content_layer.h"
      6 
      7 #include "cc/resources/prioritized_resource.h"
      8 #include "cc/test/fake_content_layer_impl.h"
      9 
     10 namespace cc {
     11 
     12 FakeContentLayer::FakeContentLayer(ContentLayerClient* client)
     13     : ContentLayer(client),
     14       update_count_(0),
     15       push_properties_count_(0),
     16       always_update_resources_(false) {
     17   SetAnchorPoint(gfx::PointF(0.f, 0.f));
     18   SetBounds(gfx::Size(1, 1));
     19   SetIsDrawable(true);
     20 }
     21 
     22 FakeContentLayer::~FakeContentLayer() {}
     23 
     24 scoped_ptr<LayerImpl> FakeContentLayer::CreateLayerImpl(
     25     LayerTreeImpl* tree_impl) {
     26   return FakeContentLayerImpl::Create(tree_impl, layer_id_).PassAs<LayerImpl>();
     27 }
     28 
     29 bool FakeContentLayer::Update(ResourceUpdateQueue* queue,
     30                               const OcclusionTracker* occlusion) {
     31   bool updated = ContentLayer::Update(queue, occlusion);
     32   update_count_++;
     33   return updated || always_update_resources_;
     34 }
     35 
     36 void FakeContentLayer::PushPropertiesTo(LayerImpl* layer) {
     37   ContentLayer::PushPropertiesTo(layer);
     38   push_properties_count_++;
     39 }
     40 
     41 bool FakeContentLayer::HaveBackingAt(int i, int j) {
     42   const PrioritizedResource* resource = ResourceAtForTesting(i, j);
     43   return resource && resource->have_backing_texture();
     44 }
     45 
     46 }  // namespace cc
     47