summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-05-31 21:33:58 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-05-31 21:33:58 +0000
commita107d2ca8cb1aaf5e2f5035cb4cdc03a9ffec51a (patch)
tree8bf8503b8d8335db301223818678037672a38946 /tests
parentcbc4ad28904c305b1646d4bbb5dbb2db215df3bf (diff)
parent443ee3b76a41c323ec0278dde9f18d2d9029d1e1 (diff)
Merge "Optimize Link Probing unit test to prevent timeout" into qt-dev
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/LinkProbeManagerTest.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/LinkProbeManagerTest.java b/tests/wifitests/src/com/android/server/wifi/LinkProbeManagerTest.java
index 6884c03c0..32eb78d8c 100644
--- a/tests/wifitests/src/com/android/server/wifi/LinkProbeManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/LinkProbeManagerTest.java
@@ -376,17 +376,17 @@ public class LinkProbeManagerTest {
mTimeMs += LinkProbeManager.DELAY_BETWEEN_PROBES_MS + 1000;
when(mClock.getElapsedSinceBootMillis()).thenReturn(mTimeMs);
mLinkProbeManager.updateConnectionStats(mWifiInfo, TEST_IFACE_NAME);
- verify(mWifiNative, times(i))
- .probeLink(eq(TEST_IFACE_NAME), any(), any(), anyInt());
}
+ verify(mWifiNative, times((int) LinkProbeManager.MAX_PROBE_COUNT_IN_PERIOD))
+ .probeLink(eq(TEST_IFACE_NAME), any(), any(), anyInt());
// verify no more quota
for (int i = 0; i < 10; i++) {
mTimeMs += LinkProbeManager.DELAY_BETWEEN_PROBES_MS + 1000;
when(mClock.getElapsedSinceBootMillis()).thenReturn(mTimeMs);
mLinkProbeManager.updateConnectionStats(mWifiInfo, TEST_IFACE_NAME);
- verify(mWifiNative, times((int) LinkProbeManager.MAX_PROBE_COUNT_IN_PERIOD))
- .probeLink(eq(TEST_IFACE_NAME), any(), any(), anyInt());
}
+ verify(mWifiNative, times((int) LinkProbeManager.MAX_PROBE_COUNT_IN_PERIOD))
+ .probeLink(eq(TEST_IFACE_NAME), any(), any(), anyInt());
// start new period
mTimeMs += LinkProbeManager.PERIOD_MILLIS + 1000;
@@ -397,16 +397,16 @@ public class LinkProbeManagerTest {
mTimeMs += LinkProbeManager.DELAY_BETWEEN_PROBES_MS + 1000;
when(mClock.getElapsedSinceBootMillis()).thenReturn(mTimeMs);
mLinkProbeManager.updateConnectionStats(mWifiInfo, TEST_IFACE_NAME);
- verify(mWifiNative, times((int) (LinkProbeManager.MAX_PROBE_COUNT_IN_PERIOD + i)))
- .probeLink(eq(TEST_IFACE_NAME), any(), any(), anyInt());
}
+ verify(mWifiNative, times((int) (2 * LinkProbeManager.MAX_PROBE_COUNT_IN_PERIOD)))
+ .probeLink(eq(TEST_IFACE_NAME), any(), any(), anyInt());
// verify no more quota again
for (int i = 0; i < 10; i++) {
mTimeMs += LinkProbeManager.DELAY_BETWEEN_PROBES_MS + 1000;
when(mClock.getElapsedSinceBootMillis()).thenReturn(mTimeMs);
mLinkProbeManager.updateConnectionStats(mWifiInfo, TEST_IFACE_NAME);
- verify(mWifiNative, times((int) (2 * LinkProbeManager.MAX_PROBE_COUNT_IN_PERIOD)))
- .probeLink(eq(TEST_IFACE_NAME), any(), any(), anyInt());
}
+ verify(mWifiNative, times((int) (2 * LinkProbeManager.MAX_PROBE_COUNT_IN_PERIOD)))
+ .probeLink(eq(TEST_IFACE_NAME), any(), any(), anyInt());
}
}