diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiChannelUtilizationTest.java | 13 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiDataStallTest.java | 8 |
2 files changed, 18 insertions, 3 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiChannelUtilizationTest.java b/tests/wifitests/src/com/android/server/wifi/WifiChannelUtilizationTest.java index 0e96ceef6..c9ba95d41 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiChannelUtilizationTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiChannelUtilizationTest.java @@ -93,6 +93,19 @@ public class WifiChannelUtilizationTest extends WifiBaseTest { } @Test + public void verifyOneReadChanStatsWithLargeCcaBusyTime() throws Exception { + WifiLinkLayerStats llstats = new WifiLinkLayerStats(); + int freq = 5180; + ChannelStats cs = new ChannelStats(); + cs.frequency = freq; + cs.radioOnTimeMs = RADIO_ON_TIME_DIFF_MIN_MS * 2; + cs.ccaBusyTimeMs = RADIO_ON_TIME_DIFF_MIN_MS * 20; + llstats.channelStatsMap.put(freq, cs); + mWifiChannelUtilization.refreshChannelStatsAndChannelUtilization(llstats, UNKNOWN_FREQ); + assertEquals(INVALID, mWifiChannelUtilization.getUtilizationRatio(freq)); + } + + @Test public void verifyOneReadChanStatsWithLongRadioOnTime() throws Exception { WifiLinkLayerStats llstats = new WifiLinkLayerStats(); int freq = 5180; diff --git a/tests/wifitests/src/com/android/server/wifi/WifiDataStallTest.java b/tests/wifitests/src/com/android/server/wifi/WifiDataStallTest.java index 8eee0017d..922e0cef3 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiDataStallTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiDataStallTest.java @@ -145,6 +145,7 @@ public class WifiDataStallTest extends WifiBaseTest { .thenReturn(50); when(mThroughputPredictor.predictRxThroughput(any(), anyInt(), anyInt(), anyInt())) .thenReturn(150); + mWifiDataStall.init(); mWifiDataStall.setConnectionCapabilities(mCapabilities); setUpWifiBytes(1, 1); } @@ -372,7 +373,8 @@ public class WifiDataStallTest extends WifiBaseTest { assertEquals(960, mWifiDataStall.getTxThroughputKbps()); assertEquals(960, mWifiDataStall.getRxThroughputKbps()); - // 4th poll with low tx/rx traffic but high throughput + // 4th poll with low tx/rx traffic, high throughput and unknown channel utilization + when(mWifiChannelUtilization.getUtilizationRatio(anyInt())).thenReturn(-1); when(mWifiInfo.getLinkSpeed()).thenReturn(10); when(mWifiInfo.getRxLinkSpeedMbps()).thenReturn(10); when(mClock.getElapsedSinceBootMillis()).thenReturn( @@ -381,8 +383,8 @@ public class WifiDataStallTest extends WifiBaseTest { assertEquals(WifiIsUnusableEvent.TYPE_UNKNOWN, mWifiDataStall .checkDataStallAndThroughputSufficiency(mOldLlStats, mNewLlStats, mWifiInfo)); assertEquals(true, mWifiDataStall.isThroughputSufficient()); - assertEquals(4804, mWifiDataStall.getTxThroughputKbps()); - assertEquals(9609, mWifiDataStall.getRxThroughputKbps()); + assertEquals(4707, mWifiDataStall.getTxThroughputKbps()); + assertEquals(9414, mWifiDataStall.getRxThroughputKbps()); } /** |