diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-04-24 01:25:22 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-04-24 01:25:22 +0000 |
commit | bf5903c9c270c329aa2eaffcf777ce72752d7021 (patch) | |
tree | a296570e8f335cc9dfad9b8f7bfd2ec331daca95 /tests | |
parent | 964bd5d117391df9428d806f182c542cc75c1ca4 (diff) | |
parent | e0e4592a0efe0170ad5a5e162253306f7d0f21fc (diff) |
Merge "WifiNetworkFactory: Don't use WifiConfig from UI for matching" into rvc-dev
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java index b495b49c7..ff31eb223 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkFactoryTest.java @@ -1036,7 +1036,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { // Now trigger user selection to some network. WifiConfiguration selectedNetwork = WifiConfigurationTestUtil.createOpenNetwork(); - networkRequestUserSelectionCallback.select(selectedNetwork); + sendUserSelectionSelect(networkRequestUserSelectionCallback, selectedNetwork); mLooper.dispatchAll(); // Verify we did not attempt to trigger a connection or disable connectivity manager. @@ -1060,7 +1060,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { // Now trigger user selection to some network. WifiConfiguration selectedNetwork = WifiConfigurationTestUtil.createOpenNetwork(); - networkRequestUserSelectionCallback.select(selectedNetwork); + sendUserSelectionSelect(networkRequestUserSelectionCallback, selectedNetwork); mLooper.dispatchAll(); // Verify we did not attempt to trigger a connection or disable connectivity manager. @@ -1082,7 +1082,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { ScanResult matchingScanResult = mTestScanDatas[0].getResults()[0]; mSelectedNetwork = WifiConfigurationTestUtil.createPskNetwork(); mSelectedNetwork.SSID = "\"" + mTestScanDatas[0].getResults()[0].SSID + "\""; - networkRequestUserSelectionCallback.select(mSelectedNetwork); + sendUserSelectionSelect(networkRequestUserSelectionCallback, mSelectedNetwork); mLooper.dispatchAll(); // Cancel periodic scans. @@ -1140,7 +1140,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { // Now trigger user selection to one of the network. mSelectedNetwork = WifiConfigurationTestUtil.createPskNetwork(); mSelectedNetwork.SSID = "\"" + mTestScanDatas[0].getResults()[0].SSID + "\""; - networkRequestUserSelectionCallback.select(mSelectedNetwork); + sendUserSelectionSelect(networkRequestUserSelectionCallback, mSelectedNetwork); mLooper.dispatchAll(); // Verifier num of Approved access points. @@ -1150,7 +1150,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { // Now trigger user selection to another network with different SSID. mSelectedNetwork = WifiConfigurationTestUtil.createPskNetwork(); mSelectedNetwork.SSID = "\"" + mTestScanDatas[0].getResults()[numOfApPerSsid].SSID + "\""; - networkRequestUserSelectionCallback.select(mSelectedNetwork); + sendUserSelectionSelect(networkRequestUserSelectionCallback, mSelectedNetwork); mLooper.dispatchAll(); // Verify triggered trim when user Approved Access Points exceed capacity. @@ -1187,7 +1187,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { .thenReturn(matchingSavedNetwork); // Now trigger user selection to one of the network. - networkRequestUserSelectionCallback.select(mSelectedNetwork); + sendUserSelectionSelect(networkRequestUserSelectionCallback, mSelectedNetwork); mLooper.dispatchAll(); // Cancel periodic scans. @@ -1240,7 +1240,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { INetworkRequestUserSelectionCallback networkRequestUserSelectionCallback = mNetworkRequestUserSelectionCallback.getValue(); assertNotNull(networkRequestUserSelectionCallback); - networkRequestUserSelectionCallback.select(mSelectedNetwork); + sendUserSelectionSelect(networkRequestUserSelectionCallback, mSelectedNetwork); mLooper.dispatchAll(); // Verify WifiConfiguration params. @@ -1291,7 +1291,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { INetworkRequestUserSelectionCallback networkRequestUserSelectionCallback = mNetworkRequestUserSelectionCallback.getValue(); assertNotNull(networkRequestUserSelectionCallback); - networkRequestUserSelectionCallback.select(mSelectedNetwork); + sendUserSelectionSelect(networkRequestUserSelectionCallback, mSelectedNetwork); mLooper.dispatchAll(); // Verify WifiConfiguration params. @@ -1734,7 +1734,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { // Ignore stale callbacks. WifiConfiguration selectedNetwork = WifiConfigurationTestUtil.createOpenNetwork(); - networkRequestUserSelectionCallback.select(selectedNetwork); + sendUserSelectionSelect(networkRequestUserSelectionCallback, selectedNetwork); mLooper.dispatchAll(); verify(mNetworkRequestMatchCallback).onAbort(); @@ -2713,7 +2713,7 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { // Now trigger user selection to one of the network. mSelectedNetwork = WifiConfigurationTestUtil.createPskNetwork(); mSelectedNetwork.SSID = "\"" + targetSsid + "\""; - networkRequestUserSelectionCallback.select(mSelectedNetwork); + sendUserSelectionSelect(networkRequestUserSelectionCallback, mSelectedNetwork); mLooper.dispatchAll(); // Cancel the periodic scan timer. @@ -3055,4 +3055,12 @@ public class WifiNetworkFactoryTest extends WifiBaseTest { WifiConfigStore.ENCRYPT_CREDENTIALS_CONFIG_STORE_DATA_VERSION, mock(WifiConfigStoreEncryptionUtil.class)); } + + private void sendUserSelectionSelect(INetworkRequestUserSelectionCallback callback, + WifiConfiguration selectedNetwork) throws RemoteException { + WifiConfiguration selectedNetworkinCb = new WifiConfiguration(); + // only copy over the ssid + selectedNetworkinCb.SSID = selectedNetwork.SSID; + callback.select(selectedNetworkinCb); + } } |