fake_layer_tree_host.h revision 4e180b6a0b4720a9b8e9e959a882386f690f08ff
17dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// Copyright 2013 The Chromium Authors. All rights reserved.
27dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// Use of this source code is governed by a BSD-style license that can be
37dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// found in the LICENSE file.
47dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
57dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#ifndef CC_TEST_FAKE_LAYER_TREE_HOST_H_
67dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#define CC_TEST_FAKE_LAYER_TREE_HOST_H_
77dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
87dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "cc/test/fake_impl_proxy.h"
97dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "cc/test/fake_layer_tree_host_client.h"
107dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "cc/test/fake_layer_tree_host_impl.h"
117dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "cc/trees/layer_tree_host.h"
127dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "cc/trees/layer_tree_impl.h"
137dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "cc/trees/tree_synchronizer.h"
147dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
157dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochnamespace cc {
167dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
177dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochclass FakeLayerTreeHost : protected LayerTreeHost {
187dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch public:
194e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  static scoped_ptr<FakeLayerTreeHost> Create();
207dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
217dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  static scoped_ptr<FakeLayerTreeHost> Create(
224e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)      const LayerTreeSettings& settings);
237dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
247dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  virtual ~FakeLayerTreeHost() {}
257dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
264e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  virtual void SetNeedsCommit() OVERRIDE;
277dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  virtual void SetNeedsFullTreeSync() OVERRIDE {}
287dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
297dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  using LayerTreeHost::SetRootLayer;
30a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)  using LayerTreeHost::root_layer;
317dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
324e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  LayerImpl* CommitAndCreateLayerImplTree();
337dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
344e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  FakeLayerTreeHostImpl* host_impl() { return &host_impl_; }
354e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  LayerTreeImpl* active_tree() { return host_impl_.active_tree(); }
367dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
374e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  using LayerTreeHost::ScheduleMicroBenchmark;
384e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  using LayerTreeHost::SetOutputSurfaceLostForTesting;
394e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  using LayerTreeHost::InitializeForTesting;
404e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  void UpdateLayers(ResourceUpdateQueue* queue) {
414e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    LayerTreeHost::UpdateLayers(queue);
427dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  }
437dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
444e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  bool needs_commit() { return needs_commit_; }
457dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
467dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch private:
477dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  FakeLayerTreeHost(LayerTreeHostClient* client,
487dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch                    const LayerTreeSettings& settings)
497dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch      : LayerTreeHost(client, settings),
504e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)        host_impl_(settings, &proxy_),
514e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)        needs_commit_(false) {}
527dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
537dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  FakeImplProxy proxy_;
547dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  FakeLayerTreeHostImpl host_impl_;
554e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  bool needs_commit_;
567dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch};
577dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
587dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch}  // namespace cc
597dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
607dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#endif  // CC_TEST_FAKE_LAYER_TREE_HOST_H_
61