diff options
author | Hai Shalom <haishalom@google.com> | 2019-11-21 19:23:30 +0000 |
---|---|---|
committer | Hai Shalom <haishalom@google.com> | 2019-11-21 23:09:01 +0000 |
commit | ff23d602c7a925a7aef87f1f7c3d08e67ad31a5e (patch) | |
tree | 8bb3ec31fbb2e671d51aef48afdc9a1ed6b3fe8a /tests | |
parent | 9328b5ed7bcda1cf5d73cdaa9c70284b58462547 (diff) |
Revert submission
Reason for revert: Incomplete fix that causes additional issues which were not anticipated earlier.
Change-Id: Ie75fe87dd671ebe00add8c858da47dff793077a4
Merged-In: I526410612fe2f733ae41efe7ed1a20ab6d620458
Diffstat (limited to 'tests')
4 files changed, 11 insertions, 213 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/ConfigurationMapTest.java b/tests/wifitests/src/com/android/server/wifi/ConfigurationMapTest.java index b866b965b..97141c496 100644 --- a/tests/wifitests/src/com/android/server/wifi/ConfigurationMapTest.java +++ b/tests/wifitests/src/com/android/server/wifi/ConfigurationMapTest.java @@ -276,7 +276,6 @@ public class ConfigurationMapTest { verifyScanResultMatchWithNetwork(WifiConfigurationTestUtil.createPskNetwork()); verifyScanResultMatchWithNetwork(WifiConfigurationTestUtil.createWepNetwork()); verifyScanResultMatchWithNetwork(WifiConfigurationTestUtil.createEapNetwork()); - verifyScanResultMatchWithNetwork(WifiConfigurationTestUtil.createSaeNetwork()); } /** @@ -329,54 +328,4 @@ public class ConfigurationMapTest { mConfigs.clear(); assertNull(mConfigs.getByScanResultForCurrentUser(scanResult)); } - - /** - * Verifies that {@link ConfigurationMap#getPskNetworkByScanResultForCurrentUser(ScanResult)} - * can positively match a PSK network for transition mode AP. - */ - @Test - public void testFindPskNetworkFromSaeScanResult() { - final String wpa2Wpa3TransitionSsid = "\"WPA3-Transition\""; - WifiConfiguration saePskConfig = - WifiConfigurationTestUtil.createSaeNetwork(wpa2Wpa3TransitionSsid); - WifiConfiguration pskConfig = - WifiConfigurationTestUtil.createPskNetwork(wpa2Wpa3TransitionSsid); - mConfigs.put(saePskConfig); - mConfigs.put(pskConfig); - - ScanDetail scanDetail = WifiConfigurationTestUtil - .createScanDetailForWpa2Wpa3TransitionModeNetwork(saePskConfig, - "AA:BB:CC:DD:CC:BB", -40, 2402, 0, 1); - ScanResult scanResult = scanDetail.getScanResult(); - - WifiConfiguration retrievedConfig = - mConfigs.getPskNetworkByScanResultForCurrentUser(scanResult); - assertNotNull(retrievedConfig); - assertEquals(pskConfig.configKey(), retrievedConfig.configKey()); - } - - /** - * Verifies that {@link ConfigurationMap#getOpenNetworkByScanResultForCurrentUser(ScanResult)} - * can positively match a PSK network for transition mode AP. - */ - @Test - public void testFindOpenNetworkFromOweScanResult() { - final String oweTransitionSsid = "\"OWE-Transition\""; - WifiConfiguration oweOpenConfig = - WifiConfigurationTestUtil.createOweNetwork(oweTransitionSsid); - WifiConfiguration openConfig = - WifiConfigurationTestUtil.createOpenNetwork(oweTransitionSsid); - mConfigs.put(oweOpenConfig); - mConfigs.put(openConfig); - - ScanDetail scanDetail = WifiConfigurationTestUtil - .createScanDetailForOweTransitionModeNetwork(oweOpenConfig, - "AA:BB:CC:DD:CC:BB", -40, 2402, 0, 1); - ScanResult scanResult = scanDetail.getScanResult(); - - WifiConfiguration retrievedConfig = - mConfigs.getOpenNetworkByScanResultForCurrentUser(scanResult); - assertNotNull(retrievedConfig); - assertEquals(openConfig.configKey(), retrievedConfig.configKey()); - } } diff --git a/tests/wifitests/src/com/android/server/wifi/ScanResultMatchInfoTest.java b/tests/wifitests/src/com/android/server/wifi/ScanResultMatchInfoTest.java index b931e3f5b..2712ce077 100644 --- a/tests/wifitests/src/com/android/server/wifi/ScanResultMatchInfoTest.java +++ b/tests/wifitests/src/com/android/server/wifi/ScanResultMatchInfoTest.java @@ -92,7 +92,7 @@ public class ScanResultMatchInfoTest { @Test public void testEqualityRulesForTransitionMode() { WifiConfiguration wifiConfiguration = - WifiConfigurationTestUtil.createSaeNetwork("\"Transition is Hard\""); + WifiConfigurationTestUtil.createPskNetwork("\"Transition is Hard\""); ScanDetail scanDetail = createScanDetailForWpa2Wpa3TransitionModeNetwork(wifiConfiguration, "AA:BB:CC:DD:CC:BB"); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java index c3b90d36c..c4cbc6e50 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java @@ -185,8 +185,6 @@ public class WifiConfigManagerTest { return TEST_NO_PERM_NAME; } else if (uid == Process.WIFI_UID) { return TEST_WIFI_NAME; - } else if (uid == Process.SYSTEM_UID) { - return TEST_WIFI_NAME; } fail("Unexpected UID: " + uid); return ""; @@ -5351,133 +5349,4 @@ public class WifiConfigManagerTest { assertFalse(mWifiConfigManager.getConfiguredNetwork(networkId) .getNetworkSelectionStatus().isNetworkTemporaryDisabled()); } - - /** - * Verifies that when scanning a WPA3 in transition mode AP, and there is a matching WPA2 saved - * network, {@link WifiConfigManager#getConfiguredNetworkForScanDetailAndCache(ScanDetail)} - * clones a new WPA3 saved network that will be used to connect to it. - * - * The test also verifies that the new network is marked as cloned. - */ - @Test - public void testCloningPskNetworkForTransitionMode() { - final String wpa2Wpa3TransitionSsid = "\"WPA3-Transition\""; - WifiConfiguration saeNetwork = WifiConfigurationTestUtil - .createSaeNetwork(wpa2Wpa3TransitionSsid); - WifiConfiguration pskNetwork = WifiConfigurationTestUtil - .createPskNetwork(wpa2Wpa3TransitionSsid); - - // First add the WPA2 saved network. - verifyAddNetworkToWifiConfigManager(pskNetwork); - - // Now create a dummy scan detail for WPA3-Transition. - ScanDetail scanDetail = WifiConfigurationTestUtil - .createScanDetailForWpa2Wpa3TransitionModeNetwork(saeNetwork, - "AA:BB:CC:DD:CC:BB", -40, 2402, 0, 1); - - - WifiConfiguration retrievedNetwork = - mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(scanDetail); - // Retrieve the network with password data for comparison. - retrievedNetwork = - mWifiConfigManager.getConfiguredNetworkWithPassword(retrievedNetwork.networkId); - - // Verify cloned network matches the expected WPA3 network - assertEquals(saeNetwork.SSID, retrievedNetwork.SSID); - assertEquals(saeNetwork.BSSID, retrievedNetwork.BSSID); - assertEquals(saeNetwork.preSharedKey, retrievedNetwork.preSharedKey); - assertEquals(saeNetwork.requirePMF, retrievedNetwork.requirePMF); - assertEquals(saeNetwork.allowedKeyManagement, retrievedNetwork.allowedKeyManagement); - assertNotNull(retrievedNetwork.clonedNetworkConfigKey); - assertEquals(retrievedNetwork.clonedNetworkConfigKey, pskNetwork.configKey()); - } - - /** - * Verifies that when scanning a WPA3 in transition mode AP, and there is a matching WPA2 saved - * network, {@link WifiConfigManager#getConfiguredNetworkForScanDetailAndCache(ScanDetail)} - * clones a new WPA3 saved network that will be used to connect to it. - * - * The test also verifies that the new network is marked as cloned. - */ - @Test - public void testCloningOweNetworkForTransitionMode() { - final String oweTransitionSsid = "\"OWE-Transition\""; - WifiConfiguration oweNetwork = WifiConfigurationTestUtil - .createOweNetwork(oweTransitionSsid); - WifiConfiguration openNetwork = WifiConfigurationTestUtil - .createOpenNetwork(oweTransitionSsid); - - // First add the Open saved network. - verifyAddNetworkToWifiConfigManager(openNetwork); - - // Now create a dummy scan detail for OWE-Transition. - ScanDetail scanDetail = WifiConfigurationTestUtil - .createScanDetailForOweTransitionModeNetwork(oweNetwork, - "AA:BB:CC:DD:CC:BB", -40, 2402, 0, 1); - - - WifiConfiguration retrievedNetwork = - mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(scanDetail); - // Retrieve the network with password data for comparison. - retrievedNetwork = - mWifiConfigManager.getConfiguredNetworkWithPassword(retrievedNetwork.networkId); - - // Verify cloned network matches the expected OWE network - assertEquals(oweNetwork.SSID, retrievedNetwork.SSID); - assertEquals(oweNetwork.BSSID, retrievedNetwork.BSSID); - assertEquals(oweNetwork.preSharedKey, retrievedNetwork.preSharedKey); - assertEquals(oweNetwork.requirePMF, retrievedNetwork.requirePMF); - assertEquals(oweNetwork.allowedKeyManagement, retrievedNetwork.allowedKeyManagement); - assertNotNull(retrievedNetwork.clonedNetworkConfigKey); - assertEquals(retrievedNetwork.clonedNetworkConfigKey, openNetwork.configKey()); - } - - /** - * Verifies that when a cloned network is removed, its original pair is removed as well - * {@link WifiConfigManager#removeNetwork(int)} - */ - @Test - public void testRemoveClonedSaeNetwork() { - final String wpa2Wpa3TransitionSsid = "\"WPA3-Transition\""; - WifiConfiguration saeNetwork = WifiConfigurationTestUtil - .createSaeNetwork(wpa2Wpa3TransitionSsid); - WifiConfiguration pskNetwork = WifiConfigurationTestUtil - .createPskNetwork(wpa2Wpa3TransitionSsid); - - // First add the WPA2 saved network. - NetworkUpdateResult result = verifyAddNetworkToWifiConfigManager(pskNetwork); - verify(mWcmListener).onSavedNetworkAdded(result.netId); - reset(mWcmListener); - - // Now create a dummy scan detail for WPA3-Transition. - ScanDetail scanDetail = WifiConfigurationTestUtil - .createScanDetailForWpa2Wpa3TransitionModeNetwork(saeNetwork, - "AA:BB:CC:DD:CC:BB", -40, 2402, 0, 1); - - WifiConfiguration retrievedNetwork = - mWifiConfigManager.getConfiguredNetworkForScanDetailAndCache(scanDetail); - // Retrieve the network with password data for comparison. - retrievedNetwork = - mWifiConfigManager.getConfiguredNetworkWithPassword(retrievedNetwork.networkId); - - // Verify cloned network matches the expected WPA3 network - assertEquals(saeNetwork.SSID, retrievedNetwork.SSID); - assertEquals(saeNetwork.BSSID, retrievedNetwork.BSSID); - assertEquals(saeNetwork.preSharedKey, retrievedNetwork.preSharedKey); - assertEquals(saeNetwork.requirePMF, retrievedNetwork.requirePMF); - assertEquals(saeNetwork.allowedKeyManagement, retrievedNetwork.allowedKeyManagement); - assertNotNull(retrievedNetwork.clonedNetworkConfigKey); - assertEquals(retrievedNetwork.clonedNetworkConfigKey, pskNetwork.configKey()); - - // Ensure that configured network list is not empty. - assertTrue(mWifiConfigManager.getConfiguredNetworks().size() == 2); - verify(mWcmListener).onSavedNetworkAdded(retrievedNetwork.networkId); - reset(mWcmListener); - - assertTrue(mWifiConfigManager.removeNetwork(retrievedNetwork.networkId, TEST_CREATOR_UID)); - - // Ensure that configured network list is empty now. - assertTrue(mWifiConfigManager.getConfiguredNetworks().isEmpty()); - verify(mWcmListener).onSavedNetworkRemoved(retrievedNetwork.networkId); - } } diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java index 826250497..056df7c37 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java @@ -248,11 +248,8 @@ public class WifiConfigurationTestUtil { } public static WifiConfiguration createOweNetwork(String ssid) { - WifiConfiguration configuration = generateWifiConfig(TEST_NETWORK_ID, TEST_UID, ssid, - true, true, null, null, SECURITY_OWE); - - configuration.requirePMF = true; - return configuration; + return generateWifiConfig(TEST_NETWORK_ID, TEST_UID, ssid, true, true, null, + null, SECURITY_OWE); } public static WifiConfiguration createOpenNetwork() { @@ -277,7 +274,14 @@ public class WifiConfigurationTestUtil { } public static WifiConfiguration createSaeNetwork() { - return createSaeNetwork(createNewSSID()); + WifiConfiguration configuration = + generateWifiConfig(TEST_NETWORK_ID, TEST_UID, createNewSSID(), true, true, null, + null, SECURITY_SAE); + + // SAE password uses the same member. + configuration.preSharedKey = TEST_PSK; + configuration.requirePMF = true; + return configuration; } public static WifiConfiguration createPskNetwork() { @@ -300,10 +304,6 @@ public class WifiConfigurationTestUtil { WifiConfiguration configuration = generateWifiConfig(TEST_NETWORK_ID, TEST_UID, ssid, true, true, null, null, SECURITY_SAE); - - // SAE password uses the same member. - configuration.preSharedKey = TEST_PSK; - configuration.requirePMF = true; return configuration; } @@ -515,15 +515,6 @@ public class WifiConfigurationTestUtil { } /** - * Gets scan result capabilities for a WPA2/WPA3-Transition mode network configuration - */ - private static String - getScanResultCapsForOweTransitionNetwork(WifiConfiguration configuration) { - String caps = "[OWE_TRANSITION-CCMP]"; - return caps; - } - - /** * Creates a scan detail corresponding to the provided network and given BSSID, etc. */ public static ScanDetail createScanDetailForNetwork( @@ -546,17 +537,6 @@ public class WifiConfigurationTestUtil { return new ScanDetail(ssid, bssid, caps, level, frequency, tsf, seen); } - /** - * Creates a scan detail corresponding to the provided network and given BSSID, but sets - * the capabilities to OWE-Transition mode network. - */ - public static ScanDetail createScanDetailForOweTransitionModeNetwork( - WifiConfiguration configuration, String bssid, int level, int frequency, - long tsf, long seen) { - String caps = getScanResultCapsForOweTransitionNetwork(configuration); - WifiSsid ssid = WifiSsid.createFromAsciiEncoded(configuration.getPrintableSsid()); - return new ScanDetail(ssid, bssid, caps, level, frequency, tsf, seen); - } /** * Asserts that the 2 WifiConfigurations are equal in the elements saved for both backup/restore |