From 24372ebfa93f38fd6148a303290e59cd526fcc29 Mon Sep 17 00:00:00 2001 From: Robert Ancell Date: Thu, 28 Oct 2021 16:55:50 +1300 Subject: [PATCH] Move mock objects into separate modules --- .../src/flutter/shell/platform/linux/BUILD.gn | 3 + .../linux/fl_binary_messenger_test.cc | 27 +---- .../linux/fl_plugin_registrar_test.cc | 76 +------------ .../linux/fl_texture_registrar_test.cc | 98 +---------------- .../mock_binary_messenger_response_handle.cc | 25 +++++ .../mock_binary_messenger_response_handle.h | 18 ++++ .../linux/testing/mock_plugin_registrar.cc | 74 +++++++++++++ .../linux/testing/mock_plugin_registrar.h | 23 ++++ .../linux/testing/mock_texture_registrar.cc | 100 ++++++++++++++++++ .../linux/testing/mock_texture_registrar.h | 23 ++++ 10 files changed, 272 insertions(+), 195 deletions(-) create mode 100644 engine/src/flutter/shell/platform/linux/testing/mock_binary_messenger_response_handle.cc create mode 100644 engine/src/flutter/shell/platform/linux/testing/mock_binary_messenger_response_handle.h create mode 100644 engine/src/flutter/shell/platform/linux/testing/mock_plugin_registrar.cc create mode 100644 engine/src/flutter/shell/platform/linux/testing/mock_plugin_registrar.h create mode 100644 engine/src/flutter/shell/platform/linux/testing/mock_texture_registrar.cc create mode 100644 engine/src/flutter/shell/platform/linux/testing/mock_texture_registrar.h diff --git a/engine/src/flutter/shell/platform/linux/BUILD.gn b/engine/src/flutter/shell/platform/linux/BUILD.gn index 12fa833cfa7..0c4b703683a 100644 --- a/engine/src/flutter/shell/platform/linux/BUILD.gn +++ b/engine/src/flutter/shell/platform/linux/BUILD.gn @@ -201,10 +201,13 @@ executable("flutter_linux_unittests") { "fl_texture_registrar_test.cc", "fl_value_test.cc", "testing/fl_test.cc", + "testing/mock_binary_messenger_response_handle.cc", "testing/mock_engine.cc", "testing/mock_epoxy.cc", + "testing/mock_plugin_registrar.cc", "testing/mock_renderer.cc", "testing/mock_text_input_plugin.cc", + "testing/mock_texture_registrar.cc", ] public_configs = [ "//flutter:config" ] diff --git a/engine/src/flutter/shell/platform/linux/fl_binary_messenger_test.cc b/engine/src/flutter/shell/platform/linux/fl_binary_messenger_test.cc index 73b033a70a2..5edb66da69c 100644 --- a/engine/src/flutter/shell/platform/linux/fl_binary_messenger_test.cc +++ b/engine/src/flutter/shell/platform/linux/fl_binary_messenger_test.cc @@ -11,40 +11,15 @@ #include "flutter/shell/platform/linux/fl_engine_private.h" #include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h" #include "flutter/shell/platform/linux/testing/fl_test.h" +#include "flutter/shell/platform/linux/testing/mock_binary_messenger_response_handle.h" #include "flutter/shell/platform/linux/testing/mock_renderer.h" -G_DECLARE_FINAL_TYPE(FlMockBinaryMessengerResponseHandle, - fl_mock_binary_messenger_response_handle, - FL, - MOCK_BINARY_MESSENGER_RESPONSE_HANDLE, - FlBinaryMessengerResponseHandle) - G_DECLARE_FINAL_TYPE(FlMockBinaryMessenger, fl_mock_binary_messenger, FL, MOCK_BINARY_MESSENGER, GObject) -struct _FlMockBinaryMessengerResponseHandle { - FlBinaryMessengerResponseHandle parent_instance; -}; - -G_DEFINE_TYPE(FlMockBinaryMessengerResponseHandle, - fl_mock_binary_messenger_response_handle, - fl_binary_messenger_response_handle_get_type()); - -static void fl_mock_binary_messenger_response_handle_class_init( - FlMockBinaryMessengerResponseHandleClass* klass) {} - -static void fl_mock_binary_messenger_response_handle_init( - FlMockBinaryMessengerResponseHandle* self) {} - -static FlMockBinaryMessengerResponseHandle* -fl_mock_binary_messenger_response_handle_new() { - return FL_MOCK_BINARY_MESSENGER_RESPONSE_HANDLE( - g_object_new(fl_mock_binary_messenger_response_handle_get_type(), NULL)); -} - struct _FlMockBinaryMessenger { GObject parent_instance; diff --git a/engine/src/flutter/shell/platform/linux/fl_plugin_registrar_test.cc b/engine/src/flutter/shell/platform/linux/fl_plugin_registrar_test.cc index 5ea59f76dc1..f00f454a34d 100644 --- a/engine/src/flutter/shell/platform/linux/fl_plugin_registrar_test.cc +++ b/engine/src/flutter/shell/platform/linux/fl_plugin_registrar_test.cc @@ -11,81 +11,7 @@ #include "flutter/shell/platform/linux/fl_texture_registrar_private.h" #include "flutter/shell/platform/linux/public/flutter_linux/fl_plugin_registrar.h" #include "flutter/shell/platform/linux/testing/fl_test.h" - -G_DECLARE_FINAL_TYPE(FlMockPluginRegistrar, - fl_mock_plugin_registrar, - FL, - MOCK_PLUGIN_REGISTRAR, - GObject) - -struct _FlMockPluginRegistrar { - GObject parent_instance; - - FlView* view; - FlBinaryMessenger* messenger; - FlTextureRegistrar* texture_registrar; -}; - -static void fl_mock_plugin_registrar_iface_init( - FlPluginRegistrarInterface* iface); - -G_DEFINE_TYPE_WITH_CODE( - FlMockPluginRegistrar, - fl_mock_plugin_registrar, - G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE(fl_plugin_registrar_get_type(), - fl_mock_plugin_registrar_iface_init)) - -static void fl_mock_plugin_registrar_dispose(GObject* object) { - FlMockPluginRegistrar* self = FL_MOCK_PLUGIN_REGISTRAR(object); - - g_clear_object(&self->messenger); - g_clear_object(&self->texture_registrar); - - G_OBJECT_CLASS(fl_mock_plugin_registrar_parent_class)->dispose(object); -} - -static void fl_mock_plugin_registrar_class_init( - FlMockPluginRegistrarClass* klass) { - G_OBJECT_CLASS(klass)->dispose = fl_mock_plugin_registrar_dispose; -} - -static FlBinaryMessenger* get_messenger(FlPluginRegistrar* registrar) { - FlMockPluginRegistrar* self = FL_MOCK_PLUGIN_REGISTRAR(registrar); - return self->messenger; -} - -static FlTextureRegistrar* get_texture_registrar(FlPluginRegistrar* registrar) { - FlMockPluginRegistrar* self = FL_MOCK_PLUGIN_REGISTRAR(registrar); - return self->texture_registrar; -} - -static FlView* get_view(FlPluginRegistrar* registrar) { - FlMockPluginRegistrar* self = FL_MOCK_PLUGIN_REGISTRAR(registrar); - return self->view; -} - -static void fl_mock_plugin_registrar_iface_init( - FlPluginRegistrarInterface* iface) { - iface->get_messenger = get_messenger; - iface->get_texture_registrar = get_texture_registrar; - iface->get_view = get_view; -} - -static void fl_mock_plugin_registrar_init(FlMockPluginRegistrar* self) {} - -static FlPluginRegistrar* fl_mock_plugin_registrar_new( - FlView* view, - FlBinaryMessenger* messenger, - FlTextureRegistrar* texture_registrar) { - FlMockPluginRegistrar* registrar = FL_MOCK_PLUGIN_REGISTRAR( - g_object_new(fl_mock_plugin_registrar_get_type(), NULL)); - registrar->view = view; - registrar->messenger = FL_BINARY_MESSENGER(g_object_ref(messenger)); - registrar->texture_registrar = - FL_TEXTURE_REGISTRAR(g_object_ref(texture_registrar)); - return FL_PLUGIN_REGISTRAR(registrar); -} +#include "flutter/shell/platform/linux/testing/mock_plugin_registrar.h" // Checks can make a mock registrar. TEST(FlPluginRegistrarTest, FlMockRegistrar) { diff --git a/engine/src/flutter/shell/platform/linux/fl_texture_registrar_test.cc b/engine/src/flutter/shell/platform/linux/fl_texture_registrar_test.cc index 0a812369655..45ac18edfe2 100644 --- a/engine/src/flutter/shell/platform/linux/fl_texture_registrar_test.cc +++ b/engine/src/flutter/shell/platform/linux/fl_texture_registrar_test.cc @@ -8,6 +8,7 @@ #include "flutter/shell/platform/linux/public/flutter_linux/fl_pixel_buffer_texture.h" #include "flutter/shell/platform/linux/public/flutter_linux/fl_texture_gl.h" #include "flutter/shell/platform/linux/testing/fl_test.h" +#include "flutter/shell/platform/linux/testing/mock_texture_registrar.h" #include "gtest/gtest.h" #include @@ -19,97 +20,6 @@ static constexpr uint32_t BUFFER_HEIGHT = 4u; static constexpr uint32_t REAL_BUFFER_WIDTH = 2u; static constexpr uint32_t REAL_BUFFER_HEIGHT = 2u; -G_DECLARE_FINAL_TYPE(FlMockTextureRegistrar, - fl_mock_texture_registrar, - FL, - MOCK_TEXTURE_REGISTRAR, - GObject) - -struct _FlMockTextureRegistrar { - GObject parent_instance; - FlTexture* texture; - gboolean frame_available; -}; - -static void fl_mock_texture_registrar_iface_init( - FlTextureRegistrarInterface* iface); - -G_DEFINE_TYPE_WITH_CODE( - FlMockTextureRegistrar, - fl_mock_texture_registrar, - G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE(fl_texture_registrar_get_type(), - fl_mock_texture_registrar_iface_init)) - -static void fl_mock_texture_registrar_dispose(GObject* object) { - FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(object); - g_clear_object(&self->texture); - G_OBJECT_CLASS(fl_mock_texture_registrar_parent_class)->dispose(object); -} - -static void fl_mock_texture_registrar_class_init( - FlMockTextureRegistrarClass* klass) { - G_OBJECT_CLASS(klass)->dispose = fl_mock_texture_registrar_dispose; -} - -static gboolean register_texture(FlTextureRegistrar* registrar, - FlTexture* texture) { - FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar); - if (self->texture != nullptr) { - return FALSE; - } - self->texture = FL_TEXTURE(g_object_ref(texture)); - return TRUE; -} - -static FlTexture* lookup_texture(FlTextureRegistrar* registrar, - int64_t texture_id) { - FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar); - if (self->texture != nullptr && - fl_texture_get_texture_id(self->texture) == texture_id) { - return self->texture; - } - return nullptr; -} - -static gboolean mark_texture_frame_available(FlTextureRegistrar* registrar, - FlTexture* texture) { - FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar); - if (lookup_texture(registrar, fl_texture_get_texture_id(texture)) == - nullptr) { - return FALSE; - } - self->frame_available = TRUE; - return TRUE; -} - -static gboolean unregister_texture(FlTextureRegistrar* registrar, - FlTexture* texture) { - FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar); - if (self->texture != texture) { - return FALSE; - } - - g_clear_object(&self->texture); - - return TRUE; -} - -static void fl_mock_texture_registrar_iface_init( - FlTextureRegistrarInterface* iface) { - iface->register_texture = register_texture; - iface->lookup_texture = lookup_texture; - iface->mark_texture_frame_available = mark_texture_frame_available; - iface->unregister_texture = unregister_texture; -} - -static void fl_mock_texture_registrar_init(FlMockTextureRegistrar* self) {} - -static FlMockTextureRegistrar* fl_mock_texture_registrar_new() { - return FL_MOCK_TEXTURE_REGISTRAR( - g_object_new(fl_mock_texture_registrar_get_type(), nullptr)); -} - G_DECLARE_FINAL_TYPE(FlTestRegistrarTexture, fl_test_registrar_texture, FL, @@ -163,17 +73,17 @@ TEST(FlTextureRegistrarTest, MockRegistrar) { EXPECT_TRUE(fl_texture_registrar_register_texture( FL_TEXTURE_REGISTRAR(registrar), texture)); - EXPECT_EQ(registrar->texture, texture); + EXPECT_EQ(fl_mock_texture_registrar_get_texture(registrar), texture); EXPECT_EQ( fl_texture_registrar_lookup_texture(FL_TEXTURE_REGISTRAR(registrar), fl_texture_get_texture_id(texture)), texture); EXPECT_TRUE(fl_texture_registrar_mark_texture_frame_available( FL_TEXTURE_REGISTRAR(registrar), texture)); - EXPECT_TRUE(registrar->frame_available); + EXPECT_TRUE(fl_mock_texture_registrar_get_frame_available(registrar)); EXPECT_TRUE(fl_texture_registrar_unregister_texture( FL_TEXTURE_REGISTRAR(registrar), texture)); - EXPECT_EQ(registrar->texture, nullptr); + EXPECT_EQ(fl_mock_texture_registrar_get_texture(registrar), nullptr); } // Test that registering a texture works. diff --git a/engine/src/flutter/shell/platform/linux/testing/mock_binary_messenger_response_handle.cc b/engine/src/flutter/shell/platform/linux/testing/mock_binary_messenger_response_handle.cc new file mode 100644 index 00000000000..4bd7e419d20 --- /dev/null +++ b/engine/src/flutter/shell/platform/linux/testing/mock_binary_messenger_response_handle.cc @@ -0,0 +1,25 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/shell/platform/linux/testing/mock_binary_messenger_response_handle.h" + +struct _FlMockBinaryMessengerResponseHandle { + FlBinaryMessengerResponseHandle parent_instance; +}; + +G_DEFINE_TYPE(FlMockBinaryMessengerResponseHandle, + fl_mock_binary_messenger_response_handle, + fl_binary_messenger_response_handle_get_type()); + +static void fl_mock_binary_messenger_response_handle_class_init( + FlMockBinaryMessengerResponseHandleClass* klass) {} + +static void fl_mock_binary_messenger_response_handle_init( + FlMockBinaryMessengerResponseHandle* self) {} + +FlMockBinaryMessengerResponseHandle* +fl_mock_binary_messenger_response_handle_new() { + return FL_MOCK_BINARY_MESSENGER_RESPONSE_HANDLE( + g_object_new(fl_mock_binary_messenger_response_handle_get_type(), NULL)); +} diff --git a/engine/src/flutter/shell/platform/linux/testing/mock_binary_messenger_response_handle.h b/engine/src/flutter/shell/platform/linux/testing/mock_binary_messenger_response_handle.h new file mode 100644 index 00000000000..66372c71092 --- /dev/null +++ b/engine/src/flutter/shell/platform/linux/testing/mock_binary_messenger_response_handle.h @@ -0,0 +1,18 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/shell/platform/linux/fl_binary_messenger_private.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlMockBinaryMessengerResponseHandle, + fl_mock_binary_messenger_response_handle, + FL, + MOCK_BINARY_MESSENGER_RESPONSE_HANDLE, + FlBinaryMessengerResponseHandle) + +FlMockBinaryMessengerResponseHandle* +fl_mock_binary_messenger_response_handle_new(); + +G_END_DECLS diff --git a/engine/src/flutter/shell/platform/linux/testing/mock_plugin_registrar.cc b/engine/src/flutter/shell/platform/linux/testing/mock_plugin_registrar.cc new file mode 100644 index 00000000000..0294ea7c30c --- /dev/null +++ b/engine/src/flutter/shell/platform/linux/testing/mock_plugin_registrar.cc @@ -0,0 +1,74 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/shell/platform/linux/testing/mock_plugin_registrar.h" + +struct _FlMockPluginRegistrar { + GObject parent_instance; + + FlView* view; + FlBinaryMessenger* messenger; + FlTextureRegistrar* texture_registrar; +}; + +static void fl_mock_plugin_registrar_iface_init( + FlPluginRegistrarInterface* iface); + +G_DEFINE_TYPE_WITH_CODE( + FlMockPluginRegistrar, + fl_mock_plugin_registrar, + G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE(fl_plugin_registrar_get_type(), + fl_mock_plugin_registrar_iface_init)) + +static void fl_mock_plugin_registrar_dispose(GObject* object) { + FlMockPluginRegistrar* self = FL_MOCK_PLUGIN_REGISTRAR(object); + + g_clear_object(&self->messenger); + g_clear_object(&self->texture_registrar); + + G_OBJECT_CLASS(fl_mock_plugin_registrar_parent_class)->dispose(object); +} + +static void fl_mock_plugin_registrar_class_init( + FlMockPluginRegistrarClass* klass) { + G_OBJECT_CLASS(klass)->dispose = fl_mock_plugin_registrar_dispose; +} + +static FlBinaryMessenger* get_messenger(FlPluginRegistrar* registrar) { + FlMockPluginRegistrar* self = FL_MOCK_PLUGIN_REGISTRAR(registrar); + return self->messenger; +} + +static FlTextureRegistrar* get_texture_registrar(FlPluginRegistrar* registrar) { + FlMockPluginRegistrar* self = FL_MOCK_PLUGIN_REGISTRAR(registrar); + return self->texture_registrar; +} + +static FlView* get_view(FlPluginRegistrar* registrar) { + FlMockPluginRegistrar* self = FL_MOCK_PLUGIN_REGISTRAR(registrar); + return self->view; +} + +static void fl_mock_plugin_registrar_iface_init( + FlPluginRegistrarInterface* iface) { + iface->get_messenger = get_messenger; + iface->get_texture_registrar = get_texture_registrar; + iface->get_view = get_view; +} + +static void fl_mock_plugin_registrar_init(FlMockPluginRegistrar* self) {} + +FlPluginRegistrar* fl_mock_plugin_registrar_new( + FlView* view, + FlBinaryMessenger* messenger, + FlTextureRegistrar* texture_registrar) { + FlMockPluginRegistrar* registrar = FL_MOCK_PLUGIN_REGISTRAR( + g_object_new(fl_mock_plugin_registrar_get_type(), NULL)); + registrar->view = view; + registrar->messenger = FL_BINARY_MESSENGER(g_object_ref(messenger)); + registrar->texture_registrar = + FL_TEXTURE_REGISTRAR(g_object_ref(texture_registrar)); + return FL_PLUGIN_REGISTRAR(registrar); +} diff --git a/engine/src/flutter/shell/platform/linux/testing/mock_plugin_registrar.h b/engine/src/flutter/shell/platform/linux/testing/mock_plugin_registrar.h new file mode 100644 index 00000000000..71fce94688b --- /dev/null +++ b/engine/src/flutter/shell/platform/linux/testing/mock_plugin_registrar.h @@ -0,0 +1,23 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/shell/platform/linux/public/flutter_linux/fl_binary_messenger.h" +#include "flutter/shell/platform/linux/public/flutter_linux/fl_plugin_registrar.h" +#include "flutter/shell/platform/linux/public/flutter_linux/fl_texture_registrar.h" +#include "flutter/shell/platform/linux/public/flutter_linux/fl_view.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlMockPluginRegistrar, + fl_mock_plugin_registrar, + FL, + MOCK_PLUGIN_REGISTRAR, + GObject) + +FlPluginRegistrar* fl_mock_plugin_registrar_new( + FlView* view, + FlBinaryMessenger* messenger, + FlTextureRegistrar* texture_registrar); + +G_END_DECLS diff --git a/engine/src/flutter/shell/platform/linux/testing/mock_texture_registrar.cc b/engine/src/flutter/shell/platform/linux/testing/mock_texture_registrar.cc new file mode 100644 index 00000000000..66b5b8cfab9 --- /dev/null +++ b/engine/src/flutter/shell/platform/linux/testing/mock_texture_registrar.cc @@ -0,0 +1,100 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/shell/platform/linux/testing/mock_texture_registrar.h" +#include "flutter/shell/platform/linux/fl_texture_private.h" + +struct _FlMockTextureRegistrar { + GObject parent_instance; + FlTexture* texture; + gboolean frame_available; +}; + +static void fl_mock_texture_registrar_iface_init( + FlTextureRegistrarInterface* iface); + +G_DEFINE_TYPE_WITH_CODE( + FlMockTextureRegistrar, + fl_mock_texture_registrar, + G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE(fl_texture_registrar_get_type(), + fl_mock_texture_registrar_iface_init)) + +static gboolean register_texture(FlTextureRegistrar* registrar, + FlTexture* texture) { + FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar); + if (self->texture != nullptr) { + return FALSE; + } + self->texture = FL_TEXTURE(g_object_ref(texture)); + return TRUE; +} + +static FlTexture* lookup_texture(FlTextureRegistrar* registrar, + int64_t texture_id) { + FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar); + if (self->texture != nullptr && + fl_texture_get_texture_id(self->texture) == texture_id) { + return self->texture; + } + return nullptr; +} + +static gboolean mark_texture_frame_available(FlTextureRegistrar* registrar, + FlTexture* texture) { + FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar); + if (lookup_texture(registrar, fl_texture_get_texture_id(texture)) == + nullptr) { + return FALSE; + } + self->frame_available = TRUE; + return TRUE; +} + +static gboolean unregister_texture(FlTextureRegistrar* registrar, + FlTexture* texture) { + FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(registrar); + if (self->texture != texture) { + return FALSE; + } + + g_clear_object(&self->texture); + + return TRUE; +} + +static void fl_mock_texture_registrar_iface_init( + FlTextureRegistrarInterface* iface) { + iface->register_texture = register_texture; + iface->lookup_texture = lookup_texture; + iface->mark_texture_frame_available = mark_texture_frame_available; + iface->unregister_texture = unregister_texture; +} + +static void fl_mock_texture_registrar_dispose(GObject* object) { + FlMockTextureRegistrar* self = FL_MOCK_TEXTURE_REGISTRAR(object); + g_clear_object(&self->texture); + G_OBJECT_CLASS(fl_mock_texture_registrar_parent_class)->dispose(object); +} + +static void fl_mock_texture_registrar_class_init( + FlMockTextureRegistrarClass* klass) { + G_OBJECT_CLASS(klass)->dispose = fl_mock_texture_registrar_dispose; +} + +static void fl_mock_texture_registrar_init(FlMockTextureRegistrar* self) {} + +FlMockTextureRegistrar* fl_mock_texture_registrar_new() { + return FL_MOCK_TEXTURE_REGISTRAR( + g_object_new(fl_mock_texture_registrar_get_type(), nullptr)); +} + +FlTexture* fl_mock_texture_registrar_get_texture(FlMockTextureRegistrar* self) { + return self->texture; +} + +gboolean fl_mock_texture_registrar_get_frame_available( + FlMockTextureRegistrar* self) { + return self->frame_available; +} diff --git a/engine/src/flutter/shell/platform/linux/testing/mock_texture_registrar.h b/engine/src/flutter/shell/platform/linux/testing/mock_texture_registrar.h new file mode 100644 index 00000000000..65c617da128 --- /dev/null +++ b/engine/src/flutter/shell/platform/linux/testing/mock_texture_registrar.h @@ -0,0 +1,23 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/shell/platform/linux/fl_texture_registrar_private.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlMockTextureRegistrar, + fl_mock_texture_registrar, + FL, + MOCK_TEXTURE_REGISTRAR, + GObject) + +FlMockTextureRegistrar* fl_mock_texture_registrar_new(); + +FlTexture* fl_mock_texture_registrar_get_texture( + FlMockTextureRegistrar* registrar); + +gboolean fl_mock_texture_registrar_get_frame_available( + FlMockTextureRegistrar* registrar); + +G_END_DECLS