summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Plass <mplass@google.com>2019-04-02 16:09:43 -0700
committerMichael Plass <mplass@google.com>2019-04-03 10:02:54 -0700
commit734ea2fae6332bfd82f0e2128dffd2876d64e3eb (patch)
treed9a3c484aa76d7e75ebf2dca4740d96d9b64f7e8 /tests
parent91f73103a010fbf6006c48fb76543f3e8e1f19f6 (diff)
WifiMetrics - record the active CandidateScorer id
Bug: 128937950 Test: atest FrameworksWifiTests Test: adb shell dumpsys wifi | grep networkSelectorExperimentId Change-Id: Ided67c570c7dce72c64540b0fe1cb379fa8924f7
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java30
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java6
2 files changed, 21 insertions, 15 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index 33da96690..5d94c1193 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -2159,13 +2159,12 @@ public class WifiMetricsTest {
}
/**
- * Check ScoringParams
+ * Check network selector id
*/
@Test
- public void testExperimentId() throws Exception {
- final int id = 42;
- final String expectId = "x" + id;
- when(mScoringParams.getExperimentIdentifier()).thenReturn(id);
+ public void testNetworkSelectorExperimentId() throws Exception {
+ final int id = 42888888;
+ mWifiMetrics.setNetworkSelectorExperimentId(id);
mWifiMetrics.startConnectionEvent(mTestWifiConfig, "TestNetwork",
WifiMetricsProto.ConnectionEvent.ROAM_ENTERPRISE);
mWifiMetrics.endConnectionEvent(
@@ -2173,11 +2172,22 @@ public class WifiMetricsTest {
WifiMetricsProto.ConnectionEvent.HLF_NONE,
WifiMetricsProto.ConnectionEvent.FAILURE_REASON_UNKNOWN);
dumpProtoAndDeserialize();
- assertEquals(expectId, mDecodedProto.scoreExperimentId);
assertEquals(id, mDecodedProto.connectionEvent[0].networkSelectorExperimentId);
}
/**
+ * Check ScoringParams
+ */
+ @Test
+ public void testExperimentId() throws Exception {
+ final int id = 42;
+ final String expectId = "x" + id;
+ when(mScoringParams.getExperimentIdentifier()).thenReturn(id);
+ dumpProtoAndDeserialize();
+ assertEquals(expectId, mDecodedProto.scoreExperimentId);
+ }
+
+ /**
* Check ScoringParams default case
*/
@Test
@@ -2185,16 +2195,8 @@ public class WifiMetricsTest {
final int id = 0;
final String expectId = "";
when(mScoringParams.getExperimentIdentifier()).thenReturn(id);
- mWifiMetrics.startConnectionEvent(mTestWifiConfig, "TestNetwork",
- WifiMetricsProto.ConnectionEvent.ROAM_ENTERPRISE);
- mWifiMetrics.endConnectionEvent(
- WifiMetrics.ConnectionEvent.FAILURE_NONE,
- WifiMetricsProto.ConnectionEvent.HLF_NONE,
- WifiMetricsProto.ConnectionEvent.FAILURE_REASON_UNKNOWN);
dumpProtoAndDeserialize();
assertEquals(expectId, mDecodedProto.scoreExperimentId);
- assertEquals(id, mDecodedProto.connectionEvent[0].networkSelectorExperimentId);
-
}
/** short hand for instantiating an anonymous int array, instead of 'new int[]{a1, a2, ...}' */
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java
index ec79e5749..cda5d626b 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSelectorTest.java
@@ -783,6 +783,7 @@ public class WifiNetworkSelectorTest {
WifiMetricsProto.ConnectionEvent.NOMINATOR_EXTERNAL_SCORED,
WifiMetricsProto.ConnectionEvent.NOMINATOR_SAVED)));
}
+ verify(mWifiMetrics, atLeastOnce()).setNetworkSelectorExperimentId(anyInt());
}
/**
@@ -1627,6 +1628,7 @@ public class WifiNetworkSelectorTest {
verify(mWifiMetrics).logNetworkSelectionDecision(
WifiNetworkSelector.LEGACY_CANDIDATE_SCORER_EXP_ID, nullScorerId, false, 2);
verify(mWifiMetrics, atLeastOnce()).setNominatorForNetwork(anyInt(), anyInt());
+ verify(mWifiMetrics, atLeastOnce()).setNetworkSelectorExperimentId(anyInt());
verifyNoMoreInteractions(mWifiMetrics);
}
@@ -1670,6 +1672,8 @@ public class WifiNetworkSelectorTest {
verify(mWifiMetrics, times(2)).logNetworkSelectionDecision(
WifiNetworkSelector.LEGACY_CANDIDATE_SCORER_EXP_ID, compatibilityExpId, true, 2);
+
+ int expid = CompatibilityScorer.COMPATIBILITY_SCORER_DEFAULT_EXPID;
+ verify(mWifiMetrics, atLeastOnce()).setNetworkSelectorExperimentId(eq(expid));
}
}
-