Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fab5dcfe authored by Hyundo Moon's avatar Hyundo Moon Committed by Android (Google) Code Review
Browse files

Merge changes from topic "cherrypicker-L92000000957720434:N15800001319641700" into tm-qpr-dev

* changes:
  Enable mapclient profile when running test
  Enable pbapclient profile when running test
parents 820fc4e0 e1ceb71b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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" />
+6 −0
Original line number Diff line number Diff line
@@ -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" />
+27 −0
Original line number Diff line number Diff line
@@ -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);
    }
}
+8 −57
Original line number Diff line number Diff line
@@ -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