Game Driver: Fix EnableForAllApps switch and test

Bug: 123707483
Bug: 119221883
Test: Build, flash, boot and make RunSettingsRoboTests
Change-Id: Iffbe3355b37763d4fa71b96271c1ba448fb6cdc5
This commit is contained in:
Yiwei Zhang
2019-01-31 18:25:00 -08:00
parent 374495a865
commit ccc81a83cc
3 changed files with 29 additions and 13 deletions

View File

@@ -36,7 +36,6 @@ import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreference;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -63,11 +62,14 @@ public class GameDriverEnableForAllAppsPreferenceControllerTest {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mResolver = mContext.getContentResolver();
Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
Settings.Global.putInt(
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
mController = new GameDriverEnableForAllAppsPreferenceController(mContext, "testKey");
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
mController.displayPreference(mScreen);
Settings.Global.putInt(mResolver, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
}
@Test
@@ -138,7 +140,6 @@ public class GameDriverEnableForAllAppsPreferenceControllerTest {
}
@Test
@Ignore("b/123707483")
public void updateState_gameDriverOff_notVisibleAndUncheck() {
Settings.Global.putInt(mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_OFF);
mController.updateState(mPreference);