Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / cc / test / fake_layer_tree_host.h
bloba50219c425f972d66821dcc71735a9f7028f302e
1 // Copyright 2013 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 #ifndef CC_TEST_FAKE_LAYER_TREE_HOST_H_
6 #define CC_TEST_FAKE_LAYER_TREE_HOST_H_
8 #include "cc/debug/micro_benchmark_controller.h"
9 #include "cc/test/fake_impl_proxy.h"
10 #include "cc/test/fake_layer_tree_host_client.h"
11 #include "cc/test/fake_layer_tree_host_impl.h"
12 #include "cc/test/test_shared_bitmap_manager.h"
13 #include "cc/trees/layer_tree_host.h"
14 #include "cc/trees/layer_tree_impl.h"
15 #include "cc/trees/tree_synchronizer.h"
17 namespace cc {
18 class TestTaskGraphRunner;
20 class FakeLayerTreeHost : public LayerTreeHost {
21 public:
22 static scoped_ptr<FakeLayerTreeHost> Create(
23 FakeLayerTreeHostClient* client,
24 TestTaskGraphRunner* task_graph_runner);
25 static scoped_ptr<FakeLayerTreeHost> Create(
26 FakeLayerTreeHostClient* client,
27 TestTaskGraphRunner* task_graph_runner,
28 const LayerTreeSettings& settings);
30 ~FakeLayerTreeHost() override;
32 void SetNeedsCommit() override;
33 void SetNeedsUpdateLayers() override {}
34 void SetNeedsFullTreeSync() override {}
36 using LayerTreeHost::SetRootLayer;
37 using LayerTreeHost::root_layer;
39 LayerImpl* CommitAndCreateLayerImplTree();
41 FakeLayerTreeHostImpl* host_impl() { return &host_impl_; }
42 LayerTreeImpl* active_tree() { return host_impl_.active_tree(); }
44 using LayerTreeHost::ScheduleMicroBenchmark;
45 using LayerTreeHost::SendMessageToMicroBenchmark;
46 using LayerTreeHost::SetOutputSurfaceLostForTesting;
47 using LayerTreeHost::InitializeSingleThreaded;
48 using LayerTreeHost::InitializeForTesting;
49 void UpdateLayers() { LayerTreeHost::UpdateLayers(); }
51 MicroBenchmarkController* GetMicroBenchmarkController() {
52 return &micro_benchmark_controller_;
55 bool needs_commit() { return needs_commit_; }
57 protected:
58 FakeLayerTreeHost(FakeLayerTreeHostClient* client,
59 LayerTreeHost::InitParams* params);
61 private:
62 FakeImplProxy proxy_;
63 FakeLayerTreeHostClient* client_;
64 TestSharedBitmapManager manager_;
65 FakeLayerTreeHostImpl host_impl_;
66 bool needs_commit_;
69 } // namespace cc
71 #endif // CC_TEST_FAKE_LAYER_TREE_HOST_H_