use of com.android.settings.fuelgauge.batterytip.tips.BatteryDefenderTip in project android_packages_apps_Settings by omnirom.
the class BatteryTipDialogFragmentTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
FakeFeatureFactory.setupForTest();
ShadowUtils.setApplicationLabel(PACKAGE_NAME, DISPLAY_NAME);
mPackageManager = Shadows.shadowOf(mContext.getPackageManager());
final ApplicationInfo applicationInfo = new ApplicationInfo();
applicationInfo.name = DISPLAY_NAME;
applicationInfo.packageName = PACKAGE_NAME;
final PackageInfo packageInfo = new PackageInfo();
packageInfo.packageName = PACKAGE_NAME;
packageInfo.applicationInfo = applicationInfo;
mPackageManager.addPackage(packageInfo);
mPackageManager.setApplicationIcon(PACKAGE_NAME, new ColorDrawable());
List<AppInfo> highUsageTips = new ArrayList<>();
mAppInfo = new AppInfo.Builder().setScreenOnTimeMs(SCREEN_TIME_MS).setPackageName(PACKAGE_NAME).build();
highUsageTips.add(mAppInfo);
mHighUsageTip = new HighUsageTip(SCREEN_TIME_MS, highUsageTips);
final List<AppInfo> restrictApps = new ArrayList<>();
restrictApps.add(mAppInfo);
mRestrictedOneAppTip = new RestrictAppTip(BatteryTip.StateType.NEW, new ArrayList<>(restrictApps));
restrictApps.add(mAppInfo);
mRestrictTwoAppsTip = new RestrictAppTip(BatteryTip.StateType.NEW, new ArrayList<>(restrictApps));
mUnrestrictAppTip = new UnrestrictAppTip(BatteryTip.StateType.NEW, mAppInfo);
mSummaryTip = spy(new SummaryTip(BatteryTip.StateType.NEW, EstimateKt.AVERAGE_TIME_TO_DISCHARGE_UNKNOWN));
mDefenderTip = new BatteryDefenderTip(BatteryTip.StateType.NEW);
}
Aggregations