summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKai Shi <kaishi@google.com>2020-06-02 20:38:23 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-06-02 20:38:23 +0000
commit7406fac7e4550b239dfa2a6f53b83a79042a5e1b (patch)
tree9288c490944c5b43a8f659ab620437d4b5493c81 /tests
parent40a6a0e1fb3efb62b81e24b30820c9ffa778b206 (diff)
parent175269fd8db424e61b3ab5e3b8e9ffa85681ab60 (diff)
Merge "Add mainlineModuleVersion in WifiMetrics" into rvc-dev
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java8
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java3
2 files changed, 8 insertions, 3 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java b/tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java
index 4e0b5b75e..264fe9048 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiHealthMonitorTest.java
@@ -110,6 +110,7 @@ public class WifiHealthMonitorTest extends WifiBaseTest {
private WifiConfiguration mWifiConfig;
private String mDriverVersion;
private String mFirmwareVersion;
+ private static final long MODULE_VERSION = 1L;
private TestAlarmManager mAlarmManager;
private TestLooper mLooper = new TestLooper();
private List<WifiConfiguration> mConfiguredNetworks;
@@ -152,7 +153,7 @@ public class WifiHealthMonitorTest extends WifiBaseTest {
mDriverVersion = "build 1.1";
mFirmwareVersion = "HW 1.1";
- mPackageInfo.versionCode = 1;
+ when(mPackageInfo.getLongVersionCode()).thenReturn(MODULE_VERSION);
when(mContext.getPackageName()).thenReturn("WifiAPK");
when(mPackageManager.getPackageInfo(anyString(), anyInt())).thenReturn(mPackageInfo);
when(mContext.getPackageManager()).thenReturn(mPackageManager);
@@ -310,6 +311,7 @@ public class WifiHealthMonitorTest extends WifiBaseTest {
// trigger extractCurrentSoftwareBuildInfo() call to update currSoftwareBuildInfo
mWifiHealthMonitor.installMemoryStoreSetUpDetectionAlarm(mMemoryStore);
mWifiHealthMonitor.setWifiEnabled(true);
+ assertEquals(0, mWifiHealthMonitor.getWifiStackVersion());
millisecondsPass(5000);
mWifiScanner.startScan(mScanSettings, mScanListener);
mAlarmManager.dispatch(WifiHealthMonitor.POST_BOOT_DETECTION_TIMER_TAG);
@@ -365,6 +367,7 @@ public class WifiHealthMonitorTest extends WifiBaseTest {
.getWifiFirmwareVersion());
assertEquals(mFirmwareVersion, wifiSystemInfoStats.getPrevSoftwareBuildInfo()
.getWifiFirmwareVersion());
+ assertEquals(MODULE_VERSION, mWifiHealthMonitor.getWifiStackVersion());
// Check write
String writtenHex = hexStringFromByteArray(mBlobs.get(mKeys.size() - 1));
@@ -395,8 +398,7 @@ public class WifiHealthMonitorTest extends WifiBaseTest {
SystemInfoStats systemInfoStats = SystemInfoStats.parseFrom(serialized);
WifiSoftwareBuildInfo currSoftwareBuildInfoFromMemory = wifiSystemInfoStats
.fromSoftwareBuildInfo(systemInfoStats.getCurrSoftwareBuildInfo());
- assertEquals(mPackageInfo.versionCode,
- currSoftwareBuildInfoFromMemory.getWifiStackVersion());
+ assertEquals(MODULE_VERSION, currSoftwareBuildInfoFromMemory.getWifiStackVersion());
assertEquals(mDriverVersion, currSoftwareBuildInfoFromMemory.getWifiDriverVersion());
assertEquals(mFirmwareVersion, currSoftwareBuildInfoFromMemory.getWifiFirmwareVersion());
assertEquals(Build.DISPLAY, currSoftwareBuildInfoFromMemory.getOsBuildVersion());
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index fcaee0550..ca5ae268d 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -441,6 +441,7 @@ public class WifiMetricsTest extends WifiBaseTest {
private static final int NUM_NETWORK_SUFFICIENT_RECENT_STATS_ONLY = 4;
private static final int NUM_NETWORK_SUFFICIENT_RECENT_PREV_STATS = 5;
private static final int NUM_BSSID_SELECTION_DIFFERENT_BETWEEN_FRAMEWORK_FIRMWARE = 3;
+ private static final long WIFI_MAINLINE_MODULE_VERSION = 123456L;
/** Number of notifications per "Connect to Network" notification type. */
private static final int[] NUM_CONNECT_TO_NETWORK_NOTIFICATIONS = {0, 10, 20, 30, 40};
@@ -1010,6 +1011,7 @@ public class WifiMetricsTest extends WifiBaseTest {
metrics.numNetworkSufficientRecentStatsOnly = NUM_NETWORK_SUFFICIENT_RECENT_STATS_ONLY;
metrics.numNetworkSufficientRecentPrevStats = NUM_NETWORK_SUFFICIENT_RECENT_PREV_STATS;
when(mWifiHealthMonitor.buildProto()).thenReturn(metrics);
+ when(mWifiHealthMonitor.getWifiStackVersion()).thenReturn(WIFI_MAINLINE_MODULE_VERSION);
}
private void addSoftApEventsToMetrics() {
@@ -1412,6 +1414,7 @@ public class WifiMetricsTest extends WifiBaseTest {
mDecodedProto.numConnectRequestWithFilsAkm);
assertEquals(NUM_L2_CONNECTION_THROUGH_FILS_AUTHENTICATION,
mDecodedProto.numL2ConnectionThroughFilsAuthentication);
+ assertEquals(WIFI_MAINLINE_MODULE_VERSION, mDecodedProto.mainlineModuleVersion);
}