Do not perform device index before device provision.
Bug: 79841744 Test: robotests Change-Id: I74243b6f31364220156e91fe63b56138a0240714
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
package com.android.settings.search;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.atLeastOnce;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.spy;
|
||||
@@ -24,6 +23,7 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.job.JobScheduler;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
@@ -47,7 +47,7 @@ public class DeviceIndexFeatureProviderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyDisabled() {
|
||||
public void updateIndex_disabled_shouldDoNothing() {
|
||||
when(mProvider.isIndexingEnabled()).thenReturn(false);
|
||||
|
||||
mProvider.updateIndex(mActivity, false);
|
||||
@@ -55,7 +55,20 @@ public class DeviceIndexFeatureProviderTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyIndexing() {
|
||||
public void updateIndex_enabled_unprovisioned_shouldDoNothing() {
|
||||
when(mProvider.isIndexingEnabled()).thenReturn(true);
|
||||
Settings.Global.putInt(mActivity.getContentResolver(),
|
||||
Settings.Global.DEVICE_PROVISIONED, 0);
|
||||
|
||||
mProvider.updateIndex(mActivity, false);
|
||||
|
||||
verify(mProvider, never()).index(any(), any(), any(), any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateIndex_enabled_provisioned_shouldIndex() {
|
||||
Settings.Global.putInt(mActivity.getContentResolver(),
|
||||
Settings.Global.DEVICE_PROVISIONED, 1);
|
||||
JobScheduler jobScheduler = mock(JobScheduler.class);
|
||||
when(mProvider.isIndexingEnabled()).thenReturn(true);
|
||||
when(mActivity.getSystemService(JobScheduler.class)).thenReturn(jobScheduler);
|
||||
|
Reference in New Issue
Block a user