use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by crdroidandroid.
the class SuggestionAdapterTest method onBindViewHolder_shouldInflateRemoteView.
@Test
public void onBindViewHolder_shouldInflateRemoteView() {
List<Tile> packages = makeSuggestions("pkg1");
RemoteViews remoteViews = mock(RemoteViews.class);
TextView textView = new TextView(RuntimeEnvironment.application);
doReturn(textView).when(remoteViews).apply(any(Context.class), any(ViewGroup.class));
packages.get(0).remoteViews = remoteViews;
setupSuggestions(mActivity, packages);
mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
assertThat(textView.getParent()).isSameAs(mSuggestionHolder.itemView);
mSuggestionHolder.itemView.performClick();
verify(mActivity).startSuggestion(any(Intent.class));
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by crdroidandroid.
the class SuggestionFeatureProviderImplTest method getSuggestionIdentifier_nullComponent_shouldNotCrash.
@Test
public void getSuggestionIdentifier_nullComponent_shouldNotCrash() {
final Tile suggestion = new Tile();
suggestion.intent = new Intent();
assertThat(mProvider.getSuggestionIdentifier(mContext, suggestion)).isNotEmpty();
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by crdroidandroid.
the class SuggestionFeatureProviderImplTest method getSuggestionIdentifier_nullContext_shouldNotCrash.
@Test
public void getSuggestionIdentifier_nullContext_shouldNotCrash() {
final Tile suggestion = new Tile();
suggestion.intent = new Intent().setClassName(RuntimeEnvironment.application.getPackageName(), "123");
assertThat(mProvider.getSuggestionIdentifier(null, suggestion)).isNotEmpty();
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by crdroidandroid.
the class SuggestionsChecksTest method testFingerprintEnrollmentIntroductionIsCompleteWhenHardwareNotDetected.
@Test
public void testFingerprintEnrollmentIntroductionIsCompleteWhenHardwareNotDetected() {
stubFingerprintSupported(true);
when(mFingerprintManager.hasEnrolledFingerprints()).thenReturn(false);
when(mFingerprintManager.isHardwareDetected()).thenReturn(false);
Tile tile = createFingerprintTile();
assertThat(mSuggestionsChecks.isSuggestionComplete(tile)).isTrue();
}
use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by crdroidandroid.
the class SuggestionsChecksTest method testFingerprintEnrollmentIntroductionIsCompleteWhenFingerprintDisabled.
@Test
public void testFingerprintEnrollmentIntroductionIsCompleteWhenFingerprintDisabled() {
stubFingerprintSupported(true);
when(mFingerprintManager.hasEnrolledFingerprints()).thenReturn(false);
when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
when(mDevicePolicyManager.getKeyguardDisabledFeatures(any(), anyInt())).thenReturn(DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT);
Tile tile = createFingerprintTile();
assertThat(mSuggestionsChecks.isSuggestionComplete(tile)).isTrue();
}
Aggregations