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

Commit 9838b73c authored by Vadim Tryshev's avatar Vadim Tryshev
Browse files

Waiting for NORMAL state after removing work profile

Bug: 313926097
Flag: N/A
Test: presubmit
Change-Id: Iddeb41dcf702855790e847417566636613f327b4
parent ff03dd19
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import static com.android.launcher3.LauncherPrefs.WORK_EDU_STEP;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.allapps.AllAppsStore.DEFER_UPDATES_TEST;
import static com.android.launcher3.testing.shared.TestProtocol.NORMAL_STATE_ORDINAL;
import static com.android.launcher3.util.TestUtil.installDummyAppForUser;

import static org.junit.Assert.assertEquals;
@@ -45,6 +46,7 @@ import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

import java.io.IOException;
import java.util.Objects;
import java.util.function.Predicate;

@@ -98,7 +100,17 @@ public class TaplWorkProfileTest extends AbstractLauncherUiTest {
            launcher.getAppsView().getAppsStore().disableDeferUpdates(DEFER_UPDATES_TEST);
        });
        TestUtil.uninstallDummyApp();

        mLauncher.runToState(
                () -> {
                    try {
                        mDevice.executeShellCommand("pm remove-user " + mProfileUserId);
                    } catch (IOException e) {
                        throw new RuntimeException(e);
                    }
                },
                NORMAL_STATE_ORDINAL,
                "executing pm 'remove-user' command");
    }

    private void waitForWorkTabSetup() {
+2 −1
Original line number Diff line number Diff line
@@ -1529,7 +1529,8 @@ public final class LauncherInstrumentation {
        }
    }

    void runToState(Runnable command, int expectedState, String actionName) {
    /** Run an action and wait for the specified Launcher state. */
    public void runToState(Runnable command, int expectedState, String actionName) {
        final List<Integer> actualEvents = new ArrayList<>();
        executeAndWaitForLauncherEvent(
                command,