6#define FML_USED_ON_EMBEDDER
8#import <OCMock/OCMock.h>
9#import <XCTest/XCTest.h>
24 void OnPlatformViewCreated(std::unique_ptr<Surface>
surface)
override {}
25 void OnPlatformViewDestroyed()
override {}
26 void OnPlatformViewScheduleFrame()
override {}
27 void OnPlatformViewAddView(int64_t
view_id,
28 const ViewportMetrics& viewport_metrics,
29 AddViewCallback
callback)
override {}
30 void OnPlatformViewRemoveView(int64_t
view_id, RemoveViewCallback
callback)
override {}
31 void OnPlatformViewSendViewFocusEvent(
const ViewFocusEvent& event)
override {}
32 void OnPlatformViewSetNextFrameCallback(
const fml::closure& closure)
override {}
33 void OnPlatformViewSetViewportMetrics(int64_t
view_id,
const ViewportMetrics& metrics)
override {}
35 void OnPlatformViewDispatchPlatformMessage(std::unique_ptr<PlatformMessage>
message)
override {}
36 void OnPlatformViewDispatchPointerDataPacket(std::unique_ptr<PointerDataPacket> packet)
override {
39 return {.has_platform_view =
false};
41 void OnPlatformViewDispatchSemanticsAction(int64_t
view_id,
45 void OnPlatformViewSetSemanticsEnabled(
bool enabled)
override {}
46 void OnPlatformViewSetAccessibilityFeatures(int32_t flags)
override {}
47 void OnPlatformViewRegisterTexture(std::shared_ptr<Texture>
texture)
override {}
48 void OnPlatformViewUnregisterTexture(int64_t
texture_id)
override {}
49 void OnPlatformViewMarkTextureFrameAvailable(int64_t
texture_id)
override {}
52 std::unique_ptr<const fml::Mapping> snapshot_data,
53 std::unique_ptr<const fml::Mapping> snapshot_instructions)
override {
55 void LoadDartDeferredLibraryError(intptr_t loading_unit_id,
56 const std::string error_message,
57 bool transient)
override {}
58 void UpdateAssetResolverByType(std::unique_ptr<AssetResolver> updated_asset_resolver,
72std::unique_ptr<fml::WeakPtrFactory<flutter::PlatformView>>
weak_factory;
78 auto sync_switch = std::make_shared<fml::SyncSwitch>();
101- (
fml::WeakPtr<flutter::PlatformView>)platformViewReplacement {
105- (void)testCallsNotifyLowMemory {
108 id mockEngine = OCMPartialMock(
engine);
109 OCMStub([mockEngine notifyLowMemory]);
110 OCMStub([mockEngine platformView]).andReturn(
platform_view.get());
112 [engine setViewController:nil];
113 OCMVerify([mockEngine notifyLowMemory]);
114 OCMReject([mockEngine notifyLowMemory]);
116 XCTNSNotificationExpectation* memoryExpectation = [[XCTNSNotificationExpectation alloc]
117 initWithName:UIApplicationDidReceiveMemoryWarningNotification];
118 [[NSNotificationCenter defaultCenter]
119 postNotificationName:UIApplicationDidReceiveMemoryWarningNotification
121 [
self waitForExpectations:@[ memoryExpectation ] timeout:5.0];
122 OCMVerify([mockEngine notifyLowMemory]);
123 OCMReject([mockEngine notifyLowMemory]);
125 XCTNSNotificationExpectation* backgroundExpectation = [[XCTNSNotificationExpectation alloc]
126 initWithName:UIApplicationDidEnterBackgroundNotification];
127 [[NSNotificationCenter defaultCenter]
128 postNotificationName:UIApplicationDidEnterBackgroundNotification
130 [
self waitForExpectations:@[ backgroundExpectation ] timeout:5.0];
132 OCMVerify([mockEngine notifyLowMemory]);
AssetResolverType
Identifies the type of AssetResolver an instance is.
A Mapping like NonOwnedMapping, but uses Free as its release proc.
static void EnsureInitializedForCurrentThread()
fml::RefPtr< fml::TaskRunner > GetTaskRunner() const
static FML_EMBEDDER_ONLY MessageLoop & GetCurrent()
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
G_BEGIN_DECLS FlutterViewId view_id
FlutterDesktopBinaryReply callback
static void LoadDartDeferredLibrary(JNIEnv *env, jobject obj, jlong shell_holder, jint jLoadingUnitId, jobjectArray jSearchPaths)
std::function< void()> closure
impeller::ShaderType type