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

Commit 685db72e authored by Jason Monk's avatar Jason Monk
Browse files

Fix up the tests (yet again)

Turns out there was an actual bug in QSFooter where it was using
the wrong handler class (and not showing any of its security features),
and it would have been caught by presubmit if it was working...

Test: runtest systemui
Change-Id: Icbb19db1cc6f3f2a5f984618428ceb2899af69ab
parent 470ecb2c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ public class QSFooter implements OnClickListener, DialogInterface.OnClickListene

    private AlertDialog mDialog;
    private QSTileHost mHost;
    protected Handler mHandler;
    protected H mHandler;

    private boolean mIsVisible;
    private boolean mIsIconVisible;
@@ -83,7 +83,7 @@ public class QSFooter implements OnClickListener, DialogInterface.OnClickListene
        mMainHandler = new Handler(Looper.getMainLooper());
        mActivityStarter = Dependency.get(ActivityStarter.class);
        mSecurityController = Dependency.get(SecurityController.class);
        mHandler = new Handler((Looper) Dependency.get(Dependency.BG_LOOPER));
        mHandler = new H(Dependency.get(Dependency.BG_LOOPER));
    }

    public void setHostEnvironment(QSTileHost host) {
+4 −8
Original line number Diff line number Diff line
@@ -162,6 +162,10 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
        BatteryMeterView battery = (BatteryMeterView) findViewById(R.id.battery);
        int colorSecondary = Utils.getColorAttr(getContext(), android.R.attr.textColorSecondary);
        battery.setRawColors(colorForeground, colorSecondary);

        mNextAlarmController = Dependency.get(NextAlarmController.class);
        mUserInfoController = Dependency.get(UserInfoController.class);
        mActivityStarter = Dependency.get(ActivityStarter.class);
    }

    @Override
@@ -259,14 +263,6 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements
        mExpandIndicator.setExpanded(headerExpansionFraction > EXPAND_INDICATOR_THRESHOLD);
    }

    @Override
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        mNextAlarmController = Dependency.get(NextAlarmController.class);
        mUserInfoController = Dependency.get(UserInfoController.class);
        mActivityStarter = Dependency.get(ActivityStarter.class);
    }

    @Override
    @VisibleForTesting
    public void onDetachedFromWindow() {
+3 −0
Original line number Diff line number Diff line
@@ -30,6 +30,9 @@
    <uses-permission android:name="android.permission.ACCESS_KEYGUARD_SECURE_STORAGE" />
    <uses-permission android:name="android.permission.STATUS_BAR_SERVICE" />
    <uses-permission android:name="android.permission.ACCESS_VR_MANAGER" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" />
    <uses-permission android:name="android.permission.MANAGE_NETWORK_POLICY" />

    <application>
        <uses-library android:name="android.test.runner" />
+5 −2
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
package com.android.systemui;

import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
@@ -25,6 +26,8 @@ import com.android.systemui.statusbar.policy.FlashlightController;

import org.junit.Test;

import java.io.PrintWriter;

public class DependencyTest extends SysuiTestCase {

    @Test
@@ -46,8 +49,8 @@ public class DependencyTest extends SysuiTestCase {
        Dumpable d = mock(Dumpable.class);
        injectTestDependency("test", d);
        Dependency.get("test");
        mDependency.dump(null, null, null);
        verify(d).dump(eq(null), eq(null), eq(null));
        mDependency.dump(null, mock(PrintWriter.class), null);
        verify(d).dump(eq(null), any(), eq(null));
    }

    @Test
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ public abstract class SysuiTestCase {
    public void SysuiSetup() throws Exception {
        System.setProperty("dexmaker.share_classloader", "true");
        mContext = new TestableContext(InstrumentationRegistry.getTargetContext(), this);
        SystemUIFactory.createFromConfig(mContext);
        mDependency = new TestDependency();
        mDependency.mContext = mContext;
        mDependency.start();
Loading