Merge changes I7ed2070a,I432bc610

* changes:
  update language package test to sdk 26
  Update LanguageAndInputSettingsTest to sdk 26
This commit is contained in:
TreeHugger Robot
2017-12-01 00:21:50 +00:00
committed by Android (Google) Code Review
3 changed files with 14 additions and 8 deletions

View File

@@ -64,7 +64,7 @@ import java.util.ArrayList;
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class LanguageAndInputSettingsTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
@@ -159,12 +159,15 @@ public class LanguageAndInputSettingsTest {
final Context context = spy(RuntimeEnvironment.application);
final Resources res = spy(RuntimeEnvironment.application.getResources());
//(InputManager) context.getSystemService(Context.INPUT_SERVICE);
InputManager manager = mock(InputManager.class);
when(manager.getInputDeviceIds()).thenReturn(new int[]{});
doReturn(manager).when(context).getSystemService(Context.INPUT_SERVICE);
final InputManager inputManager = mock(InputManager.class);
final TextServicesManager textServicesManager = mock(TextServicesManager.class);
when(inputManager.getInputDeviceIds()).thenReturn(new int[]{});
doReturn(inputManager).when(context).getSystemService(Context.INPUT_SERVICE);
doReturn(textServicesManager).when(context).getSystemService(
Context.TEXT_SERVICES_MANAGER_SERVICE);
doReturn(res).when(context).getResources();
doReturn(false).when(res)
.getBoolean(com.android.internal.R.bool.config_supportSystemNavigationKeys);
.getBoolean(com.android.internal.R.bool.config_supportSystemNavigationKeys);
final List<String> niks = LanguageAndInputSettings.SEARCH_INDEX_DATA_PROVIDER
.getNonIndexableKeys(context);
LanguageAndInputSettings settings = new LanguageAndInputSettings();
@@ -177,7 +180,10 @@ public class LanguageAndInputSettingsTest {
@Test
public void testPreferenceControllers_getPreferenceKeys_existInPreferenceScreen() {
final Context context = RuntimeEnvironment.application;
final Context context = spy(RuntimeEnvironment.application);
final TextServicesManager textServicesManager = mock(TextServicesManager.class);
doReturn(textServicesManager).when(context).getSystemService(
Context.TEXT_SERVICES_MANAGER_SERVICE);
final LanguageAndInputSettings fragment = new LanguageAndInputSettings();
final List<String> preferenceScreenKeys = XmlTestUtils.getKeysFromPreferenceXml(context,
fragment.getPreferenceScreenResId());

View File

@@ -39,7 +39,7 @@ import java.util.ArrayList;
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class PhoneLanguagePreferenceControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)

View File

@@ -39,7 +39,7 @@ import org.robolectric.shadows.ShadowApplication;
import java.util.TreeSet;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class UserDictionaryPreferenceControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)