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

Commit 55b9f102 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Handle teardown after incomplete setup in locksettings tests" into main

parents 6ac4a512 b4d45425
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -354,15 +354,21 @@ public abstract class BaseLockSettingsServiceTests {

    @After
    public void tearDown_baseServices() throws Exception {
        if (mStorage != null) {
            mStorage.closeDatabase();
        }
        File db = InstrumentationRegistry.getContext().getDatabasePath("locksettings.db");
        assertTrue(!db.exists() || db.delete());

        if (mStorage != null) {
            File storageDir = mStorage.mStorageDir;
            assertTrue(FileUtils.deleteContents(storageDir));
        }

        if (mPasswordSlotManager != null) {
            mPasswordSlotManager.cleanup();
        }
    }

    protected void flushHandlerTasks() {
        mService.mHandler.runWithScissors(() -> { }, 0 /*now*/); // Flush runnables on handler
+3 −1
Original line number Diff line number Diff line
@@ -124,8 +124,10 @@ public class LockSettingsStorageTests {

    @After
    public void tearDown() throws Exception {
        if (mStorage != null) {
            mStorage.closeDatabase();
        }
    }

    @Test
    public void testKeyValue_InitializeWorked() {
+3 −1
Original line number Diff line number Diff line
@@ -49,8 +49,10 @@ public class PasswordSlotManagerTests {

    @After
    public void tearDown() throws Exception {
        if (mManager != null) {
            mManager.cleanup();
        }
    }

    @Test
    public void testBasicSlotUse() throws Exception {
+6 −3
Original line number Diff line number Diff line
@@ -156,9 +156,12 @@ public class KeySyncTaskTest {

    @After
    public void tearDown() {
        if (mRecoverableKeyStoreDb != null) {
            mRecoverableKeyStoreDb.close();
        }
        if (mDatabaseFile != null) {
            mDatabaseFile.delete();

        }
        File file = new File(InstrumentationRegistry.getTargetContext().getFilesDir(),
                SNAPSHOT_TOP_LEVEL_DIRECTORY);
        FileUtils.deleteContentsAndDir(file);
+6 −2
Original line number Diff line number Diff line
@@ -117,9 +117,13 @@ public class PlatformKeyManagerTest {

    @After
    public void tearDown() {
        if (mRecoverableKeyStoreDb != null) {
            mRecoverableKeyStoreDb.close();
        }
        if (mDatabaseFile != null) {
            mDatabaseFile.delete();
        }
    }

    @Test
    public void init_createsEncryptKeyWithCorrectAlias() throws Exception {
Loading