Commit 66110381 authored by Kyle Milka's avatar Kyle Milka Committed by Commit Bot

[SharingHub] Remove IS_FIRST_PARTY item property

This property is no longer needed since switching to vector icons.

Bug: None
Change-Id: I01e92a838c2bba16516b77f10572e3a9f7875fac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2219350
Commit-Queue: Kyle Milka <kmilka@chromium.org>
Reviewed-by: default avatarTravis Skare <skare@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796123}
parent 91da7b30
...@@ -178,9 +178,7 @@ class ChromeProvidedSharingOptionsProvider { ...@@ -178,9 +178,7 @@ class ChromeProvidedSharingOptionsProvider {
private FirstPartyOption createScreenshotFirstPartyOption() { private FirstPartyOption createScreenshotFirstPartyOption() {
PropertyModel propertyModel = ShareSheetPropertyModelBuilder.createPropertyModel( PropertyModel propertyModel = ShareSheetPropertyModelBuilder.createPropertyModel(
AppCompatResources.getDrawable(mActivity, R.drawable.screenshot), AppCompatResources.getDrawable(mActivity, R.drawable.screenshot),
mActivity.getResources().getString(R.string.sharing_screenshot), mActivity.getResources().getString(R.string.sharing_screenshot), (view) -> {
(view)
-> {
RecordUserAction.record("SharingHubAndroid.ScreenshotSelected"); RecordUserAction.record("SharingHubAndroid.ScreenshotSelected");
recordTimeToShare(mShareStartTime); recordTimeToShare(mShareStartTime);
mScreenshotCoordinator = new ScreenshotCoordinator(mActivity, mScreenshotCoordinator = new ScreenshotCoordinator(mActivity,
...@@ -189,8 +187,7 @@ class ChromeProvidedSharingOptionsProvider { ...@@ -189,8 +187,7 @@ class ChromeProvidedSharingOptionsProvider {
// observer will then remove itself. // observer will then remove itself.
mBottomSheetController.addObserver(mSheetObserver); mBottomSheetController.addObserver(mSheetObserver);
mBottomSheetController.hideContent(mBottomSheetContent, true); mBottomSheetController.hideContent(mBottomSheetContent, true);
}, });
/*isFirstParty=*/true);
return new FirstPartyOption(propertyModel, return new FirstPartyOption(propertyModel,
Arrays.asList(ContentType.LINK_PAGE_VISIBLE, ContentType.TEXT, Arrays.asList(ContentType.LINK_PAGE_VISIBLE, ContentType.TEXT,
ContentType.HIGHLIGHTED_TEXT, ContentType.IMAGE)); ContentType.HIGHLIGHTED_TEXT, ContentType.IMAGE));
...@@ -199,9 +196,7 @@ class ChromeProvidedSharingOptionsProvider { ...@@ -199,9 +196,7 @@ class ChromeProvidedSharingOptionsProvider {
private FirstPartyOption createCopyLinkFirstPartyOption() { private FirstPartyOption createCopyLinkFirstPartyOption() {
PropertyModel propertyModel = ShareSheetPropertyModelBuilder.createPropertyModel( PropertyModel propertyModel = ShareSheetPropertyModelBuilder.createPropertyModel(
AppCompatResources.getDrawable(mActivity, R.drawable.ic_content_copy_black), AppCompatResources.getDrawable(mActivity, R.drawable.ic_content_copy_black),
mActivity.getResources().getString(R.string.sharing_copy_url), mActivity.getResources().getString(R.string.sharing_copy_url), (view) -> {
(view)
-> {
RecordUserAction.record("SharingHubAndroid.CopyURLSelected"); RecordUserAction.record("SharingHubAndroid.CopyURLSelected");
recordTimeToShare(mShareStartTime); recordTimeToShare(mShareStartTime);
mBottomSheetController.hideContent(mBottomSheetContent, true); mBottomSheetController.hideContent(mBottomSheetContent, true);
...@@ -210,8 +205,7 @@ class ChromeProvidedSharingOptionsProvider { ...@@ -210,8 +205,7 @@ class ChromeProvidedSharingOptionsProvider {
clipboard.setPrimaryClip( clipboard.setPrimaryClip(
ClipData.newPlainText(mShareParams.getTitle(), mShareParams.getUrl())); ClipData.newPlainText(mShareParams.getTitle(), mShareParams.getUrl()));
Toast.makeText(mActivity, R.string.link_copied, Toast.LENGTH_SHORT).show(); Toast.makeText(mActivity, R.string.link_copied, Toast.LENGTH_SHORT).show();
}, });
/*isFirstParty=*/true);
return new FirstPartyOption(propertyModel, return new FirstPartyOption(propertyModel,
Arrays.asList(ContentType.LINK_PAGE_VISIBLE, ContentType.LINK_PAGE_NOT_VISIBLE)); Arrays.asList(ContentType.LINK_PAGE_VISIBLE, ContentType.LINK_PAGE_NOT_VISIBLE));
} }
...@@ -219,9 +213,7 @@ class ChromeProvidedSharingOptionsProvider { ...@@ -219,9 +213,7 @@ class ChromeProvidedSharingOptionsProvider {
private FirstPartyOption createCopyImageFirstPartyOption() { private FirstPartyOption createCopyImageFirstPartyOption() {
PropertyModel propertyModel = ShareSheetPropertyModelBuilder.createPropertyModel( PropertyModel propertyModel = ShareSheetPropertyModelBuilder.createPropertyModel(
AppCompatResources.getDrawable(mActivity, R.drawable.ic_content_copy_black), AppCompatResources.getDrawable(mActivity, R.drawable.ic_content_copy_black),
mActivity.getResources().getString(R.string.sharing_copy_image), mActivity.getResources().getString(R.string.sharing_copy_image), (view) -> {
(view)
-> {
RecordUserAction.record("SharingHubAndroid.CopyImageSelected"); RecordUserAction.record("SharingHubAndroid.CopyImageSelected");
recordTimeToShare(mShareStartTime); recordTimeToShare(mShareStartTime);
mBottomSheetController.hideContent(mBottomSheetContent, true); mBottomSheetController.hideContent(mBottomSheetContent, true);
...@@ -229,17 +221,14 @@ class ChromeProvidedSharingOptionsProvider { ...@@ -229,17 +221,14 @@ class ChromeProvidedSharingOptionsProvider {
Clipboard.getInstance().setImageUri(mShareParams.getFileUris().get(0)); Clipboard.getInstance().setImageUri(mShareParams.getFileUris().get(0));
Toast.makeText(mActivity, R.string.image_copied, Toast.LENGTH_SHORT).show(); Toast.makeText(mActivity, R.string.image_copied, Toast.LENGTH_SHORT).show();
} }
}, });
/*isFirstParty=*/true);
return new FirstPartyOption(propertyModel, Arrays.asList(ContentType.IMAGE)); return new FirstPartyOption(propertyModel, Arrays.asList(ContentType.IMAGE));
} }
private FirstPartyOption createCopyTextFirstPartyOption() { private FirstPartyOption createCopyTextFirstPartyOption() {
PropertyModel propertyModel = ShareSheetPropertyModelBuilder.createPropertyModel( PropertyModel propertyModel = ShareSheetPropertyModelBuilder.createPropertyModel(
AppCompatResources.getDrawable(mActivity, R.drawable.ic_content_copy_black), AppCompatResources.getDrawable(mActivity, R.drawable.ic_content_copy_black),
mActivity.getResources().getString(R.string.sharing_copy_text), mActivity.getResources().getString(R.string.sharing_copy_text), (view) -> {
(view)
-> {
RecordUserAction.record("SharingHubAndroid.CopyTextSelected"); RecordUserAction.record("SharingHubAndroid.CopyTextSelected");
recordTimeToShare(mShareStartTime); recordTimeToShare(mShareStartTime);
mBottomSheetController.hideContent(mBottomSheetContent, true); mBottomSheetController.hideContent(mBottomSheetContent, true);
...@@ -248,8 +237,7 @@ class ChromeProvidedSharingOptionsProvider { ...@@ -248,8 +237,7 @@ class ChromeProvidedSharingOptionsProvider {
clipboard.setPrimaryClip( clipboard.setPrimaryClip(
ClipData.newPlainText(mShareParams.getTitle(), mShareParams.getText())); ClipData.newPlainText(mShareParams.getTitle(), mShareParams.getText()));
Toast.makeText(mActivity, R.string.text_copied, Toast.LENGTH_SHORT).show(); Toast.makeText(mActivity, R.string.text_copied, Toast.LENGTH_SHORT).show();
}, });
/*isFirstParty=*/true);
return new FirstPartyOption( return new FirstPartyOption(
propertyModel, Arrays.asList(ContentType.TEXT, ContentType.HIGHLIGHTED_TEXT)); propertyModel, Arrays.asList(ContentType.TEXT, ContentType.HIGHLIGHTED_TEXT));
} }
...@@ -258,8 +246,7 @@ class ChromeProvidedSharingOptionsProvider { ...@@ -258,8 +246,7 @@ class ChromeProvidedSharingOptionsProvider {
PropertyModel propertyModel = ShareSheetPropertyModelBuilder.createPropertyModel( PropertyModel propertyModel = ShareSheetPropertyModelBuilder.createPropertyModel(
AppCompatResources.getDrawable(mActivity, R.drawable.send_tab), AppCompatResources.getDrawable(mActivity, R.drawable.send_tab),
mActivity.getResources().getString(R.string.send_tab_to_self_share_activity_title), mActivity.getResources().getString(R.string.send_tab_to_self_share_activity_title),
(view) (view) -> {
-> {
RecordUserAction.record("SharingHubAndroid.SendTabToSelfSelected"); RecordUserAction.record("SharingHubAndroid.SendTabToSelfSelected");
recordTimeToShare(mShareStartTime); recordTimeToShare(mShareStartTime);
mBottomSheetController.hideContent(mBottomSheetContent, true); mBottomSheetController.hideContent(mBottomSheetContent, true);
...@@ -271,8 +258,7 @@ class ChromeProvidedSharingOptionsProvider { ...@@ -271,8 +258,7 @@ class ChromeProvidedSharingOptionsProvider {
.getVisibleEntry() .getVisibleEntry()
.getTimestamp(), .getTimestamp(),
mBottomSheetController); mBottomSheetController);
}, });
/*isFirstParty=*/true);
return new FirstPartyOption(propertyModel, return new FirstPartyOption(propertyModel,
Arrays.asList(ContentType.LINK_PAGE_VISIBLE, ContentType.LINK_PAGE_NOT_VISIBLE, Arrays.asList(ContentType.LINK_PAGE_VISIBLE, ContentType.LINK_PAGE_NOT_VISIBLE,
ContentType.IMAGE)); ContentType.IMAGE));
...@@ -281,16 +267,13 @@ class ChromeProvidedSharingOptionsProvider { ...@@ -281,16 +267,13 @@ class ChromeProvidedSharingOptionsProvider {
private FirstPartyOption createQrCodeFirstPartyOption() { private FirstPartyOption createQrCodeFirstPartyOption() {
PropertyModel propertyModel = ShareSheetPropertyModelBuilder.createPropertyModel( PropertyModel propertyModel = ShareSheetPropertyModelBuilder.createPropertyModel(
AppCompatResources.getDrawable(mActivity, R.drawable.qr_code), AppCompatResources.getDrawable(mActivity, R.drawable.qr_code),
mActivity.getResources().getString(R.string.qr_code_share_icon_label), mActivity.getResources().getString(R.string.qr_code_share_icon_label), (view) -> {
(view)
-> {
RecordUserAction.record("SharingHubAndroid.QRCodeSelected"); RecordUserAction.record("SharingHubAndroid.QRCodeSelected");
recordTimeToShare(mShareStartTime); recordTimeToShare(mShareStartTime);
mBottomSheetController.hideContent(mBottomSheetContent, true); mBottomSheetController.hideContent(mBottomSheetContent, true);
QrCodeCoordinator qrCodeCoordinator = new QrCodeCoordinator(mActivity, mUrl); QrCodeCoordinator qrCodeCoordinator = new QrCodeCoordinator(mActivity, mUrl);
qrCodeCoordinator.show(); qrCodeCoordinator.show();
}, });
/*isFirstParty=*/true);
return new FirstPartyOption(propertyModel, return new FirstPartyOption(propertyModel,
Arrays.asList(ContentType.LINK_PAGE_VISIBLE, ContentType.LINK_PAGE_NOT_VISIBLE, Arrays.asList(ContentType.LINK_PAGE_VISIBLE, ContentType.LINK_PAGE_NOT_VISIBLE,
ContentType.IMAGE)); ContentType.IMAGE));
...@@ -299,15 +282,12 @@ class ChromeProvidedSharingOptionsProvider { ...@@ -299,15 +282,12 @@ class ChromeProvidedSharingOptionsProvider {
private FirstPartyOption createPrintingFirstPartyOption() { private FirstPartyOption createPrintingFirstPartyOption() {
PropertyModel propertyModel = ShareSheetPropertyModelBuilder.createPropertyModel( PropertyModel propertyModel = ShareSheetPropertyModelBuilder.createPropertyModel(
AppCompatResources.getDrawable(mActivity, R.drawable.sharing_print), AppCompatResources.getDrawable(mActivity, R.drawable.sharing_print),
mActivity.getResources().getString(R.string.print_share_activity_title), mActivity.getResources().getString(R.string.print_share_activity_title), (view) -> {
(view)
-> {
RecordUserAction.record("SharingHubAndroid.PrintSelected"); RecordUserAction.record("SharingHubAndroid.PrintSelected");
recordTimeToShare(mShareStartTime); recordTimeToShare(mShareStartTime);
mBottomSheetController.hideContent(mBottomSheetContent, true); mBottomSheetController.hideContent(mBottomSheetContent, true);
mPrintTabCallback.onResult(mTabProvider.get()); mPrintTabCallback.onResult(mTabProvider.get());
}, });
/*isFirstParty=*/true);
return new FirstPartyOption( return new FirstPartyOption(
propertyModel, Collections.singleton(ContentType.LINK_PAGE_VISIBLE)); propertyModel, Collections.singleton(ContentType.LINK_PAGE_VISIBLE));
} }
...@@ -316,8 +296,7 @@ class ChromeProvidedSharingOptionsProvider { ...@@ -316,8 +296,7 @@ class ChromeProvidedSharingOptionsProvider {
PropertyModel propertyModel = ShareSheetPropertyModelBuilder.createPropertyModel( PropertyModel propertyModel = ShareSheetPropertyModelBuilder.createPropertyModel(
AppCompatResources.getDrawable(mActivity, R.drawable.link), AppCompatResources.getDrawable(mActivity, R.drawable.link),
mActivity.getResources().getString(R.string.sharing_highlights), mActivity.getResources().getString(R.string.sharing_highlights),
(currentActivity) (currentActivity) -> {
-> {
RecordUserAction.record("SharingHubAndroid.LinkToTextSelected"); RecordUserAction.record("SharingHubAndroid.LinkToTextSelected");
recordTimeToShare(mShareStartTime); recordTimeToShare(mShareStartTime);
LinkToTextCoordinator linkToTextCoordinator = new LinkToTextCoordinator( LinkToTextCoordinator linkToTextCoordinator = new LinkToTextCoordinator(
...@@ -325,8 +304,7 @@ class ChromeProvidedSharingOptionsProvider { ...@@ -325,8 +304,7 @@ class ChromeProvidedSharingOptionsProvider {
mChromeOptionShareCallback, mShareParams.getUrl(), mChromeOptionShareCallback, mShareParams.getUrl(),
mShareParams.getText()); mShareParams.getText());
mBottomSheetController.hideContent(mBottomSheetContent, true); mBottomSheetController.hideContent(mBottomSheetContent, true);
}, });
/*isFirstParty=*/true);
return new FirstPartyOption( return new FirstPartyOption(
propertyModel, Collections.singleton(ContentType.HIGHLIGHTED_TEXT)); propertyModel, Collections.singleton(ContentType.HIGHLIGHTED_TEXT));
} }
......
...@@ -163,13 +163,11 @@ public class ShareSheetCoordinator ...@@ -163,13 +163,11 @@ public class ShareSheetCoordinator
PropertyModel morePropertyModel = ShareSheetPropertyModelBuilder.createPropertyModel( PropertyModel morePropertyModel = ShareSheetPropertyModelBuilder.createPropertyModel(
AppCompatResources.getDrawable(activity, R.drawable.sharing_more), AppCompatResources.getDrawable(activity, R.drawable.sharing_more),
activity.getResources().getString(R.string.sharing_more_icon_label), activity.getResources().getString(R.string.sharing_more_icon_label),
(shareParams) (shareParams) -> {
-> {
RecordUserAction.record("SharingHubAndroid.MoreSelected"); RecordUserAction.record("SharingHubAndroid.MoreSelected");
mBottomSheetController.hideContent(mBottomSheet, true); mBottomSheetController.hideContent(mBottomSheet, true);
ShareHelper.showDefaultShareUi(params, saveLastUsed); ShareHelper.showDefaultShareUi(params, saveLastUsed);
}, });
/*isFirstParty=*/true);
models.add(morePropertyModel); models.add(morePropertyModel);
return models; return models;
......
...@@ -22,9 +22,5 @@ final class ShareSheetItemViewProperties { ...@@ -22,9 +22,5 @@ final class ShareSheetItemViewProperties {
public static final WritableObjectPropertyKey<OnClickListener> CLICK_LISTENER = public static final WritableObjectPropertyKey<OnClickListener> CLICK_LISTENER =
new WritableObjectPropertyKey<>(); new WritableObjectPropertyKey<>();
/** True if this share sheet item is provided by Chrome. **/ public static final PropertyKey[] ALL_KEYS = {ICON, LABEL, CLICK_LISTENER};
public static final WritableObjectPropertyKey<Boolean> IS_FIRST_PARTY =
new WritableObjectPropertyKey<>();
public static final PropertyKey[] ALL_KEYS = {ICON, LABEL, CLICK_LISTENER, IS_FIRST_PARTY};
} }
...@@ -179,8 +179,7 @@ public class ShareSheetPropertyModelBuilder { ...@@ -179,8 +179,7 @@ public class ShareSheetPropertyModelBuilder {
}; };
PropertyModel propertyModel = PropertyModel propertyModel =
createPropertyModel(ShareHelper.loadIconForResolveInfo(info, mPackageManager), createPropertyModel(ShareHelper.loadIconForResolveInfo(info, mPackageManager),
(String) info.loadLabel(mPackageManager), onClickListener, (String) info.loadLabel(mPackageManager), onClickListener);
/*isFirstParty=*/false);
models.add(propertyModel); models.add(propertyModel);
} }
...@@ -245,12 +244,11 @@ public class ShareSheetPropertyModelBuilder { ...@@ -245,12 +244,11 @@ public class ShareSheetPropertyModelBuilder {
} }
static PropertyModel createPropertyModel( static PropertyModel createPropertyModel(
Drawable icon, String label, OnClickListener listener, boolean isFirstParty) { Drawable icon, String label, OnClickListener listener) {
return new PropertyModel.Builder(ShareSheetItemViewProperties.ALL_KEYS) return new PropertyModel.Builder(ShareSheetItemViewProperties.ALL_KEYS)
.with(ShareSheetItemViewProperties.ICON, icon) .with(ShareSheetItemViewProperties.ICON, icon)
.with(ShareSheetItemViewProperties.LABEL, label) .with(ShareSheetItemViewProperties.LABEL, label)
.with(ShareSheetItemViewProperties.CLICK_LISTENER, listener) .with(ShareSheetItemViewProperties.CLICK_LISTENER, listener)
.with(ShareSheetItemViewProperties.IS_FIRST_PARTY, isFirstParty)
.build(); .build();
} }
......
...@@ -41,7 +41,6 @@ import org.chromium.components.user_prefs.UserPrefsJni; ...@@ -41,7 +41,6 @@ import org.chromium.components.user_prefs.UserPrefsJni;
import org.chromium.ui.modelutil.PropertyModel; import org.chromium.ui.modelutil.PropertyModel;
import org.chromium.ui.test.util.DummyUiActivity; import org.chromium.ui.test.util.DummyUiActivity;
import java.util.Collection;
import java.util.List; import java.util.List;
/** /**
...@@ -106,7 +105,6 @@ public class ChromeProvidedSharingOptionsProviderTest { ...@@ -106,7 +105,6 @@ public class ChromeProvidedSharingOptionsProviderTest {
mActivity.getResources().getString( mActivity.getResources().getString(
R.string.send_tab_to_self_share_activity_title), R.string.send_tab_to_self_share_activity_title),
mActivity.getResources().getString(R.string.qr_code_share_icon_label))); mActivity.getResources().getString(R.string.qr_code_share_icon_label)));
assertModelsAreFirstParty(propertyModels);
} }
@Test @Test
...@@ -125,7 +123,6 @@ public class ChromeProvidedSharingOptionsProviderTest { ...@@ -125,7 +123,6 @@ public class ChromeProvidedSharingOptionsProviderTest {
ImmutableList.of(mActivity.getResources().getString(R.string.sharing_copy_url), ImmutableList.of(mActivity.getResources().getString(R.string.sharing_copy_url),
mActivity.getResources().getString( mActivity.getResources().getString(
R.string.send_tab_to_self_share_activity_title))); R.string.send_tab_to_self_share_activity_title)));
assertModelsAreFirstParty(propertyModels);
} }
@Test @Test
...@@ -145,7 +142,6 @@ public class ChromeProvidedSharingOptionsProviderTest { ...@@ -145,7 +142,6 @@ public class ChromeProvidedSharingOptionsProviderTest {
mActivity.getResources().getString( mActivity.getResources().getString(
R.string.send_tab_to_self_share_activity_title), R.string.send_tab_to_self_share_activity_title),
mActivity.getResources().getString(R.string.print_share_activity_title))); mActivity.getResources().getString(R.string.print_share_activity_title)));
assertModelsAreFirstParty(propertyModels);
} }
@Test @Test
...@@ -165,7 +161,6 @@ public class ChromeProvidedSharingOptionsProviderTest { ...@@ -165,7 +161,6 @@ public class ChromeProvidedSharingOptionsProviderTest {
Assert.assertEquals("Incorrect number of property models.", 1, propertyModels.size()); Assert.assertEquals("Incorrect number of property models.", 1, propertyModels.size());
assertModelsAreInTheRightOrder(propertyModels, assertModelsAreInTheRightOrder(propertyModels,
ImmutableList.of(mActivity.getResources().getString(R.string.sharing_copy_text))); ImmutableList.of(mActivity.getResources().getString(R.string.sharing_copy_text)));
assertModelsAreFirstParty(propertyModels);
} }
@Test @Test
...@@ -186,7 +181,6 @@ public class ChromeProvidedSharingOptionsProviderTest { ...@@ -186,7 +181,6 @@ public class ChromeProvidedSharingOptionsProviderTest {
mActivity.getResources().getString( mActivity.getResources().getString(
R.string.send_tab_to_self_share_activity_title), R.string.send_tab_to_self_share_activity_title),
mActivity.getResources().getString(R.string.qr_code_share_icon_label))); mActivity.getResources().getString(R.string.qr_code_share_icon_label)));
assertModelsAreFirstParty(propertyModels);
} }
@Test @Test
...@@ -208,7 +202,6 @@ public class ChromeProvidedSharingOptionsProviderTest { ...@@ -208,7 +202,6 @@ public class ChromeProvidedSharingOptionsProviderTest {
mActivity.getResources().getString( mActivity.getResources().getString(
R.string.send_tab_to_self_share_activity_title), R.string.send_tab_to_self_share_activity_title),
mActivity.getResources().getString(R.string.qr_code_share_icon_label))); mActivity.getResources().getString(R.string.qr_code_share_icon_label)));
assertModelsAreFirstParty(propertyModels);
} }
@Test @Test
...@@ -222,7 +215,6 @@ public class ChromeProvidedSharingOptionsProviderTest { ...@@ -222,7 +215,6 @@ public class ChromeProvidedSharingOptionsProviderTest {
ImmutableSet.of(ContentType.TEXT)); ImmutableSet.of(ContentType.TEXT));
Assert.assertEquals("Incorrect number of property models.", 0, propertyModels.size()); Assert.assertEquals("Incorrect number of property models.", 0, propertyModels.size());
assertModelsAreFirstParty(propertyModels);
} }
@Test @Test
...@@ -240,7 +232,6 @@ public class ChromeProvidedSharingOptionsProviderTest { ...@@ -240,7 +232,6 @@ public class ChromeProvidedSharingOptionsProviderTest {
assertModelsAreInTheRightOrder(propertyModels, assertModelsAreInTheRightOrder(propertyModels,
ImmutableList.of(mActivity.getResources().getString(R.string.sharing_copy_text), ImmutableList.of(mActivity.getResources().getString(R.string.sharing_copy_text),
mActivity.getResources().getString(R.string.sharing_highlights))); mActivity.getResources().getString(R.string.sharing_highlights)));
assertModelsAreFirstParty(propertyModels);
} }
@Test @Test
...@@ -289,12 +280,4 @@ public class ChromeProvidedSharingOptionsProviderTest { ...@@ -289,12 +280,4 @@ public class ChromeProvidedSharingOptionsProviderTest {
assertEquals( assertEquals(
"Property models in the wrong order.", expectedOrder, actualLabelOrder.build()); "Property models in the wrong order.", expectedOrder, actualLabelOrder.build());
} }
private void assertModelsAreFirstParty(Collection<PropertyModel> propertyModels) {
for (PropertyModel propertyModel : propertyModels) {
assertEquals(propertyModel.get(ShareSheetItemViewProperties.LABEL)
+ " isn't marked as first party.",
true, propertyModel.get(ShareSheetItemViewProperties.IS_FIRST_PARTY));
}
}
} }
...@@ -73,13 +73,11 @@ public final class ShareSheetCoordinatorTest { ...@@ -73,13 +73,11 @@ public final class ShareSheetCoordinatorTest {
.with(ShareSheetItemViewProperties.ICON, null) .with(ShareSheetItemViewProperties.ICON, null)
.with(ShareSheetItemViewProperties.LABEL, "testModel1") .with(ShareSheetItemViewProperties.LABEL, "testModel1")
.with(ShareSheetItemViewProperties.CLICK_LISTENER, null) .with(ShareSheetItemViewProperties.CLICK_LISTENER, null)
.with(ShareSheetItemViewProperties.IS_FIRST_PARTY, false)
.build(); .build();
PropertyModel testModel2 = new PropertyModel.Builder(ShareSheetItemViewProperties.ALL_KEYS) PropertyModel testModel2 = new PropertyModel.Builder(ShareSheetItemViewProperties.ALL_KEYS)
.with(ShareSheetItemViewProperties.ICON, null) .with(ShareSheetItemViewProperties.ICON, null)
.with(ShareSheetItemViewProperties.LABEL, "testModel2") .with(ShareSheetItemViewProperties.LABEL, "testModel2")
.with(ShareSheetItemViewProperties.CLICK_LISTENER, null) .with(ShareSheetItemViewProperties.CLICK_LISTENER, null)
.with(ShareSheetItemViewProperties.IS_FIRST_PARTY, false)
.build(); .build();
ArrayList<PropertyModel> thirdPartyPropertyModels = ArrayList<PropertyModel> thirdPartyPropertyModels =
...@@ -115,16 +113,10 @@ public final class ShareSheetCoordinatorTest { ...@@ -115,16 +113,10 @@ public final class ShareSheetCoordinatorTest {
assertEquals("Incorrect number of property models.", 3, propertyModels.size()); assertEquals("Incorrect number of property models.", 3, propertyModels.size());
assertEquals("First property model isn't testModel1.", "testModel1", assertEquals("First property model isn't testModel1.", "testModel1",
propertyModels.get(0).get(ShareSheetItemViewProperties.LABEL)); propertyModels.get(0).get(ShareSheetItemViewProperties.LABEL));
assertEquals("First property model is marked as first party.", false,
propertyModels.get(0).get(ShareSheetItemViewProperties.IS_FIRST_PARTY));
assertEquals("Second property model isn't testModel2.", "testModel2", assertEquals("Second property model isn't testModel2.", "testModel2",
propertyModels.get(1).get(ShareSheetItemViewProperties.LABEL)); propertyModels.get(1).get(ShareSheetItemViewProperties.LABEL));
assertEquals("Second property model is marked as first party.", false,
propertyModels.get(1).get(ShareSheetItemViewProperties.IS_FIRST_PARTY));
assertEquals("Third property model isn't More.", assertEquals("Third property model isn't More.",
activity.getResources().getString(R.string.sharing_more_icon_label), activity.getResources().getString(R.string.sharing_more_icon_label),
propertyModels.get(2).get(ShareSheetItemViewProperties.LABEL)); propertyModels.get(2).get(ShareSheetItemViewProperties.LABEL));
assertEquals("Third property model isn't marked as first party.", true,
propertyModels.get(2).get(ShareSheetItemViewProperties.IS_FIRST_PARTY));
} }
} }
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