7#include "flutter/shell/platform/android/android_shell_holder.h"
8#include "gmock/gmock.h"
9#include "gtest/gtest.h"
15class MockPlatformViewAndroidJNI :
public PlatformViewAndroidJNI {
18 FlutterViewHandlePlatformMessage,
19 (std::unique_ptr<flutter::PlatformMessage>
message,
23 FlutterViewHandlePlatformMessageResponse,
24 (
int responseId, std::unique_ptr<fml::Mapping>
data),
27 FlutterViewUpdateSemantics,
28 (std::vector<uint8_t>
buffer,
29 std::vector<std::string> strings,
30 std::vector<std::vector<uint8_t>> string_attribute_args),
33 FlutterViewUpdateCustomAccessibilityActions,
34 (std::vector<uint8_t> actions_buffer,
35 std::vector<std::string> strings),
37 MOCK_METHOD(
void, FlutterViewOnFirstFrame, (), (
override));
38 MOCK_METHOD(
void, FlutterViewOnPreEngineRestart, (), (
override));
40 SurfaceTextureAttachToGLContext,
44 SurfaceTextureShouldUpdate,
48 SurfaceTextureUpdateTexImage,
52 SurfaceTextureGetTransformMatrix,
56 SurfaceTextureDetachFromGLContext,
60 ImageProducerTextureEntryAcquireLatestImage,
64 ImageGetHardwareBuffer,
73 FlutterViewOnDisplayPlatformView,
81 MutatorsStack mutators_stack),
84 FlutterViewDisplayOverlaySurface,
87 MOCK_METHOD(
void, FlutterViewBeginFrame, (), (
override));
88 MOCK_METHOD(
void, FlutterViewEndFrame, (), (
override));
89 MOCK_METHOD(std::unique_ptr<PlatformViewAndroidJNI::OverlayMetadata>,
90 FlutterViewCreateOverlaySurface,
93 MOCK_METHOD(
void, FlutterViewDestroyOverlaySurfaces, (), (
override));
94 MOCK_METHOD(std::unique_ptr<std::vector<std::string>>,
95 FlutterViewComputePlatformResolvedLocale,
96 (std::vector<std::string> supported_locales_data),
98 MOCK_METHOD(
double, GetDisplayRefreshRate, (), (
override));
99 MOCK_METHOD(
double, GetDisplayWidth, (), (
override));
100 MOCK_METHOD(
double, GetDisplayHeight, (), (
override));
101 MOCK_METHOD(
double, GetDisplayDensity, (), (
override));
103 RequestDartDeferredLibrary,
104 (
int loading_unit_id),
107 FlutterViewGetScaledFontSize,
108 (
double font_size,
int configuration_id),
117 MOCK_METHOD(
void, Complete, (std::unique_ptr<fml::Mapping>
data), (
override));
118 MOCK_METHOD(
void, CompleteEmpty, (), (
override));
124 settings.enable_software_rendering =
false;
125 auto jni = std::make_shared<MockPlatformViewAndroidJNI>();
126 auto holder = std::make_unique<AndroidShellHolder>(
settings, jni);
127 EXPECT_NE(holder.get(),
nullptr);
129 EXPECT_NE(holder->GetPlatformView().get(),
nullptr);
130 auto window = fml::MakeRefCounted<AndroidNativeWindow>(
132 holder->GetPlatformView()->NotifyCreated(
window);
137 settings.enable_software_rendering =
false;
138 auto jni = std::make_shared<MockPlatformViewAndroidJNI>();
139 auto holder = std::make_unique<AndroidShellHolder>(
settings, jni);
140 EXPECT_NE(holder.get(),
nullptr);
142 EXPECT_NE(holder->GetPlatformView().get(),
nullptr);
143 auto window = fml::MakeRefCounted<AndroidNativeWindow>(
145 holder->GetPlatformView()->NotifyCreated(
window);
147 size_t data_size = 4;
152 auto message = std::make_unique<PlatformMessage>(
153 "foo", std::move(bytes), response);
156 FlutterViewHandlePlatformMessage(::testing::_, response_id));
157 EXPECT_CALL(*response, CompleteEmpty());
158 holder->GetPlatformMessageHandler()->HandlePlatformMessage(
160 holder->GetPlatformMessageHandler()
161 ->InvokePlatformMessageEmptyResponseCallback(response_id);
static sk_sp< Effect > Create()
This is the Android owner of the core engine Shell.
A Mapping like NonOwnedMapping, but uses Free as its release proc.
sk_sp< const SkImage > image
void * malloc(size_t size)
TEST(DisplayListComplexity, EmptyDisplayList)
std::nullptr_t JavaLocalRef
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
RefPtr< T > AdoptRef(T *ptr)
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
#define EXPECT_TRUE(handle)