aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Example/Tests/Util/FSTDispatchQueueTests.mm
diff options
context:
space:
mode:
Diffstat (limited to 'Firestore/Example/Tests/Util/FSTDispatchQueueTests.mm')
-rw-r--r--Firestore/Example/Tests/Util/FSTDispatchQueueTests.mm46
1 files changed, 28 insertions, 18 deletions
diff --git a/Firestore/Example/Tests/Util/FSTDispatchQueueTests.mm b/Firestore/Example/Tests/Util/FSTDispatchQueueTests.mm
index 811fa34..1f49aa4 100644
--- a/Firestore/Example/Tests/Util/FSTDispatchQueueTests.mm
+++ b/Firestore/Example/Tests/Util/FSTDispatchQueueTests.mm
@@ -66,9 +66,10 @@ static const FSTTimerID timerID3 = FSTTimerIDWriteStreamConnectionBackoff;
XCTAssertNotNil(caught);
XCTAssertEqualObjects(caught.name, NSInternalInconsistencyException);
- XCTAssertTrue(
- [caught.reason hasPrefix:@"FIRESTORE INTERNAL ASSERTION FAILED: "
- @"dispatchAsync called when we are already running on target"]);
+ XCTAssertTrue([caught.reason
+ hasPrefix:
+ @"FIRESTORE INTERNAL ASSERTION FAILED: "
+ @"Enqueue methods cannot be called when we are already running on target executor"]);
}
- (void)testDispatchAsyncAllowingSameQueueActuallyAllowsSameQueue {
@@ -133,9 +134,10 @@ static const FSTTimerID timerID3 = FSTTimerIDWriteStreamConnectionBackoff;
XCTAssertNotNil(caught);
XCTAssertEqualObjects(caught.name, NSInternalInconsistencyException);
- XCTAssertTrue(
- [caught.reason hasPrefix:@"FIRESTORE INTERNAL ASSERTION FAILED: "
- @"dispatchSync called when we are already running on target"]);
+ XCTAssertTrue([caught.reason
+ hasPrefix:
+ @"FIRESTORE INTERNAL ASSERTION FAILED: "
+ @"Enqueue methods cannot be called when we are already running on target executor"]);
}
- (void)testVerifyIsCurrentQueueActuallyRequiresCurrentQueue {
@@ -150,7 +152,8 @@ static const FSTTimerID timerID3 = FSTTimerIDWriteStreamConnectionBackoff;
}
XCTAssertNotNil(caught);
XCTAssertTrue([caught.reason hasPrefix:@"FIRESTORE INTERNAL ASSERTION FAILED: "
- @"We are running on the wrong dispatch queue"]);
+ @"Expected to be called by the executor "
+ @"associated with this queue"]);
}
- (void)testVerifyIsCurrentQueueRequiresOperationIsInProgress {
@@ -165,7 +168,7 @@ static const FSTTimerID timerID3 = FSTTimerIDWriteStreamConnectionBackoff;
XCTAssertNotNil(caught);
XCTAssertTrue(
[caught.reason hasPrefix:@"FIRESTORE INTERNAL ASSERTION FAILED: "
- @"verifyIsCurrentQueue called outside enterCheckedOperation"]);
+ @"VerifyIsCurrentQueue called when no operation is executing"]);
}
- (void)testVerifyIsCurrentQueueWorksWithOperationIsInProgress {
@@ -194,9 +197,10 @@ static const FSTTimerID timerID3 = FSTTimerIDWriteStreamConnectionBackoff;
}];
XCTAssertNil(problem);
XCTAssertNotNil(caught);
- XCTAssertTrue([caught.reason
- hasPrefix:@"FIRESTORE INTERNAL ASSERTION FAILED: "
- @"enterCheckedOperation may not be called when an operation is in progress"]);
+ XCTAssertTrue(
+ [caught.reason hasPrefix:@"FIRESTORE INTERNAL ASSERTION FAILED: "
+ @"ExecuteBlocking may not be called before the previous operation "
+ @"finishes executing"]);
}
/**
@@ -217,8 +221,10 @@ static const FSTTimerID timerID3 = FSTTimerIDWriteStreamConnectionBackoff;
_expectation = [self expectationWithDescription:@"Expected steps"];
_expectedSteps = @[ @1, @2, @3, @4 ];
[_queue dispatchAsync:[self blockForStep:1]];
- [_queue dispatchAfterDelay:0.005 timerID:timerID1 block:[self blockForStep:4]];
- [_queue dispatchAfterDelay:0.001 timerID:timerID2 block:[self blockForStep:3]];
+ [_queue dispatchAsync:^{
+ [_queue dispatchAfterDelay:0.005 timerID:timerID1 block:[self blockForStep:4]];
+ [_queue dispatchAfterDelay:0.001 timerID:timerID2 block:[self blockForStep:3]];
+ }];
[_queue dispatchAsync:[self blockForStep:2]];
[self awaitExpectations];
@@ -244,8 +250,10 @@ static const FSTTimerID timerID3 = FSTTimerIDWriteStreamConnectionBackoff;
- (void)testCanManuallyDrainAllDelayedCallbacksForTesting {
[_queue dispatchAsync:[self blockForStep:1]];
- [_queue dispatchAfterDelay:20 timerID:timerID1 block:[self blockForStep:4]];
- [_queue dispatchAfterDelay:10 timerID:timerID2 block:[self blockForStep:3]];
+ [_queue dispatchAsync:^{
+ [_queue dispatchAfterDelay:20 timerID:timerID1 block:[self blockForStep:4]];
+ [_queue dispatchAfterDelay:10 timerID:timerID2 block:[self blockForStep:3]];
+ }];
[_queue dispatchAsync:[self blockForStep:2]];
[_queue runDelayedCallbacksUntil:FSTTimerIDAll];
@@ -254,9 +262,11 @@ static const FSTTimerID timerID3 = FSTTimerIDWriteStreamConnectionBackoff;
- (void)testCanManuallyDrainSpecificDelayedCallbacksForTesting {
[_queue dispatchAsync:[self blockForStep:1]];
- [_queue dispatchAfterDelay:20 timerID:timerID1 block:[self blockForStep:5]];
- [_queue dispatchAfterDelay:10 timerID:timerID2 block:[self blockForStep:3]];
- [_queue dispatchAfterDelay:15 timerID:timerID3 block:[self blockForStep:4]];
+ [_queue dispatchAsync:^{
+ [_queue dispatchAfterDelay:20 timerID:timerID1 block:[self blockForStep:5]];
+ [_queue dispatchAfterDelay:10 timerID:timerID2 block:[self blockForStep:3]];
+ [_queue dispatchAfterDelay:15 timerID:timerID3 block:[self blockForStep:4]];
+ }];
[_queue dispatchAsync:[self blockForStep:2]];
[_queue runDelayedCallbacksUntil:timerID3];