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

Commit f461bdd7 authored by Jernej Virag's avatar Jernej Virag
Browse files

Add getContentObservers call to FakeSettings

This allows tests to verify whether observers were added without
resorting to mocking.

Bug: 383302806
Flag: TEST_ONLY
Test: atest ColumbusContentObserverTest which uses it
Change-Id: Ie626a2d6510646405a3fe52314811ac0523d4de4
parent 1bda2306
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -70,6 +70,14 @@ class FakeSettings : SecureSettings, SystemSettings, UserSettingsProxy {
        }
    }

    fun getContentObservers(uri: Uri, userHandle: Int): List<ContentObserver> {
        if (userHandle == UserHandle.USER_ALL) {
            return contentObserversAllUsers[uri.toString()] ?: listOf()
        } else {
            return contentObservers[SettingsKey(userHandle, uri.toString())] ?: listOf()
        }
    }

    override fun getContentResolver(): ContentResolver {
        throw UnsupportedOperationException("FakeSettings.getContentResolver is not implemented")
    }