Merge "Fix up the tests (yet again)"
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -58,6 +58,7 @@ public class QSFragmentTest extends FragmentTestCase {
|
||||
|
||||
@Before
|
||||
public void addLeakCheckDependencies() {
|
||||
injectTestDependency(Dependency.BG_LOOPER, Looper.getMainLooper());
|
||||
injectMockDependency(UserSwitcherController.class);
|
||||
injectLeakCheckedDependencies(BluetoothController.class, LocationController.class,
|
||||
RotationLockController.class, NetworkController.class, ZenModeController.class,
|
||||
|
||||
@@ -40,6 +40,7 @@ public class NavigationBarFragmentTest extends FragmentTestCase {
|
||||
mContext.putComponent(PhoneStatusBar.class, mock(PhoneStatusBar.class));
|
||||
mContext.putComponent(Recents.class, mock(Recents.class));
|
||||
mContext.putComponent(Divider.class, mock(Divider.class));
|
||||
mContext.addMockSystemService(Context.WINDOW_SERVICE, mock(WindowManager.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user