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

Commit 3531778a authored by Samuel Fufa's avatar Samuel Fufa
Browse files

Defer AllAppsUpdate while edu test is running

Bug: 159671700
Test: Presubmit
Change-Id: I6f1421117286225d80a1538e45fbf2592229b586
parent 9cde419e
Loading
Loading
Loading
Loading
+18 −1
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.launcher3.ui;


import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.allapps.AllAppsStore.DEFER_UPDATES_TEST;


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertTrue;
@@ -77,6 +78,17 @@ public class WorkTabTest extends AbstractLauncherUiTest {
        mDevice.executeShellCommand("pm remove-user " + mProfileUserId);
        mDevice.executeShellCommand("pm remove-user " + mProfileUserId);
    }
    }


    @After
    public void resumeAppStoreUpdate() {
        executeOnLauncher(launcher -> {
            if (launcher == null || launcher.getAppsView() == null) {
                return;
            }
            launcher.getAppsView().getAppsStore().disableDeferUpdates(DEFER_UPDATES_TEST);
            Log.d(TestProtocol.WORK_PROFILE_REMOVED, "resuming AppStore updates");
        });
    }

    @Test
    @Test
    public void workTabExists() {
    public void workTabExists() {
        mDevice.pressHome();
        mDevice.pressHome();
@@ -145,6 +157,12 @@ public class WorkTabTest extends AbstractLauncherUiTest {
                "work profile status (" + mProfileUserId + ") :"
                "work profile status (" + mProfileUserId + ") :"
                        + launcher.getAppsView().isWorkTabVisible()));
                        + launcher.getAppsView().isWorkTabVisible()));



        executeOnLauncher(launcher -> {
            launcher.getAppsView().getAppsStore().enableDeferUpdates(DEFER_UPDATES_TEST);
            Log.d(TestProtocol.WORK_PROFILE_REMOVED, "Defer all apps update");
        });

        AtomicInteger attempt = new AtomicInteger(0);
        AtomicInteger attempt = new AtomicInteger(0);
        // verify work edu is seen next
        // verify work edu is seen next
        waitForLauncherCondition("Launcher did not show the next edu screen", l -> {
        waitForLauncherCondition("Launcher did not show the next edu screen", l -> {
@@ -157,7 +175,6 @@ public class WorkTabTest extends AbstractLauncherUiTest {
            if (((AllAppsPagedView) l.getAppsView().getContentView()).getCurrentPage()
            if (((AllAppsPagedView) l.getAppsView().getContentView()).getCurrentPage()
                    != WORK_PAGE) {
                    != WORK_PAGE) {
                Log.d(TestProtocol.WORK_PROFILE_REMOVED, "Work page not highlighted");
                Log.d(TestProtocol.WORK_PROFILE_REMOVED, "Work page not highlighted");
                return false;
            }
            }
            return ((TextView) workEduView.findViewById(R.id.content_text)).getText().equals(
            return ((TextView) workEduView.findViewById(R.id.content_text)).getText().equals(
                    l.getResources().getString(R.string.work_profile_edu_work_apps));
                    l.getResources().getString(R.string.work_profile_edu_work_apps));