use of com.android.settings.testutils.FakeFeatureFactory in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SlicesDatabaseAccessorTest method getSliceKeys_indexesDatabase.
@Test
@Config(qualifiers = "mcc999")
public void getSliceKeys_indexesDatabase() {
// Force new indexing
Locale.setDefault(new Locale("ca"));
final SearchFeatureProvider provider = new SearchFeatureProviderImpl();
final SlicesFeatureProvider sliceProvider = spy(new SlicesFeatureProviderImpl());
final FakeFeatureFactory factory = FakeFeatureFactory.setupForTest();
factory.searchFeatureProvider = provider;
factory.slicesFeatureProvider = sliceProvider;
// Fake the indexable list.
provider.getSearchIndexableResources().getProviderValues().clear();
provider.getSearchIndexableResources().getProviderValues().add(FakeIndexProvider.class);
final SlicesDatabaseAccessor accessor = new SlicesDatabaseAccessor(mContext);
final List<String> keys = accessor.getSliceKeys(true);
assertThat(keys).isNotEmpty();
}
use of com.android.settings.testutils.FakeFeatureFactory in project android_packages_apps_Settings by omnirom.
the class SecurityDashboardActivityTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
FakeFeatureFactory mFeatureFactory = FakeFeatureFactory.setupForTest();
mSecuritySettingsFeatureProvider = mFeatureFactory.getSecuritySettingsFeatureProvider();
mDefaultIntent = new Intent();
mDefaultIntent.setAction(android.provider.Settings.ACTION_SECURITY_SETTINGS);
mDefaultIntent.setClass(InstrumentationRegistry.getInstrumentation().getTargetContext(), Settings.SecurityDashboardActivity.class);
mDefaultIntent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT, DEFAULT_FRAGMENT_CLASSNAME);
InstrumentationRegistry.getInstrumentation().runOnMainSync(() -> {
try {
mActivity = (Settings.SecurityDashboardActivity) InstrumentationRegistry.getInstrumentation().newActivity(getClass().getClassLoader(), Settings.SecurityDashboardActivity.class.getName(), mDefaultIntent);
} catch (Exception e) {
// nothing to do
throw new RuntimeException(e);
}
});
}
use of com.android.settings.testutils.FakeFeatureFactory in project android_packages_apps_Settings by omnirom.
the class SecuritySettingsTest method setup.
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
mContext = ApplicationProvider.getApplicationContext();
FakeFeatureFactory mFeatureFactory = FakeFeatureFactory.setupForTest();
mSecuritySettingsFeatureProvider = mFeatureFactory.getSecuritySettingsFeatureProvider();
SecurityFeatureProvider mSecurityFeatureProvider = mFeatureFactory.getSecurityFeatureProvider();
when(mSecurityFeatureProvider.getTrustAgentManager()).thenReturn(mTrustAgentManager);
}
use of com.android.settings.testutils.FakeFeatureFactory in project android_packages_apps_Settings by omnirom.
the class ControlsPrivacyPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mShadowPackageManager = Shadows.shadowOf(mContext.getPackageManager());
mContentResolver = mContext.getContentResolver();
FakeFeatureFactory featureFactory = FakeFeatureFactory.setupForTest();
when(featureFactory.securityFeatureProvider.getLockPatternUtils(mContext)).thenReturn(mLockPatternUtils);
when(mLockPatternUtils.isSecure(anyInt())).thenReturn(true);
mController = new ControlsPrivacyPreferenceController(mContext, TEST_KEY);
}
use of com.android.settings.testutils.FakeFeatureFactory in project android_packages_apps_Settings by omnirom.
the class SetNewPasswordActivityTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
FakeFeatureFactory fakeFeatureFactory = FakeFeatureFactory.setupForTest();
mockMetricsProvider = fakeFeatureFactory.getMetricsFeatureProvider();
when(mockMetricsProvider.getAttribution(any())).thenReturn(SettingsEnums.PAGE_UNKNOWN);
mProvisioned = Settings.Global.getInt(RuntimeEnvironment.application.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0);
}
Aggregations