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"
20 class TestContextSupport
: public gpu::ContextSupport
{
23 ~TestContextSupport() override
;
25 // gpu::ContextSupport implementation.
26 void SignalSyncPoint(uint32 sync_point
,
27 const base::Closure
& callback
) override
;
28 void SignalQuery(uint32 query
, const base::Closure
& callback
) override
;
29 void SetSurfaceVisible(bool visible
) override
;
30 void SetAggressivelyFreeResources(bool aggressively_free_resources
) override
;
32 void PartialSwapBuffers(const gfx::Rect
& sub_buffer
) override
;
33 uint32
InsertFutureSyncPointCHROMIUM() override
;
34 void RetireSyncPointCHROMIUM(uint32 sync_point
) override
;
35 void ScheduleOverlayPlane(int plane_z_order
,
36 gfx::OverlayTransform plane_transform
,
37 unsigned overlay_texture_id
,
38 const gfx::Rect
& display_bounds
,
39 const gfx::RectF
& uv_rect
) override
;
40 uint64_t ShareGroupTracingGUID() const override
;
42 void CallAllSyncPointCallbacks();
44 typedef base::Callback
<void(bool visible
)> SurfaceVisibleCallback
;
45 void SetSurfaceVisibleCallback(
46 const SurfaceVisibleCallback
& set_visible_callback
);
48 typedef base::Callback
<void(int plane_z_order
,
49 gfx::OverlayTransform plane_transform
,
50 unsigned overlay_texture_id
,
51 const gfx::Rect
& display_bounds
,
52 const gfx::RectF
& crop_rect
)>
53 ScheduleOverlayPlaneCallback
;
54 void SetScheduleOverlayPlaneCallback(
55 const ScheduleOverlayPlaneCallback
& schedule_overlay_plane_callback
);
58 std::vector
<base::Closure
> sync_point_callbacks_
;
59 SurfaceVisibleCallback set_visible_callback_
;
60 ScheduleOverlayPlaneCallback schedule_overlay_plane_callback_
;
62 base::WeakPtrFactory
<TestContextSupport
> weak_ptr_factory_
;
64 DISALLOW_COPY_AND_ASSIGN(TestContextSupport
);
69 #endif // CC_TEST_TEST_CONTEXT_SUPPORT_H_