remoting.Identity unit-tests and fixes.
[chromium-blink-merge.git] / cc / test / fake_content_layer.cc
bloba0a01eee7fb650074d1c2fe1176359a3d75586a8
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_content_layer.h"
7 #include "cc/resources/content_layer_updater.h"
8 #include "cc/resources/prioritized_resource.h"
9 #include "cc/test/fake_content_layer_impl.h"
11 namespace cc {
13 class FakeContentLayerUpdater : public ContentLayerUpdater {
14 public:
15 using ContentLayerUpdater::paint_rect;
17 private:
18 ~FakeContentLayerUpdater() override {}
21 FakeContentLayer::FakeContentLayer(ContentLayerClient* client)
22 : ContentLayer(client),
23 update_count_(0),
24 push_properties_count_(0),
25 output_surface_created_count_(0),
26 always_update_resources_(false) {
27 SetBounds(gfx::Size(1, 1));
28 SetIsDrawable(true);
31 FakeContentLayer::~FakeContentLayer() {}
33 scoped_ptr<LayerImpl> FakeContentLayer::CreateLayerImpl(
34 LayerTreeImpl* tree_impl) {
35 return FakeContentLayerImpl::Create(tree_impl, layer_id_);
38 bool FakeContentLayer::Update(ResourceUpdateQueue* queue,
39 const OcclusionTracker<Layer>* occlusion) {
40 bool updated = ContentLayer::Update(queue, occlusion);
41 update_count_++;
42 return updated || always_update_resources_;
45 gfx::Rect FakeContentLayer::LastPaintRect() const {
46 return (static_cast<FakeContentLayerUpdater*>(Updater()))->paint_rect();
49 void FakeContentLayer::PushPropertiesTo(LayerImpl* layer) {
50 ContentLayer::PushPropertiesTo(layer);
51 push_properties_count_++;
54 void FakeContentLayer::OnOutputSurfaceCreated() {
55 ContentLayer::OnOutputSurfaceCreated();
56 output_surface_created_count_++;
59 bool FakeContentLayer::HaveBackingAt(int i, int j) {
60 const PrioritizedResource* resource = ResourceAtForTesting(i, j);
61 return resource && resource->have_backing_texture();
64 } // namespace cc