@@ -73,7 +73,6 @@ - (instancetype)initWithDataSource:(id<PFCommandRunnerProvider>)dataSource
7373 _commandEnqueueTaskQueue = [[PFTaskQueue alloc ] init ];
7474
7575 _taskCompletionSources = [NSMutableDictionary dictionary ];
76- _testHelper = [[PFEventuallyQueueTestHelper alloc ] init ];
7776
7877 [self _startMonitoringNetworkReachability ];
7978
@@ -103,14 +102,11 @@ - (BFTask *)enqueueCommandInBackground:(id<PFNetworkCommand>)command withObject:
103102 object: object
104103 identifier: identifier] continueWithBlock: ^id (BFTask *task) {
105104 if (task.faulted || task.cancelled ) {
106- [self .testHelper notify: PFEventuallyQueueEventCommandNotEnqueued];
107105 if (task.error ) {
108106 taskCompletionSource.error = task.error ;
109107 } else if (task.cancelled ) {
110108 [taskCompletionSource cancel ];
111109 }
112- } else {
113- [self .testHelper notify: PFEventuallyQueueEventCommandEnqueued];
114110 }
115111
116112 return task;
@@ -337,12 +333,6 @@ - (BFTask *)_didFinishRunningCommand:(id<PFNetworkCommand>)command
337333 [_taskCompletionSources removeObjectForKey: identifier];
338334 });
339335
340- if (resultTask.faulted || resultTask.cancelled ) {
341- [self .testHelper notify: PFEventuallyQueueEventCommandFailed];
342- } else {
343- [self .testHelper notify: PFEventuallyQueueEventCommandSucceded];
344- }
345-
346336 return resultTask;
347337}
348338
@@ -437,11 +427,6 @@ - (int)_commandsInMemory {
437427 return (int )_taskCompletionSources.count ;
438428}
439429
440- /* * Called by PFObject whenever an object has been updated after a saveEventually. */
441- - (void )_notifyTestHelperObjectUpdated {
442- [self .testHelper notify: PFEventuallyQueueEventObjectUpdated];
443- }
444-
445430- (void )_setMaxAttemptsCount : (NSUInteger )attemptsCount {
446431 _maxAttemptsCount = attemptsCount;
447432}
@@ -465,33 +450,3 @@ - (void)reachability:(PFReachability *)reachability didChangeReachabilityState:(
465450#endif
466451
467452@end
468-
469- // PFEventuallyQueueTestHelper gets notifications of various events happening in the command cache,
470- // so that tests can be synchronized. See CommandTests.m for examples of how to use this.
471-
472- @implementation PFEventuallyQueueTestHelper
473-
474- - (instancetype )init {
475- self = [super init ];
476- if (self) {
477- [self clear ];
478- }
479- return self;
480- }
481-
482- - (void )clear {
483- for (int i = 0 ; i < PFEventuallyQueueEventCount; ++i) {
484- events[i] = dispatch_semaphore_create (0 );
485- }
486- }
487-
488- - (void )notify : (PFEventuallyQueueTestHelperEvent)event {
489- dispatch_semaphore_signal (events[event]);
490- }
491-
492- - (BOOL )waitFor : (PFEventuallyQueueTestHelperEvent)event {
493- // Wait 1 second for a permit from the semaphore.
494- return (dispatch_semaphore_wait (events[event], dispatch_time (DISPATCH_TIME_NOW, 10LL * NSEC_PER_SEC)) == 0 );
495- }
496-
497- @end
0 commit comments