Fix TetherSettingsTest

Fixes: 151204777
Test: run TetherSettingsTest
Change-Id: Ic510aac7fc7f9af095e78473bc191a4e903dcaba
This commit is contained in:
Yi-Ling Chuang
2020-03-11 18:18:36 +08:00
parent b8fb854e98
commit 542f76a51e

View File

@@ -30,9 +30,12 @@ import android.net.ConnectivityManager;
import android.net.wifi.WifiManager;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.FeatureFlagUtils;
import androidx.preference.Preference;
import com.android.settings.core.FeatureFlags;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -72,6 +75,7 @@ public class TetherSettingsTest {
@Test
public void testTetherNonIndexableKeys_tetherAvailable_keysNotReturned() {
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE, false);
// To let TetherUtil.isTetherAvailable return true, select one of the combinations
setupIsTetherAvailable(true);
@@ -106,6 +110,7 @@ public class TetherSettingsTest {
@Test
public void testTetherNonIndexableKeys_usbAvailable_usbKeyNotReturned() {
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE, false);
// We can ignore the condition of Utils.isMonkeyRunning()
// In normal case, monkey and robotest should not execute at the same time
when(mConnectivityManager.getTetherableUsbRegexs()).thenReturn(new String[]{"dummyRegex"});
@@ -128,6 +133,7 @@ public class TetherSettingsTest {
@Test
public void testTetherNonIndexableKeys_bluetoothAvailable_bluetoothKeyNotReturned() {
FeatureFlagUtils.setEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE, false);
when(mConnectivityManager.getTetherableBluetoothRegexs())
.thenReturn(new String[]{"dummyRegex"});