summaryrefslogtreecommitdiff
path: root/java/tests
diff options
context:
space:
mode:
author 1 <mrcasey@google.com> 2023-04-25 19:17:58 +0000
committer 1 <mrcasey@google.com> 2023-04-26 19:24:59 +0000
commitc74648831207df9495dcb13bf08afdecdf30fa93 (patch)
tree03a354689cc5ff2eb962dafc3ac62a404d45af26 /java/tests
parentf1107ce7b0771006130ac9fc49944f69d9594076 (diff)
Update file+share to align toggled text with mock.
When text is toggled off, it should say e.g. "Image only". Mock: https://www.figma.com/file/JVIcmg4OhWuO5Vc1UdPVxe/Sharesheet-(U)?node-id=66-5067&t=Wj5ulJXOpvpOPlYY-0 Bug: 279599021 Test: atest UnbundledChooserActivityTest Test: Manual test with ShareTest Change-Id: I85eecae3c24f348e355717b78b2cf23aa748f91a
Diffstat (limited to 'java/tests')
-rw-r--r--java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java b/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java
index 6c659133..7c4838a2 100644
--- a/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java
+++ b/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java
@@ -694,14 +694,13 @@ public class UnbundledChooserActivityTest {
}
@Test
- public void testImagePlusTextSharing_ExcludeText() {
+ public void testFilePlusTextSharing_ExcludeText() {
Uri uri = Uri.parse(
"android.resource://com.android.frameworks.coretests/"
+ R.drawable.test320x240);
Intent sendIntent = createSendImageIntent(uri);
ChooserActivityOverrideData.getInstance().imageLoader =
createImageLoader(uri, createBitmap());
- ChooserActivityOverrideData.getInstance().isImageType = true;
sendIntent.putExtra(Intent.EXTRA_TEXT, "https://google.com/search?q=google");
List<ResolvedComponentInfo> resolvedComponentInfos = Arrays.asList(
@@ -723,6 +722,8 @@ public class UnbundledChooserActivityTest {
.perform(click());
waitForIdle();
+ onView(withId(R.id.content_preview_text)).check(matches(withText("File only")));
+
AtomicReference<Intent> launchedIntentRef = new AtomicReference<>();
ChooserActivityOverrideData.getInstance().onSafelyStartInternalCallback = targetInfo -> {
launchedIntentRef.set(targetInfo.getTargetIntent());
@@ -736,14 +737,13 @@ public class UnbundledChooserActivityTest {
}
@Test
- public void testImagePlusTextSharing_RemoveAndAddBackText() {
+ public void testFilePlusTextSharing_RemoveAndAddBackText() {
Uri uri = Uri.parse(
"android.resource://com.android.frameworks.coretests/"
+ R.drawable.test320x240);
Intent sendIntent = createSendImageIntent(uri);
ChooserActivityOverrideData.getInstance().imageLoader =
createImageLoader(uri, createBitmap());
- ChooserActivityOverrideData.getInstance().isImageType = true;
final String text = "https://google.com/search?q=google";
sendIntent.putExtra(Intent.EXTRA_TEXT, text);
@@ -765,10 +765,14 @@ public class UnbundledChooserActivityTest {
.check(matches(isDisplayed()))
.perform(click());
waitForIdle();
+ onView(withId(R.id.content_preview_text)).check(matches(withText("File only")));
+
onView(withId(R.id.include_text_action))
.perform(click());
waitForIdle();
+ onView(withId(R.id.content_preview_text)).check(matches(withText(text)));
+
AtomicReference<Intent> launchedIntentRef = new AtomicReference<>();
ChooserActivityOverrideData.getInstance().onSafelyStartInternalCallback = targetInfo -> {
launchedIntentRef.set(targetInfo.getTargetIntent());
@@ -782,14 +786,13 @@ public class UnbundledChooserActivityTest {
}
@Test
- public void testImagePlusTextSharing_TextExclusionDoesNotAffectAlternativeIntent() {
+ public void testFilePlusTextSharing_TextExclusionDoesNotAffectAlternativeIntent() {
Uri uri = Uri.parse(
"android.resource://com.android.frameworks.coretests/"
+ R.drawable.test320x240);
Intent sendIntent = createSendImageIntent(uri);
ChooserActivityOverrideData.getInstance().imageLoader =
createImageLoader(uri, createBitmap());
- ChooserActivityOverrideData.getInstance().isImageType = true;
sendIntent.putExtra(Intent.EXTRA_TEXT, "https://google.com/search?q=google");
Intent alternativeIntent = createSendTextIntent();
@@ -828,7 +831,7 @@ public class UnbundledChooserActivityTest {
}
@Test
- public void testImagePlusTextSharing_failedThumbnailAndExcludedText_textRemainsVisible() {
+ public void testImagePlusTextSharing_failedThumbnailAndExcludedText_textChanges() {
Uri uri = Uri.parse(
"android.resource://com.android.frameworks.coretests/"
+ R.drawable.test320x240);
@@ -860,7 +863,7 @@ public class UnbundledChooserActivityTest {
onView(withId(R.id.image_view))
.check(matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)));
onView(withId(R.id.content_preview_text))
- .check(matches(allOf(isDisplayed(), not(isEnabled()))));
+ .check(matches(allOf(isDisplayed(), not(isEnabled()), withText("File only"))));
}
@Test