diff options
author | Michael Lehenbauer <mikelehen@gmail.com> | 2018-03-05 09:49:41 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-05 09:49:41 -0800 |
commit | 34ebf10b0acc65f1924d723e82085d4104bc281d (patch) | |
tree | 98237b8eef85abdc7d464ef221a37d3bb6937be7 /Firestore/Example/Tests/Core/FSTEventManagerTests.mm | |
parent | 1c40e7aada6b32bbc621f06fb5f380149606a58d (diff) |
Add 10 second timeout waiting for connection before client behaves as-if offline. (#872)
[Port of https://github.com/firebase/firebase-js-sdk/commit/0fa319e5e019dd0d40ab441d2ff9f8f6d4724e43]
* Refactored FSTOnlineState tracking out of FSTRemoteStore and into new
FSTOnlineStateTracker component.
* Added a 10 second timeout to transition from OnlineState.Unknown to
OnlineState.Offline rather than waiting indefinitely for the stream to
succeed or fail.
* Removed hack to run SpecTests using an FSTDispatchQueue that wrapped
dispatch_get_main_queue(). This was incompatible with [FSTDispatchQueue
runDelayedCallbacksUntil:] since it queues work and blocks waiting for
it to complete. Now spec tests create / use a proper FSTDispatchQueue.
* Added a SpecTest to verify OnlineState timeout behavior.
* Misc cleanup:
* Renamed FSTOnlineState states: Failed => Offline, Healthy => Online
* Renamed FSTTimerIds (ListenStreamConnection => ListenStreamConnectionBackoff)
* Added ability to run timers from spec tests.
Diffstat (limited to 'Firestore/Example/Tests/Core/FSTEventManagerTests.mm')
-rw-r--r-- | Firestore/Example/Tests/Core/FSTEventManagerTests.mm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Firestore/Example/Tests/Core/FSTEventManagerTests.mm b/Firestore/Example/Tests/Core/FSTEventManagerTests.mm index fcde17d..f5f7b5b 100644 --- a/Firestore/Example/Tests/Core/FSTEventManagerTests.mm +++ b/Firestore/Example/Tests/Core/FSTEventManagerTests.mm @@ -143,9 +143,9 @@ NS_ASSUME_NONNULL_BEGIN .andDo(^(NSInvocation *invocation) { [events addObject:@(FSTOnlineStateUnknown)]; }); - OCMStub([fakeListener applyChangedOnlineState:FSTOnlineStateHealthy]) + OCMStub([fakeListener applyChangedOnlineState:FSTOnlineStateOnline]) .andDo(^(NSInvocation *invocation) { - [events addObject:@(FSTOnlineStateHealthy)]; + [events addObject:@(FSTOnlineStateOnline)]; }); FSTSyncEngine *syncEngineMock = OCMClassMock([FSTSyncEngine class]); @@ -154,8 +154,8 @@ NS_ASSUME_NONNULL_BEGIN [eventManager addListener:fakeListener]; XCTAssertEqualObjects(events, @[ @(FSTOnlineStateUnknown) ]); - [eventManager applyChangedOnlineState:FSTOnlineStateHealthy]; - XCTAssertEqualObjects(events, (@[ @(FSTOnlineStateUnknown), @(FSTOnlineStateHealthy) ])); + [eventManager applyChangedOnlineState:FSTOnlineStateOnline]; + XCTAssertEqualObjects(events, (@[ @(FSTOnlineStateUnknown), @(FSTOnlineStateOnline) ])); } @end |