summaryrefslogtreecommitdiff
path: root/services/tests
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2021-12-17 06:17:56 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-12-17 06:17:56 +0000
commit9f94e2b4450b320248e8b2c4957a9566e38840f6 (patch)
tree4f7a02011a43a03d39c551dd8d054a1f37b6239c /services/tests
parentf4590668aad32738d722619f2f5f2712340058ad (diff)
parentdb71562964d5e5862ee08274bf3d2e0dca58a6fb (diff)
Merge "DO NOT MERGE: Revert "DO NOT MERGE: Lower bound throttling interval"" into sc-v2-dev
Diffstat (limited to 'services/tests')
-rw-r--r--services/tests/mockingservicestests/src/com/android/server/location/provider/StationaryThrottlingLocationProviderTest.java31
1 files changed, 10 insertions, 21 deletions
diff --git a/services/tests/mockingservicestests/src/com/android/server/location/provider/StationaryThrottlingLocationProviderTest.java b/services/tests/mockingservicestests/src/com/android/server/location/provider/StationaryThrottlingLocationProviderTest.java
index 4eba21934a4e..4d6f49e5d223 100644
--- a/services/tests/mockingservicestests/src/com/android/server/location/provider/StationaryThrottlingLocationProviderTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/location/provider/StationaryThrottlingLocationProviderTest.java
@@ -90,19 +90,6 @@ public class StationaryThrottlingLocationProviderTest {
}
@Test
- public void testThrottle_lowInterval() {
- ProviderRequest request = new ProviderRequest.Builder().setIntervalMillis(0).build();
-
- mProvider.getController().setRequest(request);
- mDelegateProvider.reportLocation(createLocationResult("test_provider", mRandom));
- verify(mListener, times(1)).onReportLocation(any(LocationResult.class));
-
- mInjector.getDeviceStationaryHelper().setStationary(true);
- mInjector.getDeviceIdleHelper().setIdle(true);
- verify(mListener, after(1500).times(2)).onReportLocation(any(LocationResult.class));
- }
-
- @Test
public void testThrottle_stationaryExit() {
ProviderRequest request = new ProviderRequest.Builder().setIntervalMillis(50).build();
@@ -117,16 +104,17 @@ public class StationaryThrottlingLocationProviderTest {
mInjector.getDeviceIdleHelper().setIdle(true);
verify(mDelegate).onSetRequest(ProviderRequest.EMPTY_REQUEST);
- verify(mListener, timeout(1100).times(2)).onReportLocation(any(LocationResult.class));
+ verify(mListener, timeout(75).times(2)).onReportLocation(any(LocationResult.class));
+ verify(mListener, timeout(75).times(3)).onReportLocation(any(LocationResult.class));
mInjector.getDeviceStationaryHelper().setStationary(false);
verify(mDelegate, times(2)).onSetRequest(request);
- verify(mListener, after(1000).times(2)).onReportLocation(any(LocationResult.class));
+ verify(mListener, after(75).times(3)).onReportLocation(any(LocationResult.class));
}
@Test
public void testThrottle_idleExit() {
- ProviderRequest request = new ProviderRequest.Builder().setIntervalMillis(1000).build();
+ ProviderRequest request = new ProviderRequest.Builder().setIntervalMillis(50).build();
mProvider.getController().setRequest(request);
verify(mDelegate).onSetRequest(request);
@@ -139,16 +127,17 @@ public class StationaryThrottlingLocationProviderTest {
mInjector.getDeviceStationaryHelper().setStationary(true);
verify(mDelegate).onSetRequest(ProviderRequest.EMPTY_REQUEST);
- verify(mListener, timeout(1100).times(2)).onReportLocation(any(LocationResult.class));
+ verify(mListener, timeout(75).times(2)).onReportLocation(any(LocationResult.class));
+ verify(mListener, timeout(75).times(3)).onReportLocation(any(LocationResult.class));
mInjector.getDeviceIdleHelper().setIdle(false);
verify(mDelegate, times(2)).onSetRequest(request);
- verify(mListener, after(1000).times(2)).onReportLocation(any(LocationResult.class));
+ verify(mListener, after(75).times(3)).onReportLocation(any(LocationResult.class));
}
@Test
public void testThrottle_NoInitialLocation() {
- ProviderRequest request = new ProviderRequest.Builder().setIntervalMillis(1000).build();
+ ProviderRequest request = new ProviderRequest.Builder().setIntervalMillis(50).build();
mProvider.getController().setRequest(request);
verify(mDelegate).onSetRequest(request);
@@ -160,11 +149,11 @@ public class StationaryThrottlingLocationProviderTest {
mDelegateProvider.reportLocation(createLocationResult("test_provider", mRandom));
verify(mListener, times(1)).onReportLocation(any(LocationResult.class));
verify(mDelegate, times(1)).onSetRequest(ProviderRequest.EMPTY_REQUEST);
- verify(mListener, timeout(1100).times(2)).onReportLocation(any(LocationResult.class));
+ verify(mListener, timeout(75).times(2)).onReportLocation(any(LocationResult.class));
mInjector.getDeviceStationaryHelper().setStationary(false);
verify(mDelegate, times(2)).onSetRequest(request);
- verify(mListener, after(1000).times(2)).onReportLocation(any(LocationResult.class));
+ verify(mListener, after(75).times(2)).onReportLocation(any(LocationResult.class));
}
@Test