[sync] Expose LocalDataDescription's domain display text to Java
No behavior change, but exposes this logic [1] to Java. There are
no new strings, a single string is moved from ios_strings.grd to
sync_ui_strings.grdp so it can reused by Android.
[1] https://source.chromium.org/chromium/chromium/src/+/main:ios/chrome/browser/ui/settings/google_services/bulk_upload/bulk_upload_mediator.mm;l=193;drc=fc0de1c030cdf94435d3791012ccbf00b1b26738
Low-Coverage-Reason: TESTS_IN_SEPARATE_CL the lines that are not tested are just plumbing from C++ to Java and will be tested by integration tests in future CLs.
Bug: 326040498
Change-Id: Ife5b954fc3699efa455e57de3b8fea9799353858
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5733878
Reviewed-by: Jungshik Shin <[email protected]>
Reviewed-by: Jérôme Lebel <[email protected]>
Reviewed-by: Boris Sazonov <[email protected]>
Reviewed-by: Arthur Milchior <[email protected]>
Auto-Submit: Victor Vianna <[email protected]>
Commit-Queue: Victor Vianna <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1332465}
diff --git a/components/sync/service/local_data_description_unittest.cc b/components/sync/service/local_data_description_unittest.cc
index ca66eb8..32ae1eb 100644
--- a/components/sync/service/local_data_description_unittest.cc
+++ b/components/sync/service/local_data_description_unittest.cc
@@ -62,5 +62,25 @@
BuildDescription(3, {"a.com"}, 1));
}
+TEST(LocalDataDescriptionTest, GetDomainsDisplayText) {
+ EXPECT_EQ(GetDomainsDisplayText(LocalDataDescription({GURL("http://a.com")})),
+ u"a.com");
+ EXPECT_EQ(GetDomainsDisplayText(LocalDataDescription(
+ {GURL("http://a.com"), GURL("http://b.com")})),
+ u"a.com, b.com");
+ EXPECT_EQ(
+ GetDomainsDisplayText(LocalDataDescription(
+ {GURL("http://a.com"), GURL("http://b.com"), GURL("http://c.com")})),
+ u"a.com, b.com, and 1 more");
+ EXPECT_EQ(GetDomainsDisplayText(LocalDataDescription(
+ {GURL("http://a.com"), GURL("http://b.com"),
+ GURL("http://c.com"), GURL("http://d.com")})),
+ u"a.com, b.com, and 2 more");
+ EXPECT_EQ(
+ GetDomainsDisplayText(LocalDataDescription(
+ {GURL("http://a.com"), GURL("http://a.com"), GURL("http://b.com")})),
+ u"a.com, b.com");
+}
+
} // namespace
} // namespace syncer