Fix test bug
Bug: 146423585
Test: atest LocationManagerFineTest
Change-Id: I4efe188da0bb78e4613d0eefe6d47b9dce1b3647
diff --git a/tests/location/location_fine/src/android/location/cts/fine/LocationManagerFineTest.java b/tests/location/location_fine/src/android/location/cts/fine/LocationManagerFineTest.java
index 9bf775b..c147cfd 100644
--- a/tests/location/location_fine/src/android/location/cts/fine/LocationManagerFineTest.java
+++ b/tests/location/location_fine/src/android/location/cts/fine/LocationManagerFineTest.java
@@ -861,12 +861,12 @@
for (String provider : mManager.getAllProviders()) {
if (TEST_PROVIDER.equals(provider)) {
- try (GetCurrentLocationCapture capture = new GetCurrentLocationCapture()) {
- mManager.getCurrentLocation(provider, capture.getCancellationSignal(),
+ try (LocationListenerCapture capture = new LocationListenerCapture(mContext)) {
+ mManager.requestLocationUpdates(TEST_PROVIDER, 0, 0,
Executors.newSingleThreadExecutor(), capture);
mManager.setTestProviderLocation(provider, loc1);
- Location received = capture.getLocation(TIMEOUT_MS);
+ Location received = capture.getNextLocation(TIMEOUT_MS);
assertThat(received).isEqualTo(loc1);
assertThat(received.isFromMockProvider()).isTrue();
assertThat(mManager.getLastKnownLocation(provider)).isEqualTo(loc1);
@@ -874,7 +874,7 @@
setTestProviderEnabled(provider, false);
mManager.setTestProviderLocation(provider, loc2);
assertThat(mManager.getLastKnownLocation(provider)).isNull();
- assertThat(capture.getLocation(FAILURE_TIMEOUT_MS)).isNull();
+ assertThat(capture.getNextLocation(FAILURE_TIMEOUT_MS)).isNull();
}
} else {
try {