Introduce ClearAdbKeysPreferenceController

- Create new ClearAdbKeysPreferenceController
 - Added ClearAdbKeysWarningDialog
 - Create controller inside the DashboardFragment
 - Port logic from DevelopmentSettings into the controller

Bug: 34203528
Test: make RunSettingsRoboTests -j40
Change-Id: Ia12bfee753f2c9222e6d833b1fb7e099f3602fdf
This commit is contained in:
jeffreyhuang
2017-10-02 15:54:56 -07:00
parent 498e883d52
commit 97dbff233d
6 changed files with 422 additions and 3 deletions

View File

@@ -115,7 +115,8 @@ public class DevelopmentSettingsDashboardFragmentTest {
@Config(shadows = {
ShadowPictureColorModePreferenceController.class,
ShadowAdbPreferenceController.class,
ShadowBluetoothInbandRingingPreferenceController.class
ShadowBluetoothInbandRingingPreferenceController.class,
ShadowClearAdbKeysPreferenceController.class
})
public void searchIndex_pageEnabled_shouldNotAddKeysToNonIndexable() {
final Context appContext = RuntimeEnvironment.application;
@@ -208,6 +209,17 @@ public class DevelopmentSettingsDashboardFragmentTest {
verify(controller).onAdbDialogDismissed();
}
@Test
public void onAdbClearKeysDialogConfirmed_shouldCallControllerDialogConfirmed() {
final ClearAdbKeysPreferenceController controller = mock(
ClearAdbKeysPreferenceController.class);
doReturn(controller).when(mDashboard).getDevelopmentOptionsController(
ClearAdbKeysPreferenceController.class);
mDashboard.onAdbClearKeysDialogConfirmed();
verify(controller).onClearAdbKeysConfirmed();
}
@Implements(EnableDevelopmentSettingWarningDialog.class)
public static class ShadowEnableDevelopmentSettingWarningDialog {
@@ -248,4 +260,13 @@ public class DevelopmentSettingsDashboardFragmentTest {
return true;
}
}
@Implements(ClearAdbKeysPreferenceController.class)
public static class ShadowClearAdbKeysPreferenceController {
@Implementation
public boolean isAvailable() {
return true;
}
}
}