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

Commit 1bd25eb1 authored by Jack He's avatar Jack He
Browse files

Fix PhonePolicyTest timeout

* PhonePolicyTest used to run too long (26 seconds plus) because it
  needs to wait for the reconnect timeout
* This CL fixes the test by
  1) Moving common setup code into setUp() method
  2) Using TestLooperManager to manually execute delayed handler
     messages immediately after they are posted

Bug: 68818803
Test: runtest -i -j40 bluetooth; adb shell am instrument -w -e
timeout_msec 300000 -e class
'com.android.bluetooth.btservice.PhonePolicyTest'
'com.android.bluetooth.tests/android.support.test.runner.AndroidJUnitRunner'
Change-Id: I4789e3427e1a5729be6f620d39da539f76767e57
parent 70f695c4
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.os.Looper;
import android.os.Message;
import android.os.ParcelUuid;
import android.os.Parcelable;
import android.support.annotation.VisibleForTesting;
import android.util.Log;

import com.android.bluetooth.a2dp.A2dpService;
@@ -124,8 +125,8 @@ class PhonePolicy {
        }
    };

    // ONLY for testing
    public BroadcastReceiver getBroadcastReceiver() {
    @VisibleForTesting
    BroadcastReceiver getBroadcastReceiver() {
        return mReceiver;
    }

+96 −166

File changed.

Preview size limit exceeded, changes collapsed.