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
8f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "cc/debug/micro_benchmark_controller.h"
97dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "cc/test/fake_impl_proxy.h"
107dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "cc/test/fake_layer_tree_host_client.h"
117dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "cc/test/fake_layer_tree_host_impl.h"
1223730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)#include "cc/test/test_shared_bitmap_manager.h"
137dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "cc/trees/layer_tree_host.h"
147dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "cc/trees/layer_tree_impl.h"
157dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "cc/trees/tree_synchronizer.h"
167dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
177dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochnamespace cc {
187dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
19f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)class FakeLayerTreeHost : public LayerTreeHost {
207dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch public:
211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  static scoped_ptr<FakeLayerTreeHost> Create(FakeLayerTreeHostClient* client);
227dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  static scoped_ptr<FakeLayerTreeHost> Create(
231320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      FakeLayerTreeHostClient* client,
244e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)      const LayerTreeSettings& settings);
257dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
261320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual ~FakeLayerTreeHost();
277dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
284e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  virtual void SetNeedsCommit() OVERRIDE;
297dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  virtual void SetNeedsFullTreeSync() OVERRIDE {}
307dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
317dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  using LayerTreeHost::SetRootLayer;
32a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)  using LayerTreeHost::root_layer;
337dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
344e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  LayerImpl* CommitAndCreateLayerImplTree();
357dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
364e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  FakeLayerTreeHostImpl* host_impl() { return &host_impl_; }
374e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  LayerTreeImpl* active_tree() { return host_impl_.active_tree(); }
387dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
394e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  using LayerTreeHost::ScheduleMicroBenchmark;
40cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  using LayerTreeHost::SendMessageToMicroBenchmark;
414e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  using LayerTreeHost::SetOutputSurfaceLostForTesting;
42f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  using LayerTreeHost::InitializeSingleThreaded;
434e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  using LayerTreeHost::InitializeForTesting;
444e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  void UpdateLayers(ResourceUpdateQueue* queue) {
454e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    LayerTreeHost::UpdateLayers(queue);
467dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  }
477dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
48f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  MicroBenchmarkController* GetMicroBenchmarkController() {
49f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)    return &micro_benchmark_controller_;
50f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  }
51f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
524e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  bool needs_commit() { return needs_commit_; }
537dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
547dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch private:
551320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  FakeLayerTreeHost(FakeLayerTreeHostClient* client,
5623730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)                    const LayerTreeSettings& settings);
577dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
587dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  FakeImplProxy proxy_;
591320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  FakeLayerTreeHostClient* client_;
6023730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  TestSharedBitmapManager manager_;
617dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  FakeLayerTreeHostImpl host_impl_;
624e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  bool needs_commit_;
637dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch};
647dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
657dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch}  // namespace cc
667dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
677dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#endif  // CC_TEST_FAKE_LAYER_TREE_HOST_H_
68