Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f04e10e authored by Song Chun Fan's avatar Song Chun Fan
Browse files

[SettingsProvider] fix mock leakage in NameValueCacheTest

Settings.java keeps a reference of ContentProvider in ContentProviderHolder so it doesn't have to call contentResolver.acquireProvider on repeated calls. However, when we pass in a mock ContentProvider there, it doesn't get automatically removed and remains active in the same test process, unless the cleanup was called specifically. This may affect other tests that use the Settings class in the same test process. This CL fixes that.

Change-Id: I2d1f169fdc48a9defe54c45f99e2f75302632417
BUG: 297724333
FIXES: 297724333
Test: presubmit
parent d058fd16
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -55,7 +55,6 @@ import java.util.Map;
 * Due to how the classes are structured, we have to test it in a somewhat roundabout way. We're
 * mocking out the contentProvider and are handcrafting very specific Bundles to answer the queries.
 */
@Ignore("b/297724333")
@Presubmit
@RunWith(AndroidJUnit4.class)
@SmallTest
@@ -229,6 +228,8 @@ public class NameValueCacheTest {

    @After
    public void cleanUp() throws IOException {
        Settings.Config.clearProviderForTest();
        Settings.Secure.clearProviderForTest();
        mConfigsStorage.clear();
        mSettingsStorage.clear();
        mSettingsCacheGenerationStore.close();