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_TEST_CONTEXT_SUPPORT_H_
6 #define CC_TEST_TEST_CONTEXT_SUPPORT_H_
10 #include "base/memory/weak_ptr.h"
11 #include "gpu/command_buffer/client/context_support.h"
15 class TestContextSupport
: public gpu::ContextSupport
{
18 ~TestContextSupport() override
;
20 // gpu::ContextSupport implementation.
21 void SignalSyncPoint(uint32 sync_point
,
22 const base::Closure
& callback
) override
;
23 void SignalQuery(uint32 query
, const base::Closure
& callback
) override
;
24 void SetSurfaceVisible(bool visible
) override
;
25 void SetAggressivelyFreeResources(bool aggressively_free_resources
) override
;
27 void PartialSwapBuffers(const gfx::Rect
& sub_buffer
) override
;
28 uint32
InsertFutureSyncPointCHROMIUM() override
;
29 void RetireSyncPointCHROMIUM(uint32 sync_point
) override
;
30 void ScheduleOverlayPlane(int plane_z_order
,
31 gfx::OverlayTransform plane_transform
,
32 unsigned overlay_texture_id
,
33 const gfx::Rect
& display_bounds
,
34 const gfx::RectF
& uv_rect
) override
;
36 void CallAllSyncPointCallbacks();
38 typedef base::Callback
<void(bool visible
)> SurfaceVisibleCallback
;
39 void SetSurfaceVisibleCallback(
40 const SurfaceVisibleCallback
& set_visible_callback
);
42 typedef base::Callback
<void(int plane_z_order
,
43 gfx::OverlayTransform plane_transform
,
44 unsigned overlay_texture_id
,
45 const gfx::Rect
& display_bounds
,
46 const gfx::RectF
& crop_rect
)>
47 ScheduleOverlayPlaneCallback
;
48 void SetScheduleOverlayPlaneCallback(
49 const ScheduleOverlayPlaneCallback
& schedule_overlay_plane_callback
);
52 std::vector
<base::Closure
> sync_point_callbacks_
;
53 SurfaceVisibleCallback set_visible_callback_
;
54 ScheduleOverlayPlaneCallback schedule_overlay_plane_callback_
;
56 base::WeakPtrFactory
<TestContextSupport
> weak_ptr_factory_
;
58 DISALLOW_COPY_AND_ASSIGN(TestContextSupport
);
63 #endif // CC_TEST_TEST_CONTEXT_SUPPORT_H_