• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 FakeOutputSurfaceClient : public OutputSurfaceClient {
14  public:
FakeOutputSurfaceClient()15   FakeOutputSurfaceClient()
16       : begin_impl_frame_count_(0),
17         deferred_initialize_result_(true),
18         deferred_initialize_called_(false),
19         did_lose_output_surface_called_(false),
20         memory_policy_(0) {}
21 
22   virtual bool DeferredInitialize(
23       scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE;
ReleaseGL()24   virtual void ReleaseGL() OVERRIDE {}
SetNeedsRedrawRect(gfx::Rect damage_rect)25   virtual void SetNeedsRedrawRect(gfx::Rect damage_rect) OVERRIDE {}
26   virtual void BeginImplFrame(const BeginFrameArgs& args) OVERRIDE;
DidSwapBuffers()27   virtual void DidSwapBuffers() OVERRIDE {}
OnSwapBuffersComplete()28   virtual void OnSwapBuffersComplete() OVERRIDE {}
ReclaimResources(const CompositorFrameAck * ack)29   virtual void ReclaimResources(const CompositorFrameAck* ack) OVERRIDE {}
30   virtual void DidLoseOutputSurface() OVERRIDE;
SetExternalDrawConstraints(const gfx::Transform & transform,gfx::Rect viewport,gfx::Rect clip,bool valid_for_tile_management)31   virtual void SetExternalDrawConstraints(
32       const gfx::Transform& transform,
33       gfx::Rect viewport,
34       gfx::Rect clip,
35       bool valid_for_tile_management) OVERRIDE {}
36   virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE;
SetTreeActivationCallback(const base::Closure &)37   virtual void SetTreeActivationCallback(const base::Closure&) OVERRIDE {}
38 
begin_impl_frame_count()39   int begin_impl_frame_count() {
40     return begin_impl_frame_count_;
41   }
42 
set_deferred_initialize_result(bool result)43   void set_deferred_initialize_result(bool result) {
44     deferred_initialize_result_ = result;
45   }
46 
deferred_initialize_called()47   bool deferred_initialize_called() {
48     return deferred_initialize_called_;
49   }
50 
did_lose_output_surface_called()51   bool did_lose_output_surface_called() {
52     return did_lose_output_surface_called_;
53   }
54 
memory_policy()55   const ManagedMemoryPolicy& memory_policy() const { return memory_policy_; }
56 
57  private:
58   int begin_impl_frame_count_;
59   bool deferred_initialize_result_;
60   bool deferred_initialize_called_;
61   bool did_lose_output_surface_called_;
62   ManagedMemoryPolicy memory_policy_;
63 };
64 
65 }  // namespace cc
66 
67 #endif  // CC_TEST_FAKE_OUTPUT_SURFACE_CLIENT_H_
68