Replace placeholder ROLE_ASSISTANT with ROLE_NOTES.

Bug: 254834764
Test: StylusDevicesController
Change-Id: I2303034180f9609db8f1a6d663c389a55dd04600
This commit is contained in:
Vania Januar
2023-01-04 16:22:38 +00:00
parent 47f6d387e7
commit e5651cd86e
2 changed files with 7 additions and 11 deletions

View File

@@ -99,8 +99,7 @@ public class StylusDevicesControllerTest {
when(mContext.getSystemService(RoleManager.class)).thenReturn(mRm);
doNothing().when(mContext).startActivity(any());
// TODO(b/254834764): notes role placeholder
when(mRm.getRoleHoldersAsUser(eq(RoleManager.ROLE_ASSISTANT), any(UserHandle.class)))
when(mRm.getRoleHoldersAsUser(eq(RoleManager.ROLE_NOTES), any(UserHandle.class)))
.thenReturn(Collections.singletonList(NOTES_PACKAGE_NAME));
when(mContext.getPackageManager()).thenReturn(mPm);
when(mPm.getApplicationInfo(eq(NOTES_PACKAGE_NAME),
@@ -237,8 +236,7 @@ public class StylusDevicesControllerTest {
@Test
public void defaultNotesPreference_noRoleHolder_hidesNotesRoleApp() {
// TODO(b/254834764): replace with notes role once merged
when(mRm.getRoleHoldersAsUser(eq(RoleManager.ROLE_ASSISTANT), any(UserHandle.class)))
when(mRm.getRoleHoldersAsUser(eq(RoleManager.ROLE_NOTES), any(UserHandle.class)))
.thenReturn(Collections.emptyList());
showScreen(mController);
@@ -258,14 +256,13 @@ public class StylusDevicesControllerTest {
showScreen(mController);
Preference defaultNotesPref = mPreferenceContainer.getPreference(0);
mController.onPreferenceClick(defaultNotesPref);
verify(mContext).startActivity(captor.capture());
verify(mContext).startActivity(captor.capture());
Intent intent = captor.getValue();
assertThat(intent.getAction()).isEqualTo(Intent.ACTION_MANAGE_DEFAULT_APP);
assertThat(intent.getPackage()).isEqualTo(permissionPackageName);
// TODO(b/254834764): when notes role is merged
assertThat(intent.getStringExtra(Intent.EXTRA_ROLE_NAME)).isEqualTo(
RoleManager.ROLE_ASSISTANT);
RoleManager.ROLE_NOTES);
}
@Test