summaryrefslogtreecommitdiff
path: root/java/tests/src
diff options
context:
space:
mode:
author Andrey Epin <ayepin@google.com> 2022-11-04 22:16:19 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-11-04 22:16:19 +0000
commitd98c446b684a41d073a28093d139b94642f45ac9 (patch)
treef8de1d3c8a4aa20a66d87dad9b88cd708bc068f9 /java/tests/src
parent53705d85ff4092c94592b281d3a05403bae01665 (diff)
parent578b259bd38d2a75fc7b1ecca1bfeb2009d99e07 (diff)
Merge "Remove ChooserListAdapter notifyDataSetChange throttling" into tm-qpr-dev
Diffstat (limited to 'java/tests/src')
-rw-r--r--java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java51
1 files changed, 10 insertions, 41 deletions
diff --git a/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java b/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java
index ee801101..dfdbeda7 100644
--- a/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java
+++ b/java/tests/src/com/android/intentresolver/UnbundledChooserActivityTest.java
@@ -636,7 +636,7 @@ public class UnbundledChooserActivityTest {
}
@Test @Ignore
- public void hasOtherProfileOneOption() throws Exception {
+ public void hasOtherProfileOneOption() {
List<ResolvedComponentInfo> personalResolvedComponentInfos =
createResolvedComponentsForTestWithOtherProfile(2, /* userId */ 10);
List<ResolvedComponentInfo> workResolvedComponentInfos = createResolvedComponentsForTest(4);
@@ -662,7 +662,6 @@ public class UnbundledChooserActivityTest {
List<ResolvedComponentInfo> stableCopy =
createResolvedComponentsForTestWithOtherProfile(2, /* userId= */ 10);
waitForIdle();
- Thread.sleep(((ChooserActivity) activity).mListViewUpdateDelayMs);
onView(first(withText(stableCopy.get(1).getResolveInfoAt(0).activityInfo.name)))
.perform(click());
@@ -1278,7 +1277,7 @@ public class UnbundledChooserActivityTest {
// This test is too long and too slow and should not be taken as an example for future tests.
@Test @Ignore
- public void testDirectTargetSelectionLogging() throws InterruptedException {
+ public void testDirectTargetSelectionLogging() {
Intent sendIntent = createSendTextIntent();
// We need app targets for direct targets to get displayed
List<ResolvedComponentInfo> resolvedComponentInfos = createResolvedComponentsForTest(2);
@@ -1321,11 +1320,6 @@ public class UnbundledChooserActivityTest {
/* directShareToAppTargets */ null)
);
- // Thread.sleep shouldn't be a thing in an integration test but it's
- // necessary here because of the way the code is structured
- // TODO: restructure the tests b/129870719
- Thread.sleep(((ChooserActivity) activity).mListViewUpdateDelayMs);
-
assertThat("Chooser should have 3 targets (2 apps, 1 direct)",
activity.getAdapter().getCount(), is(3));
assertThat("Chooser should have exactly one selectable direct target",
@@ -1356,7 +1350,7 @@ public class UnbundledChooserActivityTest {
// This test is too long and too slow and should not be taken as an example for future tests.
@Test @Ignore
- public void testDirectTargetLoggingWithRankedAppTarget() throws InterruptedException {
+ public void testDirectTargetLoggingWithRankedAppTarget() {
Intent sendIntent = createSendTextIntent();
// We need app targets for direct targets to get displayed
List<ResolvedComponentInfo> resolvedComponentInfos = createResolvedComponentsForTest(2);
@@ -1399,10 +1393,6 @@ public class UnbundledChooserActivityTest {
directShareToShortcutInfos,
/* directShareToAppTargets */ null)
);
- // Thread.sleep shouldn't be a thing in an integration test but it's
- // necessary here because of the way the code is structured
- // TODO: restructure the tests b/129870719
- Thread.sleep(((ChooserActivity) activity).mListViewUpdateDelayMs);
assertThat("Chooser should have 3 targets (2 apps, 1 direct)",
activity.getAdapter().getCount(), is(3));
@@ -1429,7 +1419,7 @@ public class UnbundledChooserActivityTest {
}
@Test @Ignore
- public void testShortcutTargetWithApplyAppLimits() throws InterruptedException {
+ public void testShortcutTargetWithApplyAppLimits() {
// Set up resources
ChooserActivityOverrideData.getInstance().resources = Mockito.spy(
InstrumentationRegistry.getInstrumentation().getContext().getResources());
@@ -1482,10 +1472,6 @@ public class UnbundledChooserActivityTest {
directShareToShortcutInfos,
/* directShareToAppTargets */ null)
);
- // Thread.sleep shouldn't be a thing in an integration test but it's
- // necessary here because of the way the code is structured
- // TODO: restructure the tests b/129870719
- Thread.sleep(((ChooserActivity) activity).mListViewUpdateDelayMs);
assertThat("Chooser should have 3 targets (2 apps, 1 direct)",
wrapper.getAdapter().getCount(), is(3));
@@ -1498,7 +1484,7 @@ public class UnbundledChooserActivityTest {
}
@Test @Ignore
- public void testShortcutTargetWithoutApplyAppLimits() throws InterruptedException {
+ public void testShortcutTargetWithoutApplyAppLimits() {
setDeviceConfigProperty(
SystemUiDeviceConfigFlags.APPLY_SHARING_APP_LIMITS_IN_SYSUI,
Boolean.toString(false));
@@ -1554,10 +1540,6 @@ public class UnbundledChooserActivityTest {
directShareToShortcutInfos,
/* directShareToAppTargets */ null)
);
- // Thread.sleep shouldn't be a thing in an integration test but it's
- // necessary here because of the way the code is structured
- // TODO: restructure the tests b/129870719
- Thread.sleep(((ChooserActivity) activity).mListViewUpdateDelayMs);
assertThat("Chooser should have 4 targets (2 apps, 2 direct)",
wrapper.getAdapter().getCount(), is(4));
@@ -1604,8 +1586,7 @@ public class UnbundledChooserActivityTest {
}
private void testDirectTargetLoggingWithAppTargetNotRanked(
- int orientation, int appTargetsExpected
- ) throws InterruptedException {
+ int orientation, int appTargetsExpected) {
Configuration configuration =
new Configuration(InstrumentationRegistry.getInstrumentation().getContext()
.getResources().getConfiguration());
@@ -1643,9 +1624,8 @@ public class UnbundledChooserActivityTest {
ResolveInfo ri = ResolverDataProvider.createResolveInfo(16, 0);
// Start activity
- final IChooserWrapper activity = (IChooserWrapper)
+ final IChooserWrapper wrapper = (IChooserWrapper)
mActivityRule.launchActivity(Intent.createChooser(sendIntent, null));
- final IChooserWrapper wrapper = (IChooserWrapper) activity;
// Insert the direct share target
Map<ChooserTarget, ShortcutInfo> directShareToShortcutInfos = new HashMap<>();
directShareToShortcutInfos.put(serviceTargets.get(0), null);
@@ -1662,10 +1642,6 @@ public class UnbundledChooserActivityTest {
directShareToShortcutInfos,
/* directShareToAppTargets */ null)
);
- // Thread.sleep shouldn't be a thing in an integration test but it's
- // necessary here because of the way the code is structured
- // TODO: restructure the tests b/129870719
- Thread.sleep(((ChooserActivity) activity).mListViewUpdateDelayMs);
assertThat(
String.format("Chooser should have %d targets (%d apps, 1 direct, 15 A-Z)",
@@ -1764,7 +1740,7 @@ public class UnbundledChooserActivityTest {
}
@Test @Ignore
- public void testWorkTab_selectingWorkTabAppOpensAppInWorkProfile() throws InterruptedException {
+ public void testWorkTab_selectingWorkTabAppOpensAppInWorkProfile() {
markWorkProfileUserAvailable();
List<ResolvedComponentInfo> personalResolvedComponentInfos =
createResolvedComponentsForTestWithOtherProfile(3, /* userId */ 10);
@@ -1780,13 +1756,10 @@ public class UnbundledChooserActivityTest {
return true;
};
- final IChooserWrapper activity = (IChooserWrapper)
- mActivityRule.launchActivity(Intent.createChooser(sendIntent, "work tab test"));
+ mActivityRule.launchActivity(Intent.createChooser(sendIntent, "work tab test"));
waitForIdle();
onView(withText(R.string.resolver_work_tab)).perform(click());
waitForIdle();
- // wait for the share sheet to expand
- Thread.sleep(((ChooserActivity) activity).mListViewUpdateDelayMs);
onView(first(allOf(
withText(workResolvedComponentInfos.get(0)
@@ -1957,7 +1930,7 @@ public class UnbundledChooserActivityTest {
}
@Test @Ignore
- public void testDirectTargetLogging() throws InterruptedException {
+ public void testDirectTargetLogging() {
Intent sendIntent = createSendTextIntent();
// We need app targets for direct targets to get displayed
List<ResolvedComponentInfo> resolvedComponentInfos = createResolvedComponentsForTest(2);
@@ -1997,10 +1970,6 @@ public class UnbundledChooserActivityTest {
directShareToShortcutInfos,
/* directShareToAppTargets */ null)
);
- // Thread.sleep shouldn't be a thing in an integration test but it's
- // necessary here because of the way the code is structured
- // TODO: restructure the tests b/129870719
- Thread.sleep(((ChooserActivity) activity).mListViewUpdateDelayMs);
assertThat("Chooser should have 3 targets (2 apps, 1 direct)",
activity.getAdapter().getCount(), is(3));