@@ -73,7 +73,6 @@ - (instancetype)initWithDataSource:(id<PFCommandRunnerProvider>)dataSource
73
73
_commandEnqueueTaskQueue = [[PFTaskQueue alloc ] init ];
74
74
75
75
_taskCompletionSources = [NSMutableDictionary dictionary ];
76
- _testHelper = [[PFEventuallyQueueTestHelper alloc ] init ];
77
76
78
77
[self _startMonitoringNetworkReachability ];
79
78
@@ -103,14 +102,11 @@ - (BFTask *)enqueueCommandInBackground:(id<PFNetworkCommand>)command withObject:
103
102
object: object
104
103
identifier: identifier] continueWithBlock: ^id (BFTask *task) {
105
104
if (task.faulted || task.cancelled ) {
106
- [self .testHelper notify: PFEventuallyQueueEventCommandNotEnqueued];
107
105
if (task.error ) {
108
106
taskCompletionSource.error = task.error ;
109
107
} else if (task.cancelled ) {
110
108
[taskCompletionSource cancel ];
111
109
}
112
- } else {
113
- [self .testHelper notify: PFEventuallyQueueEventCommandEnqueued];
114
110
}
115
111
116
112
return task;
@@ -337,12 +333,6 @@ - (BFTask *)_didFinishRunningCommand:(id<PFNetworkCommand>)command
337
333
[_taskCompletionSources removeObjectForKey: identifier];
338
334
});
339
335
340
- if (resultTask.faulted || resultTask.cancelled ) {
341
- [self .testHelper notify: PFEventuallyQueueEventCommandFailed];
342
- } else {
343
- [self .testHelper notify: PFEventuallyQueueEventCommandSucceded];
344
- }
345
-
346
336
return resultTask;
347
337
}
348
338
@@ -437,11 +427,6 @@ - (int)_commandsInMemory {
437
427
return (int )_taskCompletionSources.count ;
438
428
}
439
429
440
- /* * Called by PFObject whenever an object has been updated after a saveEventually. */
441
- - (void )_notifyTestHelperObjectUpdated {
442
- [self .testHelper notify: PFEventuallyQueueEventObjectUpdated];
443
- }
444
-
445
430
- (void )_setMaxAttemptsCount : (NSUInteger )attemptsCount {
446
431
_maxAttemptsCount = attemptsCount;
447
432
}
@@ -465,33 +450,3 @@ - (void)reachability:(PFReachability *)reachability didChangeReachabilityState:(
465
450
#endif
466
451
467
452
@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