Search in sources :

Example 51 with RadioButtonPreference

use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.

the class WebViewAppPickerTest method testSuccessfulClickChangesProvider.

private void testSuccessfulClickChangesProvider() {
    when(mWvusWrapper.getValidWebViewApplicationInfos(any())).thenReturn(Collections.singletonList(createApplicationInfo(PACKAGE_NAME)));
    when(mWvusWrapper.setWebViewProvider(eq(PACKAGE_NAME))).thenReturn(true);
    RadioButtonPreference defaultPackagePref = mock(RadioButtonPreference.class);
    when(defaultPackagePref.getKey()).thenReturn(PACKAGE_NAME);
    mPicker.onRadioButtonClicked(defaultPackagePref);
    verify(mWvusWrapper, times(1)).setWebViewProvider(eq(PACKAGE_NAME));
    verify(mPicker, times(1)).updateCheckedState(PACKAGE_NAME);
    verify(mWvusWrapper, never()).showInvalidChoiceToast(any());
}
Also used : RadioButtonPreference(com.android.settingslib.widget.RadioButtonPreference)

Example 52 with RadioButtonPreference

use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.

the class WebViewAppPickerTest method testEnabledPackageShownAsEnabled.

@Test
public void testEnabledPackageShownAsEnabled() {
    String disabledReason = "";
    DefaultAppInfo webviewAppInfo = mPicker.createDefaultAppInfo(mContext, mContext.getPackageManager(), createApplicationInfo(PACKAGE_NAME), disabledReason);
    RadioButtonPreference preference = mock(RadioButtonPreference.class);
    mPicker.bindPreference(preference, PACKAGE_NAME, webviewAppInfo, null);
    mPicker.bindPreferenceExtra(preference, PACKAGE_NAME, webviewAppInfo, null, null);
    verify(preference, times(1)).setEnabled(eq(true));
    verify(preference, never()).setEnabled(eq(false));
}
Also used : DefaultAppInfo(com.android.settingslib.applications.DefaultAppInfo) RadioButtonPreference(com.android.settingslib.widget.RadioButtonPreference) Test(org.junit.Test)

Aggregations

RadioButtonPreference (com.android.settingslib.widget.RadioButtonPreference)52 Test (org.junit.Test)27 Before (org.junit.Before)8 DefaultAppInfo (com.android.settingslib.applications.DefaultAppInfo)6 PreferenceScreen (androidx.preference.PreferenceScreen)5 CandidateInfo (com.android.settingslib.widget.CandidateInfo)3 Preference (androidx.preference.Preference)2 PreferenceCategory (androidx.preference.PreferenceCategory)2 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)2 FooterPreference (com.android.settingslib.widget.FooterPreference)2 AppOpsManager (android.app.AppOpsManager)1 SettingsEnums (android.app.settings.SettingsEnums)1 Context (android.content.Context)1 Intent (android.content.Intent)1 ApplicationInfo (android.content.pm.ApplicationInfo)1 PackageManager (android.content.pm.PackageManager)1 Resources (android.content.res.Resources)1 Drawable (android.graphics.drawable.Drawable)1 BatteryStats (android.os.BatteryStats)1 Bundle (android.os.Bundle)1