Game Driver: rename GUP to Game Driver
Bug: 119221883 Test: make RunSettingsRoboTests Change-Id: Ia7b9e3978ad96436a66843e6b5d1bd1e15f367c9 Merged-In: Ia7b9e3978ad96436a66843e6b5d1bd1e15f367c9
This commit is contained in:
@@ -6,7 +6,7 @@ com.android.settings.accounts.AccountDetailDashboardFragment
|
||||
com.android.settings.fuelgauge.PowerUsageAnomalyDetails
|
||||
com.android.settings.fuelgauge.AdvancedPowerUsageDetail
|
||||
com.android.settings.development.featureflags.FeatureFlagsDashboard
|
||||
com.android.settings.development.gup.GupDashboard
|
||||
com.android.settings.development.gamedriver.GameDriverDashboard
|
||||
com.android.settings.development.qstile.DevelopmentTileConfigFragment
|
||||
com.android.settings.deviceinfo.StorageProfileFragment
|
||||
com.android.settings.notification.ChannelNotificationSettings
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.development.gup;
|
||||
package com.android.settings.development.gamedriver;
|
||||
|
||||
import static com.android.settings.testutils.ApplicationTestUtils.buildInfo;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
@@ -48,9 +48,10 @@ import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class GupPreferenceControllerTest {
|
||||
public class GameDriverAppPreferenceControllerTest {
|
||||
|
||||
private static final int DEFAULT = 0;
|
||||
private static final int GUP = 1;
|
||||
private static final int GAME_DRIVER = 1;
|
||||
private static final int SYSTEM = 2;
|
||||
private static final String TEST_APP_NAME = "testApp";
|
||||
private static final String TEST_PKG_NAME = "testPkg";
|
||||
@@ -71,7 +72,7 @@ public class GupPreferenceControllerTest {
|
||||
private PreferenceGroup mGroup;
|
||||
private PreferenceManager mPreferenceManager;
|
||||
private ContentResolver mResolver;
|
||||
private GupPreferenceController mController;
|
||||
private GameDriverAppPreferenceController mController;
|
||||
private CharSequence[] mValueList;
|
||||
private String mDialogTitle;
|
||||
|
||||
@@ -80,8 +81,9 @@ public class GupPreferenceControllerTest {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = spy(RuntimeEnvironment.application);
|
||||
mResolver = mContext.getContentResolver();
|
||||
mValueList = mContext.getResources().getStringArray(R.array.gup_app_preference_values);
|
||||
mDialogTitle = mContext.getResources().getString(R.string.gup_app_preference_title);
|
||||
mValueList =
|
||||
mContext.getResources().getStringArray(R.array.game_driver_app_preference_values);
|
||||
mDialogTitle = mContext.getResources().getString(R.string.game_driver_app_preference_title);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -130,7 +132,7 @@ public class GupPreferenceControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createPreference_configGup_shouldSetGupAttributes() {
|
||||
public void createPreference_configGAME_DRIVER_shouldSetGameDriverAttributes() {
|
||||
loadConfig(TEST_PKG_NAME, "");
|
||||
final ListPreference preference =
|
||||
mController.createListPreference(mContext, TEST_PKG_NAME, TEST_APP_NAME);
|
||||
@@ -140,9 +142,9 @@ public class GupPreferenceControllerTest {
|
||||
assertThat(preference.getDialogTitle()).isEqualTo(mDialogTitle);
|
||||
assertThat(preference.getEntries()).isEqualTo(mValueList);
|
||||
assertThat(preference.getEntryValues()).isEqualTo(mValueList);
|
||||
assertThat(preference.getEntry()).isEqualTo(mValueList[GUP]);
|
||||
assertThat(preference.getValue()).isEqualTo(mValueList[GUP]);
|
||||
assertThat(preference.getSummary()).isEqualTo(mValueList[GUP]);
|
||||
assertThat(preference.getEntry()).isEqualTo(mValueList[GAME_DRIVER]);
|
||||
assertThat(preference.getValue()).isEqualTo(mValueList[GAME_DRIVER]);
|
||||
assertThat(preference.getSummary()).isEqualTo(mValueList[GAME_DRIVER]);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -171,25 +173,25 @@ public class GupPreferenceControllerTest {
|
||||
assertThat(preference.getEntry()).isEqualTo(mValueList[DEFAULT]);
|
||||
assertThat(preference.getValue()).isEqualTo(mValueList[DEFAULT]);
|
||||
assertThat(preference.getSummary()).isEqualTo(mValueList[DEFAULT]);
|
||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_IN_APPS))
|
||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GAME_DRIVER_OPT_IN_APPS))
|
||||
.isEqualTo("");
|
||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_OUT_APPS))
|
||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GAME_DRIVER_OPT_OUT_APPS))
|
||||
.isEqualTo("");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_selectGup_shouldUpdateAttributesAndSettingsGlobal() {
|
||||
public void onPreferenceChange_selectGAME_DRIVER_shouldUpdateAttributesAndSettingsGlobal() {
|
||||
loadDefaultConfig();
|
||||
final ListPreference preference =
|
||||
mController.createListPreference(mContext, TEST_PKG_NAME, TEST_APP_NAME);
|
||||
mController.onPreferenceChange(preference, mValueList[GUP]);
|
||||
mController.onPreferenceChange(preference, mValueList[GAME_DRIVER]);
|
||||
|
||||
assertThat(preference.getEntry()).isEqualTo(mValueList[GUP]);
|
||||
assertThat(preference.getValue()).isEqualTo(mValueList[GUP]);
|
||||
assertThat(preference.getSummary()).isEqualTo(mValueList[GUP]);
|
||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_IN_APPS))
|
||||
assertThat(preference.getEntry()).isEqualTo(mValueList[GAME_DRIVER]);
|
||||
assertThat(preference.getValue()).isEqualTo(mValueList[GAME_DRIVER]);
|
||||
assertThat(preference.getSummary()).isEqualTo(mValueList[GAME_DRIVER]);
|
||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GAME_DRIVER_OPT_IN_APPS))
|
||||
.isEqualTo(TEST_PKG_NAME);
|
||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_OUT_APPS))
|
||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GAME_DRIVER_OPT_OUT_APPS))
|
||||
.isEqualTo("");
|
||||
}
|
||||
|
||||
@@ -203,9 +205,9 @@ public class GupPreferenceControllerTest {
|
||||
assertThat(preference.getEntry()).isEqualTo(mValueList[SYSTEM]);
|
||||
assertThat(preference.getValue()).isEqualTo(mValueList[SYSTEM]);
|
||||
assertThat(preference.getSummary()).isEqualTo(mValueList[SYSTEM]);
|
||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_IN_APPS))
|
||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GAME_DRIVER_OPT_IN_APPS))
|
||||
.isEqualTo("");
|
||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GUP_DEV_OPT_OUT_APPS))
|
||||
assertThat(Settings.Global.getString(mResolver, Settings.Global.GAME_DRIVER_OPT_OUT_APPS))
|
||||
.isEqualTo(TEST_PKG_NAME);
|
||||
}
|
||||
|
||||
@@ -227,10 +229,10 @@ public class GupPreferenceControllerTest {
|
||||
private void loadDefaultConfig() { loadConfig("", ""); }
|
||||
|
||||
private void loadConfig(String optIn, String optOut) {
|
||||
Settings.Global.putString(mResolver, Settings.Global.GUP_DEV_OPT_IN_APPS, optIn);
|
||||
Settings.Global.putString(mResolver, Settings.Global.GUP_DEV_OPT_OUT_APPS, optOut);
|
||||
Settings.Global.putString(mResolver, Settings.Global.GAME_DRIVER_OPT_IN_APPS, optIn);
|
||||
Settings.Global.putString(mResolver, Settings.Global.GAME_DRIVER_OPT_OUT_APPS, optOut);
|
||||
|
||||
mController = new GupPreferenceController(mContext, "testKey");
|
||||
mController = new GameDriverAppPreferenceController(mContext, "testKey");
|
||||
mGroup = spy(new PreferenceCategory(mContext));
|
||||
final PreferenceManager preferenceManager = new PreferenceManager(mContext);
|
||||
when(mGroup.getContext()).thenReturn(mContext);
|
@@ -14,13 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.development.gup;
|
||||
package com.android.settings.development.gamedriver;
|
||||
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.provider.Settings;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -31,6 +32,7 @@ import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class GameDriverContentObserverTest {
|
||||
|
||||
@Mock
|
||||
private ContentResolver mResolver;
|
||||
@Mock
|
||||
@@ -57,7 +59,7 @@ public class GameDriverContentObserverTest {
|
||||
mGameDriverContentObserver.register(mResolver);
|
||||
|
||||
verify(mResolver).registerContentObserver(
|
||||
Settings.Global.getUriFor(Settings.Global.GUP_DEV_ALL_APPS), false,
|
||||
Settings.Global.getUriFor(Settings.Global.GAME_DRIVER_ALL_APPS), false,
|
||||
mGameDriverContentObserver);
|
||||
}
|
||||
|
@@ -14,11 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.development.gup;
|
||||
package com.android.settings.development.gamedriver;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -27,12 +28,13 @@ import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class GupDashboardTest {
|
||||
private GupDashboard mDashboard;
|
||||
public class GameDriverDashboardTest {
|
||||
|
||||
private GameDriverDashboard mDashboard;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mDashboard = new GupDashboard();
|
||||
mDashboard = new GameDriverDashboard();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -41,14 +43,13 @@ public class GupDashboardTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getMetricesCategory_shouldReturnGupDashboard() {
|
||||
public void getMetricesCategory_shouldReturnGameDriverDashboard() {
|
||||
assertThat(mDashboard.getMetricsCategory())
|
||||
.isEqualTo(MetricsProto.MetricsEvent.SETTINGS_GUP_DASHBOARD);
|
||||
.isEqualTo(MetricsProto.MetricsEvent.SETTINGS_GAME_DRIVER_DASHBOARD);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPreferenceScreen_shouldReturnGupSettings() {
|
||||
assertThat(mDashboard.getPreferenceScreenResId())
|
||||
.isEqualTo(R.xml.gup_settings);
|
||||
public void getPreferenceScreen_shouldReturnGameDriverSettings() {
|
||||
assertThat(mDashboard.getPreferenceScreenResId()).isEqualTo(R.xml.game_driver_settings);
|
||||
}
|
||||
}
|
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.development.gup;
|
||||
package com.android.settings.development.gamedriver;
|
||||
|
||||
import static com.android.settings.development.gup.GupEnableForAllAppsPreferenceController.GUP_ALL_APPS;
|
||||
import static com.android.settings.development.gup.GupEnableForAllAppsPreferenceController.GUP_DEFAULT;
|
||||
import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_ALL_APPS;
|
||||
import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_DEFAULT;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.atLeastOnce;
|
||||
@@ -40,7 +40,8 @@ import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class GupEnableForAllAppsPreferenceControllerTest {
|
||||
public class GameDriverEnableForAllAppsPreferenceControllerTest {
|
||||
|
||||
@Mock
|
||||
private PreferenceScreen mScreen;
|
||||
@Mock
|
||||
@@ -50,14 +51,14 @@ public class GupEnableForAllAppsPreferenceControllerTest {
|
||||
|
||||
private Context mContext;
|
||||
private ContentResolver mResolver;
|
||||
private GupEnableForAllAppsPreferenceController mController;
|
||||
private GameDriverEnableForAllAppsPreferenceController mController;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mResolver = mContext.getContentResolver();
|
||||
mController = new GupEnableForAllAppsPreferenceController(mContext, "testKey");
|
||||
mController = new GameDriverEnableForAllAppsPreferenceController(mContext, "testKey");
|
||||
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
|
||||
mController.displayPreference(mScreen);
|
||||
|
||||
@@ -66,7 +67,8 @@ public class GupEnableForAllAppsPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void displayPreference_shouldAddSwitchPreference() {
|
||||
Settings.Global.putInt(mResolver, Settings.Global.GUP_DEV_ALL_APPS, GUP_DEFAULT);
|
||||
Settings.Global.putInt(
|
||||
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
|
||||
mController.updateState(mPreference);
|
||||
|
||||
verify(mPreference).setChecked(false);
|
||||
@@ -90,19 +92,23 @@ public class GupEnableForAllAppsPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_check_shouldUpdateSettingsGlobal() {
|
||||
Settings.Global.putInt(mResolver, Settings.Global.GUP_DEV_ALL_APPS, GUP_DEFAULT);
|
||||
Settings.Global.putInt(
|
||||
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
|
||||
mController.onPreferenceChange(mPreference, true);
|
||||
|
||||
assertThat(Settings.Global.getInt(mResolver, Settings.Global.GUP_DEV_ALL_APPS, GUP_DEFAULT))
|
||||
.isEqualTo(GUP_ALL_APPS);
|
||||
assertThat(Settings.Global.getInt(
|
||||
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
|
||||
.isEqualTo(GAME_DRIVER_ALL_APPS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_uncheck_shouldUpdateSettingsGlobal() {
|
||||
Settings.Global.putInt(mResolver, Settings.Global.GUP_DEV_ALL_APPS, GUP_ALL_APPS);
|
||||
Settings.Global.putInt(
|
||||
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_ALL_APPS);
|
||||
mController.onPreferenceChange(mPreference, false);
|
||||
|
||||
assertThat(Settings.Global.getInt(mResolver, Settings.Global.GUP_DEV_ALL_APPS, GUP_DEFAULT))
|
||||
.isEqualTo(GUP_DEFAULT);
|
||||
assertThat(Settings.Global.getInt(
|
||||
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
|
||||
.isEqualTo(GAME_DRIVER_DEFAULT);
|
||||
}
|
||||
}
|
@@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.development.gup;
|
||||
package com.android.settings.development.gamedriver;
|
||||
|
||||
import static com.android.settings.core.BasePreferenceController.AVAILABLE;
|
||||
import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
|
||||
import static com.android.settings.development.gup.GupEnableForAllAppsPreferenceController.GUP_ALL_APPS;
|
||||
import static com.android.settings.development.gup.GupEnableForAllAppsPreferenceController.GUP_DEFAULT;
|
||||
import static com.android.settings.development.gup.GupEnableForAllAppsPreferenceController.GUP_OFF;
|
||||
import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_ALL_APPS;
|
||||
import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_DEFAULT;
|
||||
import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_OFF;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.spy;
|
||||
@@ -45,6 +45,7 @@ import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class GameDriverFooterPreferenceControllerTest {
|
||||
|
||||
@Mock
|
||||
private PreferenceScreen mScreen;
|
||||
@Mock
|
||||
@@ -67,21 +68,23 @@ public class GameDriverFooterPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_gameDriverOff_availableUnsearchable() {
|
||||
Settings.Global.putInt(mResolver, Settings.Global.GUP_DEV_ALL_APPS, GUP_OFF);
|
||||
Settings.Global.putInt(mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_OFF);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_gameDriverDefault_conditionallyUnavailable() {
|
||||
Settings.Global.putInt(mResolver, Settings.Global.GUP_DEV_ALL_APPS, GUP_DEFAULT);
|
||||
Settings.Global.putInt(
|
||||
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_gameDriverAllApps_conditionallyUnavailable() {
|
||||
Settings.Global.putInt(mResolver, Settings.Global.GUP_DEV_ALL_APPS, GUP_ALL_APPS);
|
||||
Settings.Global.putInt(
|
||||
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_ALL_APPS);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
|
||||
}
|
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.development.gup;
|
||||
package com.android.settings.development.gamedriver;
|
||||
|
||||
import static com.android.settings.development.gup.GupEnableForAllAppsPreferenceController.GUP_DEFAULT;
|
||||
import static com.android.settings.development.gup.GupEnableForAllAppsPreferenceController.GUP_OFF;
|
||||
import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_DEFAULT;
|
||||
import static com.android.settings.development.gamedriver.GameDriverEnableForAllAppsPreferenceController.GAME_DRIVER_OFF;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.verify;
|
||||
@@ -39,7 +39,8 @@ import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class GupGlobalSwitchBarControllerTest {
|
||||
public class GameDriverGlobalSwitchBarControllerTest {
|
||||
|
||||
@Mock
|
||||
private SwitchBar mSwitchBar;
|
||||
@Mock
|
||||
@@ -49,7 +50,7 @@ public class GupGlobalSwitchBarControllerTest {
|
||||
|
||||
private Context mContext;
|
||||
private ContentResolver mResolver;
|
||||
private GupGlobalSwitchBarController mController;
|
||||
private GameDriverGlobalSwitchBarController mController;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
@@ -59,27 +60,28 @@ public class GupGlobalSwitchBarControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructor_gupOn_shouldCheckSwitchBar() {
|
||||
Settings.Global.putInt(mResolver, Settings.Global.GUP_DEV_ALL_APPS, GUP_DEFAULT);
|
||||
mController =
|
||||
new GupGlobalSwitchBarController(mContext, new SwitchBarController(mSwitchBar));
|
||||
public void constructor_gameDriverOn_shouldCheckSwitchBar() {
|
||||
Settings.Global.putInt(
|
||||
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
|
||||
mController = new GameDriverGlobalSwitchBarController(
|
||||
mContext, new SwitchBarController(mSwitchBar));
|
||||
|
||||
verify(mSwitchBar).setChecked(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructor_gupOff_shouldUncheckSwitchBar() {
|
||||
Settings.Global.putInt(mResolver, Settings.Global.GUP_DEV_ALL_APPS, GUP_OFF);
|
||||
mController =
|
||||
new GupGlobalSwitchBarController(mContext, new SwitchBarController(mSwitchBar));
|
||||
public void constructor_gameDriverOff_shouldUncheckSwitchBar() {
|
||||
Settings.Global.putInt(mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_OFF);
|
||||
mController = new GameDriverGlobalSwitchBarController(
|
||||
mContext, new SwitchBarController(mSwitchBar));
|
||||
|
||||
verify(mSwitchBar).setChecked(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onStart_shouldStartListeningAndRegister() {
|
||||
mController =
|
||||
new GupGlobalSwitchBarController(mContext, new SwitchBarController(mSwitchBar));
|
||||
mController = new GameDriverGlobalSwitchBarController(
|
||||
mContext, new SwitchBarController(mSwitchBar));
|
||||
mController.mSwitchWidgetController = mSwitchWidgetController;
|
||||
mController.mGameDriverContentObserver = mGameDriverContentObserver;
|
||||
mController.onStart();
|
||||
@@ -90,8 +92,8 @@ public class GupGlobalSwitchBarControllerTest {
|
||||
|
||||
@Test
|
||||
public void onStop_shouldStopListeningAndUnregister() {
|
||||
mController =
|
||||
new GupGlobalSwitchBarController(mContext, new SwitchBarController(mSwitchBar));
|
||||
mController = new GameDriverGlobalSwitchBarController(
|
||||
mContext, new SwitchBarController(mSwitchBar));
|
||||
mController.mSwitchWidgetController = mSwitchWidgetController;
|
||||
mController.mGameDriverContentObserver = mGameDriverContentObserver;
|
||||
mController.onStop();
|
||||
@@ -101,24 +103,27 @@ public class GupGlobalSwitchBarControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onSwitchToggled_checked_shouldTurnOnGup() {
|
||||
Settings.Global.putInt(mResolver, Settings.Global.GUP_DEV_ALL_APPS, GUP_OFF);
|
||||
mController =
|
||||
new GupGlobalSwitchBarController(mContext, new SwitchBarController(mSwitchBar));
|
||||
public void onSwitchToggled_checked_shouldTurnOnGameDriver() {
|
||||
Settings.Global.putInt(mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_OFF);
|
||||
mController = new GameDriverGlobalSwitchBarController(
|
||||
mContext, new SwitchBarController(mSwitchBar));
|
||||
mController.onSwitchToggled(true);
|
||||
|
||||
assertThat(Settings.Global.getInt(mResolver, Settings.Global.GUP_DEV_ALL_APPS, GUP_DEFAULT))
|
||||
.isEqualTo(GUP_DEFAULT);
|
||||
assertThat(Settings.Global.getInt(
|
||||
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
|
||||
.isEqualTo(GAME_DRIVER_DEFAULT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onSwitchToggled_unchecked_shouldTurnOffGup() {
|
||||
Settings.Global.putInt(mResolver, Settings.Global.GUP_DEV_ALL_APPS, GUP_DEFAULT);
|
||||
mController =
|
||||
new GupGlobalSwitchBarController(mContext, new SwitchBarController(mSwitchBar));
|
||||
public void onSwitchToggled_unchecked_shouldTurnOffGameDriver() {
|
||||
Settings.Global.putInt(
|
||||
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT);
|
||||
mController = new GameDriverGlobalSwitchBarController(
|
||||
mContext, new SwitchBarController(mSwitchBar));
|
||||
mController.onSwitchToggled(false);
|
||||
|
||||
assertThat(Settings.Global.getInt(mResolver, Settings.Global.GUP_DEV_ALL_APPS, GUP_DEFAULT))
|
||||
.isEqualTo(GUP_OFF);
|
||||
assertThat(Settings.Global.getInt(
|
||||
mResolver, Settings.Global.GAME_DRIVER_ALL_APPS, GAME_DRIVER_DEFAULT))
|
||||
.isEqualTo(GAME_DRIVER_OFF);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user