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_OUTPUT_SURFACE_CLIENT_H_ 6 #define CC_TEST_FAKE_OUTPUT_SURFACE_CLIENT_H_ 7 8 #include "cc/output/managed_memory_policy.h" 9 #include "cc/output/output_surface_client.h" 10 11 namespace cc { 12 13 class OutputSurface; 14 15 class FakeOutputSurfaceClient : public OutputSurfaceClient { 16 public: 17 FakeOutputSurfaceClient() 18 : output_surface_(NULL), 19 begin_frame_count_(0), 20 deferred_initialize_called_(false), 21 did_lose_output_surface_called_(false), 22 memory_policy_(0) {} 23 24 explicit FakeOutputSurfaceClient(OutputSurface* output_surface) 25 : output_surface_(output_surface), 26 begin_frame_count_(0), 27 deferred_initialize_called_(false), 28 did_lose_output_surface_called_(false), 29 memory_policy_(0) {} 30 31 virtual void DeferredInitialize() OVERRIDE; 32 virtual void ReleaseGL() OVERRIDE; 33 virtual void CommitVSyncParameters(base::TimeTicks timebase, 34 base::TimeDelta interval) OVERRIDE {} 35 virtual void SetNeedsRedrawRect(const gfx::Rect& damage_rect) OVERRIDE {} 36 virtual void BeginFrame(const BeginFrameArgs& args) OVERRIDE; 37 virtual void DidSwapBuffers() OVERRIDE {} 38 virtual void DidSwapBuffersComplete() OVERRIDE {} 39 virtual void ReclaimResources(const CompositorFrameAck* ack) OVERRIDE {} 40 virtual void DidLoseOutputSurface() OVERRIDE; 41 virtual void SetExternalDrawConstraints( 42 const gfx::Transform& transform, 43 const gfx::Rect& viewport, 44 const gfx::Rect& clip, 45 const gfx::Rect& viewport_rect_for_tile_priority, 46 const gfx::Transform& transform_for_tile_priority, 47 bool resourceless_software_draw) OVERRIDE {} 48 virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE; 49 virtual void SetTreeActivationCallback(const base::Closure&) OVERRIDE {} 50 51 int begin_frame_count() { return begin_frame_count_; } 52 53 bool deferred_initialize_called() { 54 return deferred_initialize_called_; 55 } 56 57 bool did_lose_output_surface_called() { 58 return did_lose_output_surface_called_; 59 } 60 61 const ManagedMemoryPolicy& memory_policy() const { return memory_policy_; } 62 63 private: 64 OutputSurface* output_surface_; 65 int begin_frame_count_; 66 bool deferred_initialize_called_; 67 bool did_lose_output_surface_called_; 68 ManagedMemoryPolicy memory_policy_; 69 }; 70 71 } // namespace cc 72 73 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_CLIENT_H_ 74