Flutter Engine
The Flutter Engine
mock_renderer.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter 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#include "flutter/shell/platform/linux/testing/mock_renderer.h"
6
8 FlRenderer parent_instance;
9 FlMockRendererGetRefreshRate get_refresh_rate;
10};
11
12G_DEFINE_TYPE(FlMockRenderer, fl_mock_renderer, fl_renderer_get_type())
13
14// Implements FlRenderer::make_current.
15static void fl_mock_renderer_make_current(FlRenderer* renderer) {}
16
17// Implements FlRenderer::make_resource_current.
19
20// Implements FlRenderer::clear_current.
21static void fl_mock_renderer_clear_current(FlRenderer* renderer) {}
22
23// Implements FlRenderer::get_refresh_rate.
25 FlMockRenderer* self = FL_MOCK_RENDERER(renderer);
26 if (self->get_refresh_rate != nullptr) {
27 return self->get_refresh_rate(renderer);
28 }
29 return -1.0;
30}
31
32static void fl_mock_renderer_class_init(FlMockRendererClass* klass) {
33 FL_RENDERER_CLASS(klass)->make_current = fl_mock_renderer_make_current;
34 FL_RENDERER_CLASS(klass)->make_resource_current =
36 FL_RENDERER_CLASS(klass)->clear_current = fl_mock_renderer_clear_current;
37 FL_RENDERER_CLASS(klass)->get_refresh_rate =
39}
40
41static void fl_mock_renderer_init(FlMockRenderer* self) {}
42
43// Creates a stub renderer
44FlMockRenderer* fl_mock_renderer_new(
45 FlMockRendererGetRefreshRate get_refresh_rate) {
46 FlMockRenderer* fl_mock_renderer = FL_MOCK_RENDERER(
47 g_object_new_valist(fl_mock_renderer_get_type(), nullptr, nullptr));
48 fl_mock_renderer->get_refresh_rate = get_refresh_rate;
49 return fl_mock_renderer;
50}
G_DEFINE_TYPE(FlBasicMessageChannelResponseHandle, fl_basic_message_channel_response_handle, G_TYPE_OBJECT) static void fl_basic_message_channel_response_handle_dispose(GObject *object)
static gdouble fl_mock_renderer_default_get_refresh_rate(FlRenderer *renderer)
static void fl_mock_renderer_make_current(FlRenderer *renderer)
static void fl_mock_renderer_class_init(FlMockRendererClass *klass)
static void fl_mock_renderer_init(FlMockRenderer *self)
static void fl_mock_renderer_make_resource_current(FlRenderer *renderer)
FlMockRenderer * fl_mock_renderer_new(FlMockRendererGetRefreshRate get_refresh_rate)
static void fl_mock_renderer_clear_current(FlRenderer *renderer)
FlRenderer parent_instance
Definition: mock_renderer.cc:8
FlMockRendererGetRefreshRate get_refresh_rate
Definition: mock_renderer.cc:9