Skip to content

Commit

Permalink
Remove runloop spinner for other interaction setter APIs.
Browse files Browse the repository at this point in the history
runloop spinner APIs are not compatible with Swift async tests, Runloop spinner is also not necessary for setter APIs because there is no thread safety issue. Removing them for now instead of creating async API version for these APIs.

PiperOrigin-RevId: 570588092
  • Loading branch information
AlbertWang0116 authored and mobile-devx-github-bot committed Oct 4, 2023
1 parent 8dd5438 commit a56af86
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions TestLib/EarlGreyImpl/GREYElementInteractionProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ - (void)assertWithMatcher:(id<GREYMatcher>)matcher

- (id<GREYInteraction>)inRoot:(id<GREYMatcher>)rootMatcher {
GREYThrowOnNilParameterWithMessage(rootMatcher, @"Root Matcher can't be nil.");
GREYExecuteSyncBlockInBackgroundQueue(^{
[self->_remoteElementInteraction inRoot:rootMatcher];
});
// The remote interaction completes the whole execution within the target thread. If this is
// changed at remote, the method call below should be wrapped with
// `GREYExecuteSyncBlockInBackgroundQueue`, and a completion handler version of this API should be
// provided for Swift async test.
[self->_remoteElementInteraction inRoot:rootMatcher];
return self;
}

Expand All @@ -134,16 +136,20 @@ - (void)assertWithMatcher:(id<GREYMatcher>)matcher
}

- (id<GREYInteraction>)atIndex:(NSUInteger)index {
GREYExecuteSyncBlockInBackgroundQueue(^{
[self->_remoteElementInteraction atIndex:index];
});
// The remote interaction completes the whole execution within the target thread. If this is
// changed at remote, the method call below should be wrapped with
// `GREYExecuteSyncBlockInBackgroundQueue`, and a completion handler version of this API should be
// provided for Swift async test.
[self->_remoteElementInteraction atIndex:index];
return self;
}

- (id<GREYInteraction>)includeStatusBar {
GREYExecuteSyncBlockInBackgroundQueue(^{
[self->_remoteElementInteraction includeStatusBar];
});
// The remote interaction completes the whole execution within the target thread. If this is
// changed at remote, the method call below should be wrapped with
// `GREYExecuteSyncBlockInBackgroundQueue`, and a completion handler version of this API should be
// provided for Swift async test.
[self->_remoteElementInteraction includeStatusBar];
return self;
}

Expand Down

0 comments on commit a56af86

Please sign in to comment.