Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
b2eabf2
FIRAuthAppDelegateProxy: implementation updated to use GULAppDelegate…
maksymmalyhin Mar 26, 2019
4ab86de
GULAppDelegateSwizzler - make sure subclass name is unique.
maksymmalyhin Mar 27, 2019
1f1560a
GoogleUtilities: enable code coverage
maksymmalyhin Mar 27, 2019
f4a4638
Merge branch 'master'
maksymmalyhin Mar 27, 2019
9fcedce
GULAppDelegateSwizzler: Add support of remote notification methods
maksymmalyhin Mar 27, 2019
27c8b5b
GULAppDelegateSwizzler - tests for remote notification methods
maksymmalyhin Mar 27, 2019
dee28d3
Revert "FIRAuthAppDelegateProxy: implementation updated to use GULApp…
maksymmalyhin Mar 27, 2019
5821591
FIRMessaging: prepare to use GULAppDelegateSwizzler [WIP]
maksymmalyhin Mar 27, 2019
908b6ea
FIRMessagingRemoteNotificationsProxy - use GULAppDelegateSwizzler [WIP]
maksymmalyhin Mar 28, 2019
9e377d2
FIRMessagingRemoteNotificationsProxy - AppDelegate proxy - test only …
maksymmalyhin Mar 28, 2019
7861cde
FIRMessagingRemoteNotificationsProxy test only public API with no imp…
maksymmalyhin Mar 28, 2019
b7703ac
Cleanup
maksymmalyhin Mar 28, 2019
ad1da54
Cleanup
maksymmalyhin Mar 28, 2019
2bdf353
Merge branch 'master'
maksymmalyhin Mar 28, 2019
8eafece
Merge branch 'mm/messaging-tests'
maksymmalyhin Mar 28, 2019
e5d2ce8
Merge branch 'master'
maksymmalyhin Mar 29, 2019
86ff257
Cocoapods 1.6.1: Podfile supports only single post_install hook. It i…
maksymmalyhin Mar 29, 2019
79b7613
FIRMessagingRemoteNotificationsProxyTest: [GULAppDelegateSwizzler res…
maksymmalyhin Mar 29, 2019
98ffccb
FIRMessagingRemoteNotificationsProxy: app delegate missing methods te…
maksymmalyhin Mar 29, 2019
cd44395
GULAppDelegateSwizzler: don't swizzle invalid application delegate
maksymmalyhin Mar 29, 2019
3df4140
Cleanup
maksymmalyhin Mar 29, 2019
dcd0e10
Run ./scripts/check.sh
maksymmalyhin Mar 29, 2019
18381dd
Merge branch 'master'
maksymmalyhin Apr 1, 2019
dae75d9
GoogleUtilities/GULAppDelegateSwizzler - tvOS support
maksymmalyhin Apr 1, 2019
6dee8d3
style.sh generated changes
maksymmalyhin Apr 1, 2019
2726e7c
FirebaseMessaging - missing dependencies added
maksymmalyhin Apr 1, 2019
63fd1f5
FCM data channel messages - pass data to [FIRMessaging appDidReceiveM…
maksymmalyhin Apr 1, 2019
4a3fbb1
FIRMessagingRemoteNotificationsProxyTest - remove GULLoggerForceDebug()
maksymmalyhin Apr 2, 2019
b390f4f
GULAppDelegateSwizzler - add deprecated `application:didReceiveRemote…
maksymmalyhin Apr 2, 2019
236877d
Merge branch 'master'
maksymmalyhin Apr 3, 2019
3641d35
Merge branch 'master'
maksymmalyhin Apr 3, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
GoogleUtilities/GULAppDelegateSwizzler - tvOS support
  • Loading branch information
maksymmalyhin committed Apr 1, 2019
commit dae75d905c869f8e11476fdca9487b9ba99d58c7
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ - (void)testSwizzlingNonAppDelegate {
}

- (void)testSwizzledIncompleteAppDelegateRemoteNotificationMethod {
#if TARGET_OS_IOS
IncompleteAppDelegate *incompleteAppDelegate = [[IncompleteAppDelegate alloc] init];
[OCMStub([self.mockSharedApplication delegate]) andReturn:incompleteAppDelegate];
[self.proxy swizzleMethodsIfPossible];
Expand All @@ -205,6 +206,7 @@ - (void)testSwizzledIncompleteAppDelegateRemoteNotificationMethod {
didReceiveRemoteNotification:notification];

[self.mockMessaging verify];
#endif // TARGET_OS_IOS
}

- (void)testIncompleteAppDelegateRemoteNotificationWithFetchHandlerMethod {
Expand All @@ -215,8 +217,11 @@ - (void)testIncompleteAppDelegateRemoteNotificationWithFetchHandlerMethod {
SEL remoteNotificationWithFetchHandler =
@selector(application:didReceiveRemoteNotification:fetchCompletionHandler:);
XCTAssertFalse([incompleteAppDelegate respondsToSelector:remoteNotificationWithFetchHandler]);

#if TARGET_OS_IOS
SEL remoteNotification = @selector(application:didReceiveRemoteNotification:);
XCTAssertTrue([incompleteAppDelegate respondsToSelector:remoteNotification]);
#endif // TARGET_OS_IOS
}

- (void)testSwizzledAppDelegateRemoteNotificationMethods {
Expand Down
7 changes: 6 additions & 1 deletion Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ - (void)swizzleMethodsIfPossible {
}

- (void)unswizzleAllMethods {
[GULAppDelegateSwizzler unregisterAppDelegateInterceptorWithID:self.appDelegateInterceptorID];
if (self.appDelegateInterceptorID) {
[GULAppDelegateSwizzler unregisterAppDelegateInterceptorWithID:self.appDelegateInterceptorID];
}

for (NSString *className in self.swizzledSelectorsByClass) {
Class klass = NSClassFromString(className);
NSArray *selectorStrings = self.swizzledSelectorsByClass[className];
Expand Down Expand Up @@ -391,10 +394,12 @@ id getNamedPropertyFromObject(id object, NSString *propertyName, Class klass) {

#pragma mark - UIApplicationDelegate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tejasd Is this required that if I use GULAppDelegateSwizzler and I need to swizzle some methods under UIApplicationDelegate, my class must follow the protocol and implement the methods here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the current design, yes. If that's a blocker we can create our own protocol, say GULAppDelegate which can be platform agnostic.


#if TARGET_OS_IOS
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
[[FIRMessaging messaging] appDidReceiveMessage:userInfo];
}
#endif // TARGET_OS_IOS

- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
Expand Down
59 changes: 40 additions & 19 deletions GoogleUtilities/AppDelegateSwizzler/GULAppDelegateSwizzler.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#import "TargetConditionals.h"

#if TARGET_OS_IOS
#if TARGET_OS_IOS || TARGET_OS_TV

#import <GoogleUtilities/GULAppEnvironmentUtil.h>
#import <GoogleUtilities/GULLogger.h>
Expand Down Expand Up @@ -65,14 +65,19 @@ typedef void (*GULRealDidReceiveRemoteNotificationWithCompletionIMP)(
static char const *const kGULContinueUserActivityIMPKey = "GUL_continueUserActivityIMP";
static char const *const kGULHandleBackgroundSessionIMPKey = "GUL_handleBackgroundSessionIMP";
static char const *const kGULOpenURLOptionsIMPKey = "GUL_openURLOptionsIMP";

#if TARGET_OS_IOS
static char const *const kGULOpenURLOptionsSourceAnnotationsIMPKey =
"GUL_openURLSourceApplicationAnnotationIMP";
static char const *const kGULRealDidReceiveRemoteNotificationIMPKey =
"GUL_didReceiveRemoteNotificationIMP";
#endif // TARGET_OS_IOS

static char const *const kGULRealDidRegisterForRemoteNotificationsIMPKey =
"GUL_didRegisterForRemoteNotificationsIMP";
static char const *const kGULRealDidFailToRegisterForRemoteNotificationsIMPKey =
"GUL_didFailToRegisterForRemoteNotificationsIMP";
static char const *const kGULRealDidReceiveRemoteNotificationIMPKey =
"GUL_didReceiveRemoteNotificationIMP";

static char const *const kGULRealDidReceiveRemoteNotificationWithCompletionIMPKey =
"GUL_didReceiveRemoteNotificationWithCompletionIMP";

Expand Down Expand Up @@ -354,6 +359,7 @@ + (void)createSubclassWithObject:(id<UIApplicationDelegate>)anObject {
fromClass:realClass];
NSValue *continueUserActivityIMPPointer = [NSValue valueWithPointer:continueUserActivityIMP];

#if TARGET_OS_IOS
// For application:openURL:sourceApplication:annotation:
SEL openURLSourceApplicationAnnotationSEL = @selector(application:
openURL:sourceApplication:annotation:);
Expand All @@ -367,6 +373,19 @@ + (void)createSubclassWithObject:(id<UIApplicationDelegate>)anObject {
NSValue *openURLSourceAppAnnotationIMPPointer =
[NSValue valueWithPointer:openURLSourceApplicationAnnotationIMP];

// For application:didReceiveRemoteNotification:
SEL didReceiveRemoteNotificationSEL = @selector(application:didReceiveRemoteNotification:);
[GULAppDelegateSwizzler addInstanceMethodWithSelector:didReceiveRemoteNotificationSEL
fromClass:[GULAppDelegateSwizzler class]
toClass:appDelegateSubClass];
GULRealDidReceiveRemoteNotificationIMP didReceiveRemoteNotificationIMP =
(GULRealDidReceiveRemoteNotificationIMP)
[GULAppDelegateSwizzler implementationOfMethodSelector:didReceiveRemoteNotificationSEL
fromClass:realClass];
NSValue *didReceiveRemoteNotificationIMPPointer =
[NSValue valueWithPointer:didReceiveRemoteNotificationIMP];
#endif // TARGET_OS_IOS

// For application:handleEventsForBackgroundURLSession:completionHandler:
SEL handleEventsForBackgroundURLSessionSEL = @selector(application:
handleEventsForBackgroundURLSession:completionHandler:);
Expand Down Expand Up @@ -430,18 +449,6 @@ + (void)createSubclassWithObject:(id<UIApplicationDelegate>)anObject {
[NSValue valueWithPointer:didReceiveRemoteNotificationWithCompletionIMP];
}

// For application:didReceiveRemoteNotification:
SEL didReceiveRemoteNotificationSEL = @selector(application:didReceiveRemoteNotification:);
[GULAppDelegateSwizzler addInstanceMethodWithSelector:didReceiveRemoteNotificationSEL
fromClass:[GULAppDelegateSwizzler class]
toClass:appDelegateSubClass];
GULRealDidReceiveRemoteNotificationIMP didReceiveRemoteNotificationIMP =
(GULRealDidReceiveRemoteNotificationIMP)
[GULAppDelegateSwizzler implementationOfMethodSelector:didReceiveRemoteNotificationSEL
fromClass:realClass];
NSValue *didReceiveRemoteNotificationIMPPointer =
[NSValue valueWithPointer:didReceiveRemoteNotificationIMP];

// Override the description too so the custom class name will not show up.
[GULAppDelegateSwizzler addInstanceMethodWithDestinationSelector:@selector(description)
withImplementationFromSourceSelector:@selector(fakeDescription)
Expand All @@ -457,8 +464,16 @@ + (void)createSubclassWithObject:(id<UIApplicationDelegate>)anObject {
objc_setAssociatedObject(anObject, &kGULOpenURLOptionsIMPKey, openURLOptionsIMPPointer,
OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

#if TARGET_OS_IOS
objc_setAssociatedObject(anObject, &kGULOpenURLOptionsSourceAnnotationsIMPKey,
openURLSourceAppAnnotationIMPPointer, OBJC_ASSOCIATION_RETAIN_NONATOMIC);

objc_setAssociatedObject(anObject, &kGULRealDidReceiveRemoteNotificationIMPKey,
didReceiveRemoteNotificationIMPPointer,
OBJC_ASSOCIATION_RETAIN_NONATOMIC);
#endif // TARGET_OS_IOS

objc_setAssociatedObject(anObject, &kGULRealDidRegisterForRemoteNotificationsIMPKey,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tejasd I used the same way of storing the original implementations as for the old methods. But it looks like it can be optimized to avoid boilerplate (e.g. store the implementations in a dictionary).

Also, I think, some repeated code may be moved to separate methods.

@tejasd What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, that's definitely an option! Feel free to refactor that in a separate PR :)

didRegisterForRemoteNotificationsIMPPointer,
OBJC_ASSOCIATION_RETAIN_NONATOMIC);
Expand All @@ -468,9 +483,7 @@ + (void)createSubclassWithObject:(id<UIApplicationDelegate>)anObject {
objc_setAssociatedObject(anObject, &kGULRealDidReceiveRemoteNotificationWithCompletionIMPKey,
didReceiveRemoteNotificationWithCompletionIMPPointer,
OBJC_ASSOCIATION_RETAIN_NONATOMIC);
objc_setAssociatedObject(anObject, &kGULRealDidReceiveRemoteNotificationIMPKey,
didReceiveRemoteNotificationIMPPointer,
OBJC_ASSOCIATION_RETAIN_NONATOMIC);

objc_setAssociatedObject(anObject, &kGULRealClassKey, realClass,
OBJC_ASSOCIATION_RETAIN_NONATOMIC);

Expand Down Expand Up @@ -652,6 +665,8 @@ - (BOOL)application:(UIApplication *)application
return returnedValue;
}

#if TARGET_OS_IOS

- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
Expand Down Expand Up @@ -682,6 +697,8 @@ - (BOOL)application:(UIApplication *)application
return returnedValue;
}

#endif // TARGET_OS_IOS

#pragma mark - [Donor Methods] Network overridden handler methods

#pragma clang diagnostic push
Expand Down Expand Up @@ -812,6 +829,8 @@ - (void)application:(UIApplication *)application
}
}

#if TARGET_OS_IOS

- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
NSValue *didReceiveRemoteNotificationIMPPointer =
Expand All @@ -833,6 +852,8 @@ - (void)application:(UIApplication *)application
}
}

#endif // TARGET_OS_IOS

+ (void)proxyAppDelegate:(id<UIApplicationDelegate>)appDelegate {
if (![appDelegate conformsToProtocol:@protocol(UIApplicationDelegate)]) {
GULLogNotice(
Expand Down Expand Up @@ -911,4 +932,4 @@ + (void)resetProxyOriginalDelegateOnceToken {

@end

#endif // TARGET_OS_IOS
#endif // TARGET_OS_IOS || TARGET_OS_TV
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; };
6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; };
9A414672225259F900B08D77 /* GULAppDelegateSwizzlerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = EFBE67F92101401100E756A7 /* GULAppDelegateSwizzlerTest.m */; };
9A7C37C2224BD9C600033B0D /* GULAppDelegateSwizzlerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = EFBE67F92101401100E756A7 /* GULAppDelegateSwizzlerTest.m */; };
DE5CF98E20F686310063FFDD /* GULAppEnvironmentUtilTest.m in Sources */ = {isa = PBXBuildFile; fileRef = DE5CF98C20F686290063FFDD /* GULAppEnvironmentUtilTest.m */; };
DE84BBC421D7EC900048A176 /* GULUserDefaultsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DE84BBC321D7EC900048A176 /* GULUserDefaultsTests.m */; };
Expand Down Expand Up @@ -93,7 +94,7 @@
6003F5AE195388D20070C39A /* Tests_iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests_iOS.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
6003F5AF195388D20070C39A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
6003F5B7195388D20070C39A /* Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Tests-Info.plist"; sourceTree = "<group>"; };
7BEA793625C8DE7C8EC60006 /* GoogleUtilities.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = GoogleUtilities.podspec; path = ../GoogleUtilities.podspec; sourceTree = "<group>"; };
7BEA793625C8DE7C8EC60006 /* GoogleUtilities.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = GoogleUtilities.podspec; path = ../../GoogleUtilities.podspec; sourceTree = "<group>"; };
DE5CF98C20F686290063FFDD /* GULAppEnvironmentUtilTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GULAppEnvironmentUtilTest.m; sourceTree = "<group>"; };
DE84BBC321D7EC900048A176 /* GULUserDefaultsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GULUserDefaultsTests.m; sourceTree = "<group>"; };
DEC977D320F68C3300014E20 /* GULReachabilityCheckerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GULReachabilityCheckerTest.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -671,6 +672,7 @@
DEC9786A20F6D66300014E20 /* GULMutableDictionaryTest.m in Sources */,
DE84BBC621D7EC900048A176 /* GULUserDefaultsTests.m in Sources */,
DEC9786C20F6D66700014E20 /* GULReachabilityCheckerTest.m in Sources */,
9A414672225259F900B08D77 /* GULAppDelegateSwizzlerTest.m in Sources */,
DEC9786820F6D65B00014E20 /* GULLoggerTest.m in Sources */,
DEC9786D20F6D66B00014E20 /* GULAppEnvironmentUtilTest.m in Sources */,
);
Expand Down Expand Up @@ -1101,6 +1103,7 @@
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../Reachability",
"$(SRCROOT)/../AppDelegateSwizzler/Internal",
);
INFOPLIST_FILE = "Tests/Tests-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
Expand Down Expand Up @@ -1131,6 +1134,7 @@
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../Reachability",
"$(SRCROOT)/../AppDelegateSwizzler/Internal",
);
INFOPLIST_FILE = "Tests/Tests-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
Expand Down
20 changes: 10 additions & 10 deletions GoogleUtilities/Example/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ target 'Example_iOS' do
inherit! :search_paths
pod 'OCMock'
end

post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.name != 'Release'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'GUL_UNSWIZZLING_ENABLED=1', 'GUL_APP_DELEGATE_TESTING=1']
end
end
end
end
end

target 'Example_macOS' do
Expand All @@ -42,3 +32,13 @@ target 'Example_tvOS' do
pod 'OCMock'
end
end

post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.name != 'Release'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'GUL_UNSWIZZLING_ENABLED=1', 'GUL_APP_DELEGATE_TESTING=1']
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,13 @@ - (void)application:(UIApplication *)application
self.failToRegisterForRemoteNotificationsError = error;
}

#if TARGET_OS_IOS
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
self.application = application;
self.remoteNotification = userInfo;
}
#endif // TARGET_OS_IOS

- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
Expand Down Expand Up @@ -207,13 +209,15 @@ - (BOOL)application:(UIApplication *)app
return YES;
}

#if TARGET_OS_IOS
- (BOOL)application:(UIApplication *)application
openURL:(nonnull NSURL *)url
sourceApplication:(nullable NSString *)sourceApplication
annotation:(nonnull id)annotation {
_URLForIOS8 = [url copy];
return YES;
}
#endif // TARGET_OS_IOS

#if SDK_HAS_USERACTIVITY

Expand Down Expand Up @@ -279,8 +283,14 @@ - (void)testProxyAppDelegate {
XCTAssertEqual(sizeBefore, sizeAfter);

// After being proxied, it should be able to respond to the required method selector.
#if TARGET_OS_IOS
XCTAssertTrue([realAppDelegate
respondsToSelector:@selector(application:openURL:sourceApplication:annotation:)]);

XCTAssertTrue([realAppDelegate respondsToSelector:@selector(application:
didReceiveRemoteNotification:)]);
#endif // TARGET_OS_IOS

XCTAssertTrue([realAppDelegate respondsToSelector:@selector(application:
continueUserActivity:restorationHandler:)]);
XCTAssertTrue([realAppDelegate respondsToSelector:@selector(application:openURL:options:)]);
Expand All @@ -294,8 +304,7 @@ - (void)testProxyAppDelegate {
XCTAssertTrue([realAppDelegate
respondsToSelector:@selector(application:
didReceiveRemoteNotification:fetchCompletionHandler:)]);
XCTAssertTrue([realAppDelegate respondsToSelector:@selector(application:
didReceiveRemoteNotification:)]);

// Make sure that the class has changed.
XCTAssertNotEqualObjects([realAppDelegate class], realAppDelegateClassBefore);

Expand Down Expand Up @@ -511,6 +520,7 @@ - (void)testResultOfApplicationOpenURLOptionsIsORed {
XCTAssertTrue(shouldOpen);
}

#if TARGET_OS_IOS
/** Tests that application:openURL:sourceApplication:annotation: is invoked on the interceptors if
* it exists.
*/
Expand Down Expand Up @@ -593,6 +603,7 @@ - (void)testApplicationOpenURLSourceApplicationAnnotationResultIsORed {
// The result is YES if one of the interceptors returns YES.
XCTAssertTrue(shouldOpen);
}
#endif // TARGET_OS_IOS

/** Tests that application:handleEventsForBackgroundURLSession:completionHandler: is invoked on the
* interceptors if it exists.
Expand Down Expand Up @@ -753,6 +764,7 @@ - (void)testApplicationDidFailToRegisterForRemoteNotificationsIsInvokedOnInterce
}

- (void)testApplicationDidReceiveRemoteNotificationIsInvokedOnInterceptors {
#if TARGET_OS_IOS
NSDictionary *notification = @{};
UIApplication *application = [UIApplication sharedApplication];

Expand All @@ -773,6 +785,7 @@ - (void)testApplicationDidReceiveRemoteNotificationIsInvokedOnInterceptors {

XCTAssertEqual(testAppDelegate.application, application);
XCTAssertEqual(testAppDelegate.remoteNotification, notification);
#endif // TARGET_OS_IOS
}

- (void)testApplicationDidReceiveRemoteNotificationWithCompletionIsInvokedOnInterceptors {
Expand Down