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. 4 5 #ifndef CC_TEST_FAKE_LAYER_TREE_HOST_CLIENT_H_ 6 #define CC_TEST_FAKE_LAYER_TREE_HOST_CLIENT_H_ 7 8 #include "base/memory/scoped_ptr.h" 9 #include "cc/input/input_handler.h" 10 #include "cc/test/test_context_provider.h" 11 #include "cc/trees/layer_tree_host_client.h" 12 #include "cc/trees/layer_tree_host_single_thread_client.h" 13 14 namespace cc { 15 class OutputSurface; 16 17 class FakeLayerTreeHostClient : public LayerTreeHostClient, 18 public LayerTreeHostSingleThreadClient { 19 public: 20 enum RendererOptions { 21 DIRECT_3D, 22 DIRECT_SOFTWARE, 23 DELEGATED_3D, 24 DELEGATED_SOFTWARE 25 }; 26 explicit FakeLayerTreeHostClient(RendererOptions options); 27 virtual ~FakeLayerTreeHostClient(); 28 29 // Caller responsible for unsetting this and maintaining the host's lifetime. SetLayerTreeHost(LayerTreeHost * host)30 void SetLayerTreeHost(LayerTreeHost* host) { host_ = host; } 31 32 // LayerTreeHostClient implementation. WillBeginMainFrame(int frame_id)33 virtual void WillBeginMainFrame(int frame_id) OVERRIDE {} DidBeginMainFrame()34 virtual void DidBeginMainFrame() OVERRIDE {} BeginMainFrame(const BeginFrameArgs & args)35 virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE {} Layout()36 virtual void Layout() OVERRIDE {} ApplyViewportDeltas(const gfx::Vector2d & scroll_delta,float page_scale,float top_controls_delta)37 virtual void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta, 38 float page_scale, 39 float top_controls_delta) OVERRIDE {} 40 41 virtual void RequestNewOutputSurface(bool fallback) OVERRIDE; DidInitializeOutputSurface()42 virtual void DidInitializeOutputSurface() OVERRIDE {} WillCommit()43 virtual void WillCommit() OVERRIDE {} DidCommit()44 virtual void DidCommit() OVERRIDE {} DidCommitAndDrawFrame()45 virtual void DidCommitAndDrawFrame() OVERRIDE {} DidCompleteSwapBuffers()46 virtual void DidCompleteSwapBuffers() OVERRIDE {} 47 48 // LayerTreeHostSingleThreadClient implementation. DidPostSwapBuffers()49 virtual void DidPostSwapBuffers() OVERRIDE {} DidAbortSwapBuffers()50 virtual void DidAbortSwapBuffers() OVERRIDE {} 51 52 private: 53 bool use_software_rendering_; 54 bool use_delegating_renderer_; 55 56 LayerTreeHost* host_; 57 }; 58 59 } // namespace cc 60 61 #endif // CC_TEST_FAKE_LAYER_TREE_HOST_CLIENT_H_ 62