Clean up BackupSettingsHelper.getSummary()

Backup item in System page no longer has summary.

Bug: 310513318
Test: m RunSettingsRoboTests
Change-Id: I0bb3b9114287546c279a5f30b65fb7081af54e44
This commit is contained in:
Chaohui Wang
2023-11-27 15:02:03 +08:00
parent 63b69694f6
commit c3e97122c1
3 changed files with 0 additions and 60 deletions

View File

@@ -34,7 +34,6 @@ import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.UserHandle;
import com.android.settings.R;
@@ -48,8 +47,6 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.shadow.api.Shadow;
import org.robolectric.shadows.ShadowUserManager;
@RunWith(RobolectricTestRunner.class)
@Config(shadows = BackupSettingsHelperTest.ShadowBackupManagerStub.class)
@@ -72,46 +69,12 @@ public class BackupSettingsHelperTest {
@Mock
private static IBackupManager mBackupManager;
private ShadowUserManager mUserManager;
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application.getApplicationContext());
when(mBackupManager.getCurrentTransport()).thenReturn("test_transport");
mBackupSettingsHelper = new BackupSettingsHelper(mContext);
mUserManager = Shadow.extract(mContext.getSystemService(Context.USER_SERVICE));
}
@Test
public void testGetSummary_backupEnabledOnlyOneProfile_showsOn() throws Exception {
mUserManager.addUserProfile(new UserHandle(0));
when(mBackupManager.isBackupEnabled()).thenReturn(true);
String backupSummary = mBackupSettingsHelper.getSummary();
assertThat(backupSummary).isEqualTo(mContext.getString(R.string.backup_summary_state_on));
}
@Test
public void testGetSummary_backupDisabledOnlyOneProfile_showsOff() throws Exception {
mUserManager.addUserProfile(new UserHandle(0));
when(mBackupManager.isBackupEnabled()).thenReturn(false);
String backupSummary = mBackupSettingsHelper.getSummary();
assertThat(backupSummary).isEqualTo(mContext.getString(R.string.backup_summary_state_off));
}
@Test
public void testGetSummary_TwoProfiles_returnsNull() throws Exception {
mUserManager.addUserProfile(new UserHandle(0));
mUserManager.addUserProfile(new UserHandle(10));
when(mBackupManager.isBackupEnabled()).thenReturn(true);
String backupSummary = mBackupSettingsHelper.getSummary();
assertThat(backupSummary).isNull();
}
@Test