Remove search indexing pipeline from Settings
Index is already handled by SettingsIntelligenec. No longer needed in Settings. Change-Id: Id43fb3100dc2759185744441cff8cb9cd2d2da20 Fixes: 69808376 Test: robotests
This commit is contained in:
@@ -23,18 +23,12 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.Matchers.anyInt;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.internal.hardware.AmbientDisplayConfiguration;
|
||||
import com.android.settings.dashboard.suggestions.SuggestionFeatureProviderImpl;
|
||||
import com.android.settings.search.InlinePayload;
|
||||
import com.android.settings.search.InlineSwitchPayload;
|
||||
import com.android.settings.search.ResultPayload;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.testutils.shadow.ShadowSecureSettings;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -43,7 +37,6 @@ import org.mockito.Answers;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
public class DoubleTapScreenPreferenceControllerTest {
|
||||
@@ -78,52 +71,16 @@ public class DoubleTapScreenPreferenceControllerTest {
|
||||
assertThat(mController.isChecked()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPreferenceController_ProperResultPayloadType() {
|
||||
final Context context = RuntimeEnvironment.application;
|
||||
DoubleTapScreenPreferenceController controller =
|
||||
new DoubleTapScreenPreferenceController(context, KEY_DOUBLE_TAP_SCREEN);
|
||||
controller.setConfig(mAmbientDisplayConfiguration);
|
||||
ResultPayload payload = controller.getResultPayload();
|
||||
assertThat(payload).isInstanceOf(InlineSwitchPayload.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(shadows = ShadowSecureSettings.class)
|
||||
public void testSetValue_updatesCorrectly() {
|
||||
int newValue = 1;
|
||||
ContentResolver resolver = mContext.getContentResolver();
|
||||
Settings.Secure.putInt(resolver, Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP, 0);
|
||||
|
||||
((InlinePayload) mController.getResultPayload()).setValue(mContext, newValue);
|
||||
int updatedValue = Settings.Secure.getInt(resolver,
|
||||
Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP, -1);
|
||||
|
||||
assertThat(updatedValue).isEqualTo(newValue);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(shadows = ShadowSecureSettings.class)
|
||||
public void testGetValue_correctValueReturned() {
|
||||
int currentValue = 1;
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.DOZE_PULSE_ON_DOUBLE_TAP, currentValue);
|
||||
|
||||
int newValue = ((InlinePayload) mController.getResultPayload()).getValue(mContext);
|
||||
|
||||
assertThat(newValue).isEqualTo(currentValue);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSuggestionCompleted_ambientDisplay_falseWhenNotVisited() {
|
||||
when(mAmbientDisplayConfiguration.pulseOnDoubleTapAvailable()).thenReturn(true);
|
||||
// No stored value in shared preferences if not visited yet.
|
||||
final Context context = RuntimeEnvironment.application;
|
||||
final SharedPreferences prefs =
|
||||
new SuggestionFeatureProviderImpl(context).getSharedPrefs(context);
|
||||
new SuggestionFeatureProviderImpl(context).getSharedPrefs(context);
|
||||
|
||||
assertThat(DoubleTapScreenPreferenceController
|
||||
.isSuggestionComplete(mAmbientDisplayConfiguration, prefs)).isFalse();
|
||||
.isSuggestionComplete(mAmbientDisplayConfiguration, prefs)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -131,13 +88,13 @@ public class DoubleTapScreenPreferenceControllerTest {
|
||||
when(mAmbientDisplayConfiguration.pulseOnDoubleTapAvailable()).thenReturn(false);
|
||||
final Context context = RuntimeEnvironment.application;
|
||||
final SharedPreferences prefs =
|
||||
new SuggestionFeatureProviderImpl(context).getSharedPrefs(context);
|
||||
new SuggestionFeatureProviderImpl(context).getSharedPrefs(context);
|
||||
|
||||
prefs.edit().putBoolean(
|
||||
DoubleTapScreenSettings.PREF_KEY_SUGGESTION_COMPLETE, true).commit();
|
||||
|
||||
assertThat(DoubleTapScreenPreferenceController
|
||||
.isSuggestionComplete(mAmbientDisplayConfiguration, prefs)).isTrue();
|
||||
.isSuggestionComplete(mAmbientDisplayConfiguration, prefs)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -183,7 +140,7 @@ public class DoubleTapScreenPreferenceControllerTest {
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final DoubleTapScreenPreferenceController controller =
|
||||
new DoubleTapScreenPreferenceController(mContext,"gesture_double_tap_screen");
|
||||
new DoubleTapScreenPreferenceController(mContext, "gesture_double_tap_screen");
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user