Loading tests/robotests/src/com/android/settings/location/LocationSettingsFooterPreferenceControllerTest.java +13 −6 Original line number Diff line number Diff line Loading @@ -109,24 +109,30 @@ public class LocationSettingsFooterPreferenceControllerTest { assertThat(mController.isAvailable()).isTrue(); } /** * Display the footer even without the injected string. */ @Test public void isAvailable_noSystemApp_returnsFalse() { public void isAvailable_noSystemApp_returnsTrue() { final List<ResolveInfo> testResolveInfos = new ArrayList<>(); testResolveInfos.add( getTestResolveInfo(/*isSystemApp*/ false, /*hasRequiredMetadata*/ true)); when(mPackageManager.queryBroadcastReceivers(any(Intent.class), anyInt())) .thenReturn(testResolveInfos); assertThat(mController.isAvailable()).isFalse(); assertThat(mController.isAvailable()).isTrue(); } /** * Display the footer even without the injected string. */ @Test public void isAvailable_noRequiredMetadata_returnsFalse() { public void isAvailable_noRequiredMetadata_returnsTrue() { final List<ResolveInfo> testResolveInfos = new ArrayList<>(); testResolveInfos.add( getTestResolveInfo(/*isSystemApp*/ true, /*hasRequiredMetadata*/ false)); when(mPackageManager.queryBroadcastReceivers(any(Intent.class), anyInt())) .thenReturn(testResolveInfos); assertThat(mController.isAvailable()).isFalse(); assertThat(mController.isAvailable()).isTrue(); } @Test Loading Loading @@ -154,7 +160,8 @@ public class LocationSettingsFooterPreferenceControllerTest { mController.onLocationModeChanged(/* mode= */ 0, /* restricted= */ false); ArgumentCaptor<CharSequence> title = ArgumentCaptor.forClass(CharSequence.class); verify(mFooterPreference, times(2)).setTitle(title.capture()); assertThat(title.getValue().toString()).isEqualTo( assertThat(title.getValue().toString()).contains( Html.fromHtml(mContext.getString( R.string.location_settings_footer_location_off)).toString()); } Loading @@ -171,7 +178,7 @@ public class LocationSettingsFooterPreferenceControllerTest { mController.onLocationModeChanged(/* mode= */ 1, /* restricted= */ false); ArgumentCaptor<CharSequence> title = ArgumentCaptor.forClass(CharSequence.class); verify(mFooterPreference, times(2)).setTitle(title.capture()); assertThat(title.getValue().toString()).isNotEqualTo( assertThat(title.getValue().toString()).doesNotContain( Html.fromHtml(mContext.getString( R.string.location_settings_footer_location_off)).toString()); } Loading Loading
tests/robotests/src/com/android/settings/location/LocationSettingsFooterPreferenceControllerTest.java +13 −6 Original line number Diff line number Diff line Loading @@ -109,24 +109,30 @@ public class LocationSettingsFooterPreferenceControllerTest { assertThat(mController.isAvailable()).isTrue(); } /** * Display the footer even without the injected string. */ @Test public void isAvailable_noSystemApp_returnsFalse() { public void isAvailable_noSystemApp_returnsTrue() { final List<ResolveInfo> testResolveInfos = new ArrayList<>(); testResolveInfos.add( getTestResolveInfo(/*isSystemApp*/ false, /*hasRequiredMetadata*/ true)); when(mPackageManager.queryBroadcastReceivers(any(Intent.class), anyInt())) .thenReturn(testResolveInfos); assertThat(mController.isAvailable()).isFalse(); assertThat(mController.isAvailable()).isTrue(); } /** * Display the footer even without the injected string. */ @Test public void isAvailable_noRequiredMetadata_returnsFalse() { public void isAvailable_noRequiredMetadata_returnsTrue() { final List<ResolveInfo> testResolveInfos = new ArrayList<>(); testResolveInfos.add( getTestResolveInfo(/*isSystemApp*/ true, /*hasRequiredMetadata*/ false)); when(mPackageManager.queryBroadcastReceivers(any(Intent.class), anyInt())) .thenReturn(testResolveInfos); assertThat(mController.isAvailable()).isFalse(); assertThat(mController.isAvailable()).isTrue(); } @Test Loading Loading @@ -154,7 +160,8 @@ public class LocationSettingsFooterPreferenceControllerTest { mController.onLocationModeChanged(/* mode= */ 0, /* restricted= */ false); ArgumentCaptor<CharSequence> title = ArgumentCaptor.forClass(CharSequence.class); verify(mFooterPreference, times(2)).setTitle(title.capture()); assertThat(title.getValue().toString()).isEqualTo( assertThat(title.getValue().toString()).contains( Html.fromHtml(mContext.getString( R.string.location_settings_footer_location_off)).toString()); } Loading @@ -171,7 +178,7 @@ public class LocationSettingsFooterPreferenceControllerTest { mController.onLocationModeChanged(/* mode= */ 1, /* restricted= */ false); ArgumentCaptor<CharSequence> title = ArgumentCaptor.forClass(CharSequence.class); verify(mFooterPreference, times(2)).setTitle(title.capture()); assertThat(title.getValue().toString()).isNotEqualTo( assertThat(title.getValue().toString()).doesNotContain( Html.fromHtml(mContext.getString( R.string.location_settings_footer_location_off)).toString()); } Loading