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.
5 #ifndef CC_TEST_FAKE_OUTPUT_SURFACE_CLIENT_H_
6 #define CC_TEST_FAKE_OUTPUT_SURFACE_CLIENT_H_
8 #include "cc/output/managed_memory_policy.h"
9 #include "cc/output/output_surface_client.h"
13 class FakeOutputSurfaceClient
: public OutputSurfaceClient
{
15 FakeOutputSurfaceClient()
16 : begin_frame_count_(0),
17 deferred_initialize_result_(true),
18 deferred_initialize_called_(false),
19 did_lose_output_surface_called_(false),
21 discard_backbuffer_when_not_visible_(false) {}
23 virtual bool DeferredInitialize(
24 scoped_refptr
<ContextProvider
> offscreen_context_provider
) OVERRIDE
;
25 virtual void ReleaseGL() OVERRIDE
{}
26 virtual void SetNeedsRedrawRect(gfx::Rect damage_rect
) OVERRIDE
{}
27 virtual void BeginFrame(const BeginFrameArgs
& args
) OVERRIDE
;
28 virtual void OnSwapBuffersComplete(const CompositorFrameAck
* ack
) OVERRIDE
{}
29 virtual void DidLoseOutputSurface() OVERRIDE
;
30 virtual void SetExternalDrawConstraints(const gfx::Transform
& transform
,
31 gfx::Rect viewport
) OVERRIDE
{}
32 virtual void SetExternalStencilTest(bool enable
) OVERRIDE
{}
33 virtual void SetMemoryPolicy(const ManagedMemoryPolicy
& policy
) OVERRIDE
;
34 virtual void SetDiscardBackBufferWhenNotVisible(bool discard
) OVERRIDE
;
35 virtual void SetTreeActivationCallback(const base::Closure
&) OVERRIDE
{}
37 int begin_frame_count() {
38 return begin_frame_count_
;
41 void set_deferred_initialize_result(bool result
) {
42 deferred_initialize_result_
= result
;
45 bool deferred_initialize_called() {
46 return deferred_initialize_called_
;
49 bool did_lose_output_surface_called() {
50 return did_lose_output_surface_called_
;
53 const ManagedMemoryPolicy
& memory_policy() const { return memory_policy_
; }
55 bool discard_backbuffer_when_not_visible() const {
56 return discard_backbuffer_when_not_visible_
;
60 int begin_frame_count_
;
61 bool deferred_initialize_result_
;
62 bool deferred_initialize_called_
;
63 bool did_lose_output_surface_called_
;
64 ManagedMemoryPolicy memory_policy_
;
65 bool discard_backbuffer_when_not_visible_
;
70 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_CLIENT_H_