Loading android/app/tests/unit/AndroidTest.xml +6 −0 Original line number Diff line number Diff line Loading @@ -28,9 +28,15 @@ <option name="run-command" value="settings put global ble_scan_always_enabled 0" /> <option name="run-command" value="cmd bluetooth_manager disable" /> <option name="run-command" value="setprop bluetooth.profile.hfp.hf.enabled true" /> <option name="run-command" value="setprop bluetooth.profile.pbap.client.enabled true" /> <option name="run-command" value="setprop bluetooth.profile.map.client.enabled true" /> <option name="teardown-command" value="cmd bluetooth_manager enable" /> <option name="teardown-command" value="settings put global ble_scan_always_enabled 1" /> <option name="teardown-command" value="setprop bluetooth.profile.hfp.hf.enabled false" /> <option name="teardown-command" value="setprop bluetooth.profile.pbap.client.enabled false" /> <option name="teardown-command" value="setprop bluetooth.profile.map.client.enabled false" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.FolderSaver"> <option name="device-path" value="/data/vendor/ssrdump" /> Loading android/app/tests/unit/GoogleAndroidTest.xml +6 −0 Original line number Diff line number Diff line Loading @@ -28,8 +28,14 @@ <option name="run-command" value="settings put global ble_scan_always_enabled 0" /> <option name="run-command" value="cmd bluetooth_manager disable" /> <option name="run-command" value="setprop bluetooth.profile.hfp.hf.enabled true" /> <option name="run-command" value="setprop bluetooth.profile.pbap.client.enabled true" /> <option name="run-command" value="setprop bluetooth.profile.map.client.enabled true" /> <option name="teardown-command" value="cmd bluetooth_manager enable" /> <option name="teardown-command" value="settings put global ble_scan_always_enabled 1" /> <option name="teardown-command" value="setprop bluetooth.profile.pbap.client.enabled false" /> <option name="teardown-command" value="setprop bluetooth.profile.map.client.enabled false" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.FolderSaver"> <option name="device-path" value="/data/vendor/ssrdump" /> Loading android/app/tests/unit/src/com/android/bluetooth/mapclient/BmessageTest.java +27 −0 Original line number Diff line number Diff line Loading @@ -93,4 +93,31 @@ public class BmessageTest { Bmessage message = BmessageParser.createBmessage(NEGATIVE_LENGTH_MESSAGE); Assert.assertNull(message); } @Test public void setCharset() { Bmessage message = new Bmessage(); message.setCharset("UTF-8"); Assert.assertEquals(message.getCharset(), "UTF-8"); } @Test public void setEncoding() { Bmessage message = new Bmessage(); message.setEncoding("test_encoding"); Assert.assertEquals(message.getEncoding(), "test_encoding"); } @Test public void setStatus() { Bmessage message = new Bmessage(); message.setStatus(Bmessage.Status.READ); Assert.assertEquals(message.getStatus(), Bmessage.Status.READ); } } android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientConnectionHandlerTest.java +8 −57 Original line number Diff line number Diff line Loading @@ -173,63 +173,14 @@ public class PbapClientConnectionHandlerTest { } @Test public void downloadContacts() { final String path = PbapClientConnectionHandler.PB_PATH; try { mHandler.downloadContacts(path); } catch (Exception e) { Log.e(TAG, "Exception happened.", e); assertWithMessage("Exception should not be thrown!").fail(); } } @Test public void downloadCallLog() { final String path = PbapClientConnectionHandler.ICH_PATH; final HashMap<String, Integer> callCounter = new HashMap<>(); try { mHandler.downloadCallLog(path, callCounter); } catch (Exception e) { Log.e(TAG, "Exception happened.", e); assertWithMessage("Exception should not be thrown!").fail(); } } @Test public void addAccount() { try { mHandler.addAccount(mock(Account.class)); } catch (Exception e) { Log.e(TAG, "Exception happened.", e); assertWithMessage("Exception should not be thrown!").fail(); } } @Test public void removeAccount() { try { mHandler.removeAccount(); } catch (Exception e) { Log.e(TAG, "Exception happened.", e); assertWithMessage("Exception should not be thrown!").fail(); } } @Test public void removeCallLog() { try { public void removeCallLog_doesNotCrash() { ContentResolver res = mock(ContentResolver.class); when(mTargetContext.getContentResolver()).thenReturn(res); mHandler.removeCallLog(); // Also test when content resolver is null. when(mTargetContext.getContentResolver()).thenReturn(null); mHandler.removeCallLog(); } catch (Exception e) { Log.e(TAG, "Exception happened.", e); assertWithMessage("Exception should not be thrown!").fail(); } } @Test Loading Loading
android/app/tests/unit/AndroidTest.xml +6 −0 Original line number Diff line number Diff line Loading @@ -28,9 +28,15 @@ <option name="run-command" value="settings put global ble_scan_always_enabled 0" /> <option name="run-command" value="cmd bluetooth_manager disable" /> <option name="run-command" value="setprop bluetooth.profile.hfp.hf.enabled true" /> <option name="run-command" value="setprop bluetooth.profile.pbap.client.enabled true" /> <option name="run-command" value="setprop bluetooth.profile.map.client.enabled true" /> <option name="teardown-command" value="cmd bluetooth_manager enable" /> <option name="teardown-command" value="settings put global ble_scan_always_enabled 1" /> <option name="teardown-command" value="setprop bluetooth.profile.hfp.hf.enabled false" /> <option name="teardown-command" value="setprop bluetooth.profile.pbap.client.enabled false" /> <option name="teardown-command" value="setprop bluetooth.profile.map.client.enabled false" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.FolderSaver"> <option name="device-path" value="/data/vendor/ssrdump" /> Loading
android/app/tests/unit/GoogleAndroidTest.xml +6 −0 Original line number Diff line number Diff line Loading @@ -28,8 +28,14 @@ <option name="run-command" value="settings put global ble_scan_always_enabled 0" /> <option name="run-command" value="cmd bluetooth_manager disable" /> <option name="run-command" value="setprop bluetooth.profile.hfp.hf.enabled true" /> <option name="run-command" value="setprop bluetooth.profile.pbap.client.enabled true" /> <option name="run-command" value="setprop bluetooth.profile.map.client.enabled true" /> <option name="teardown-command" value="cmd bluetooth_manager enable" /> <option name="teardown-command" value="settings put global ble_scan_always_enabled 1" /> <option name="teardown-command" value="setprop bluetooth.profile.pbap.client.enabled false" /> <option name="teardown-command" value="setprop bluetooth.profile.map.client.enabled false" /> </target_preparer> <target_preparer class="com.android.tradefed.targetprep.FolderSaver"> <option name="device-path" value="/data/vendor/ssrdump" /> Loading
android/app/tests/unit/src/com/android/bluetooth/mapclient/BmessageTest.java +27 −0 Original line number Diff line number Diff line Loading @@ -93,4 +93,31 @@ public class BmessageTest { Bmessage message = BmessageParser.createBmessage(NEGATIVE_LENGTH_MESSAGE); Assert.assertNull(message); } @Test public void setCharset() { Bmessage message = new Bmessage(); message.setCharset("UTF-8"); Assert.assertEquals(message.getCharset(), "UTF-8"); } @Test public void setEncoding() { Bmessage message = new Bmessage(); message.setEncoding("test_encoding"); Assert.assertEquals(message.getEncoding(), "test_encoding"); } @Test public void setStatus() { Bmessage message = new Bmessage(); message.setStatus(Bmessage.Status.READ); Assert.assertEquals(message.getStatus(), Bmessage.Status.READ); } }
android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientConnectionHandlerTest.java +8 −57 Original line number Diff line number Diff line Loading @@ -173,63 +173,14 @@ public class PbapClientConnectionHandlerTest { } @Test public void downloadContacts() { final String path = PbapClientConnectionHandler.PB_PATH; try { mHandler.downloadContacts(path); } catch (Exception e) { Log.e(TAG, "Exception happened.", e); assertWithMessage("Exception should not be thrown!").fail(); } } @Test public void downloadCallLog() { final String path = PbapClientConnectionHandler.ICH_PATH; final HashMap<String, Integer> callCounter = new HashMap<>(); try { mHandler.downloadCallLog(path, callCounter); } catch (Exception e) { Log.e(TAG, "Exception happened.", e); assertWithMessage("Exception should not be thrown!").fail(); } } @Test public void addAccount() { try { mHandler.addAccount(mock(Account.class)); } catch (Exception e) { Log.e(TAG, "Exception happened.", e); assertWithMessage("Exception should not be thrown!").fail(); } } @Test public void removeAccount() { try { mHandler.removeAccount(); } catch (Exception e) { Log.e(TAG, "Exception happened.", e); assertWithMessage("Exception should not be thrown!").fail(); } } @Test public void removeCallLog() { try { public void removeCallLog_doesNotCrash() { ContentResolver res = mock(ContentResolver.class); when(mTargetContext.getContentResolver()).thenReturn(res); mHandler.removeCallLog(); // Also test when content resolver is null. when(mTargetContext.getContentResolver()).thenReturn(null); mHandler.removeCallLog(); } catch (Exception e) { Log.e(TAG, "Exception happened.", e); assertWithMessage("Exception should not be thrown!").fail(); } } @Test Loading