summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMingguang Xu <mingguangxu@google.com>2020-09-10 04:33:53 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-09-10 04:33:53 +0000
commita0ea2e4b30a1ba0e86ec3d177f638604d9a079dc (patch)
tree5fc0de594bad49a44dddfdc6d79a645ef3d272e9 /tests
parent59d3999893e4f2bade6c81bd2a7187a63a433c16 (diff)
parentc8623f0fe9ba447c890063bc74850a06b9022bf5 (diff)
Merge "Add metrics for Adaptive Connectivity toggle" into rvc-qpr-dev
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index b4cd7592c..b69b30208 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -2302,6 +2302,7 @@ public class WifiMetricsTest extends WifiBaseTest {
mTestLooper.dispatchAll();
wifiMetrics.setScreenState(true);
when(mWifiDataStall.isCellularDataAvailable()).thenReturn(true);
+ wifiMetrics.setAdaptiveConnectivityState(true);
for (int i = 0; i < mTestStaLogInts.length; i++) {
int[] lia = mTestStaLogInts[i];
wifiMetrics.logStaEvent(lia[0], lia[1], lia[2] == 1 ? mTestWifiConfig : null);
@@ -2342,6 +2343,7 @@ public class WifiMetricsTest extends WifiBaseTest {
evs[7] == 1 ? mTestWifiConfig : null, event.configInfo);
assertEquals(true, event.screenOn);
assertEquals(true, event.isCellularDataAvailable);
+ assertEquals(true, event.isAdaptiveConnectivityEnabled);
j++;
}
assertEquals(mExpectedValues.length, j);
@@ -2554,6 +2556,35 @@ public class WifiMetricsTest extends WifiBaseTest {
}
/**
+ * Test the logging of UserActionEvent for Adaptive Connectivity toggle
+ */
+ @Test
+ public void testLogUserActionEventForAdaptiveConnectivity() throws Exception {
+ long testStartTimeMillis = 123123L;
+ boolean adaptiveConnectivityEnabled = true;
+ when(mClock.getElapsedSinceBootMillis()).thenReturn(testStartTimeMillis);
+ mWifiMetrics.logUserActionEvent(
+ mWifiMetrics.convertAdaptiveConnectivityStateToUserActionEventType(
+ adaptiveConnectivityEnabled));
+ long testStartTimeMillis2 = 200000L;
+ boolean adaptiveConnectivityEnabled2 = false;
+ when(mClock.getElapsedSinceBootMillis()).thenReturn(testStartTimeMillis2);
+ mWifiMetrics.logUserActionEvent(
+ mWifiMetrics.convertAdaptiveConnectivityStateToUserActionEventType(
+ adaptiveConnectivityEnabled2));
+ dumpProtoAndDeserialize();
+
+ WifiMetricsProto.UserActionEvent[] userActionEvents = mDecodedProto.userActionEvents;
+ assertEquals(2, userActionEvents.length);
+ assertEquals(WifiMetricsProto.UserActionEvent.EVENT_CONFIGURE_ADAPTIVE_CONNECTIVITY_ON,
+ userActionEvents[0].eventType);
+ assertEquals(testStartTimeMillis, userActionEvents[0].startTimeMillis);
+ assertEquals(WifiMetricsProto.UserActionEvent.EVENT_CONFIGURE_ADAPTIVE_CONNECTIVITY_OFF,
+ userActionEvents[1].eventType);
+ assertEquals(testStartTimeMillis2, userActionEvents[1].startTimeMillis);
+ }
+
+ /**
* Verify that the max length of the UserActionEvent list is limited to MAX_USER_ACTION_EVENTS.
*/
@Test