diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2017-08-16 18:55:10 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-08-16 18:55:10 +0000 |
commit | 0af8182c7a421108aff122440724ecc5d1e4c6d7 (patch) | |
tree | 174c8615fc227f770e64551dc6534e18a094df70 /tests | |
parent | 49f325ce2ad66f14c7f844c4d429bbbbd79106aa (diff) | |
parent | 347faef7fe3f5df209da431eb844bc026a1ba007 (diff) |
Merge "WifiConfigManager: Skip data migration if new store is present" into oc-mr1-dev
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java | 19 |
1 files changed, 19 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 7509c18b3..a85e5740b 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java @@ -2555,6 +2555,7 @@ public class WifiConfigManagerTest { new WifiConfigStoreDataLegacy(networks, deletedEphermalSSIDs); when(mWifiConfigStoreLegacy.areStoresPresent()).thenReturn(true); + when(mWifiConfigStore.areStoresPresent()).thenReturn(false); when(mWifiConfigStoreLegacy.read()).thenReturn(storeData); // Now trigger the migration from legacy store. This should populate the in memory list with @@ -2588,6 +2589,24 @@ public class WifiConfigManagerTest { } /** + * Verifies the loading of networks using {@link WifiConfigManager#migrateFromLegacyStore()} ()} + * does not attempt to migrate data from legacy stores when the new store files are present + * (i.e migration was already done once). + */ + @Test + public void testNewStoreFilesPresentNoMigrationFromLegacyStore() throws Exception { + when(mWifiConfigStore.areStoresPresent()).thenReturn(true); + when(mWifiConfigStoreLegacy.areStoresPresent()).thenReturn(true); + + // Now trigger a migration from legacy store. + assertTrue(mWifiConfigManager.migrateFromLegacyStore()); + + verify(mWifiConfigStoreLegacy, never()).read(); + // Verify that we went ahead and deleted the old store files. + verify(mWifiConfigStoreLegacy).removeStores(); + } + + /** * Verifies the loading of networks using {@link WifiConfigManager#loadFromStore()} does * not attempt to read from any of the stores (new or legacy) when the store files are * not present. |