diff options
author | Roshan Pius <rpius@google.com> | 2019-08-02 11:18:53 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2019-08-06 14:52:15 -0700 |
commit | 138d7dbe7a142e286d656fdd57bc9b40b855c982 (patch) | |
tree | 068a5e9bfec9268923dac3187aa0ced4d5afbdf2 /tests | |
parent | ece7e1bb352a57ed82124173449b7d5b6d479e8e (diff) |
Revert "WifiConfigStore: Limit integrity checks to single user devices"
This reverts commit 8e70909c098f29b008d062e0cb30f313d300542d.
Removing workaround. Proper fix in CL above.
Bug: 138482990
Test: N/A
Change-Id: Iaee7746a3afc0fd6e80daa77ce5034e660261e8b
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java | 3 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java | 51 |
2 files changed, 2 insertions, 52 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java index 28964b109..686b2098d 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java @@ -229,8 +229,7 @@ public class WifiConfigManagerTest { mSession = ExtendedMockito.mockitoSession() .mockStatic(WifiConfigStore.class, withSettings().lenient()) .startMocking(); - when(WifiConfigStore.createUserFiles(anyInt(), any(UserManager.class))) - .thenReturn(mock(List.class)); + when(WifiConfigStore.createUserFiles(anyInt())).thenReturn(mock(List.class)); when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mDataTelephonyManager); } diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java index 6fdcce80c..64e762bec 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java @@ -31,7 +31,6 @@ import androidx.test.filters.SmallTest; import com.android.internal.util.ArrayUtils; import com.android.server.wifi.WifiConfigStore.StoreData; import com.android.server.wifi.WifiConfigStore.StoreFile; -import com.android.server.wifi.util.DataIntegrityChecker; import com.android.server.wifi.util.XmlUtil; import org.junit.After; @@ -148,7 +147,6 @@ public class WifiConfigStoreTest { private TestLooper mLooper; @Mock private Clock mClock; @Mock private WifiMetrics mWifiMetrics; - @Mock private DataIntegrityChecker mDataIntegrityChecker; private MockStoreFile mSharedStore; private MockStoreFile mUserStore; private MockStoreFile mUserNetworkSuggestionsStore; @@ -381,48 +379,6 @@ public class WifiConfigStoreTest { } /** - * Tests the read API behaviour after a write to the store files (with no integrity checks). - * Expected behaviour: The read should return the same data that was last written. - */ - @Test - public void testReadAfterWriteWithNoIntegrityCheck() throws Exception { - // Recreate the mock store files with no data integrity checking. - mUserStores.clear(); - mSharedStore = new MockStoreFile(WifiConfigStore.STORE_FILE_SHARED_GENERAL, null); - mUserStore = new MockStoreFile(WifiConfigStore.STORE_FILE_USER_GENERAL, null); - mUserNetworkSuggestionsStore = - new MockStoreFile(WifiConfigStore.STORE_FILE_USER_NETWORK_SUGGESTIONS, null); - mUserStores.add(mUserStore); - mUserStores.add(mUserNetworkSuggestionsStore); - mWifiConfigStore = new WifiConfigStore(mContext, mLooper.getLooper(), mClock, mWifiMetrics, - mSharedStore); - - // Register data container. - mWifiConfigStore.registerStoreData(mSharedStoreData); - mWifiConfigStore.registerStoreData(mUserStoreData); - - // Read both share and user config store. - mWifiConfigStore.switchUserStoresAndRead(mUserStores); - - // Verify no data is read. - assertNull(mUserStoreData.getData()); - assertNull(mSharedStoreData.getData()); - - // Write share and user data. - mUserStoreData.setData(TEST_USER_DATA); - mSharedStoreData.setData(TEST_SHARE_DATA); - mWifiConfigStore.write(true); - - // Read and verify the data content in the data container. - mWifiConfigStore.read(); - assertEquals(TEST_USER_DATA, mUserStoreData.getData()); - assertEquals(TEST_SHARE_DATA, mSharedStoreData.getData()); - - verify(mWifiMetrics, times(2)).noteWifiConfigStoreReadDuration(anyInt()); - verify(mWifiMetrics).noteWifiConfigStoreWriteDuration(anyInt()); - } - - /** * Tests the read API behaviour when the shared store file is empty and the user store * is not yet visible (user not yet unlocked). * Expected behaviour: The read should return an empty store data instance when the file not @@ -805,12 +761,7 @@ public class WifiConfigStoreTest { private boolean mStoreWritten; MockStoreFile(@WifiConfigStore.StoreFileId int fileId) { - super(new File("MockStoreFile"), fileId, mDataIntegrityChecker); - } - - MockStoreFile(@WifiConfigStore.StoreFileId int fileId, - DataIntegrityChecker dataIntegrityChecker) { - super(new File("MockStoreFile"), fileId, dataIntegrityChecker); + super(new File("MockStoreFile"), fileId); } @Override |