@@ -21,29 +21,21 @@ class StorageBackgroundEventsRegistryTests: XCTestCase {
21
21
let done = asyncExpectation ( description: " done " , expectedFulfillmentCount: 2 )
22
22
23
23
Task {
24
- let handled = await withCheckedContinuation { ( continuation: CheckedContinuation < Bool , Never > ) in
25
- StorageBackgroundEventsRegistry . handleBackgroundEvents ( identifier: identifier, continuation: continuation)
26
- Task {
27
- await done. fulfill ( )
28
- }
29
- }
24
+ let handled = await StorageBackgroundEventsRegistry . handleEventsForBackgroundURLSession ( identifier: identifier)
25
+ await done. fulfill ( )
30
26
XCTAssertTrue ( handled)
31
27
}
32
28
33
29
Task {
34
- let otherHandled = await withCheckedContinuation { ( continuation: CheckedContinuation < Bool , Never > ) in
35
- StorageBackgroundEventsRegistry . handleBackgroundEvents ( identifier: otherIdentifier, continuation: continuation)
36
- Task {
37
- await done. fulfill ( )
38
- }
39
- }
30
+ let otherHandled = await StorageBackgroundEventsRegistry . handleEventsForBackgroundURLSession ( identifier: otherIdentifier)
31
+ await done. fulfill ( )
40
32
XCTAssertFalse ( otherHandled)
41
33
}
42
34
43
- await waitForExpectations ( [ done] )
44
-
45
35
handleEvents ( for: identifier)
46
36
handleEvents ( for: otherIdentifier)
37
+
38
+ await waitForExpectations ( [ done] )
47
39
}
48
40
49
41
func testHandlingUnregisteredIdentifier( ) async throws {
@@ -54,12 +46,8 @@ class StorageBackgroundEventsRegistryTests: XCTestCase {
54
46
let done = asyncExpectation ( description: " done " )
55
47
56
48
Task {
57
- let handled = await withCheckedContinuation { ( continuation: CheckedContinuation < Bool , Never > ) in
58
- StorageBackgroundEventsRegistry . handleBackgroundEvents ( identifier: identifier, continuation: continuation)
59
- Task {
60
- await done. fulfill ( )
61
- }
62
- }
49
+ let handled = await StorageBackgroundEventsRegistry . handleEventsForBackgroundURLSession ( identifier: identifier)
50
+ await done. fulfill ( )
63
51
XCTAssertFalse ( handled)
64
52
}
65
53
@@ -70,6 +58,7 @@ class StorageBackgroundEventsRegistryTests: XCTestCase {
70
58
func handleEvents( for identifier: String ) {
71
59
if let continuation = StorageBackgroundEventsRegistry . getContinuation ( for: identifier) {
72
60
continuation. resume ( returning: true )
61
+ StorageBackgroundEventsRegistry . removeContinuation ( for: identifier)
73
62
}
74
63
}
75
64
0 commit comments