Merge "Make Nfc/Beam searchable based on feature availability" into pi-dev am: dc09b3ff49
am: f549cd1e05
Change-Id: Ied4f01787aec0cf8f261483e942615abd1889918
This commit is contained in:
@@ -41,6 +41,9 @@ import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.util.ReflectionHelpers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
public class AndroidBeamPreferenceControllerTest {
|
||||
|
||||
@@ -132,4 +135,24 @@ public class AndroidBeamPreferenceControllerTest {
|
||||
mAndroidBeamController.onResume();
|
||||
assertThat(mAndroidBeamPreference.isEnabled()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateNonIndexableKeys_available_shouldNotUpdate() {
|
||||
when(mNfcAdapter.isEnabled()).thenReturn(true);
|
||||
final List<String> keys = new ArrayList<>();
|
||||
|
||||
mAndroidBeamController.updateNonIndexableKeys(keys);
|
||||
|
||||
assertThat(keys).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateNonIndexableKeys_notAvailable_shouldUpdate() {
|
||||
ReflectionHelpers.setField(mAndroidBeamController, "mNfcAdapter", null);
|
||||
final List<String> keys = new ArrayList<>();
|
||||
|
||||
mAndroidBeamController.updateNonIndexableKeys(keys);
|
||||
|
||||
assertThat(keys).hasSize(1);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user