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

Commit c339f34b authored by Hyundo Moon's avatar Hyundo Moon
Browse files

Enable pbapclient profile when running test

Below three tests are enabled by this change.

Bug: 237467631
Test: atest PbapClientConnectionHandlerTest
      atest PbapParserTest
      atest PbapClientServiceTest
Change-Id: I90dd659224300ecc95b47a687e60501b5513f4ca
parent 8abb1245
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -28,9 +28,12 @@
        <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="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" />
    </target_preparer>
    <target_preparer class="com.android.tradefed.targetprep.FolderSaver">
        <option name="device-path" value="/data/vendor/ssrdump" />
+3 −0
Original line number Diff line number Diff line
@@ -28,8 +28,11 @@
        <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="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" />
    </target_preparer>
    <target_preparer class="com.android.tradefed.targetprep.FolderSaver">
        <option name="device-path" value="/data/vendor/ssrdump" />
+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