6#define FML_USED_ON_EMBEDDER
8#import <OCMock/OCMock.h>
9#import <XCTest/XCTest.h>
11#include "flutter/fml/message_loop.h"
12#import "flutter/shell/platform/darwin/common/framework/Headers/FlutterMacros.h"
13#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine_Internal.h"
14#import "flutter/shell/platform/darwin/ios/platform_view_ios.h"
23 void OnPlatformViewCreated(std::unique_ptr<Surface>
surface)
override {}
24 void OnPlatformViewDestroyed()
override {}
25 void OnPlatformViewScheduleFrame()
override {}
26 void OnPlatformViewAddView(int64_t view_id,
27 const ViewportMetrics& viewport_metrics,
28 AddViewCallback
callback)
override {}
29 void OnPlatformViewRemoveView(int64_t view_id, RemoveViewCallback
callback)
override {}
30 void OnPlatformViewSetNextFrameCallback(
const fml::closure& closure)
override {}
31 void OnPlatformViewSetViewportMetrics(int64_t view_id,
const ViewportMetrics& metrics)
override {}
33 void OnPlatformViewDispatchPlatformMessage(std::unique_ptr<PlatformMessage>
message)
override {}
34 void OnPlatformViewDispatchPointerDataPacket(std::unique_ptr<PointerDataPacket> packet)
override {
36 void OnPlatformViewDispatchSemanticsAction(int32_t
id,
39 void OnPlatformViewSetSemanticsEnabled(
bool enabled)
override {}
40 void OnPlatformViewSetAccessibilityFeatures(int32_t
flags)
override {}
41 void OnPlatformViewRegisterTexture(std::shared_ptr<Texture>
texture)
override {}
42 void OnPlatformViewUnregisterTexture(int64_t
texture_id)
override {}
43 void OnPlatformViewMarkTextureFrameAvailable(int64_t
texture_id)
override {}
46 std::unique_ptr<const fml::Mapping> snapshot_data,
47 std::unique_ptr<const fml::Mapping> snapshot_instructions)
override {
49 void LoadDartDeferredLibraryError(intptr_t loading_unit_id,
50 const std::string error_message,
51 bool transient)
override {}
52 void UpdateAssetResolverByType(std::unique_ptr<AssetResolver> updated_asset_resolver,
66std::unique_ptr<fml::WeakPtrFactory<flutter::PlatformView>>
weak_factory;
72 auto sync_switch = std::make_shared<fml::SyncSwitch>();
95- (
fml::WeakPtr<flutter::PlatformView>)platformViewReplacement {
113 auto sync_switch = std::make_shared<fml::SyncSwitch>();
119 auto msaa_4x_platform_view = std::make_unique<flutter::PlatformViewIOS>(
127 XCTAssertEqual(msaa_4x_platform_view->GetIosContext()->GetMsaaSampleCount(),
134 id mockEngine = OCMPartialMock(
engine);
135 OCMStub([mockEngine notifyLowMemory]);
136 OCMStub([mockEngine iosPlatformView]).andReturn(
platform_view.get());
139 OCMVerify([mockEngine notifyLowMemory]);
140 OCMReject([mockEngine notifyLowMemory]);
142 XCTNSNotificationExpectation* memoryExpectation = [[XCTNSNotificationExpectation alloc]
143 initWithName:UIApplicationDidReceiveMemoryWarningNotification];
144 [[NSNotificationCenter defaultCenter]
145 postNotificationName:UIApplicationDidReceiveMemoryWarningNotification
147 [
self waitForExpectations:@[ memoryExpectation ] timeout:5.0];
148 OCMVerify([mockEngine notifyLowMemory]);
149 OCMReject([mockEngine notifyLowMemory]);
151 XCTNSNotificationExpectation* backgroundExpectation = [[XCTNSNotificationExpectation alloc]
152 initWithName:UIApplicationDidEnterBackgroundNotification];
153 [[NSNotificationCenter defaultCenter]
154 postNotificationName:UIApplicationDidEnterBackgroundNotification
156 [
self waitForExpectations:@[ backgroundExpectation ] timeout:5.0];
158 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()
FlutterSemanticsFlag flags
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
void setViewController:(FlutterViewController *viewController)
static void LoadDartDeferredLibrary(JNIEnv *env, jobject obj, jlong shell_holder, jint jLoadingUnitId, jobjectArray jSearchPaths)
std::function< void()> closure