From 6ecd7a8dcde46e3524c15c4a07075ca06ab681b5 Mon Sep 17 00:00:00 2001 From: Peter Qiu Date: Thu, 30 Mar 2017 11:07:01 -0700 Subject: hotspot2: initiate disconnect when updating current network's provider When a Passpoint provider configuration that's being used for the current network connection is updated, we should initiate a disconnect from the current connection so that updated provider configuration (e.g. credential) will be used. Bug: 36777009 Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh Test: verify WiFi is disconnect then reconnect when updating Passpoint provider that's used for the current connection Change-Id: Id5ed0883a75ef8b0ca6d238f4e8e52d7a4d36ea7 --- .../android/server/wifi/WifiStateMachineTest.java | 27 +++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java index c901227e0..80e29c6b1 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java @@ -1166,22 +1166,33 @@ public class WifiStateMachineTest { */ @Test public void syncAddOrUpdatePasspointConfig() throws Exception { - when(mPasspointManager.addOrUpdateProvider(any(PasspointConfiguration.class))) - .thenReturn(true); + PasspointConfiguration config = new PasspointConfiguration(); + HomeSp homeSp = new HomeSp(); + homeSp.setFqdn("test.com"); + config.setHomeSp(homeSp); + + when(mPasspointManager.addOrUpdateProvider(config)).thenReturn(true); mLooper.startAutoDispatch(); - assertTrue(mWsm.syncAddOrUpdatePasspointConfig(mWsmAsyncChannel, - new PasspointConfiguration())); + assertTrue(mWsm.syncAddOrUpdatePasspointConfig(mWsmAsyncChannel, config)); mLooper.stopAutoDispatch(); reset(mPasspointManager); - when(mPasspointManager.addOrUpdateProvider(any(PasspointConfiguration.class))) - .thenReturn(false); + when(mPasspointManager.addOrUpdateProvider(config)).thenReturn(false); mLooper.startAutoDispatch(); - assertFalse(mWsm.syncAddOrUpdatePasspointConfig(mWsmAsyncChannel, - new PasspointConfiguration())); + assertFalse(mWsm.syncAddOrUpdatePasspointConfig(mWsmAsyncChannel, config)); mLooper.stopAutoDispatch(); } + /** + * Verify that syncAddOrUpdatePasspointConfig will redirect calls to {@link PasspointManager} + * and returning the result that's returned from {@link PasspointManager} when in client mode. + */ + @Test + public void syncAddOrUpdatePasspointConfigInClientMode() throws Exception { + loadComponentsInStaMode(); + syncAddOrUpdatePasspointConfig(); + } + /** * Verify that syncRemovePasspointConfig will redirect calls to {@link PasspointManager} * and returning the result that's returned from {@link PasspointManager}. -- cgit v1.2.3