Loading android/app/tests/unit/Android.bp +2 −0 Original line number Original line Diff line number Diff line Loading @@ -72,6 +72,7 @@ java_defaults { "-Xep:InvalidParam:ERROR", "-Xep:InvalidParam:ERROR", "-Xep:MockNotUsedInProduction:ERROR", "-Xep:MockNotUsedInProduction:ERROR", "-Xep:ModifiedButNotUsed:ERROR", "-Xep:ModifiedButNotUsed:ERROR", "-Xep:NarrowCalculation:ERROR", "-Xep:NonApiType:ERROR", "-Xep:NonApiType:ERROR", "-Xep:NonCanonicalType:ERROR", "-Xep:NonCanonicalType:ERROR", "-Xep:NotJavadoc:ERROR", "-Xep:NotJavadoc:ERROR", Loading @@ -80,6 +81,7 @@ java_defaults { "-Xep:StringCharset:ERROR", "-Xep:StringCharset:ERROR", "-Xep:TruthConstantAsserts:ERROR", "-Xep:TruthConstantAsserts:ERROR", "-Xep:TruthIncompatibleType:ERROR", "-Xep:TruthIncompatibleType:ERROR", "-Xep:UndefinedEquals:ERROR", "-Xep:UnnecessaryAssignment:ERROR", "-Xep:UnnecessaryAssignment:ERROR", "-Xep:UnnecessaryAsync:ERROR", "-Xep:UnnecessaryAsync:ERROR", "-Xep:UnusedMethod:ERROR", "-Xep:UnusedMethod:ERROR", Loading android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpStateMachineTest.java +2 −4 Original line number Original line Diff line number Diff line Loading @@ -26,12 +26,10 @@ import android.bluetooth.BluetoothCodecConfig; import android.bluetooth.BluetoothCodecStatus; import android.bluetooth.BluetoothCodecStatus; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothProfile; import android.content.Context; import android.content.Intent; import android.content.Intent; import android.os.Bundle; import android.os.Bundle; import android.os.HandlerThread; import android.os.HandlerThread; import androidx.test.InstrumentationRegistry; import androidx.test.filters.MediumTest; import androidx.test.filters.MediumTest; import androidx.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4; Loading Loading @@ -252,7 +250,7 @@ public class A2dpStateMachineTest { // Verify that one connection state broadcast is executed // Verify that one connection state broadcast is executed ArgumentCaptor<Intent> intentArgument2 = ArgumentCaptor.forClass(Intent.class); ArgumentCaptor<Intent> intentArgument2 = ArgumentCaptor.forClass(Intent.class); verify(mA2dpService, timeout(A2dpStateMachine.sConnectTimeoutMs * 2).times(2)) verify(mA2dpService, timeout(A2dpStateMachine.sConnectTimeoutMs * 2L).times(2)) .sendBroadcast(intentArgument2.capture(), anyString(), any(Bundle.class)); .sendBroadcast(intentArgument2.capture(), anyString(), any(Bundle.class)); assertThat(intentArgument2.getValue().getIntExtra(BluetoothProfile.EXTRA_STATE, -1)) assertThat(intentArgument2.getValue().getIntExtra(BluetoothProfile.EXTRA_STATE, -1)) .isEqualTo(BluetoothProfile.STATE_DISCONNECTED); .isEqualTo(BluetoothProfile.STATE_DISCONNECTED); Loading Loading @@ -289,7 +287,7 @@ public class A2dpStateMachineTest { // Verify that one connection state broadcast is executed // Verify that one connection state broadcast is executed ArgumentCaptor<Intent> intentArgument2 = ArgumentCaptor.forClass(Intent.class); ArgumentCaptor<Intent> intentArgument2 = ArgumentCaptor.forClass(Intent.class); verify(mA2dpService, timeout(A2dpStateMachine.sConnectTimeoutMs * 2).times(2)) verify(mA2dpService, timeout(A2dpStateMachine.sConnectTimeoutMs * 2L).times(2)) .sendBroadcast(intentArgument2.capture(), anyString(), any(Bundle.class)); .sendBroadcast(intentArgument2.capture(), anyString(), any(Bundle.class)); assertThat(intentArgument2.getValue().getIntExtra(BluetoothProfile.EXTRA_STATE, -1)) assertThat(intentArgument2.getValue().getIntExtra(BluetoothProfile.EXTRA_STATE, -1)) .isEqualTo(BluetoothProfile.STATE_DISCONNECTED); .isEqualTo(BluetoothProfile.STATE_DISCONNECTED); Loading android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowserPlayerWrapperTest.java +6 −4 Original line number Original line Diff line number Diff line Loading @@ -396,14 +396,16 @@ public class BrowserPlayerWrapperTest { Assert.assertNotNull(folder); Assert.assertNotNull(folder); Assert.assertFalse(folder.isPlayable); Assert.assertFalse(folder.isPlayable); Assert.assertEquals(expected.getDescription().getMediaId(), folder.mediaId); Assert.assertEquals(expected.getDescription().getMediaId(), folder.mediaId); Assert.assertEquals(expected.getDescription().getTitle(), folder.title); Assert.assertEquals(expected.getDescription().getTitle().toString(), folder.title); } else { } else { Metadata song = item.song; Metadata song = item.song; Assert.assertNotNull(song); Assert.assertNotNull(song); Assert.assertEquals(expected.getDescription().getMediaId(), song.mediaId); Assert.assertEquals(expected.getDescription().getMediaId(), song.mediaId); Assert.assertEquals(expected.getDescription().getTitle(), song.title); Assert.assertEquals(expected.getDescription().getTitle().toString(), song.title); Assert.assertEquals(expected.getDescription().getSubtitle(), song.artist); Assert.assertEquals( Assert.assertEquals(expected.getDescription().getDescription(), song.album); expected.getDescription().getSubtitle().toString(), song.artist); Assert.assertEquals( expected.getDescription().getDescription().toString(), song.album); if (expected.getDescription().getIconBitmap() != null) { if (expected.getDescription().getIconBitmap() != null) { Assert.assertNotNull(song.image); Assert.assertNotNull(song.image); Bitmap expectedBitmap = expected.getDescription().getIconBitmap(); Bitmap expectedBitmap = expected.getDescription().getIconBitmap(); Loading android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpItemTest.java +3 −5 Original line number Original line Diff line number Diff line Loading @@ -18,13 +18,11 @@ package com.android.bluetooth.avrcpcontroller; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; import android.net.Uri; import android.support.v4.media.MediaBrowserCompat.MediaItem; import android.support.v4.media.MediaBrowserCompat.MediaItem; import android.support.v4.media.MediaDescriptionCompat; import android.support.v4.media.MediaDescriptionCompat; import android.support.v4.media.MediaMetadataCompat; import android.support.v4.media.MediaMetadataCompat; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4; import org.junit.After; import org.junit.After; Loading Loading @@ -554,7 +552,7 @@ public final class AvrcpItemTest { Assert.assertEquals(UUID, desc.getMediaId()); Assert.assertEquals(UUID, desc.getMediaId()); Assert.assertEquals(null, desc.getMediaUri()); Assert.assertEquals(null, desc.getMediaUri()); Assert.assertEquals(title, desc.getTitle().toString()); Assert.assertEquals(title, desc.getTitle().toString()); Assert.assertEquals(desc.getSubtitle(), null); Assert.assertNull(desc.getSubtitle()); Assert.assertEquals(uri, desc.getIconUri()); Assert.assertEquals(uri, desc.getIconUri()); Assert.assertEquals(null, desc.getIconBitmap()); Assert.assertEquals(null, desc.getIconBitmap()); } } Loading Loading @@ -583,7 +581,7 @@ public final class AvrcpItemTest { Assert.assertEquals(UUID, desc.getMediaId()); Assert.assertEquals(UUID, desc.getMediaId()); Assert.assertEquals(null, desc.getMediaUri()); Assert.assertEquals(null, desc.getMediaUri()); Assert.assertEquals(displayName, desc.getTitle().toString()); Assert.assertEquals(displayName, desc.getTitle().toString()); Assert.assertEquals(desc.getSubtitle(), null); Assert.assertNull(desc.getSubtitle()); Assert.assertEquals(uri, desc.getIconUri()); Assert.assertEquals(uri, desc.getIconUri()); Assert.assertEquals(null, desc.getIconBitmap()); Assert.assertEquals(null, desc.getIconBitmap()); } } Loading @@ -610,7 +608,7 @@ public final class AvrcpItemTest { Assert.assertEquals(UUID, desc.getMediaId()); Assert.assertEquals(UUID, desc.getMediaId()); Assert.assertEquals(null, desc.getMediaUri()); Assert.assertEquals(null, desc.getMediaUri()); Assert.assertEquals(title, desc.getTitle().toString()); Assert.assertEquals(title, desc.getTitle().toString()); Assert.assertEquals(desc.getSubtitle(), null); Assert.assertNull(desc.getSubtitle()); Assert.assertEquals(uri, desc.getIconUri()); Assert.assertEquals(uri, desc.getIconUri()); Assert.assertEquals(null, desc.getIconBitmap()); Assert.assertEquals(null, desc.getIconBitmap()); } } Loading android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipAttachmentFormatTest.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.bluetooth.avrcpcontroller; package com.android.bluetooth.avrcpcontroller; import android.annotation.SuppressLint; import androidx.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4; import org.junit.Assert; import org.junit.Assert; Loading Loading @@ -44,6 +46,7 @@ public class BipAttachmentFormatTest { return makeDate(month, day, year, hours, min, sec, null); return makeDate(month, day, year, hours, min, sec, null); } } @SuppressLint("UndefinedEquals") private void testParse( private void testParse( String contentType, String contentType, String charset, String charset, Loading Loading @@ -78,6 +81,7 @@ public class BipAttachmentFormatTest { } } } } @SuppressLint("UndefinedEquals") private void testCreate( private void testCreate( String contentType, String contentType, String charset, String charset, Loading Loading
android/app/tests/unit/Android.bp +2 −0 Original line number Original line Diff line number Diff line Loading @@ -72,6 +72,7 @@ java_defaults { "-Xep:InvalidParam:ERROR", "-Xep:InvalidParam:ERROR", "-Xep:MockNotUsedInProduction:ERROR", "-Xep:MockNotUsedInProduction:ERROR", "-Xep:ModifiedButNotUsed:ERROR", "-Xep:ModifiedButNotUsed:ERROR", "-Xep:NarrowCalculation:ERROR", "-Xep:NonApiType:ERROR", "-Xep:NonApiType:ERROR", "-Xep:NonCanonicalType:ERROR", "-Xep:NonCanonicalType:ERROR", "-Xep:NotJavadoc:ERROR", "-Xep:NotJavadoc:ERROR", Loading @@ -80,6 +81,7 @@ java_defaults { "-Xep:StringCharset:ERROR", "-Xep:StringCharset:ERROR", "-Xep:TruthConstantAsserts:ERROR", "-Xep:TruthConstantAsserts:ERROR", "-Xep:TruthIncompatibleType:ERROR", "-Xep:TruthIncompatibleType:ERROR", "-Xep:UndefinedEquals:ERROR", "-Xep:UnnecessaryAssignment:ERROR", "-Xep:UnnecessaryAssignment:ERROR", "-Xep:UnnecessaryAsync:ERROR", "-Xep:UnnecessaryAsync:ERROR", "-Xep:UnusedMethod:ERROR", "-Xep:UnusedMethod:ERROR", Loading
android/app/tests/unit/src/com/android/bluetooth/a2dp/A2dpStateMachineTest.java +2 −4 Original line number Original line Diff line number Diff line Loading @@ -26,12 +26,10 @@ import android.bluetooth.BluetoothCodecConfig; import android.bluetooth.BluetoothCodecStatus; import android.bluetooth.BluetoothCodecStatus; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothProfile; import android.content.Context; import android.content.Intent; import android.content.Intent; import android.os.Bundle; import android.os.Bundle; import android.os.HandlerThread; import android.os.HandlerThread; import androidx.test.InstrumentationRegistry; import androidx.test.filters.MediumTest; import androidx.test.filters.MediumTest; import androidx.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4; Loading Loading @@ -252,7 +250,7 @@ public class A2dpStateMachineTest { // Verify that one connection state broadcast is executed // Verify that one connection state broadcast is executed ArgumentCaptor<Intent> intentArgument2 = ArgumentCaptor.forClass(Intent.class); ArgumentCaptor<Intent> intentArgument2 = ArgumentCaptor.forClass(Intent.class); verify(mA2dpService, timeout(A2dpStateMachine.sConnectTimeoutMs * 2).times(2)) verify(mA2dpService, timeout(A2dpStateMachine.sConnectTimeoutMs * 2L).times(2)) .sendBroadcast(intentArgument2.capture(), anyString(), any(Bundle.class)); .sendBroadcast(intentArgument2.capture(), anyString(), any(Bundle.class)); assertThat(intentArgument2.getValue().getIntExtra(BluetoothProfile.EXTRA_STATE, -1)) assertThat(intentArgument2.getValue().getIntExtra(BluetoothProfile.EXTRA_STATE, -1)) .isEqualTo(BluetoothProfile.STATE_DISCONNECTED); .isEqualTo(BluetoothProfile.STATE_DISCONNECTED); Loading Loading @@ -289,7 +287,7 @@ public class A2dpStateMachineTest { // Verify that one connection state broadcast is executed // Verify that one connection state broadcast is executed ArgumentCaptor<Intent> intentArgument2 = ArgumentCaptor.forClass(Intent.class); ArgumentCaptor<Intent> intentArgument2 = ArgumentCaptor.forClass(Intent.class); verify(mA2dpService, timeout(A2dpStateMachine.sConnectTimeoutMs * 2).times(2)) verify(mA2dpService, timeout(A2dpStateMachine.sConnectTimeoutMs * 2L).times(2)) .sendBroadcast(intentArgument2.capture(), anyString(), any(Bundle.class)); .sendBroadcast(intentArgument2.capture(), anyString(), any(Bundle.class)); assertThat(intentArgument2.getValue().getIntExtra(BluetoothProfile.EXTRA_STATE, -1)) assertThat(intentArgument2.getValue().getIntExtra(BluetoothProfile.EXTRA_STATE, -1)) .isEqualTo(BluetoothProfile.STATE_DISCONNECTED); .isEqualTo(BluetoothProfile.STATE_DISCONNECTED); Loading
android/app/tests/unit/src/com/android/bluetooth/audio_util/BrowserPlayerWrapperTest.java +6 −4 Original line number Original line Diff line number Diff line Loading @@ -396,14 +396,16 @@ public class BrowserPlayerWrapperTest { Assert.assertNotNull(folder); Assert.assertNotNull(folder); Assert.assertFalse(folder.isPlayable); Assert.assertFalse(folder.isPlayable); Assert.assertEquals(expected.getDescription().getMediaId(), folder.mediaId); Assert.assertEquals(expected.getDescription().getMediaId(), folder.mediaId); Assert.assertEquals(expected.getDescription().getTitle(), folder.title); Assert.assertEquals(expected.getDescription().getTitle().toString(), folder.title); } else { } else { Metadata song = item.song; Metadata song = item.song; Assert.assertNotNull(song); Assert.assertNotNull(song); Assert.assertEquals(expected.getDescription().getMediaId(), song.mediaId); Assert.assertEquals(expected.getDescription().getMediaId(), song.mediaId); Assert.assertEquals(expected.getDescription().getTitle(), song.title); Assert.assertEquals(expected.getDescription().getTitle().toString(), song.title); Assert.assertEquals(expected.getDescription().getSubtitle(), song.artist); Assert.assertEquals( Assert.assertEquals(expected.getDescription().getDescription(), song.album); expected.getDescription().getSubtitle().toString(), song.artist); Assert.assertEquals( expected.getDescription().getDescription().toString(), song.album); if (expected.getDescription().getIconBitmap() != null) { if (expected.getDescription().getIconBitmap() != null) { Assert.assertNotNull(song.image); Assert.assertNotNull(song.image); Bitmap expectedBitmap = expected.getDescription().getIconBitmap(); Bitmap expectedBitmap = expected.getDescription().getIconBitmap(); Loading
android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/AvrcpItemTest.java +3 −5 Original line number Original line Diff line number Diff line Loading @@ -18,13 +18,11 @@ package com.android.bluetooth.avrcpcontroller; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothDevice; import android.content.Context; import android.net.Uri; import android.net.Uri; import android.support.v4.media.MediaBrowserCompat.MediaItem; import android.support.v4.media.MediaBrowserCompat.MediaItem; import android.support.v4.media.MediaDescriptionCompat; import android.support.v4.media.MediaDescriptionCompat; import android.support.v4.media.MediaMetadataCompat; import android.support.v4.media.MediaMetadataCompat; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4; import org.junit.After; import org.junit.After; Loading Loading @@ -554,7 +552,7 @@ public final class AvrcpItemTest { Assert.assertEquals(UUID, desc.getMediaId()); Assert.assertEquals(UUID, desc.getMediaId()); Assert.assertEquals(null, desc.getMediaUri()); Assert.assertEquals(null, desc.getMediaUri()); Assert.assertEquals(title, desc.getTitle().toString()); Assert.assertEquals(title, desc.getTitle().toString()); Assert.assertEquals(desc.getSubtitle(), null); Assert.assertNull(desc.getSubtitle()); Assert.assertEquals(uri, desc.getIconUri()); Assert.assertEquals(uri, desc.getIconUri()); Assert.assertEquals(null, desc.getIconBitmap()); Assert.assertEquals(null, desc.getIconBitmap()); } } Loading Loading @@ -583,7 +581,7 @@ public final class AvrcpItemTest { Assert.assertEquals(UUID, desc.getMediaId()); Assert.assertEquals(UUID, desc.getMediaId()); Assert.assertEquals(null, desc.getMediaUri()); Assert.assertEquals(null, desc.getMediaUri()); Assert.assertEquals(displayName, desc.getTitle().toString()); Assert.assertEquals(displayName, desc.getTitle().toString()); Assert.assertEquals(desc.getSubtitle(), null); Assert.assertNull(desc.getSubtitle()); Assert.assertEquals(uri, desc.getIconUri()); Assert.assertEquals(uri, desc.getIconUri()); Assert.assertEquals(null, desc.getIconBitmap()); Assert.assertEquals(null, desc.getIconBitmap()); } } Loading @@ -610,7 +608,7 @@ public final class AvrcpItemTest { Assert.assertEquals(UUID, desc.getMediaId()); Assert.assertEquals(UUID, desc.getMediaId()); Assert.assertEquals(null, desc.getMediaUri()); Assert.assertEquals(null, desc.getMediaUri()); Assert.assertEquals(title, desc.getTitle().toString()); Assert.assertEquals(title, desc.getTitle().toString()); Assert.assertEquals(desc.getSubtitle(), null); Assert.assertNull(desc.getSubtitle()); Assert.assertEquals(uri, desc.getIconUri()); Assert.assertEquals(uri, desc.getIconUri()); Assert.assertEquals(null, desc.getIconBitmap()); Assert.assertEquals(null, desc.getIconBitmap()); } } Loading
android/app/tests/unit/src/com/android/bluetooth/avrcpcontroller/bip/BipAttachmentFormatTest.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.bluetooth.avrcpcontroller; package com.android.bluetooth.avrcpcontroller; import android.annotation.SuppressLint; import androidx.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4; import org.junit.Assert; import org.junit.Assert; Loading Loading @@ -44,6 +46,7 @@ public class BipAttachmentFormatTest { return makeDate(month, day, year, hours, min, sec, null); return makeDate(month, day, year, hours, min, sec, null); } } @SuppressLint("UndefinedEquals") private void testParse( private void testParse( String contentType, String contentType, String charset, String charset, Loading Loading @@ -78,6 +81,7 @@ public class BipAttachmentFormatTest { } } } } @SuppressLint("UndefinedEquals") private void testCreate( private void testCreate( String contentType, String contentType, String charset, String charset, Loading