Merge "Set correct network type when launching wifi usage data."

This commit is contained in:
TreeHugger Robot
2019-01-29 02:12:41 +00:00
committed by Android (Google) Code Review
2 changed files with 17 additions and 1 deletions

View File

@@ -26,6 +26,7 @@ import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.graphics.Typeface;
import android.net.ConnectivityManager;
import android.net.NetworkTemplate;
import android.os.Bundle;
import android.telephony.SubscriptionManager;
@@ -531,6 +532,18 @@ public class DataUsageSummaryPreferenceTest {
assertThat(mLaunchButton.isEnabled()).isFalse();
}
@Test
public void launchWifiDataUsage_shouldSetWifiNetworkTypeInIntentExtra() {
mSummaryPreference.launchWifiDataUsage(mActivity);
final Intent launchIntent = Shadows.shadowOf(mActivity).getNextStartedActivity();
final Bundle args =
launchIntent.getBundleExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENTS);
assertThat(args.getInt(DataUsageList.EXTRA_NETWORK_TYPE))
.isEqualTo(ConnectivityManager.TYPE_WIFI);
}
private void bindViewHolder() {
mSummaryPreference.onBindViewHolder(mHolder);
mUsageTitle = (TextView) mHolder.findViewById(R.id.usage_title);