ProviderTestRule option to use non-mocked ContentResolver
Description
For research and development, I want to write tests that explore the behavior of content-change notifications my ContentProvider sends via ContentResolver.notifyChange(). This is not possible with ProviderTestRule, as MockContentResolver has empty implementation for notifyChange().
Request
Please extend ProviderTestRule with an option to use a real ContentResolver in place of MockContentResolver.
Background
My ContentProvider is providing a client-side helper API for accessing content, and this implementation relies in part on content-change notifications from my ContentProvider. I need to be able to test those interactions in a testing context.
I'd also like to have this functionality. Oddly enough my tests that used the ContentResolver#notifyChange provided by ProviderTestCase2 worked just fine and I could observe new changes. But when I refactored my tests to ProviderTestRule my ContentObserver doesn't see any new changes.
But now that I've looked into why this is I can't seem to figure out how it ever worked in the first place. It would seem that ProviderTestCase2 uses the same MockContentResolver as ProviderTestRule. And MockContentResolver never seems to notify changes. Maybe it has something to do with the way I'm getting a ContentResolver inside ProviderTestCase2?
class FlowContentResolverTest : ProviderTestCase2<TestContentProvider>(
TestContentProvider::class.java, AUTHORITY.authority
) {
private lateinit var contentResolver: ContentResolver
override fun setUp() {
super.setUp()
contentResolver = mockContentResolver
provider.init(context.contentResolver)
}
...
}