diff --git a/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java index 139ef41e489..55381556eee 100644 --- a/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java +++ b/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java @@ -55,6 +55,7 @@ public class AdvancedBluetoothDetailsHeaderControllerTest{ private static final int BATTERY_LEVEL_LEFT = 25; private static final int BATTERY_LEVEL_RIGHT = 45; private static final String ICON_URI = "content://test.provider/icon.png"; + private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C"; private Context mContext; @@ -83,6 +84,7 @@ public class AdvancedBluetoothDetailsHeaderControllerTest{ mController.mLayoutPreference = mLayoutPreference; mController.mBluetoothAdapter = mBluetoothAdapter; when(mCachedDevice.getDevice()).thenReturn(mBluetoothDevice); + when(mCachedDevice.getAddress()).thenReturn(MAC_ADDRESS); } @Test diff --git a/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java index e57d5aa0ac9..29640d6d470 100644 --- a/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java +++ b/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java @@ -52,6 +52,8 @@ import java.util.Collection; @Config(shadows = {ShadowAudioManager.class, ShadowBluetoothAdapter.class, ShadowCachedBluetoothDeviceManager.class}) public class AvailableMediaBluetoothDeviceUpdaterTest { + private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C"; + @Mock private DashboardFragment mDashboardFragment; @Mock @@ -84,6 +86,7 @@ public class AvailableMediaBluetoothDeviceUpdaterTest { doReturn(mContext).when(mDashboardFragment).getContext(); when(mCachedBluetoothDevice.getDevice()).thenReturn(mBluetoothDevice); + when(mCachedBluetoothDevice.getAddress()).thenReturn(MAC_ADDRESS); mBluetoothDeviceUpdater = spy(new AvailableMediaBluetoothDeviceUpdater(mContext, mDashboardFragment, mDevicePreferenceCallback)); diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java index f6969ec8aef..56d17f490e8 100644 --- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java +++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java @@ -52,6 +52,7 @@ import org.robolectric.util.ReflectionHelpers; @Config(shadows = {ShadowAlertDialogCompat.class}) public class BluetoothDevicePreferenceTest { private static final boolean SHOW_DEVICES_WITHOUT_NAMES = true; + private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C"; private Context mContext; @Mock @@ -68,6 +69,7 @@ public class BluetoothDevicePreferenceTest { mContext = new ContextThemeWrapper(context, R.style.Theme_Settings); mFakeFeatureFactory = FakeFeatureFactory.setupForTest(); mMetricsFeatureProvider = mFakeFeatureFactory.getMetricsFeatureProvider(); + when(mCachedBluetoothDevice.getAddress()).thenReturn(MAC_ADDRESS); mPreference = new BluetoothDevicePreference(mContext, mCachedBluetoothDevice, SHOW_DEVICES_WITHOUT_NAMES); } @@ -163,18 +165,6 @@ public class BluetoothDevicePreferenceTest { assertThat(mPreference.shouldHideSecondTarget()).isFalse(); } - @Test - public void imagingDeviceIcon_isICSettingsPrint() { - when(mCachedBluetoothDevice.getBatteryLevel()) - .thenReturn(BluetoothDevice.BATTERY_LEVEL_UNKNOWN); - when(mCachedBluetoothDevice.getBtClass()) - .thenReturn(new BluetoothClass(BluetoothClass.Device.Major.IMAGING)); - - mPreference.onDeviceAttributesChanged(); - DrawableTestHelper.assertDrawableResId(mPreference.getIcon(), - com.android.internal.R.drawable.ic_settings_print); - } - @Test public void testVisible_showDeviceWithoutNames_visible() { doReturn(false).when(mCachedBluetoothDevice).hasHumanReadableName(); diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java index b3205006c3c..24aae859a31 100644 --- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java +++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceUpdaterTest.java @@ -56,6 +56,9 @@ import java.util.List; @Config(shadows = {ShadowBluetoothAdapter.class}) public class BluetoothDeviceUpdaterTest { + private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C"; + private static final String SUB_MAC_ADDRESS = "05:52:C7:0B:D8:3C"; + @Mock private DashboardFragment mDashboardFragment; @Mock @@ -93,6 +96,8 @@ public class BluetoothDeviceUpdaterTest { when(mSubCachedBluetoothDevice.getDevice()).thenReturn(mSubBluetoothDevice); when(mLocalManager.getCachedDeviceManager()).thenReturn(mCachedDeviceManager); when(mCachedDeviceManager.getCachedDevicesCopy()).thenReturn(mCachedDevices); + when(mCachedBluetoothDevice.getAddress()).thenReturn(MAC_ADDRESS); + when(mSubBluetoothDevice.getAddress()).thenReturn(SUB_MAC_ADDRESS); mPreference = new BluetoothDevicePreference(mContext, mCachedBluetoothDevice, false); mBluetoothDeviceUpdater = diff --git a/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java index db4da4fa036..615f67a99cc 100644 --- a/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java +++ b/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java @@ -54,6 +54,9 @@ import java.util.Collection; @Config(shadows = {ShadowAudioManager.class, ShadowBluetoothAdapter.class, ShadowCachedBluetoothDeviceManager.class}) public class ConnectedBluetoothDeviceUpdaterTest { + + private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C"; + @Mock private DashboardFragment mDashboardFragment; @Mock @@ -84,6 +87,7 @@ public class ConnectedBluetoothDeviceUpdaterTest { mCachedDevices = new ArrayList<>(); when(mCachedBluetoothDevice.getDevice()).thenReturn(mBluetoothDevice); + when(mCachedBluetoothDevice.getAddress()).thenReturn(MAC_ADDRESS); mShadowCachedBluetoothDeviceManager.setCachedDevicesCopy(mCachedDevices); mBluetoothDeviceUpdater = spy(new ConnectedBluetoothDeviceUpdater(mContext, mDashboardFragment, mDevicePreferenceCallback)); diff --git a/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java index 03c713680e7..ac7692d470a 100644 --- a/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java +++ b/tests/robotests/src/com/android/settings/bluetooth/SavedBluetoothDeviceUpdaterTest.java @@ -44,6 +44,8 @@ import org.robolectric.annotation.Config; @Config(shadows = {ShadowBluetoothAdapter.class}) public class SavedBluetoothDeviceUpdaterTest { + private static final String MAC_ADDRESS = "04:52:C7:0B:D8:3C"; + @Mock private DashboardFragment mDashboardFragment; @Mock @@ -64,6 +66,7 @@ public class SavedBluetoothDeviceUpdaterTest { mContext = RuntimeEnvironment.application; doReturn(mContext).when(mDashboardFragment).getContext(); when(mCachedBluetoothDevice.getDevice()).thenReturn(mBluetoothDevice); + when(mCachedBluetoothDevice.getAddress()).thenReturn(MAC_ADDRESS); when(mBluetoothDevice.getBondState()).thenReturn(BluetoothDevice.BOND_BONDED); mBluetoothDeviceUpdater = spy(new SavedBluetoothDeviceUpdater(mContext, mDashboardFragment,