@@ -1710,57 +1710,47 @@ - (void)testDelayedSyncAuthCancelFetchWithCallback_WithoutFetcherService {
1710
1710
}
1711
1711
1712
1712
- (void )testImmediateSyncAuthCancelFetchWithCallback {
1713
- XCTSkip (@" Has failed on CI, but not locally, needs investigation." );
1714
1713
[self internalCancelFetchWithCallback: 0 authorizer: [TestAuthorizer syncAuthorizer ]];
1715
1714
}
1716
1715
1717
1716
- (void )testImmediateSyncAuthCancelFetchWithCallback_WithoutFetcherService {
1718
1717
_fetcherService = nil ;
1719
- XCTSkip (@" Has failed on CI, but not locally, needs investigation." );
1720
1718
[self internalCancelFetchWithCallback: 0 authorizer: [TestAuthorizer syncAuthorizer ]];
1721
1719
}
1722
1720
1723
1721
- (void )testDelayedAsyncAuthCancelFetchWithCallback {
1724
- XCTSkip (@" Currently fails, needs fixing." );
1725
1722
[self internalCancelFetchWithCallback: 1 authorizer: [TestAuthorizer asyncAuthorizer ]];
1726
1723
}
1727
1724
1728
1725
- (void )testDelayedAsyncAuthCancelFetchWithCallback_WithoutFetcherService {
1729
1726
_fetcherService = nil ;
1730
- XCTSkip (@" Currently fails, needs fixing." );
1731
1727
[self internalCancelFetchWithCallback: 1 authorizer: [TestAuthorizer asyncAuthorizer ]];
1732
1728
}
1733
1729
1734
1730
- (void )testImmediateAsyncAuthCancelFetchWithCallback {
1735
- XCTSkip (@" Currently fails, needs fixing." );
1736
1731
[self internalCancelFetchWithCallback: 0 authorizer: [TestAuthorizer asyncAuthorizer ]];
1737
1732
}
1738
1733
1739
1734
- (void )testImmediateAsyncAuthCancelFetchWithCallback_WithoutFetcherService {
1740
1735
_fetcherService = nil ;
1741
- XCTSkip (@" Currently fails, needs fixing." );
1742
1736
[self internalCancelFetchWithCallback: 0 authorizer: [TestAuthorizer asyncAuthorizer ]];
1743
1737
}
1744
1738
1745
1739
- (void )testDelayedAsyncDelayedAuthCancelFetchWithCallback {
1746
- XCTSkip (@" Currently fails, needs fixing." );
1747
1740
[self internalCancelFetchWithCallback: 1 authorizer: [TestAuthorizer asyncAuthorizerDelayed: 2 ]];
1748
1741
}
1749
1742
1750
1743
- (void )testDelayedAsyncDelayedAuthCancelFetchWithCallback_WithoutFetcherService {
1751
1744
_fetcherService = nil ;
1752
- XCTSkip (@" Currently fails, needs fixing." );
1753
1745
[self internalCancelFetchWithCallback: 1 authorizer: [TestAuthorizer asyncAuthorizerDelayed: 2 ]];
1754
1746
}
1755
1747
1756
1748
- (void )testImmediateAsyncDelayedAuthCancelFetchWithCallback {
1757
- XCTSkip (@" Currently fails, needs fixing." );
1758
1749
[self internalCancelFetchWithCallback: 0 authorizer: [TestAuthorizer asyncAuthorizerDelayed: 1 ]];
1759
1750
}
1760
1751
1761
1752
- (void )testImmediateAsyncDelayedAuthCancelFetchWithCallback_WithoutFetcherService {
1762
1753
_fetcherService = nil ;
1763
- XCTSkip (@" Currently fails, needs fixing." );
1764
1754
[self internalCancelFetchWithCallback: 0 authorizer: [TestAuthorizer asyncAuthorizerDelayed: 1 ]];
1765
1755
}
1766
1756
@@ -1774,7 +1764,17 @@ - (void)internalCancelFetchWithCallback:(unsigned int)sleepTime
1774
1764
#pragma clang diagnostic pop
1775
1765
if (!_isServerRunning) return ;
1776
1766
1777
- CREATE_START_STOP_NOTIFICATION_EXPECTATIONS (1 , 1 );
1767
+ // If the authorizer is async, then the fetch won't fully begin, and there won't ever be
1768
+ // a start notification (and thus stop notification).
1769
+ int expectedNotificationCount = ((TestAuthorizer*)authorizer).isAsync ? 0 : 1 ;
1770
+ XCTestExpectation *fetcherStartedExpectation = nil ;
1771
+ XCTestExpectation *fetcherStoppedExpectation = nil ;
1772
+ if (expectedNotificationCount) {
1773
+ fetcherStartedExpectation =
1774
+ [[XCTNSNotificationExpectation alloc ] initWithName: kGTMSessionFetcherStartedNotification ];
1775
+ fetcherStoppedExpectation =
1776
+ [[XCTNSNotificationExpectation alloc ] initWithName: kGTMSessionFetcherStoppedNotification ];
1777
+ }
1778
1778
1779
1779
FetcherNotificationsCounter *fnctr = [[FetcherNotificationsCounter alloc ] init ];
1780
1780
@@ -1799,19 +1799,17 @@ - (void)internalCancelFetchWithCallback:(unsigned int)sleepTime
1799
1799
}
1800
1800
[fetcher stopFetching ];
1801
1801
1802
- WAIT_FOR_START_STOP_NOTIFICATION_EXPECTATIONS ();
1803
-
1804
1802
[self waitForExpectationsWithTimeout: _timeoutInterval handler: nil ];
1805
1803
1806
1804
[self assertCallbacksReleasedForFetcher: fetcher];
1807
1805
1808
1806
// Check the notifications.
1809
- XCTAssertEqual (fnctr.fetchStarted , 1 , @" %@ " , fnctr.fetchersStartedDescriptions );
1810
- XCTAssertEqual (fnctr.fetchStopped , 1 , @" %@ " , fnctr.fetchersStoppedDescriptions );
1807
+ XCTAssertEqual (fnctr.fetchStarted , expectedNotificationCount , @" %@ " , fnctr.fetchersStartedDescriptions );
1808
+ XCTAssertEqual (fnctr.fetchStopped , fnctr. fetchStarted , @" %@ " , fnctr.fetchersStoppedDescriptions );
1811
1809
XCTAssertEqual (fnctr.fetchCompletionInvoked , 1 );
1812
1810
#if GTM_BACKGROUND_TASK_FETCHING
1813
1811
[self waitForBackgroundTaskEndedNotifications: fnctr];
1814
- XCTAssertEqual (fnctr.backgroundTasksStarted .count , (NSUInteger )1 );
1812
+ XCTAssertEqual (fnctr.backgroundTasksStarted .count , (NSUInteger )expectedNotificationCount );
1815
1813
XCTAssertEqualObjects (fnctr.backgroundTasksStarted , fnctr.backgroundTasksEnded );
1816
1814
#endif
1817
1815
}
0 commit comments