Commit e4b2e6fd authored by Ehimare Okoyomon's avatar Ehimare Okoyomon Committed by Commit Bot

[Android] replace page info permissions strings with plurals

Bug: 1077766
Change-Id: Ia4ff90e3aedaa1254cedb3b788d506650157907a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2421893Reviewed-by: default avatarChristian Dullweber <dullweber@chromium.org>
Commit-Queue: Ehimare Okoyomon <eokoyomon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808950}
parent 7a9727f0
......@@ -46,6 +46,8 @@ public class PageInfoPermissionsControllerUnitTest {
private static final PermissionRowParams SOUND_BLOCKED = createPermission("Sound", false, 0);
private static final PermissionRowParams VR_ALLOWED = createPermission("VR", true, 0);
private static final PermissionRowParams VR_BLOCKED = createPermission("VR", false, 0);
private static final PermissionRowParams AR_ALLOWED = createPermission("AR", true, 0);
private static final PermissionRowParams AR_BLOCKED = createPermission("AR", false, 0);
private Context mContext;
private String mTestName;
......@@ -73,17 +75,27 @@ public class PageInfoPermissionsControllerUnitTest {
"Location and Sound blocked"},
{"Two Permissions Mixed", Arrays.asList(LOCATION_ALLOWED, SOUND_BLOCKED),
"Location allowed, Sound blocked"},
{"Two Permissions Mixed 2", Arrays.asList(LOCATION_BLOCKED, SOUND_ALLOWED),
{"Two Permissions Mixed Reverse Order",
Arrays.asList(LOCATION_BLOCKED, SOUND_ALLOWED),
"Sound allowed, Location blocked"},
{"Multiple Permissions Allowed",
Arrays.asList(LOCATION_ALLOWED, SOUND_ALLOWED, VR_ALLOWED),
"Location, Sound, and 1 more allowed"},
{"Multiple Permissions Allowed 2",
Arrays.asList(LOCATION_ALLOWED, SOUND_ALLOWED, VR_ALLOWED, AR_ALLOWED),
"Location, Sound, and 2 more allowed"},
{"Multiple Permissions Blocked",
Arrays.asList(LOCATION_BLOCKED, SOUND_BLOCKED, VR_BLOCKED),
"Location, Sound, and 1 more blocked"},
{"Multiple Permissions Blocked 2",
Arrays.asList(LOCATION_BLOCKED, SOUND_BLOCKED, VR_BLOCKED, AR_BLOCKED),
"Location, Sound, and 2 more blocked"},
{"Multiple Permissions Mixed",
Arrays.asList(LOCATION_ALLOWED, SOUND_BLOCKED, VR_BLOCKED),
"Location, Sound, and 1 more"}});
"Location, Sound, and 1 more"},
{"Multiple Permissions Mixed 2",
Arrays.asList(LOCATION_ALLOWED, SOUND_BLOCKED, VR_BLOCKED, AR_BLOCKED),
"Location, Sound, and 2 more"}});
}
@Test
......
......@@ -454,13 +454,19 @@
<ph name="PERMISSION_1">%1$s<ex>Location</ex></ph> and <ph name="PERMISSION_2">%2$s<ex>Sound</ex></ph> blocked
</message>
<message name="IDS_PAGE_INFO_PERMISSIONS_SUMMARY_MORE_MIXED" desc="Summary page info permissions string for more than 2 permissions, with a mix of allowed/blocked.">
<ph name="PERMISSION_1">%1$s<ex>Location</ex></ph>, <ph name="PERMISSION_2">%2$s<ex>Sound</ex></ph>, and <ph name="NUM_MORE">%3$s<ex>2</ex></ph> more
{PERMISSIONS_SUMMARY_MIXED, plural,
=1 {<ph name="PERMISSION_1">%1$s<ex>Location</ex></ph>, <ph name="PERMISSION_2">%2$s<ex>Sound</ex></ph>, and <ph name="NUM_MORE">%3$s<ex>1</ex></ph> more}
other {<ph name="PERMISSION_1">%1$s<ex>Location</ex></ph>, <ph name="PERMISSION_2">%2$s<ex>Sound</ex></ph>, and <ph name="NUM_MORE">%3$s<ex>2</ex></ph> more}}
</message>
<message name="IDS_PAGE_INFO_PERMISSIONS_SUMMARY_MORE_ALLOWED" desc="Summary page info permissions string for more than 2 permissions, all allowed.">
<ph name="PERMISSION_1">%1$s<ex>Location</ex></ph>, <ph name="PERMISSION_2">%2$s<ex>Sound</ex></ph>, and <ph name="NUM_MORE">%3$s<ex>2</ex></ph> more allowed
{PERMISSIONS_SUMMARY_ALLOWED, plural,
=1 {<ph name="PERMISSION_1">%1$s<ex>Location</ex></ph>, <ph name="PERMISSION_2">%2$s<ex>Sound</ex></ph>, and <ph name="NUM_MORE">%3$s<ex>1</ex></ph> more allowed}
other {<ph name="PERMISSION_1">%1$s<ex>Location</ex></ph>, <ph name="PERMISSION_2">%2$s<ex>Sound</ex></ph>, and <ph name="NUM_MORE">%3$s<ex>2</ex></ph> more allowed}}
</message>
<message name="IDS_PAGE_INFO_PERMISSIONS_SUMMARY_MORE_BLOCKED" desc="Summary page info permissions string for more than 2 permissions, all blocked.">
<ph name="PERMISSION_1">%1$s<ex>Location</ex></ph>, <ph name="PERMISSION_2">%2$s<ex>Sound</ex></ph>, and <ph name="NUM_MORE">%3$s<ex>2</ex></ph> more blocked
{PERMISSIONS_SUMMARY_BLOCKED, plural,
=1 {<ph name="PERMISSION_1">%1$s<ex>Location</ex></ph>, <ph name="PERMISSION_2">%2$s<ex>Sound</ex></ph>, and <ph name="NUM_MORE">%3$s<ex>1</ex></ph> more blocked}
other {<ph name="PERMISSION_1">%1$s<ex>Location</ex></ph>, <ph name="PERMISSION_2">%2$s<ex>Sound</ex></ph>, and <ph name="NUM_MORE">%3$s<ex>2</ex></ph> more blocked}}
</message>
<message name="IDS_PAGE_INFO_INSTANT_APP_BUTTON" desc="Text in the button that opens an Android Instant app that is associated with the website's URL.">
Open Instant App
......
1318ad925d07f4068db9b4c221c79bd46a5eff3f
\ No newline at end of file
922c3132a13820a2a43e2ba5f762d3b6abdf7df7
\ No newline at end of file
26b79f2b7fc672cddbb3d04cfd48d4075625875c
\ No newline at end of file
9706763ffee06d9bd4ba8d79f0ebd89f4927ec3d
\ No newline at end of file
4c609fe0133dc1ee0fb153e764efefbde0910cb2
\ No newline at end of file
4bd3ee74502fcdd9cc2358b91c3ae0b9d4dec5fc
\ No newline at end of file
......@@ -127,13 +127,13 @@ public class PageInfoPermissionsController implements PageInfoSubpageController
// More than 2 permissions.
if (same) {
int resId = perm1.allowed ? R.string.page_info_permissions_summary_more_allowed
: R.string.page_info_permissions_summary_more_blocked;
return resources.getString(
resId, perm1.name.toString(), perm2.name.toString(), numPermissions - 2);
int resId = perm1.allowed ? R.plurals.page_info_permissions_summary_more_allowed
: R.plurals.page_info_permissions_summary_more_blocked;
return resources.getQuantityString(resId, numPermissions - 2, perm1.name.toString(),
perm2.name.toString(), numPermissions - 2);
}
int resId = R.string.page_info_permissions_summary_more_mixed;
return resources.getString(
resId, perm1.name.toString(), perm2.name.toString(), numPermissions - 2);
int resId = R.plurals.page_info_permissions_summary_more_mixed;
return resources.getQuantityString(resId, numPermissions - 2, perm1.name.toString(),
perm2.name.toString(), numPermissions - 2);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment