use of com.android.settingslib.net.UidDetail in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AppDataUsageTest method onCreate_noNetworkTemplateAndInvalidDataSubscription_shouldUseWifiTemplate.
@Test
@Config(shadows = { ShadowDataUsageUtils.class, ShadowSubscriptionManager.class })
public void onCreate_noNetworkTemplateAndInvalidDataSubscription_shouldUseWifiTemplate() {
ShadowDataUsageUtils.IS_MOBILE_DATA_SUPPORTED = true;
ShadowDataUsageUtils.IS_WIFI_SUPPORTED = true;
ShadowDataUsageUtils.HAS_SIM = false;
ShadowSubscriptionManager.setDefaultDataSubscriptionId(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
mFragment = spy(new AppDataUsage());
doReturn(Robolectric.setupActivity(FragmentActivity.class)).when(mFragment).getActivity();
doReturn(RuntimeEnvironment.application).when(mFragment).getContext();
final UidDetailProvider uidDetailProvider = mock(UidDetailProvider.class);
doReturn(uidDetailProvider).when(mFragment).getUidDetailProvider();
doReturn(new UidDetail()).when(uidDetailProvider).getUidDetail(anyInt(), anyBoolean());
ReflectionHelpers.setField(mFragment, "mDashboardFeatureProvider", FakeFeatureFactory.setupForTest().dashboardFeatureProvider);
final Bundle args = new Bundle();
args.putInt(AppInfoBase.ARG_PACKAGE_UID, 123123);
mFragment.setArguments(args);
mFragment.onCreate(Bundle.EMPTY);
assertThat(mFragment.mTemplate.getMatchRule()).isEqualTo(NetworkTemplate.MATCH_WIFI_WILDCARD);
}
use of com.android.settingslib.net.UidDetail in project android_packages_apps_Settings by omnirom.
the class AppDataUsagePreferenceTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mAppItem = new AppItem(123);
mUidDetail = new UidDetail();
mUidDetail.icon = new ColorDrawable(Color.BLUE);
mUidDetail.label = "title";
}
use of com.android.settingslib.net.UidDetail in project android_packages_apps_Settings by omnirom.
the class AppDataUsageTest method onCreate_noNetworkTemplateAndInvalidDataSubscription_shouldUseWifiTemplate.
@Test
@Config(shadows = { ShadowDataUsageUtils.class, ShadowSubscriptionManager.class, ShadowFragment.class })
public void onCreate_noNetworkTemplateAndInvalidDataSubscription_shouldUseWifiTemplate() {
ShadowDataUsageUtils.IS_MOBILE_DATA_SUPPORTED = true;
ShadowDataUsageUtils.IS_WIFI_SUPPORTED = true;
ShadowDataUsageUtils.HAS_SIM = false;
ShadowSubscriptionManager.setDefaultDataSubscriptionId(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
mFragment = spy(new AppDataUsage());
doReturn(Robolectric.setupActivity(FragmentActivity.class)).when(mFragment).getActivity();
doReturn(RuntimeEnvironment.application).when(mFragment).getContext();
final UidDetailProvider uidDetailProvider = mock(UidDetailProvider.class);
doReturn(uidDetailProvider).when(mFragment).getUidDetailProvider();
doReturn(new UidDetail()).when(uidDetailProvider).getUidDetail(anyInt(), anyBoolean());
ReflectionHelpers.setField(mFragment, "mDashboardFeatureProvider", FakeFeatureFactory.setupForTest().dashboardFeatureProvider);
final Bundle args = new Bundle();
args.putInt(AppInfoBase.ARG_PACKAGE_UID, 123123);
mFragment.setArguments(args);
mFragment.onCreate(Bundle.EMPTY);
assertThat(mFragment.mTemplate.getMatchRule()).isEqualTo(NetworkTemplate.MATCH_WIFI);
assertNull(mFragment.mTemplate.getSubscriberId());
assertThat(mFragment.mTemplate.getNetworkId()).isEqualTo(NetworkTemplate.WIFI_NETWORKID_ALL);
}
Aggregations