This source file includes following definitions.
- setUp
- getContentResolver
package org.chromium.chrome.browser.test;
import android.content.ContentProvider;
import android.content.ContentResolver;
import android.test.IsolatedContext;
import android.test.mock.MockContentResolver;
import org.chromium.chrome.browser.ChromeBrowserProvider;
import org.chromium.chrome.shell.ChromeShellActivity;
import org.chromium.chrome.shell.ChromeShellTestBase;
public class ProviderTestBase extends ChromeShellTestBase {
private IsolatedContext mContext;
@Override
protected void setUp() throws Exception {
super.setUp();
ChromeShellActivity activity = launchChromeShellWithUrl(null);
assertNotNull(activity);
ContentProvider provider = new ChromeBrowserProvider();
provider.attachInfo(activity, null);
MockContentResolver resolver = new MockContentResolver();
resolver.addProvider(ChromeBrowserProvider.getApiAuthority(activity), provider);
resolver.addProvider(ChromeBrowserProvider.getInternalAuthority(activity), provider);
mContext = new IsolatedContext(resolver, activity);
assertTrue(getContentResolver() instanceof MockContentResolver);
}
protected ContentResolver getContentResolver() {
return mContext.getContentResolver();
}
}