Fix settings robotest am: 4e34839a1e

am: 517daf43a4

Change-Id: I8a8beb1549f625ac2cfa147162b747b5e05df771
This commit is contained in:
Fan Zhang
2017-06-30 03:53:57 +00:00
committed by android-build-merger

View File

@@ -32,6 +32,7 @@ import android.content.ComponentName;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.hardware.input.InputManager; import android.hardware.input.InputManager;
import android.os.UserManager; import android.os.UserManager;
import android.provider.Settings; import android.provider.Settings;
@@ -192,10 +193,14 @@ public class LanguageAndInputSettingsTest {
@Test @Test
public void testNonIndexableKeys_existInXmlLayout() { public void testNonIndexableKeys_existInXmlLayout() {
final Context context = spy(RuntimeEnvironment.application); final Context context = spy(RuntimeEnvironment.application);
final Resources res = spy(RuntimeEnvironment.application.getResources());
//(InputManager) context.getSystemService(Context.INPUT_SERVICE); //(InputManager) context.getSystemService(Context.INPUT_SERVICE);
InputManager manager = mock(InputManager.class); InputManager manager = mock(InputManager.class);
when(manager.getInputDeviceIds()).thenReturn(new int[]{}); when(manager.getInputDeviceIds()).thenReturn(new int[]{});
doReturn(manager).when(context).getSystemService(Context.INPUT_SERVICE); doReturn(manager).when(context).getSystemService(Context.INPUT_SERVICE);
doReturn(res).when(context).getResources();
doReturn(false).when(res)
.getBoolean(com.android.internal.R.bool.config_supportSystemNavigationKeys);
final List<String> niks = LanguageAndInputSettings.SEARCH_INDEX_DATA_PROVIDER final List<String> niks = LanguageAndInputSettings.SEARCH_INDEX_DATA_PROVIDER
.getNonIndexableKeys(context); .getNonIndexableKeys(context);
final int xmlId = (new LanguageAndInputSettings()).getPreferenceScreenResId(); final int xmlId = (new LanguageAndInputSettings()).getPreferenceScreenResId();