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. 4 5 #ifndef CC_TEST_FAKE_LAYER_TREE_HOST_H_ 6 #define CC_TEST_FAKE_LAYER_TREE_HOST_H_ 7 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/trees/layer_tree_host.h" 13 #include "cc/trees/layer_tree_impl.h" 14 #include "cc/trees/tree_synchronizer.h" 15 16 namespace cc { 17 18 class FakeLayerTreeHost : public LayerTreeHost { 19 public: 20 static scoped_ptr<FakeLayerTreeHost> Create(); 21 22 static scoped_ptr<FakeLayerTreeHost> Create( 23 const LayerTreeSettings& settings); 24 25 virtual ~FakeLayerTreeHost() {} 26 27 virtual void SetNeedsCommit() OVERRIDE; 28 virtual void SetNeedsFullTreeSync() OVERRIDE {} 29 30 using LayerTreeHost::SetRootLayer; 31 using LayerTreeHost::root_layer; 32 33 LayerImpl* CommitAndCreateLayerImplTree(); 34 35 FakeLayerTreeHostImpl* host_impl() { return &host_impl_; } 36 LayerTreeImpl* active_tree() { return host_impl_.active_tree(); } 37 38 using LayerTreeHost::ScheduleMicroBenchmark; 39 using LayerTreeHost::SetOutputSurfaceLostForTesting; 40 using LayerTreeHost::InitializeSingleThreaded; 41 using LayerTreeHost::InitializeForTesting; 42 void UpdateLayers(ResourceUpdateQueue* queue) { 43 LayerTreeHost::UpdateLayers(queue); 44 } 45 46 MicroBenchmarkController* GetMicroBenchmarkController() { 47 return µ_benchmark_controller_; 48 } 49 50 bool needs_commit() { return needs_commit_; } 51 52 private: 53 FakeLayerTreeHost(LayerTreeHostClient* client, 54 const LayerTreeSettings& settings) 55 : LayerTreeHost(client, NULL, settings), 56 host_impl_(settings, &proxy_), 57 needs_commit_(false) {} 58 59 FakeImplProxy proxy_; 60 FakeLayerTreeHostImpl host_impl_; 61 bool needs_commit_; 62 }; 63 64 } // namespace cc 65 66 #endif // CC_TEST_FAKE_LAYER_TREE_HOST_H_ 67