diff options
author | Michael Plass <mplass@google.com> | 2020-03-02 21:41:35 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-03-02 21:41:35 +0000 |
commit | e7915cfe68b274987d83362f107b75233be7ea38 (patch) | |
tree | ccf44000420fc8fa116a24d7b171bafb60f94751 /tests | |
parent | e7fa928e88a711ff5fcedbe0b0f13801fca6ae97 (diff) | |
parent | 734ddbc7c7a5456f1d57622937ddef3b4defb6cb (diff) |
Merge "[WifiScoreReportTest] Fix mockito misuse" into rvc-dev
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java index 33dbcd1ca..52135491f 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiScoreReportTest.java @@ -84,6 +84,8 @@ public class WifiScoreReportTest extends WifiBaseTest { } } + private static final int TEST_SESSION_ID = 8603706; + FakeClock mClock; WifiConfiguration mWifiConfiguration; WifiScoreReport mWifiScoreReport; @@ -618,9 +620,9 @@ public class WifiScoreReportTest extends WifiBaseTest { ArgumentCaptor<Integer> startId = ArgumentCaptor.forClass(Integer.class); // Register Client for verification. mWifiScoreReport.setWifiConnectedNetworkScorer(mAppBinder, mWifiConnectedNetworkScorer); - mWifiScoreReport.startConnectedNetworkScorer(anyInt()); + mWifiScoreReport.startConnectedNetworkScorer(TEST_SESSION_ID); verify(mWifiConnectedNetworkScorer).start(startId.capture()); - assertEquals((int) startId.getValue(), anyInt()); + assertEquals((int) startId.getValue(), TEST_SESSION_ID); } /** @@ -631,10 +633,10 @@ public class WifiScoreReportTest extends WifiBaseTest { ArgumentCaptor<Integer> stopId = ArgumentCaptor.forClass(Integer.class); // Register Client for verification. mWifiScoreReport.setWifiConnectedNetworkScorer(mAppBinder, mWifiConnectedNetworkScorer); - mWifiScoreReport.startConnectedNetworkScorer(anyInt()); + mWifiScoreReport.startConnectedNetworkScorer(TEST_SESSION_ID); mWifiScoreReport.stopConnectedNetworkScorer(); verify(mWifiConnectedNetworkScorer).stop(stopId.capture()); - assertEquals((int) stopId.getValue(), anyInt()); + assertEquals((int) stopId.getValue(), TEST_SESSION_ID); } /** @@ -657,7 +659,9 @@ public class WifiScoreReportTest extends WifiBaseTest { WifiConnectedNetworkScorerImpl scorerImpl = new WifiConnectedNetworkScorerImpl(); // Register Client for verification. mWifiScoreReport.setWifiConnectedNetworkScorer(mAppBinder, scorerImpl); - mWifiScoreReport.startConnectedNetworkScorer(anyInt()); + mWifiScoreReport.startConnectedNetworkScorer(TEST_SESSION_ID); + + assertEquals(TEST_SESSION_ID, scorerImpl.mSessionId); // Invalid session ID scorerImpl.mScoreChangeCallback.onScoreChange(-1, 49); @@ -689,7 +693,7 @@ public class WifiScoreReportTest extends WifiBaseTest { // Register Client for verification. mWifiScoreReport.setWifiConnectedNetworkScorer(mAppBinder, scorerImpl); mWifiScoreReport.setInterfaceName("wlan0"); - mWifiScoreReport.startConnectedNetworkScorer(anyInt()); + mWifiScoreReport.startConnectedNetworkScorer(TEST_SESSION_ID); scorerImpl.mScoreChangeCallback.onTriggerUpdateOfWifiUsabilityStats(scorerImpl.mSessionId); mLooper.dispatchAll(); @@ -705,7 +709,7 @@ public class WifiScoreReportTest extends WifiBaseTest { WifiConnectedNetworkScorerImpl scorerImpl = new WifiConnectedNetworkScorerImpl(); // Register Client for verification. mWifiScoreReport.setWifiConnectedNetworkScorer(mAppBinder, scorerImpl); - mWifiScoreReport.startConnectedNetworkScorer(anyInt()); + mWifiScoreReport.startConnectedNetworkScorer(TEST_SESSION_ID); mClock.mStepMillis = 0; mClock.mWallClockMillis = 5001; @@ -734,7 +738,7 @@ public class WifiScoreReportTest extends WifiBaseTest { WifiConnectedNetworkScorerImpl scorerImpl = new WifiConnectedNetworkScorerImpl(); // Register Client for verification. mWifiScoreReport.setWifiConnectedNetworkScorer(mAppBinder, scorerImpl); - mWifiScoreReport.startConnectedNetworkScorer(anyInt()); + mWifiScoreReport.startConnectedNetworkScorer(TEST_SESSION_ID); mClock.mStepMillis = 0; mClock.mWallClockMillis = 10; @@ -757,7 +761,7 @@ public class WifiScoreReportTest extends WifiBaseTest { WifiConnectedNetworkScorerImpl scorerImpl = new WifiConnectedNetworkScorerImpl(); // Register Client for verification. mWifiScoreReport.setWifiConnectedNetworkScorer(mAppBinder, scorerImpl); - mWifiScoreReport.startConnectedNetworkScorer(anyInt()); + mWifiScoreReport.startConnectedNetworkScorer(TEST_SESSION_ID); mClock.mStepMillis = 0; mClock.mWallClockMillis = 10; @@ -779,7 +783,7 @@ public class WifiScoreReportTest extends WifiBaseTest { WifiConnectedNetworkScorerImpl scorerImpl = new WifiConnectedNetworkScorerImpl(); // Register Client for verification. mWifiScoreReport.setWifiConnectedNetworkScorer(mAppBinder, scorerImpl); - mWifiScoreReport.startConnectedNetworkScorer(anyInt()); + mWifiScoreReport.startConnectedNetworkScorer(TEST_SESSION_ID); mClock.mStepMillis = 0; mClock.mWallClockMillis = 10; |