Loading android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerServiceTest.java +4 −6 Original line number Diff line number Diff line Loading @@ -30,8 +30,8 @@ import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.media.AudioManager; import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.support.v4.media.session.PlaybackStateCompat; Loading @@ -40,7 +40,6 @@ import androidx.test.filters.MediumTest; import androidx.test.rule.ServiceTestRule; import androidx.test.runner.AndroidJUnit4; import com.android.bluetooth.R; import com.android.bluetooth.TestUtils; import com.android.bluetooth.a2dpsink.A2dpSinkService; import com.android.bluetooth.avrcpcontroller.BluetoothMediaBrowserService.BrowseResult; Loading @@ -67,11 +66,11 @@ public class AvrcpControllerServiceTest { private static final String REMOTE_DEVICE_ADDRESS = "00:00:00:00:00:00"; private static final String REMOTE_DEVICE_ADDRESS_2 = "11:11:11:11:11:11"; @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); private AvrcpControllerService mService = null; private BluetoothAdapter mAdapter = null; @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); @Rule public final ServiceTestRule mBluetoothBrowserMediaServiceTestRule = new ServiceTestRule(); Loading Loading @@ -517,9 +516,8 @@ public class AvrcpControllerServiceTest { * first device by checking that it has remained as the active device. */ @Test @EnableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS) public void testActiveDeviceMaintainsAudioFocusWhenOtherDeviceConnects_audioFocusMaintained() { mSetFlagsRule.enableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); mService.onConnectionStateChanged(true, true, mRemoteDevice); // check set active device is called verify(mA2dpSinkService).setActiveDevice(mRemoteDevice); Loading android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java +6 −4 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ import android.content.res.Resources; import android.media.AudioManager; import android.os.Bundle; import android.os.Looper; import android.platform.test.annotations.DisableFlags; import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.support.v4.media.MediaMetadataCompat; import android.support.v4.media.session.MediaControllerCompat; Loading Loading @@ -74,10 +76,10 @@ public class AvrcpControllerStateMachineTest { private static final int UUID_START = 0; private static final int UUID_LENGTH = 25; @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); private BluetoothAdapter mAdapter; @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); @Mock private AdapterService mAdapterService; Loading Loading @@ -465,8 +467,8 @@ public class AvrcpControllerStateMachineTest { /** Get the root of the device */ @Test @DisableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS) public void testGetDeviceRootNode_flagRandomDeviceIdDisabled_rootNodeMatchesUuidFormat() { mSetFlagsRule.disableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); // create new state machine to follow current flags rule mAvrcpStateMachine = makeStateMachine(mTestDevice); setUpConnectedState(true, true); Loading @@ -478,8 +480,8 @@ public class AvrcpControllerStateMachineTest { /** Get the root of the device */ @Test @EnableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS) public void testGetDeviceRootNode_flagRandomDeviceIdEnabled_rootNodeMatchesUuidFormat() { mSetFlagsRule.enableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); // create new state machine to follow current flags rule mAvrcpStateMachine = makeStateMachine(mTestDevice); setUpConnectedState(true, true); Loading android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/BrowseTreeTest.java +5 −11 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ import static com.google.common.truth.Truth.assertThat; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.platform.test.annotations.DisableFlags; import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import com.android.bluetooth.avrcpcontroller.BrowseTree.BrowseNode; Loading Loading @@ -100,8 +102,8 @@ public class BrowseTreeTest { } @Test @EnableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS) public void sameDeviceDifferentBrowseTrees_uniqueMediaIds() { mSetFlagsRule.enableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); BrowseTree browseTree1 = new BrowseTree(mTestDevice); BrowseTree browseTree2 = new BrowseTree(mTestDevice); Loading @@ -118,21 +120,13 @@ public class BrowseTreeTest { } @Test @DisableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS) public void findBrowseNodeByIDForDevice() { mSetFlagsRule.disableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); BrowseTree browseTree = new BrowseTree(mTestDevice); final String deviceId = BrowseTree.ROOT + mTestDevice.getAddress().toString(); assertThat(browseTree.findBrowseNodeByID(deviceId)).isEqualTo(browseTree.mRootNode); } @Test public void findBrowseNodeByIDForDevice_flagEnabled() { mSetFlagsRule.enableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); BrowseTree browseTree = new BrowseTree(mTestDevice); final String deviceId = browseTree.mRootNode.getID(); assertThat(browseTree.findBrowseNodeByID(deviceId)).isEqualTo(browseTree.mRootNode); } @Test public void findBrowseNodeByIDForIllegalId() { BrowseTree browseTree = new BrowseTree(mTestDevice); Loading @@ -149,8 +143,8 @@ public class BrowseTreeTest { } @Test @EnableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS) public void findBrowseNodeByIDForDevice_withRandomDeviceID_nodeIsFound() { mSetFlagsRule.enableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); BrowseTree browseTree = new BrowseTree(mTestDevice); final String deviceId = browseTree.mRootNode.getID(); assertThat(browseTree.findBrowseNodeByID(deviceId)).isEqualTo(browseTree.mRootNode); Loading Loading
android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerServiceTest.java +4 −6 Original line number Diff line number Diff line Loading @@ -30,8 +30,8 @@ import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.media.AudioManager; import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.support.v4.media.session.PlaybackStateCompat; Loading @@ -40,7 +40,6 @@ import androidx.test.filters.MediumTest; import androidx.test.rule.ServiceTestRule; import androidx.test.runner.AndroidJUnit4; import com.android.bluetooth.R; import com.android.bluetooth.TestUtils; import com.android.bluetooth.a2dpsink.A2dpSinkService; import com.android.bluetooth.avrcpcontroller.BluetoothMediaBrowserService.BrowseResult; Loading @@ -67,11 +66,11 @@ public class AvrcpControllerServiceTest { private static final String REMOTE_DEVICE_ADDRESS = "00:00:00:00:00:00"; private static final String REMOTE_DEVICE_ADDRESS_2 = "11:11:11:11:11:11"; @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); private AvrcpControllerService mService = null; private BluetoothAdapter mAdapter = null; @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); @Rule public final ServiceTestRule mBluetoothBrowserMediaServiceTestRule = new ServiceTestRule(); Loading Loading @@ -517,9 +516,8 @@ public class AvrcpControllerServiceTest { * first device by checking that it has remained as the active device. */ @Test @EnableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS) public void testActiveDeviceMaintainsAudioFocusWhenOtherDeviceConnects_audioFocusMaintained() { mSetFlagsRule.enableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); mService.onConnectionStateChanged(true, true, mRemoteDevice); // check set active device is called verify(mA2dpSinkService).setActiveDevice(mRemoteDevice); Loading
android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpControllerStateMachineTest.java +6 −4 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ import android.content.res.Resources; import android.media.AudioManager; import android.os.Bundle; import android.os.Looper; import android.platform.test.annotations.DisableFlags; import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import android.support.v4.media.MediaMetadataCompat; import android.support.v4.media.session.MediaControllerCompat; Loading Loading @@ -74,10 +76,10 @@ public class AvrcpControllerStateMachineTest { private static final int UUID_START = 0; private static final int UUID_LENGTH = 25; @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); private BluetoothAdapter mAdapter; @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); @Mock private AdapterService mAdapterService; Loading Loading @@ -465,8 +467,8 @@ public class AvrcpControllerStateMachineTest { /** Get the root of the device */ @Test @DisableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS) public void testGetDeviceRootNode_flagRandomDeviceIdDisabled_rootNodeMatchesUuidFormat() { mSetFlagsRule.disableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); // create new state machine to follow current flags rule mAvrcpStateMachine = makeStateMachine(mTestDevice); setUpConnectedState(true, true); Loading @@ -478,8 +480,8 @@ public class AvrcpControllerStateMachineTest { /** Get the root of the device */ @Test @EnableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS) public void testGetDeviceRootNode_flagRandomDeviceIdEnabled_rootNodeMatchesUuidFormat() { mSetFlagsRule.enableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); // create new state machine to follow current flags rule mAvrcpStateMachine = makeStateMachine(mTestDevice); setUpConnectedState(true, true); Loading
android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/BrowseTreeTest.java +5 −11 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ import static com.google.common.truth.Truth.assertThat; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.platform.test.annotations.DisableFlags; import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.SetFlagsRule; import com.android.bluetooth.avrcpcontroller.BrowseTree.BrowseNode; Loading Loading @@ -100,8 +102,8 @@ public class BrowseTreeTest { } @Test @EnableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS) public void sameDeviceDifferentBrowseTrees_uniqueMediaIds() { mSetFlagsRule.enableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); BrowseTree browseTree1 = new BrowseTree(mTestDevice); BrowseTree browseTree2 = new BrowseTree(mTestDevice); Loading @@ -118,21 +120,13 @@ public class BrowseTreeTest { } @Test @DisableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS) public void findBrowseNodeByIDForDevice() { mSetFlagsRule.disableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); BrowseTree browseTree = new BrowseTree(mTestDevice); final String deviceId = BrowseTree.ROOT + mTestDevice.getAddress().toString(); assertThat(browseTree.findBrowseNodeByID(deviceId)).isEqualTo(browseTree.mRootNode); } @Test public void findBrowseNodeByIDForDevice_flagEnabled() { mSetFlagsRule.enableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); BrowseTree browseTree = new BrowseTree(mTestDevice); final String deviceId = browseTree.mRootNode.getID(); assertThat(browseTree.findBrowseNodeByID(deviceId)).isEqualTo(browseTree.mRootNode); } @Test public void findBrowseNodeByIDForIllegalId() { BrowseTree browseTree = new BrowseTree(mTestDevice); Loading @@ -149,8 +143,8 @@ public class BrowseTreeTest { } @Test @EnableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS) public void findBrowseNodeByIDForDevice_withRandomDeviceID_nodeIsFound() { mSetFlagsRule.enableFlags(Flags.FLAG_RANDOMIZE_DEVICE_LEVEL_MEDIA_IDS); BrowseTree browseTree = new BrowseTree(mTestDevice); final String deviceId = browseTree.mRootNode.getID(); assertThat(browseTree.findBrowseNodeByID(deviceId)).isEqualTo(browseTree.mRootNode); Loading