diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2018-09-12 18:38:30 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-09-12 18:38:30 +0000 |
commit | 82e4e60fbfc8c5422964d9f4e1dfa705c1ce6f4c (patch) | |
tree | c58afcd2509770f2db8e8551dac9dc41a3b6bd15 /tests | |
parent | da4cb6aa6a6b95578a565316affddfed9043ec03 (diff) | |
parent | b9e43730218a5c413be1ce73153016971ebec75d (diff) |
Merge "WifiConfigManager: Handle user switch before store load"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java | 30 |
1 files changed, 30 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 a4bc61aa1..0971dbc82 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java @@ -2630,6 +2630,36 @@ public class WifiConfigManagerTest { } /** + * Verifies that the store read after bootup received after + * a user switch via {@link WifiConfigManager#handleUserSwitch(int)} + * results in a user store read. + */ + @Test + public void testHandleBootupAfterUserSwitch() throws Exception { + int user1 = TEST_DEFAULT_USER; + int user2 = TEST_DEFAULT_USER + 1; + setupUserProfiles(user2); + + // Switch from user1 to user2 and ensure that we don't read or write any data + // (need to wait for loadFromStore invocation). + mWifiConfigManager.handleUserSwitch(user2); + mContextConfigStoreMockOrder.verify(mWifiConfigStore, never()).read(); + mContextConfigStoreMockOrder.verify(mWifiConfigStore, never()).write(anyBoolean()); + mContextConfigStoreMockOrder.verify(mWifiConfigStore, never()) + .switchUserStoreAndRead(any(WifiConfigStore.StoreFile.class)); + + // Now load from the store. + assertTrue(mWifiConfigManager.loadFromStore()); + mContextConfigStoreMockOrder.verify(mWifiConfigStore).read(); + + // Unlock the user2 and ensure that we read from the user store. + setupStoreDataForUserRead(new ArrayList<>(), new HashSet<>()); + mWifiConfigManager.handleUserUnlock(user2); + mContextConfigStoreMockOrder.verify(mWifiConfigStore) + .switchUserStoreAndRead(any(WifiConfigStore.StoreFile.class)); + } + + /** * Verifies the foreground user unlock via {@link WifiConfigManager#handleUserUnlock(int)} does * not always result in a store read unless the user had switched or just booted up. */ |