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_PROXY_H_ 6 #define CC_TEST_FAKE_PROXY_H_ 7 8 #include "base/single_thread_task_runner.h" 9 #include "cc/trees/layer_tree_host.h" 10 #include "cc/trees/proxy.h" 11 12 namespace cc { 13 14 class FakeProxy : public Proxy { 15 public: 16 FakeProxy() : Proxy(NULL), layer_tree_host_(NULL) {} 17 explicit FakeProxy( 18 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) 19 : Proxy(impl_task_runner), 20 layer_tree_host_(NULL) {} 21 22 void SetLayerTreeHost(LayerTreeHost* host); 23 24 virtual bool CompositeAndReadback(void* pixels, gfx::Rect rect) OVERRIDE; 25 virtual void FinishAllRendering() OVERRIDE {} 26 virtual bool IsStarted() const OVERRIDE; 27 virtual void SetLayerTreeHostClientReady() OVERRIDE {} 28 virtual void SetVisible(bool visible) OVERRIDE {} 29 virtual void CreateAndInitializeOutputSurface() OVERRIDE; 30 virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE; 31 virtual void SetNeedsAnimate() OVERRIDE {} 32 virtual void SetNeedsUpdateLayers() OVERRIDE {} 33 virtual void SetNeedsCommit() OVERRIDE {} 34 virtual void SetNeedsRedraw(gfx::Rect damage_rect) OVERRIDE {} 35 virtual void SetNextCommitWaitsForActivation() OVERRIDE {} 36 virtual void NotifyInputThrottledUntilCommit() OVERRIDE {} 37 virtual void SetDeferCommits(bool defer_commits) OVERRIDE {} 38 virtual void MainThreadHasStoppedFlinging() OVERRIDE {} 39 virtual bool BeginMainFrameRequested() const OVERRIDE; 40 virtual bool CommitRequested() const OVERRIDE; 41 virtual void Start(scoped_ptr<OutputSurface> first_output_surface) OVERRIDE {} 42 virtual void Stop() OVERRIDE {} 43 virtual void ForceSerializeOnSwapBuffers() OVERRIDE {} 44 virtual size_t MaxPartialTextureUpdates() const OVERRIDE; 45 virtual void AcquireLayerTextures() OVERRIDE {} 46 virtual bool CommitPendingForTesting() OVERRIDE; 47 virtual scoped_ptr<base::Value> AsValue() const OVERRIDE; 48 49 virtual RendererCapabilities& GetRendererCapabilities(); 50 void SetMaxPartialTextureUpdates(size_t max); 51 52 private: 53 RendererCapabilities capabilities_; 54 size_t max_partial_texture_updates_; 55 LayerTreeHost* layer_tree_host_; 56 }; 57 58 } // namespace cc 59 60 #endif // CC_TEST_FAKE_PROXY_H_ 61