summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-04-09 20:44:41 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-04-09 20:44:41 +0000
commitb9e042d647ff9f0249151d774db05d1c44c026f9 (patch)
tree7b4f5a7874b913d88441c01d6e7f32370d6a8047 /tests
parente75e4299ad619f0150fc52fa4ea56cd88e0a91b9 (diff)
parent6e62a783342be8f3cde6404f93aa1b65a26609c9 (diff)
Merge "Add flag to enable enhanced mac randomization" into rvc-dev
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
index b1e6f2189..d99381097 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -2229,6 +2229,22 @@ public class WifiConfigManagerTest extends WifiBaseTest {
}
/**
+ * Verify that when DeviceConfigFacade#isEnhancedMacRandomizationEnabled returns true, any
+ * networks that already use randomized MAC use enhanced MAC randomization instead.
+ */
+ @Test
+ public void testEnhanecedMacRandomizationIsEnabledGlobally() {
+ when(mFrameworkFacade.getIntegerSetting(eq(mContext),
+ eq(WifiConfigManager.ENHANCED_MAC_RANDOMIZATION_FEATURE_FORCE_ENABLE_FLAG),
+ anyInt())).thenReturn(1);
+ WifiConfiguration config = WifiConfigurationTestUtil.createOpenNetwork();
+ assertTrue(mWifiConfigManager.shouldUseAggressiveRandomization(config));
+
+ config.macRandomizationSetting = WifiConfiguration.RANDOMIZATION_NONE;
+ assertFalse(mWifiConfigManager.shouldUseAggressiveRandomization(config));
+ }
+
+ /**
* Verifies that getRandomizedMacAndUpdateIfNeeded updates the randomized MAC address and
* |randomizedMacExpirationTimeMs| correctly.
*