diff options
author | Xiangtian Dai <xiangtian@google.com> | 2017-08-28 14:38:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-28 14:38:58 -0700 |
commit | 5d984b0611ee74c760bdd4c24c27379ace454c7b (patch) | |
tree | bfb869dbcf13f25328160c448b5e2a98e20e7729 /Example | |
parent | 2a22a88141174199204356cb04fc51948ff57e5e (diff) |
Silences compiler warnings in the Auth test file from #207 . (#219)
Diffstat (limited to 'Example')
-rw-r--r-- | Example/Auth/Tests/FIRAuthAppDelegateProxyTests.m | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/Example/Auth/Tests/FIRAuthAppDelegateProxyTests.m b/Example/Auth/Tests/FIRAuthAppDelegateProxyTests.m index b65de93..d877182 100644 --- a/Example/Auth/Tests/FIRAuthAppDelegateProxyTests.m +++ b/Example/Auth/Tests/FIRAuthAppDelegateProxyTests.m @@ -15,6 +15,7 @@ */ #import <XCTest/XCTest.h> +#import <UIKit/UIKit.h> #import <objc/runtime.h> @@ -161,6 +162,11 @@ NS_ASSUME_NONNULL_BEGIN @brief The fake URL for testing. */ NSURL *_url; + + /** @var _isIOS9orLater + @brief Whether the OS version is iOS 9 or later. + */ + BOOL _isIOS9orLater; } - (void)setUp { @@ -169,6 +175,7 @@ NS_ASSUME_NONNULL_BEGIN _deviceToken = [@"asdf" dataUsingEncoding:NSUTF8StringEncoding]; _notification = @{ @"zxcv" : @1234 }; _url = [NSURL URLWithString:@"https://abc.def/ghi"]; + _isIOS9orLater = [[[UIDevice currentDevice] systemVersion] doubleValue] >= 9.0; } - (void)tearDown { @@ -235,6 +242,10 @@ NS_ASSUME_NONNULL_BEGIN imp_removeBlock(method_setImplementation(method, originalImplementation)); } +// Deprecated methods are call intentionally in tests to verify behaviors on older iOS systems. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + /** @fn testEmptyDelegateOneHandler @brief Tests that the proxy works against an empty @c UIApplicationDelegate for one handler. */ @@ -254,7 +265,7 @@ NS_ASSUME_NONNULL_BEGIN @selector(application:didReceiveRemoteNotification:fetchCompletionHandler:)]); XCTAssertFalse([delegate respondsToSelector: @selector(application:didReceiveRemoteNotification:)]); - if (&UIApplicationOpenURLOptionsAnnotationKey) { // iOS 9+ + if (_isIOS9orLater) { XCTAssertTrue([delegate respondsToSelector:@selector(application:openURL:options:)]); XCTAssertFalse([delegate respondsToSelector: @selector(application:openURL:sourceApplication:annotation:)]); @@ -291,7 +302,7 @@ NS_ASSUME_NONNULL_BEGIN // Verify one of the `application:openURL:...` methods is handled. OCMExpect([mockHandler canHandleURL:_url]).andReturn(YES); - if (&UIApplicationOpenURLOptionsAnnotationKey) { // iOS 9+ + if (_isIOS9orLater) { // Verify `application:openURL:options:` is handled. XCTAssertTrue([delegate application:_mockApplication openURL:_url options:@{}]); } else { @@ -317,7 +328,7 @@ NS_ASSUME_NONNULL_BEGIN fetchCompletionHandler:^(UIBackgroundFetchResult result) { XCTFail(@"Should not call completion handler."); }]; - if (&UIApplicationOpenURLOptionsAnnotationKey) { // iOS 9+ + if (_isIOS9orLater) { XCTAssertFalse([delegate application:_mockApplication openURL:_url options:@{}]); } else { XCTAssertFalse([delegate application:_mockApplication @@ -338,7 +349,7 @@ NS_ASSUME_NONNULL_BEGIN fetchCompletionHandler:^(UIBackgroundFetchResult result) { XCTFail(@"Should not call completion handler."); }]; - if (&UIApplicationOpenURLOptionsAnnotationKey) { // iOS 9+ + if (_isIOS9orLater) { XCTAssertFalse([delegate application:_mockApplication openURL:_url options:@{}]); } else { XCTAssertFalse([delegate application:_mockApplication @@ -498,7 +509,7 @@ NS_ASSUME_NONNULL_BEGIN XCTAssertFalse([delegate respondsToSelector: @selector(application:didReceiveRemoteNotification:)]); XCTAssertTrue([delegate respondsToSelector:@selector(application:openURL:options:)]); - if (&UIApplicationOpenURLOptionsAnnotationKey) { // iOS 9+ + if (_isIOS9orLater) { XCTAssertFalse([delegate respondsToSelector: @selector(application:openURL:sourceApplication:annotation:)]); } else { @@ -536,7 +547,7 @@ NS_ASSUME_NONNULL_BEGIN // Verify one of the `application:openURL:...` methods is handled. OCMExpect([mockHandler canHandleURL:_url]).andReturn(YES); - if (&UIApplicationOpenURLOptionsAnnotationKey) { // iOS 9+ + if (_isIOS9orLater) { // Verify `application:openURL:options:` is handled. XCTAssertTrue([delegate application:_mockApplication openURL:_url options:@{}]); } else { @@ -671,6 +682,8 @@ NS_ASSUME_NONNULL_BEGIN delegate.urlOpened = nil; } +#pragma clang diagnostic pop // ignored "-Wdeprecated-declarations" + @end NS_ASSUME_NONNULL_END |