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 {
38 void OnPlatformViewDispatchSemanticsAction(int64_t
view_id,
42 void OnPlatformViewSetSemanticsEnabled(
bool enabled)
override {}
43 void OnPlatformViewSetAccessibilityFeatures(int32_t flags)
override {}
44 void OnPlatformViewRegisterTexture(std::shared_ptr<Texture>
texture)
override {}
45 void OnPlatformViewUnregisterTexture(int64_t
texture_id)
override {}
46 void OnPlatformViewMarkTextureFrameAvailable(int64_t
texture_id)
override {}
49 std::unique_ptr<const fml::Mapping> snapshot_data,
50 std::unique_ptr<const fml::Mapping> snapshot_instructions)
override {
52 void LoadDartDeferredLibraryError(intptr_t loading_unit_id,
53 const std::string error_message,
54 bool transient)
override {}
55 void UpdateAssetResolverByType(std::unique_ptr<AssetResolver> updated_asset_resolver,
69std::unique_ptr<fml::WeakPtrFactory<flutter::PlatformView>>
weak_factory;
75 auto sync_switch = std::make_shared<fml::SyncSwitch>();
98- (
fml::WeakPtr<flutter::PlatformView>)platformViewReplacement {
102- (void)testCallsNotifyLowMemory {
105 id mockEngine = OCMPartialMock(
engine);
106 OCMStub([mockEngine notifyLowMemory]);
107 OCMStub([mockEngine platformView]).andReturn(
platform_view.get());
109 [engine setViewController:nil];
110 OCMVerify([mockEngine notifyLowMemory]);
111 OCMReject([mockEngine notifyLowMemory]);
113 XCTNSNotificationExpectation* memoryExpectation = [[XCTNSNotificationExpectation alloc]
114 initWithName:UIApplicationDidReceiveMemoryWarningNotification];
115 [[NSNotificationCenter defaultCenter]
116 postNotificationName:UIApplicationDidReceiveMemoryWarningNotification
118 [
self waitForExpectations:@[ memoryExpectation ] timeout:5.0];
119 OCMVerify([mockEngine notifyLowMemory]);
120 OCMReject([mockEngine notifyLowMemory]);
122 XCTNSNotificationExpectation* backgroundExpectation = [[XCTNSNotificationExpectation alloc]
123 initWithName:UIApplicationDidEnterBackgroundNotification];
124 [[NSNotificationCenter defaultCenter]
125 postNotificationName:UIApplicationDidEnterBackgroundNotification
127 [
self waitForExpectations:@[ backgroundExpectation ] timeout:5.0];
129 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 GBytes * message
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