5#import <OCMock/OCMock.h>
6#import <XCTest/XCTest.h>
8#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterAppDelegate.h"
9#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterEngine.h"
10#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h"
11#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate_Test.h"
12#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine_Test.h"
41 self.mockNavigationChannel = navigationChannel;
44 OCMStub([
engine navigationChannel]).andReturn(navigationChannel);
57 [
self.mockMainBundle stopMocking];
62 OCMStub([
self.mockMainBundle objectForInfoDictionaryKey:
@"FlutterDeepLinkingEnabled"])
66 [
self.appDelegate application:[UIApplication sharedApplication]
67 openURL:[NSURL URLWithString:@"http://myApp/custom/route?query=test"]
70 OCMVerify([
self.mockNavigationChannel
71 invokeMethod:
@"pushRouteInformation"
72 arguments:@{
@"location" :
@"http://myApp/custom/route?query=test"}]);
76 OCMStub([
self.mockMainBundle objectForInfoDictionaryKey:
@"FlutterDeepLinkingEnabled"])
80 [
self.appDelegate application:[UIApplication sharedApplication]
81 openURL:[NSURL URLWithString:@"http://myApp/custom/route?query=test"]
84 OCMReject([
self.mockNavigationChannel invokeMethod:OCMOCK_ANY arguments:OCMOCK_ANY]);
88 OCMStub([
self.mockMainBundle objectForInfoDictionaryKey:
@"FlutterDeepLinkingEnabled"])
92 [
self.appDelegate application:[UIApplication sharedApplication]
93 openURL:[NSURL URLWithString:@"http://myApp/custom/route?query=test"]
96 OCMReject([
self.mockNavigationChannel invokeMethod:OCMOCK_ANY arguments:OCMOCK_ANY]);
100 OCMStub([
self.mockMainBundle objectForInfoDictionaryKey:
@"FlutterDeepLinkingEnabled"])
104 application:[UIApplication sharedApplication]
105 openURL:[NSURL URLWithString:@"http://myApp/custom/route?query=test#fragment"]
108 OCMVerify([
self.mockNavigationChannel
109 invokeMethod:
@"pushRouteInformation"
110 arguments:@{
@"location" :
@"http://myApp/custom/route?query=test#fragment"}]);
114 OCMStub([
self.mockMainBundle objectForInfoDictionaryKey:
@"FlutterDeepLinkingEnabled"])
118 [
self.appDelegate application:[UIApplication sharedApplication]
119 openURL:[NSURL URLWithString:@"http://myApp/custom/route#fragment"]
122 OCMVerify([
self.mockNavigationChannel
123 invokeMethod:
@"pushRouteInformation"
124 arguments:@{
@"location" :
@"http://myApp/custom/route#fragment"}]);
128 __weak UIWindow* weakWindow;
130 id mockWindow = OCMClassMock([UIWindow
class]);
133 weakWindow = mockWindow;
134 XCTAssertNotNil(weakWindow);
135 [mockWindow stopMocking];
140 XCTAssertNil(weakWindow);
143#pragma mark - Deep linking
146 OCMStub([
self.mockMainBundle objectForInfoDictionaryKey:
@"FlutterDeepLinkingEnabled"])
149 NSUserActivity* userActivity = [[NSUserActivity alloc] initWithActivityType:@"com.example.test"];
150 userActivity.webpageURL = [NSURL URLWithString:@"http://myApp/custom/route?query=test"];
152 application:[UIApplication sharedApplication]
153 continueUserActivity:userActivity
154 restorationHandler:^(NSArray<id<UIUserActivityRestoring>>* __nullable restorableObjects){
157 OCMVerify([
self.mockNavigationChannel
158 invokeMethod:
@"pushRouteInformation"
159 arguments:@{
@"location" :
@"http://myApp/custom/route?query=test"}]);
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
void testUniversalLinkPushRouteInformation()
id mockEngineFirstFrameCallback
FlutterAppDelegate * appDelegate
void testLaunchUrlWithQueryParameterAndFragment()
void testLaunchUrlWithDeepLinkingNotSet()
void testReleasesWindowOnDealloc()
void testLaunchUrlWithDeepLinkingDisabled()
void testLaunchUrlWithFragmentNoQueryParameter()
FlutterAppLifeCycleProvider UIWindow * window
FlutterViewController *(^ rootFlutterViewControllerGetter)(void)
FlutterViewController * viewController