Merge "[Settings] configuration for hidding SIM settings UI" am: 697f570fad
am: f7090ebbee
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2319109 Change-Id: I739f417c3d19b22bc102c9a1e0253692008bd370 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -21,8 +21,10 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.os.UserManager;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -38,6 +40,8 @@ public class MobileNetworkListFragmentTest {
|
||||
@Mock
|
||||
private Context mContext;
|
||||
@Mock
|
||||
private Resources mResources;
|
||||
@Mock
|
||||
private UserManager mUserManager;
|
||||
|
||||
private MobileNetworkListFragment mFragment;
|
||||
@@ -55,6 +59,9 @@ public class MobileNetworkListFragmentTest {
|
||||
final BaseSearchIndexProvider provider =
|
||||
(BaseSearchIndexProvider) mFragment.SEARCH_INDEX_DATA_PROVIDER;
|
||||
|
||||
when(mContext.getResources()).thenReturn(mResources);
|
||||
when(mResources.getBoolean(R.bool.config_show_sim_info)).thenReturn(true);
|
||||
|
||||
final Object obj = ReflectionHelpers.callInstanceMethod(provider, "isPageSearchEnabled",
|
||||
ReflectionHelpers.ClassParameter.from(Context.class, mContext));
|
||||
final boolean isEnabled = (Boolean) obj;
|
||||
@@ -69,6 +76,9 @@ public class MobileNetworkListFragmentTest {
|
||||
final BaseSearchIndexProvider provider =
|
||||
(BaseSearchIndexProvider) mFragment.SEARCH_INDEX_DATA_PROVIDER;
|
||||
|
||||
when(mContext.getResources()).thenReturn(mResources);
|
||||
when(mResources.getBoolean(R.bool.config_show_sim_info)).thenReturn(true);
|
||||
|
||||
final Object obj = ReflectionHelpers.callInstanceMethod(provider, "isPageSearchEnabled",
|
||||
ReflectionHelpers.ClassParameter.from(Context.class, mContext));
|
||||
final boolean isEnabled = (Boolean) obj;
|
||||
|
@@ -29,6 +29,7 @@ import static org.mockito.Mockito.when;
|
||||
import android.app.Activity;
|
||||
import android.app.usage.NetworkStatsManager;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.net.NetworkPolicyManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserManager;
|
||||
@@ -37,6 +38,7 @@ import android.telephony.TelephonyManager;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.datausage.DataUsageSummaryPreferenceController;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settings.testutils.shadow.ShadowEntityHeaderController;
|
||||
@@ -68,12 +70,18 @@ public class MobileNetworkSettingsTest {
|
||||
private FragmentActivity mActivity;
|
||||
|
||||
private Context mContext;
|
||||
private Resources mResources;
|
||||
private MobileNetworkSettings mFragment;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = spy(RuntimeEnvironment.application);
|
||||
|
||||
mResources = spy(mContext.getResources());
|
||||
when(mContext.getResources()).thenReturn(mResources);
|
||||
when(mResources.getBoolean(R.bool.config_show_sim_info)).thenReturn(true);
|
||||
|
||||
when(mActivity.getSystemService(TelephonyManager.class)).thenReturn(mTelephonyManager);
|
||||
when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mTelephonyManager);
|
||||
when(mContext.getSystemService(NetworkStatsManager.class)).thenReturn(mNetworkStatsManager);
|
||||
|
Reference in New Issue
Block a user