Skip to content

Commit

Permalink
Enabling NSURLSession & AFNetworking tests for tvOS
Browse files Browse the repository at this point in the history
- Enable NSURLSession and AFNetworking-based tests for the tvOS target
- Disable tests not compatible with tvOS (because of deprecated methods used in those tests)
  • Loading branch information
AliSoftware committed Oct 31, 2015
1 parent 0192751 commit d8cd6fc
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 7 deletions.
12 changes: 8 additions & 4 deletions OHHTTPStubs/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,26 @@ source 'https://github.com/CocoaPods/Specs.git'
xcodeproj 'OHHTTPStubs.xcodeproj'
inhibit_all_warnings!

def pod_afnetworking
pod 'AFNetworking', :git => 'https://github.com/AFNetworking/AFNetworking.git', :branch => '3_0_0_branch'
end

target 'OHHTTPStubs iOS Lib Tests' do
platform :ios, '7.0'
pod 'AFNetworking', :git => 'https://github.com/AFNetworking/AFNetworking.git', :branch => '3_0_0_branch'
pod_afnetworking
end

target 'OHHTTPStubs iOS Fmk Tests' do
platform :ios, '8.0'
pod 'AFNetworking', :git => 'https://github.com/AFNetworking/AFNetworking.git', :branch => '3_0_0_branch'
pod_afnetworking
end

target 'OHHTTPStubs Mac Tests' do
platform :osx, '10.9'
pod 'AFNetworking', :git => 'https://github.com/AFNetworking/AFNetworking.git', :branch => '3_0_0_branch'
pod_afnetworking
end

target 'OHHTTPStubs tvOS Fmk Tests' do
platform :tvos, '9.0'
pod 'AFNetworking', :git => 'https://github.com/AFNetworking/AFNetworking.git', :branch => '3_0_0_branch'
pod_afnetworking
end
5 changes: 4 additions & 1 deletion OHHTTPStubs/UnitTests/Test Suites/AFNetworkingTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
***********************************************************************************/

#import <XCTest/XCTest.h>
#import <Availability.h>

#if OHHTTPSTUBS_USE_STATIC_LIBRARY
#import "OHHTTPStubs.h"
Expand Down Expand Up @@ -170,7 +171,9 @@ -(void)test_AFHTTPRequestOperation_redirect
// Compile this only if SDK version (…MAX_ALLOWED) is iOS7+/10.9+ because NSURLSession is a class only known starting these SDKs
// (this code won't compile if we use an eariler SDKs, like when building with Xcode4)
#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000) \
|| (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090)
|| (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090) \
|| (defined(__TV_OS_VERSION_MIN_REQUIRED) || defined(__WATCH_OS_VERSION_MIN_REQUIRED))


#import "AFHTTPSessionManager.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
*
***********************************************************************************/

#import <Availability.h>
// tvOS & WatchOS deprecate use of NSURLConnection but these tests are based on it
#if (!defined(__TV_OS_VERSION_MIN_REQUIRED) && !defined(__WATCH_OS_VERSION_MIN_REQUIRED))

#import <XCTest/XCTest.h>

#if OHHTTPSTUBS_USE_STATIC_LIBRARY
Expand Down Expand Up @@ -397,3 +401,5 @@ - (void)test_NSURLConnection_redirected
}

@end

#endif
6 changes: 6 additions & 0 deletions OHHTTPStubs/UnitTests/Test Suites/NSURLConnectionTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
*
***********************************************************************************/

#import <Availability.h>
// tvOS & WatchOS deprecate use of NSURLConnection but these tests are based on it
#if (!defined(__TV_OS_VERSION_MIN_REQUIRED) && !defined(__WATCH_OS_VERSION_MIN_REQUIRED))

#import <XCTest/XCTest.h>

#if OHHTTPSTUBS_USE_STATIC_LIBRARY
Expand Down Expand Up @@ -190,3 +194,5 @@ -(void)test_NSURLConnection_sendMultipleAsyncronousRequests_parallelQueue


@end

#endif
5 changes: 3 additions & 2 deletions OHHTTPStubs/UnitTests/Test Suites/NSURLSessionTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@
*
***********************************************************************************/


#import <Availability.h>
// Compile this only if SDK version (…MAX_ALLOWED) is iOS7+/10.9+ because NSURLSession is a class only known starting these SDKs
// (this code won't compile if we use an eariler SDKs, like when building with Xcode4)
#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000) \
|| (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090)
|| (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090) \
|| (defined(__TV_OS_VERSION_MIN_REQUIRED) || defined(__WATCH_OS_VERSION_MIN_REQUIRED))

#import <XCTest/XCTest.h>

Expand Down
6 changes: 6 additions & 0 deletions OHHTTPStubs/UnitTests/Test Suites/NilValuesTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
*
***********************************************************************************/

#import <Availability.h>
// tvOS & WatchOS deprecate use of NSURLConnection but these tests are based on it
#if (!defined(__TV_OS_VERSION_MIN_REQUIRED) && !defined(__WATCH_OS_VERSION_MIN_REQUIRED))

#import <XCTest/XCTest.h>

#if OHHTTPSTUBS_USE_STATIC_LIBRARY
Expand Down Expand Up @@ -272,3 +276,5 @@ - (void)test_NilURLAndCookieHandlingDisabled
}

@end

#endif
5 changes: 5 additions & 0 deletions OHHTTPStubs/UnitTests/Test Suites/TimingTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
*
***********************************************************************************/

#import <Availability.h>
// tvOS & WatchOS deprecate use of NSURLConnection but these tests are based on it
#if (!defined(__TV_OS_VERSION_MIN_REQUIRED) && !defined(__WATCH_OS_VERSION_MIN_REQUIRED))

#import <XCTest/XCTest.h>

Expand Down Expand Up @@ -165,3 +168,5 @@ -(void)test_VeryLongData_RequestTime1_ResponseTime0
}

@end

#endif

0 comments on commit d8cd6fc

Please sign in to comment.