Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 171fec8c authored by Makoto Onuki's avatar Makoto Onuki Committed by Android (Google) Code Review
Browse files

Merge "Fix flakey shortcut manager tests."

parents e6abcbed ffa519c8
Loading
Loading
Loading
Loading
+8 −12
Original line number Diff line number Diff line
@@ -120,9 +120,6 @@ import java.util.function.BiConsumer;
 */
@SmallTest
public class ShortcutManagerTest1 extends BaseShortcutManagerTest {

    private static final boolean SKIP_FOR_BUG_67325252 = true;

    /**
     * Test for the first launch path, no settings file available.
     */
@@ -724,10 +721,6 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
    }

    public void testCleanupDanglingBitmaps() throws Exception {
        if (SKIP_FOR_BUG_67325252) {
            return;
        }

        assertBitmapDirectories(USER_0, EMPTY_STRINGS);
        assertBitmapDirectories(USER_10, EMPTY_STRINGS);

@@ -786,6 +779,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {

        dumpsysOnLogcat();

        mService.waitForBitmapSavesForTest();
        // Check files and directories.
        // Package 3 has no bitmaps, so we don't create a directory.
        assertBitmapDirectories(USER_0, CALLING_PACKAGE_1, CALLING_PACKAGE_2);
@@ -841,6 +835,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
        makeFile(mService.getUserBitmapFilePath(USER_10), CALLING_PACKAGE_2, "3").createNewFile();
        makeFile(mService.getUserBitmapFilePath(USER_10), CALLING_PACKAGE_2, "4").createNewFile();

        mService.waitForBitmapSavesForTest();
        assertBitmapDirectories(USER_0, CALLING_PACKAGE_1, CALLING_PACKAGE_2, CALLING_PACKAGE_3,
                "a.b.c", "d.e.f");

@@ -855,6 +850,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
        // The below check is the same as above, except this time USER_0 use the CALLING_PACKAGE_3
        // directory.

        mService.waitForBitmapSavesForTest();
        assertBitmapDirectories(USER_0, CALLING_PACKAGE_1, CALLING_PACKAGE_2, CALLING_PACKAGE_3);
        assertBitmapDirectories(USER_10, CALLING_PACKAGE_1, CALLING_PACKAGE_2);

@@ -1133,13 +1129,13 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
                            .setIcon(Icon.createWithResource(getTestContext(), R.drawable.black_32x32))
                            .build()
            )));

            mService.waitForBitmapSavesForTest();
            assertWith(getCallerShortcuts())
                    .forShortcutWithId("s1", si -> {
                        assertTrue(si.hasIconResource());
                        assertEquals(R.drawable.black_32x32, si.getIconResourceId());
                    });

            mService.waitForBitmapSavesForTest();
            // Set bitmap icon
            assertTrue(mManager.updateShortcuts(list(
                    new ShortcutInfo.Builder(mClientContext, "s1")
@@ -1147,7 +1143,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
                                    getTestContext().getResources(), R.drawable.black_64x64)))
                            .build()
            )));

            mService.waitForBitmapSavesForTest();
            assertWith(getCallerShortcuts())
                    .forShortcutWithId("s1", si -> {
                        assertTrue(si.hasIconFile());
@@ -1167,7 +1163,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
                                    getTestContext().getResources(), R.drawable.black_64x64)))
                            .build()
            )));

            mService.waitForBitmapSavesForTest();
            assertWith(getCallerShortcuts())
                    .forShortcutWithId("s1", si -> {
                        assertTrue(si.hasIconFile());
@@ -1179,7 +1175,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest {
                            .setIcon(Icon.createWithResource(getTestContext(), R.drawable.black_32x32))
                            .build()
            )));

            mService.waitForBitmapSavesForTest();
            assertWith(getCallerShortcuts())
                    .forShortcutWithId("s1", si -> {
                        assertTrue(si.hasIconResource());