Rename updatable graphics driver to Game Update Package.

We have rebranded this project to Game Update Package, and GUP for short.

BUG: 119221883
Test: Build, flash and boot. Verify by going to developer options.
Change-Id: Ibc0814b6cd1e9bee991624c925456bc330fd93c6
This commit is contained in:
Peiyong Lin
2018-12-26 13:21:40 -08:00
parent 221b7e0b77
commit e70d103266
6 changed files with 45 additions and 43 deletions

View File

@@ -16,7 +16,7 @@
package com.android.settings.development;
import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes.REQUEST_CODE_UPDATED_GFX_DRIVER_DEV_OPT_IN_APP;
import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes.REQUEST_CODE_GUP_DEV_OPT_IN_APPS;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
@@ -44,7 +44,7 @@ import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
@RunWith(RobolectricTestRunner.class)
public class UpdatedGfxDriverDevOptInPreferenceControllerTest {
public class GameUpdatePackageDevOptInPreferenceControllerTest {
@Mock
private PreferenceScreen mPreferenceScreen;
@@ -53,13 +53,13 @@ public class UpdatedGfxDriverDevOptInPreferenceControllerTest {
private Context mContext;
private Preference mPreference;
private UpdatedGfxDriverDevOptInPreferenceController mController;
private GameUpdatePackageDevOptInPreferenceController mController;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mController = spy(new UpdatedGfxDriverDevOptInPreferenceController(mContext, mFragment));
mController = spy(new GameUpdatePackageDevOptInPreferenceController(mContext, mFragment));
mPreference = new Preference(mContext);
mPreference.setKey(mController.getPreferenceKey());
@@ -75,18 +75,19 @@ public class UpdatedGfxDriverDevOptInPreferenceControllerTest {
mController.handlePreferenceTreeClick(mPreference);
verify(mFragment).startActivityForResult(activityStartIntent,
REQUEST_CODE_UPDATED_GFX_DRIVER_DEV_OPT_IN_APP);
REQUEST_CODE_GUP_DEV_OPT_IN_APPS);
}
@Test
public void updateState_foobarAppSelected_shouldUpdateSummaryWithUpdatedDriverDevOptInAppLabel() {
public void updateState_foobarAppSelected_shouldUpdateSummaryWithGUPDevOptInAppLabel() {
final String selectedApp = "foobar";
final ContentResolver contentResolver = mContext.getContentResolver();
Settings.Global.putString(contentResolver,
Settings.Global.UPDATED_GFX_DRIVER_DEV_OPT_IN_APP, selectedApp);
Settings.Global.GUP_DEV_OPT_IN_APPS, selectedApp);
mController.updateState(mPreference);
assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.updated_gfx_driver_dev_opt_in_app_set, selectedApp));
assertThat(mPreference.getSummary()).isEqualTo(
mContext.getString(R.string.gup_dev_opt_in_app_set, selectedApp));
}
@Test
@@ -94,23 +95,25 @@ public class UpdatedGfxDriverDevOptInPreferenceControllerTest {
final String selectedApp = null;
final ContentResolver contentResolver = mContext.getContentResolver();
Settings.Global.putString(contentResolver,
Settings.Global.UPDATED_GFX_DRIVER_DEV_OPT_IN_APP, selectedApp);
Settings.Global.GUP_DEV_OPT_IN_APPS, selectedApp);
mController.updateState(mPreference);
assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.updated_gfx_driver_dev_opt_in_app_not_set));
assertThat(mPreference.getSummary()).isEqualTo(
mContext.getString(R.string.gup_dev_opt_in_app_not_set));
}
@Test
public void onActivityResult_foobarAppSelected_shouldUpdateSummaryWithUpdatedDriverDevOptInLabel() {
public void onActivityResult_foobarAppSelected_shouldUpdateSummaryWithGUPDevOptInLabel() {
Intent activityResultIntent = new Intent(mContext, AppPicker.class);
final String appLabel = "foobar";
activityResultIntent.setAction(appLabel);
final boolean result = mController
.onActivityResult(REQUEST_CODE_UPDATED_GFX_DRIVER_DEV_OPT_IN_APP, Activity.RESULT_OK,
.onActivityResult(REQUEST_CODE_GUP_DEV_OPT_IN_APPS, Activity.RESULT_OK,
activityResultIntent);
assertThat(result).isTrue();
assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.updated_gfx_driver_dev_opt_in_app_set, appLabel));
assertThat(mPreference.getSummary()).isEqualTo(
mContext.getString(R.string.gup_dev_opt_in_app_set, appLabel));
}
@Test
@@ -124,6 +127,7 @@ public class UpdatedGfxDriverDevOptInPreferenceControllerTest {
mController.onDeveloperOptionsSwitchDisabled();
assertThat(mPreference.isEnabled()).isFalse();
assertThat(mPreference.getSummary()).isEqualTo(mContext.getString(R.string.updated_gfx_driver_dev_opt_in_app_not_set));
assertThat(mPreference.getSummary()).isEqualTo(
mContext.getString(R.string.gup_dev_opt_in_app_not_set));
}
}