use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.
the class UnrestrictedPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mController = new UnrestrictedPreferenceController(RuntimeEnvironment.application, UID, PACKAGE_NAME);
mPreference = new RadioButtonPreference(RuntimeEnvironment.application);
mController.mBatteryOptimizeUtils = mockBatteryOptimizeUtils;
}
use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.
the class WebViewAppPickerTest method testWebViewVersionAddedAfterLabel.
/**
* Ensure that the version name of a WebView package is displayed after its name in the
* preference title.
*/
@Test
public void testWebViewVersionAddedAfterLabel() {
final DefaultAppInfo webviewAppInfo = mPicker.createDefaultAppInfo(mContext, mContext.getPackageManager(), createApplicationInfo(PACKAGE_NAME), "");
final RadioButtonPreference mockPreference = mock(RadioButtonPreference.class);
mPicker.bindPreference(mockPreference, PACKAGE_NAME, webviewAppInfo, null);
mPicker.bindPreferenceExtra(mockPreference, PACKAGE_NAME, webviewAppInfo, null, null);
verify(mockPreference).setTitle(eq(PACKAGE_NAME + " " + PACKAGE_VERSION));
verify(mockPreference).setTitle(any());
}
use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.
the class WebViewAppPickerTest method testDisabledPackageShownAsDisabled.
@Test
public void testDisabledPackageShownAsDisabled() {
DefaultAppInfo webviewAppInfo = mPicker.createDefaultAppInfo(mContext, mContext.getPackageManager(), createApplicationInfo(PACKAGE_NAME), "disabled");
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(false));
verify(preference, never()).setEnabled(eq(true));
}
use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.
the class WebViewAppPickerTest method testDisabledPackageShowsDisabledReasonSummary.
@Test
public void testDisabledPackageShowsDisabledReasonSummary() {
String disabledReason = "disabled";
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)).setSummary(eq(disabledReason));
// Ensure we haven't called setSummary several times.
verify(preference, times(1)).setSummary(any());
}
use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.
the class WebViewAppPickerTest method testFailingClickUpdatesSetting.
private void testFailingClickUpdatesSetting() {
when(mWvusWrapper.getValidWebViewApplicationInfos(any())).thenReturn(Collections.singletonList(createApplicationInfo(PACKAGE_NAME)));
when(mWvusWrapper.setWebViewProvider(eq(PACKAGE_NAME))).thenReturn(false);
RadioButtonPreference defaultPackagePref = mock(RadioButtonPreference.class);
when(defaultPackagePref.getKey()).thenReturn(PACKAGE_NAME);
mPicker.onRadioButtonClicked(defaultPackagePref);
verify(mWvusWrapper, times(1)).setWebViewProvider(eq(PACKAGE_NAME));
// Ensure we update the list of packages when we click a non-valid package - the list must
// have changed, otherwise this click wouldn't fail.
verify(mPicker, times(1)).updateCandidates();
verify(mWvusWrapper, times(1)).showInvalidChoiceToast(any());
}
Aggregations