use of com.android.settingslib.net.UidDetailProvider 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);
}
Aggregations