Skip to content

Commit

Permalink
Add the ability of clearing context hub client list.
Browse files Browse the repository at this point in the history
This ensures unit test functions using ShadowContextHubManager won't conflict with each other.

PiperOrigin-RevId: 575907725
  • Loading branch information
Googler authored and Copybara-Service committed Oct 23, 2023
1 parent 3a782b5 commit 8b89c18
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.robolectric.annotation.HiddenApi;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.annotation.Resetter;
import org.robolectric.shadow.api.Shadow;
import org.robolectric.util.ReflectionHelpers;
import org.robolectric.util.ReflectionHelpers.ClassParameter;
Expand Down Expand Up @@ -140,6 +141,11 @@ public List<ContextHubClient> getContextHubClientWithPendingIntentList() {
return ImmutableList.copyOf(contextHubClientWithPendingIntentList);
}

@Resetter
public static void clearContextHubClientWithPendingIntentList() {
contextHubClientWithPendingIntentList.clear();
}

@Implementation(minSdk = VERSION_CODES.P)
@HiddenApi
protected Object queryNanoApps(ContextHubInfo hubInfo) {
Expand Down

0 comments on commit 8b89c18

Please sign in to comment.