@@ -1585,57 +1585,47 @@ - (void)testDelayedSyncAuthCancelFetchWithCallback_WithoutFetcherService {
1585
1585
}
1586
1586
1587
1587
- (void )testImmediateSyncAuthCancelFetchWithCallback {
1588
- XCTSkip (@" Has failed on CI, but not locally, needs investigation." );
1589
1588
[self internalCancelFetchWithCallback: 0 authorizer: [TestAuthorizer syncAuthorizer ]];
1590
1589
}
1591
1590
1592
1591
- (void )testImmediateSyncAuthCancelFetchWithCallback_WithoutFetcherService {
1593
1592
_fetcherService = nil ;
1594
- XCTSkip (@" Has failed on CI, but not locally, needs investigation." );
1595
1593
[self internalCancelFetchWithCallback: 0 authorizer: [TestAuthorizer syncAuthorizer ]];
1596
1594
}
1597
1595
1598
1596
- (void )testDelayedAsyncAuthCancelFetchWithCallback {
1599
- XCTSkip (@" Currently fails, needs fixing." );
1600
1597
[self internalCancelFetchWithCallback: 1 authorizer: [TestAuthorizer asyncAuthorizer ]];
1601
1598
}
1602
1599
1603
1600
- (void )testDelayedAsyncAuthCancelFetchWithCallback_WithoutFetcherService {
1604
1601
_fetcherService = nil ;
1605
- XCTSkip (@" Currently fails, needs fixing." );
1606
1602
[self internalCancelFetchWithCallback: 1 authorizer: [TestAuthorizer asyncAuthorizer ]];
1607
1603
}
1608
1604
1609
1605
- (void )testImmediateAsyncAuthCancelFetchWithCallback {
1610
- XCTSkip (@" Currently fails, needs fixing." );
1611
1606
[self internalCancelFetchWithCallback: 0 authorizer: [TestAuthorizer asyncAuthorizer ]];
1612
1607
}
1613
1608
1614
1609
- (void )testImmediateAsyncAuthCancelFetchWithCallback_WithoutFetcherService {
1615
1610
_fetcherService = nil ;
1616
- XCTSkip (@" Currently fails, needs fixing." );
1617
1611
[self internalCancelFetchWithCallback: 0 authorizer: [TestAuthorizer asyncAuthorizer ]];
1618
1612
}
1619
1613
1620
1614
- (void )testDelayedAsyncDelayedAuthCancelFetchWithCallback {
1621
- XCTSkip (@" Currently fails, needs fixing." );
1622
1615
[self internalCancelFetchWithCallback: 1 authorizer: [TestAuthorizer asyncAuthorizerDelayed: 2 ]];
1623
1616
}
1624
1617
1625
1618
- (void )testDelayedAsyncDelayedAuthCancelFetchWithCallback_WithoutFetcherService {
1626
1619
_fetcherService = nil ;
1627
- XCTSkip (@" Currently fails, needs fixing." );
1628
1620
[self internalCancelFetchWithCallback: 1 authorizer: [TestAuthorizer asyncAuthorizerDelayed: 2 ]];
1629
1621
}
1630
1622
1631
1623
- (void )testImmediateAsyncDelayedAuthCancelFetchWithCallback {
1632
- XCTSkip (@" Currently fails, needs fixing." );
1633
1624
[self internalCancelFetchWithCallback: 0 authorizer: [TestAuthorizer asyncAuthorizerDelayed: 1 ]];
1634
1625
}
1635
1626
1636
1627
- (void )testImmediateAsyncDelayedAuthCancelFetchWithCallback_WithoutFetcherService {
1637
1628
_fetcherService = nil ;
1638
- XCTSkip (@" Currently fails, needs fixing." );
1639
1629
[self internalCancelFetchWithCallback: 0 authorizer: [TestAuthorizer asyncAuthorizerDelayed: 1 ]];
1640
1630
}
1641
1631
@@ -1649,7 +1639,17 @@ - (void)internalCancelFetchWithCallback:(unsigned int)sleepTime
1649
1639
#pragma clang diagnostic pop
1650
1640
if (!_isServerRunning) return ;
1651
1641
1652
- CREATE_START_STOP_NOTIFICATION_EXPECTATIONS (1 , 1 );
1642
+ // If the authorizer is async, then the fetch won't fully begin, and there won't ever be
1643
+ // a start notification (and thus stop notification).
1644
+ int expectedNotifications = ((TestAuthorizer*)authorizer).isAsync ? 0 : 1 ;
1645
+ XCTestExpectation *fetcherStartedExpectation = nil ;
1646
+ XCTestExpectation *fetcherStoppedExpectation = nil ;
1647
+ if (expectedNotifications) {
1648
+ fetcherStartedExpectation =
1649
+ [[XCTNSNotificationExpectation alloc ] initWithName: kGTMSessionFetcherStartedNotification ];
1650
+ fetcherStoppedExpectation =
1651
+ [[XCTNSNotificationExpectation alloc ] initWithName: kGTMSessionFetcherStoppedNotification ];
1652
+ }
1653
1653
1654
1654
FetcherNotificationsCounter *fnctr = [[FetcherNotificationsCounter alloc ] init ];
1655
1655
@@ -1674,19 +1674,17 @@ - (void)internalCancelFetchWithCallback:(unsigned int)sleepTime
1674
1674
}
1675
1675
[fetcher stopFetching ];
1676
1676
1677
- WAIT_FOR_START_STOP_NOTIFICATION_EXPECTATIONS ();
1678
-
1679
1677
[self waitForExpectationsWithTimeout: _timeoutInterval handler: nil ];
1680
1678
1681
1679
[self assertCallbacksReleasedForFetcher: fetcher];
1682
1680
1683
1681
// Check the notifications.
1684
- XCTAssertEqual (fnctr.fetchStarted , 1 , @" %@ " , fnctr.fetchersStartedDescriptions );
1685
- XCTAssertEqual (fnctr.fetchStopped , 1 , @" %@ " , fnctr.fetchersStoppedDescriptions );
1682
+ XCTAssertEqual (fnctr.fetchStarted , expectedNotifications , @" %@ " , fnctr.fetchersStartedDescriptions );
1683
+ XCTAssertEqual (fnctr.fetchStopped , fnctr. fetchStarted , @" %@ " , fnctr.fetchersStoppedDescriptions );
1686
1684
XCTAssertEqual (fnctr.fetchCompletionInvoked , 1 );
1687
1685
#if GTM_BACKGROUND_TASK_FETCHING
1688
1686
[self waitForBackgroundTaskEndedNotifications: fnctr];
1689
- XCTAssertEqual (fnctr.backgroundTasksStarted .count , (NSUInteger )1 );
1687
+ XCTAssertEqual (fnctr.backgroundTasksStarted .count , (NSUInteger )expectedNotifications );
1690
1688
XCTAssertEqualObjects (fnctr.backgroundTasksStarted , fnctr.backgroundTasksEnded );
1691
1689
#endif
1692
1690
}
0 commit comments