diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-04-09 20:44:41 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-04-09 20:44:41 +0000 |
commit | b9e042d647ff9f0249151d774db05d1c44c026f9 (patch) | |
tree | 7b4f5a7874b913d88441c01d6e7f32370d6a8047 /tests | |
parent | e75e4299ad619f0150fc52fa4ea56cd88e0a91b9 (diff) | |
parent | 6e62a783342be8f3cde6404f93aa1b65a26609c9 (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.java | 16 |
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. * |