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

Commit 05b81b47 authored by Geoffrey Pitsch's avatar Geoffrey Pitsch
Browse files

Fix test flake in AutoTileManagerTest

Use TestableLooper instead of default BG_LOOPER so no messages
will post while other tests are re-initializing Dependencies.

Test: runtest systemui
Change-Id: Ib2878120fadda9869f4dd721d961671224fb17a6
parent 6b2fa023
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -21,9 +21,11 @@ import static org.mockito.Mockito.verify;

import android.support.test.filters.SmallTest;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
import android.testing.TestableLooper.RunWithLooper;

import com.android.internal.app.NightDisplayController;
import com.android.systemui.Dependency;
import com.android.systemui.Prefs;
import com.android.systemui.Prefs.Key;
import com.android.systemui.SysuiTestCase;
@@ -45,6 +47,8 @@ public class AutoTileManagerTest extends SysuiTestCase {

    @Before
    public void setUp() throws Exception {
        mDependency.injectTestDependency(Dependency.BG_LOOPER,
                TestableLooper.get(this).getLooper());
        Prefs.putBoolean(mContext, Key.QS_NIGHTDISPLAY_ADDED, false);
        mQsTileHost = Mockito.mock(QSTileHost.class);
        mAutoTileManager = new AutoTileManager(mContext, mQsTileHost);